1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: imapwnd.hxx,v $
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 ************************************************************************/
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 \************************************************************************/
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
96 SdrObjUserData ( IMapInventor
, SVD_IMAP_USERDATA
, 0 ),
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
) {}
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
128 FixedText aFtURLDescription;
129 Edit aEdtURLDescription;
131 ComboBox aCbbTargets;
135 CancelButton aBtnCancel;
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
161 TargetList aTargetList
;
163 SfxItemPool
* pIMapPool
;
164 SfxItemInfo
* pItemInfo
;
165 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>
168 DECL_LINK( MenuSelectHdl
, Menu
* );
169 DECL_LINK( MouseTimerHdl
, Timer
* );
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();
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
);
200 IMapWindow( Window
* pParent
, const ResId
& rResId
, const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxDocumentFrame
);
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
);