Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _GOODIES_IMAPOBJ_HXX
30 : : #define _GOODIES_IMAPOBJ_HXX
31 : :
32 : : #include "svtools/svtdllapi.h"
33 : : #include <tools/string.hxx>
34 : : #include <svl/macitem.hxx>
35 : : #include <rtl/strbuf.hxx>
36 : :
37 : : class Point;
38 : : class Rectangle;
39 : : class SvStream;
40 : :
41 : : #define IMAP_OBJ_NONE ((sal_uInt16)0x0000)
42 : : #define IMAP_OBJ_RECTANGLE ((sal_uInt16)0x0001)
43 : : #define IMAP_OBJ_CIRCLE ((sal_uInt16)0x0002)
44 : : #define IMAP_OBJ_POLYGON ((sal_uInt16)0x0003)
45 : : #define IMAP_OBJ_VERSION ((sal_uInt16)0x0005)
46 : :
47 : : #define IMAGE_MAP_VERSION ((sal_uInt16)0x0001)
48 : :
49 : : #define IMAPMAGIC "SDIMAP"
50 : :
51 : : #define IMAP_MIRROR_HORZ 0x00000001L
52 : : #define IMAP_MIRROR_VERT 0x00000002L
53 : :
54 : : #define IMAP_FORMAT_BIN 0x00000001L
55 : : #define IMAP_FORMAT_CERN 0x00000002L
56 : : #define IMAP_FORMAT_NCSA 0x00000004L
57 : : #define IMAP_FORMAT_DETECT 0xffffffffL
58 : :
59 : : #define IMAP_ERR_OK 0x00000000L
60 : : #define IMAP_ERR_FORMAT 0x00000001L
61 : :
62 [ + - ][ + - ]: 6 : class SVT_DLLPUBLIC IMapObject
[ + - ][ + - ]
[ + - ]
63 : : {
64 : : friend class ImageMap;
65 : :
66 : : String aURL;
67 : : String aAltText;
68 : : String aDesc;
69 : : String aTarget;
70 : : String aName;
71 : : SvxMacroTableDtor aEventList;
72 : : sal_Bool bActive;
73 : :
74 : : protected:
75 : : sal_uInt16 nReadVersion;
76 : :
77 : : // Binaer-Im-/Export
78 : : virtual void WriteIMapObject( SvStream& rOStm ) const = 0;
79 : : virtual void ReadIMapObject( SvStream& rIStm ) = 0;
80 : :
81 : : // Hilfsmethoden
82 : : void AppendCERNCoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const;
83 : : void AppendCERNURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const;
84 : : void AppendNCSACoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const;
85 : : void AppendNCSAURL(rtl::OStringBuffer&rBuf, const String& rBaseURL) const;
86 : :
87 : : public:
88 : :
89 : : static rtl_TextEncoding nActualTextEncoding;
90 : :
91 : : IMapObject();
92 : : IMapObject( const String& rURL,
93 : : const String& rAltText,
94 : : const String& rDesc,
95 : : const String& rTarget,
96 : : const String& rName,
97 : : sal_Bool bActive );
98 [ + - ][ + - ]: 8 : virtual ~IMapObject() {};
[ + - ][ + - ]
[ - + ]
99 : :
100 : : virtual sal_uInt16 GetVersion() const;
101 : : virtual sal_uInt16 GetType() const = 0;
102 : : virtual sal_Bool IsHit( const Point& rPoint ) const = 0;
103 : :
104 : : void Write ( SvStream& rOStm, const String& rBaseURL ) const;
105 : : void Read( SvStream& rIStm, const String& rBaseURL );
106 : :
107 : : virtual Rectangle GetBoundRect() const = 0;
108 : :
109 : 10 : const String& GetURL() const { return aURL; }
110 : 0 : void SetURL( const String& rURL ) { aURL = rURL; }
111 : :
112 : 2 : const String& GetAltText() const { return aAltText; }
113 : 0 : void SetAltText( const String& rAltText) { aAltText = rAltText; }
114 : :
115 : 2 : const String& GetDesc() const { return aDesc; }
116 : 0 : void SetDesc( const String& rDesc ) { aDesc = rDesc; }
117 : :
118 : 2 : const String& GetTarget() const { return aTarget; }
119 : 0 : void SetTarget( const String& rTarget ) { aTarget = rTarget; }
120 : :
121 : 2 : const String& GetName() const { return aName; }
122 : 0 : void SetName( const String& rName ) { aName = rName; }
123 : :
124 : 2 : sal_Bool IsActive() const { return bActive; }
125 : 0 : void SetActive( sal_Bool bSetActive = sal_True ) { bActive = bSetActive; }
126 : :
127 : : sal_Bool IsEqual( const IMapObject& rEqObj );
128 : :
129 : : // IMap-Events
130 : 2 : inline const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
131 : 2 : inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
132 : :
133 : : inline const SvxMacro& GetEvent( sal_uInt16 nEvent ) const;
134 : : inline sal_Bool HasEvent( sal_uInt16 nEvent ) const;
135 : : void SetEvent( sal_uInt16 nEvent, const SvxMacro& );
136 : : inline sal_Bool DelEvent( sal_uInt16 nEvent );
137 : : };
138 : :
139 : : inline sal_Bool IMapObject::HasEvent( sal_uInt16 nEvent ) const
140 : : {
141 : : return aEventList.IsKeyValid( nEvent );
142 : : }
143 : : inline const SvxMacro& IMapObject::GetEvent( sal_uInt16 nEvent ) const
144 : : {
145 : : return *(aEventList.Get( nEvent ));
146 : : }
147 : : inline sal_Bool IMapObject::DelEvent( sal_uInt16 nEvent )
148 : : {
149 : : return aEventList.Erase( nEvent );
150 : : }
151 : :
152 : : #endif
153 : :
154 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|