LibreOffice Module vcl (master)  1
imapobj.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_IMAPOBJ_HXX
21 #define INCLUDED_VCL_IMAPOBJ_HXX
22 
23 #include <svl/macitem.hxx>
24 #include <rtl/strbuf.hxx>
25 
26 class Point;
27 class SvStream;
28 
29 enum class IMapObjectType
30 {
31  Rectangle = 1,
32  Circle = 2,
33  Polygon = 3
34 };
35 
36 #define IMAP_OBJ_VERSION (sal_uInt16(0x0005))
37 #define IMAGE_MAP_VERSION (sal_uInt16(0x0001))
38 
39 #define IMAPMAGIC "SDIMAP"
40 
41 #define IMAP_MIRROR_HORZ 0x00000001L
42 #define IMAP_MIRROR_VERT 0x00000002L
43 
44 enum class IMapFormat
45 {
46  Binary = 1,
47  CERN = 2,
48  NCSA = 3,
49  Detect = 15,
50 };
51 
52 #define IMAP_ERR_OK 0x00000000L
53 #define IMAP_ERR_FORMAT 0x00000001L
54 
56 {
57  friend class ImageMap;
58 
59  OUString aURL;
60  OUString aAltText;
61  OUString aDesc;
62  OUString aTarget;
63  OUString aName;
65  bool bActive;
66 
67 protected:
68  sal_uInt16 nReadVersion;
69 
70  // binary import/export
71  virtual void WriteIMapObject( SvStream& rOStm ) const = 0;
72  virtual void ReadIMapObject( SvStream& rIStm ) = 0;
73 
74  // helper methods
75  static void AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100);
76  void AppendCERNURL(OStringBuffer& rBuf) const;
77  static void AppendNCSACoords(OStringBuffer& rBuf, const Point& rPoint100);
78  void AppendNCSAURL(OStringBuffer&rBuf) const;
79 
80 public:
81 
82  IMapObject();
83  IMapObject( const OUString& rURL,
84  const OUString& rAltText,
85  const OUString& rDesc,
86  const OUString& rTarget,
87  const OUString& rName,
88  bool bActive );
89  virtual ~IMapObject() {};
90 
91  IMapObject(IMapObject const &) = default;
92  IMapObject(IMapObject &&) = default;
93  IMapObject & operator =(IMapObject const &) = default;
94  IMapObject & operator =(IMapObject &&) = default;
95 
96  virtual IMapObjectType GetType() const = 0;
97  virtual bool IsHit( const Point& rPoint ) const = 0;
98 
99  void Write ( SvStream& rOStm ) const;
100  void Read( SvStream& rIStm );
101 
102  const OUString& GetURL() const { return aURL; }
103  void SetURL( const OUString& rURL ) { aURL = rURL; }
104 
105  const OUString& GetAltText() const { return aAltText; }
106  void SetAltText( const OUString& rAltText) { aAltText = rAltText; }
107 
108  const OUString& GetDesc() const { return aDesc; }
109  void SetDesc( const OUString& rDesc ) { aDesc = rDesc; }
110 
111  const OUString& GetTarget() const { return aTarget; }
112  void SetTarget( const OUString& rTarget ) { aTarget = rTarget; }
113 
114  const OUString& GetName() const { return aName; }
115  void SetName( const OUString& rName ) { aName = rName; }
116 
117  bool IsActive() const { return bActive; }
118  void SetActive( bool bSetActive ) { bActive = bSetActive; }
119 
120  bool IsEqual( const IMapObject& rEqObj );
121 
122  // IMap-Events
123  const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
124  void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
125 };
126 
127 #endif
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString aURL
Definition: imapobj.hxx:59
bool IsActive() const
Definition: imapobj.hxx:117
const OUString & GetTarget() const
Definition: imapobj.hxx:111
virtual bool IsHit(const Point &rPoint) const =0
const OUString & GetName() const
Definition: imapobj.hxx:114
OUString aDesc
Definition: imapobj.hxx:61
IMapObject & operator=(IMapObject const &)=default
IMapFormat
Definition: imapobj.hxx:44
void SetTarget(const OUString &rTarget)
Definition: imapobj.hxx:112
void Write(SvStream &rOStm) const
Definition: imap.cxx:67
void AppendNCSAURL(OStringBuffer &rBuf) const
Definition: imap2.cxx:65
void SetAltText(const OUString &rAltText)
Definition: imapobj.hxx:106
static void AppendNCSACoords(OStringBuffer &rBuf, const Point &rPoint100)
Definition: imap2.cxx:50
void SetDesc(const OUString &rDesc)
Definition: imapobj.hxx:109
bool bActive
Definition: imapobj.hxx:65
void SetMacroTable(const SvxMacroTableDtor &rTbl)
Definition: imapobj.hxx:124
const OUString & GetAltText() const
Definition: imapobj.hxx:105
IMapObjectType
Definition: imapobj.hxx:29
static void AppendCERNCoords(OStringBuffer &rBuf, const Point &rPoint100)
Definition: imap2.cxx:39
void Read(SvStream &rIStm)
Definition: imap.cxx:96
const SvxMacroTableDtor & GetMacroTable() const
Definition: imapobj.hxx:123
OUString aName
Definition: imapobj.hxx:63
sal_uInt16 nReadVersion
Definition: imapobj.hxx:68
virtual void ReadIMapObject(SvStream &rIStm)=0
bool IsEqual(const IMapObject &rEqObj)
Definition: imap.cxx:126
OUString aAltText
Definition: imapobj.hxx:60
void SetName(const OUString &rName)
Definition: imapobj.hxx:115
OUString aTarget
Definition: imapobj.hxx:62
void SetActive(bool bSetActive)
Definition: imapobj.hxx:118
virtual ~IMapObject()
Definition: imapobj.hxx:89
void SetURL(const OUString &rURL)
Definition: imapobj.hxx:103
virtual IMapObjectType GetType() const =0
const OUString & GetDesc() const
Definition: imapobj.hxx:108
IMapObject()
Definition: imap.cxx:48
void AppendCERNURL(OStringBuffer &rBuf) const
Definition: imap2.cxx:60
SvxMacroTableDtor aEventList
Definition: imapobj.hxx:64
const OUString & GetURL() const
Definition: imapobj.hxx:102
virtual void WriteIMapObject(SvStream &rOStm) const =0