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 <vcl/dllapi.h>
24 #include <svl/macitem.hxx>
25 #include <rtl/strbuf.hxx>
26 
27 class Point;
28 class SvStream;
29 
30 #define IMAP_OBJ_RECTANGLE (sal_uInt16(0x0001))
31 #define IMAP_OBJ_CIRCLE (sal_uInt16(0x0002))
32 #define IMAP_OBJ_POLYGON (sal_uInt16(0x0003))
33 #define IMAP_OBJ_VERSION (sal_uInt16(0x0005))
34 
35 #define IMAGE_MAP_VERSION (sal_uInt16(0x0001))
36 
37 #define IMAPMAGIC "SDIMAP"
38 
39 #define IMAP_MIRROR_HORZ 0x00000001L
40 #define IMAP_MIRROR_VERT 0x00000002L
41 
42 #define IMAP_FORMAT_BIN 0x00000001L
43 #define IMAP_FORMAT_CERN 0x00000002L
44 #define IMAP_FORMAT_NCSA 0x00000004L
45 #define IMAP_FORMAT_DETECT 0xffffffffL
46 
47 #define IMAP_ERR_OK 0x00000000L
48 #define IMAP_ERR_FORMAT 0x00000001L
49 
51 {
52  friend class ImageMap;
53 
54  OUString aURL;
55  OUString aAltText;
56  OUString aDesc;
57  OUString aTarget;
58  OUString aName;
60  bool bActive;
61 
62 protected:
63  sal_uInt16 nReadVersion;
64 
65  // binary import/export
66  virtual void WriteIMapObject( SvStream& rOStm ) const = 0;
67  virtual void ReadIMapObject( SvStream& rIStm ) = 0;
68 
69  // helper methods
70  static void AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100);
71  void AppendCERNURL(OStringBuffer& rBuf) const;
72  static void AppendNCSACoords(OStringBuffer& rBuf, const Point& rPoint100);
73  void AppendNCSAURL(OStringBuffer&rBuf) const;
74 
75 public:
76 
77  IMapObject();
78  IMapObject( const OUString& rURL,
79  const OUString& rAltText,
80  const OUString& rDesc,
81  const OUString& rTarget,
82  const OUString& rName,
83  bool bActive );
84  virtual ~IMapObject() {};
85 
86  IMapObject(IMapObject const &) = default;
87  IMapObject(IMapObject &&) = default;
88  IMapObject & operator =(IMapObject const &) = default;
89  IMapObject & operator =(IMapObject &&) = default;
90 
91  virtual sal_uInt16 GetType() const = 0;
92  virtual bool IsHit( const Point& rPoint ) const = 0;
93 
94  void Write ( SvStream& rOStm ) const;
95  void Read( SvStream& rIStm );
96 
97  const OUString& GetURL() const { return aURL; }
98  void SetURL( const OUString& rURL ) { aURL = rURL; }
99 
100  const OUString& GetAltText() const { return aAltText; }
101  void SetAltText( const OUString& rAltText) { aAltText = rAltText; }
102 
103  const OUString& GetDesc() const { return aDesc; }
104  void SetDesc( const OUString& rDesc ) { aDesc = rDesc; }
105 
106  const OUString& GetTarget() const { return aTarget; }
107  void SetTarget( const OUString& rTarget ) { aTarget = rTarget; }
108 
109  const OUString& GetName() const { return aName; }
110  void SetName( const OUString& rName ) { aName = rName; }
111 
112  bool IsActive() const { return bActive; }
113  void SetActive( bool bSetActive ) { bActive = bSetActive; }
114 
115  bool IsEqual( const IMapObject& rEqObj );
116 
117  // IMap-Events
118  const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
119  void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
120 };
121 
122 #endif
123 
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString aURL
Definition: imapobj.hxx:54
bool IsActive() const
Definition: imapobj.hxx:112
const OUString & GetTarget() const
Definition: imapobj.hxx:106
virtual bool IsHit(const Point &rPoint) const =0
const OUString & GetName() const
Definition: imapobj.hxx:109
OUString aDesc
Definition: imapobj.hxx:56
IMapObject & operator=(IMapObject const &)=default
virtual sal_uInt16 GetType() const =0
void SetTarget(const OUString &rTarget)
Definition: imapobj.hxx:107
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:101
static void AppendNCSACoords(OStringBuffer &rBuf, const Point &rPoint100)
Definition: imap2.cxx:50
void SetDesc(const OUString &rDesc)
Definition: imapobj.hxx:104
bool bActive
Definition: imapobj.hxx:60
void SetMacroTable(const SvxMacroTableDtor &rTbl)
Definition: imapobj.hxx:119
const OUString & GetAltText() const
Definition: imapobj.hxx:100
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:118
OUString aName
Definition: imapobj.hxx:58
sal_uInt16 nReadVersion
Definition: imapobj.hxx:63
virtual void ReadIMapObject(SvStream &rIStm)=0
bool IsEqual(const IMapObject &rEqObj)
Definition: imap.cxx:126
OUString aAltText
Definition: imapobj.hxx:55
void SetName(const OUString &rName)
Definition: imapobj.hxx:110
OUString aTarget
Definition: imapobj.hxx:57
void SetActive(bool bSetActive)
Definition: imapobj.hxx:113
virtual ~IMapObject()
Definition: imapobj.hxx:84
void SetURL(const OUString &rURL)
Definition: imapobj.hxx:98
const OUString & GetDesc() const
Definition: imapobj.hxx:103
IMapObject()
Definition: imap.cxx:48
void AppendCERNURL(OStringBuffer &rBuf) const
Definition: imap2.cxx:60
SvxMacroTableDtor aEventList
Definition: imapobj.hxx:59
const OUString & GetURL() const
Definition: imapobj.hxx:97
virtual void WriteIMapObject(SvStream &rOStm) const =0