update dev300-m58
[ooovba.git] / svx / source / dialog / imapwnd.hxx
blob31d108dfe08e49848f8a7a00a78d7acd606fca52
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: imapwnd.hxx,v $
10 * $Revision: 1.11 $
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 ************************************************************************/
30 #ifndef _IMAPWND_HXX
31 #define _IMAPWND_HXX
33 #include <vcl/dialog.hxx>
34 #include <vcl/fixed.hxx>
35 #include <vcl/button.hxx>
36 #include <vcl/menu.hxx>
37 #include <svtools/itempool.hxx>
38 #include <svtools/imapobj.hxx>
39 #include <svtools/transfer.hxx>
40 #include <svtools/imap.hxx>
41 #include <sfx2/frame.hxx>
42 #include <svx/graphctl.hxx>
44 #include <com/sun/star/frame/XFrame.hpp>
46 /*************************************************************************
50 \************************************************************************/
52 struct NotifyInfo
54 String aMarkURL;
55 String aMarkAltText;
56 String aMarkTarget;
57 BOOL bNewObj;
58 BOOL bOneMarked;
59 BOOL bActivated;
63 struct NotifyPosSize
65 Size aPictureSize;
66 Point aMousePos;
67 BOOL bPictureSize;
68 BOOL bMousePos;
72 /*************************************************************************
76 \************************************************************************/
78 #define SVD_IMAP_USERDATA 0x0001
80 const UINT32 IMapInventor = UINT32('I') * 0x00000001+
81 UINT32('M') * 0x00000100+
82 UINT32('A') * 0x00010000+
83 UINT32('P') * 0x01000000;
86 typedef boost::shared_ptr< IMapObject > IMapObjectPtr;
88 class IMapUserData : public SdrObjUserData
90 // #i98386# use boost::shared_ptr here due to cloning possibilities
91 IMapObjectPtr mpObj;
93 public:
95 IMapUserData() :
96 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
97 mpObj ( ) {}
99 IMapUserData( const IMapObjectPtr& rIMapObj ) :
100 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
101 mpObj ( rIMapObj ) {}
103 IMapUserData( const IMapUserData& rIMapUserData ) :
104 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
105 mpObj ( rIMapUserData.mpObj ) {}
107 ~IMapUserData() { }
109 virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); }
111 void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; }
112 const IMapObjectPtr GetObject() const { return mpObj; }
113 void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; }
117 /*************************************************************************
121 \************************************************************************/
122 /* move to cui //CHINA001
123 class URLDlg : public ModalDialog
125 FixedLine aFlURL;
126 FixedText aFtURL1;
127 Edit aEdtURL;
128 FixedText aFtURLDescription;
129 Edit aEdtURLDescription;
130 FixedText aFtTarget;
131 ComboBox aCbbTargets;
132 FixedText aFtName;
133 Edit aEdtName;
134 OKButton aBtnOk;
135 CancelButton aBtnCancel;
137 public:
139 URLDlg( Window* pWindow,
140 const String& rURL, const String& rDescription,
141 const String& rTarget, const String& rName,
142 TargetList& rTargetList );
144 String GetURL() const { return aEdtURL.GetText(); }
145 String GetDescription() const { return aEdtURLDescription.GetText(); }
146 String GetTarget() const { return aCbbTargets.GetText(); }
147 String GetName() const { return aEdtName.GetText(); }
151 /*************************************************************************
155 \************************************************************************/
157 class IMapWindow : public GraphCtrl, public DropTargetHelper
159 NotifyInfo aInfo;
160 ImageMap aIMap;
161 TargetList aTargetList;
162 Link aInfoLink;
163 SfxItemPool* pIMapPool;
164 SfxItemInfo* pItemInfo;
165 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
166 mxDocumentFrame;
168 DECL_LINK( MenuSelectHdl, Menu* );
169 DECL_LINK( MouseTimerHdl, Timer* );
171 protected:
173 // GraphCtrl
174 virtual void MouseButtonUp(const MouseEvent& rMEvt);
175 virtual void Command(const CommandEvent& rCEvt);
176 virtual void RequestHelp( const HelpEvent& rHEvt );
177 virtual void SdrObjCreated( const SdrObject& rObj );
178 virtual void SdrObjChanged( const SdrObject& rObj );
179 virtual void MarkListHasChanged();
180 virtual void InitSdrModel();
182 // DropTargetHelper
183 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
184 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
186 void CreateImageMap();
187 void ReplaceImageMap( const ImageMap& rNewImageMap, BOOL bScaleToGraphic );
189 void ClearTargetList();
191 SdrObject* CreateObj( const IMapObject* pIMapObj );
192 IMapObject* GetIMapObj( const SdrObject* pSdrObj ) const;
193 SdrObject* GetSdrObj( const IMapObject* pIMapObj ) const;
194 SdrObject* GetHitSdrObj( const Point& rPosPixel ) const;
196 void UpdateInfo( BOOL bNewObj );
198 public:
200 IMapWindow( Window* pParent, const ResId& rResId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame );
201 ~IMapWindow();
203 BOOL ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
205 void SetImageMap( const ImageMap& rImageMap );
206 const ImageMap& GetImageMap();
208 void SetCurrentObjState( BOOL bActive );
209 void DoMacroAssign();
210 void DoPropertyDialog();
212 void SetInfoLink( const Link& rLink ) { aInfoLink = rLink; }
213 const Link& GetInfoLink() const { return aInfoLink; }
215 void SetTargetList( TargetList& rTargetList );
216 const TargetList& GetTargetList() const { return aTargetList; }
218 const NotifyInfo& GetInfo() const { return aInfo; }
220 void CreateDefaultObject();
221 void SelectFirstObject();
222 void StartPolyEdit();
224 virtual void KeyInput( const KeyEvent& rKEvt );
228 #endif