Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_svtools / imapobj.hxx
blobd72094fcfb899442bb21e8c5fc2704fedb6ecac0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: imapobj.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _GOODIES_IMAPOBJ_HXX
32 #define _GOODIES_IMAPOBJ_HXX
34 #ifndef INCLUDED_SVTDLLAPI_H
35 #include "bf_svtools/svtdllapi.h"
36 #endif
38 #ifndef _STRING_HXX //autogen
39 #include <tools/string.hxx>
40 #endif
42 #ifndef _SFXMACITEM_HXX //autogen
43 #include <bf_svtools/macitem.hxx>
44 #endif
46 class Point;
47 class Rectangle;
48 class SvStream;
50 namespace binfilter
53 #define IMAP_OBJ_NONE ((UINT16)0x0000)
54 #define IMAP_OBJ_RECTANGLE ((UINT16)0x0001)
55 #define IMAP_OBJ_CIRCLE ((UINT16)0x0002)
56 #define IMAP_OBJ_POLYGON ((UINT16)0x0003)
57 #define IMAP_OBJ_VERSION ((UINT16)0x0005)
59 #define IMAGE_MAP_VERSION ((UINT16)0x0001)
61 #define IMAPMAGIC "SDIMAP"
63 #define IMAP_MIRROR_HORZ 0x00000001L
64 #define IMAP_MIRROR_VERT 0x00000002L
66 #define IMAP_FORMAT_BIN 0x00000001L
67 #define IMAP_FORMAT_CERN 0x00000002L
68 #define IMAP_FORMAT_NCSA 0x00000004L
69 #define IMAP_FORMAT_DETECT 0xffffffffL
71 #define IMAP_ERR_OK 0x00000000L
72 #define IMAP_ERR_FORMAT 0x00000001L
74 /******************************************************************************
78 \******************************************************************************/
80 class IMapObject
82 friend class ImageMap;
84 String aURL;
85 String aAltText;
86 String aDesc;
87 String aTarget;
88 String aName;
89 SvxMacroTableDtor aEventList;
90 BOOL bActive;
92 protected:
94 UINT16 nReadVersion;
96 // Binaer-Im-/Export
97 virtual void WriteIMapObject( SvStream& rOStm ) const = 0;
98 virtual void ReadIMapObject( SvStream& rIStm ) = 0;
100 public:
102 static rtl_TextEncoding nActualTextEncoding;
104 IMapObject() {};
105 IMapObject( const String& rURL,
106 const String& rAltText,
107 const String& rDesc,
108 const String& rTarget,
109 const String& rName,
110 BOOL bActive );
111 virtual ~IMapObject() {};
113 virtual UINT16 GetVersion() const;
114 virtual UINT16 GetType() const = 0;
115 virtual BOOL IsHit( const Point& rPoint ) const = 0;
117 void Write ( SvStream& rOStm, const String& rBaseURL ) const;
118 void Read( SvStream& rIStm, const String& rBaseURL );
120 virtual Rectangle GetBoundRect() const = 0;
122 const String& GetURL() const { return aURL; }
123 void SetURL( const String& rURL ) { aURL = rURL; }
125 const String& GetAltText() const { return aAltText; }
126 void SetAltText( const String& rAltText) { aAltText = rAltText; }
128 const String& GetDesc() const { return aDesc; }
129 void SetDesc( const String& rDesc ) { aDesc = rDesc; }
131 const String& GetTarget() const { return aTarget; }
132 void SetTarget( const String& rTarget ) { aTarget = rTarget; }
134 const String& GetName() const { return aName; }
135 void SetName( const String& rName ) { aName = rName; }
137 BOOL IsActive() const { return bActive; }
138 void SetActive( BOOL bSetActive = TRUE ) { bActive = bSetActive; }
140 BOOL IsEqual( const IMapObject& rEqObj );
142 // IMap-Events
143 inline const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
144 inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
146 inline const SvxMacro& GetEvent( USHORT nEvent ) const;
147 inline BOOL HasEvent( USHORT nEvent ) const;
148 void SetEvent( USHORT nEvent, const SvxMacro& );
149 inline BOOL DelEvent( USHORT nEvent );
152 inline BOOL IMapObject::HasEvent( USHORT nEvent ) const
154 return aEventList.IsKeyValid( nEvent );
156 inline const SvxMacro& IMapObject::GetEvent( USHORT nEvent ) const
158 return *(aEventList.Get( nEvent ));
160 inline BOOL IMapObject::DelEvent( USHORT nEvent )
162 SvxMacro *pMacro = aEventList.Remove( nEvent );
163 delete pMacro;
164 return ( pMacro != 0 );
169 #endif