1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _IMAPWND_HXX 28 #define _IMAPWND_HXX 29 30 #include <vcl/dialog.hxx> 31 #include <vcl/fixed.hxx> 32 #include <vcl/button.hxx> 33 #include <vcl/menu.hxx> 34 #include <svl/itempool.hxx> 35 #include <svtools/imapobj.hxx> 36 #include <svtools/transfer.hxx> 37 #include <svtools/imap.hxx> 38 #include <sfx2/frame.hxx> 39 #include <svx/graphctl.hxx> 40 41 #include <com/sun/star/frame/XFrame.hpp> 42 43 /************************************************************************* 44 |* 45 |* 46 |* 47 \************************************************************************/ 48 49 struct NotifyInfo 50 { 51 String aMarkURL; 52 String aMarkAltText; 53 String aMarkTarget; 54 sal_Bool bNewObj; 55 sal_Bool bOneMarked; 56 sal_Bool bActivated; 57 }; 58 59 60 struct NotifyPosSize 61 { 62 Size aPictureSize; 63 Point aMousePos; 64 sal_Bool bPictureSize; 65 sal_Bool bMousePos; 66 }; 67 68 69 /************************************************************************* 70 |* 71 |* 72 |* 73 \************************************************************************/ 74 75 #define SVD_IMAP_USERDATA 0x0001 76 77 const sal_uInt32 IMapInventor = sal_uInt32('I') * 0x00000001+ 78 sal_uInt32('M') * 0x00000100+ 79 sal_uInt32('A') * 0x00010000+ 80 sal_uInt32('P') * 0x01000000; 81 82 83 typedef boost::shared_ptr< IMapObject > IMapObjectPtr; 84 85 class IMapUserData : public SdrObjUserData 86 { 87 // #i98386# use boost::shared_ptr here due to cloning possibilities 88 IMapObjectPtr mpObj; 89 90 public: 91 92 IMapUserData() : 93 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), 94 mpObj ( ) {} 95 96 IMapUserData( const IMapObjectPtr& rIMapObj ) : 97 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), 98 mpObj ( rIMapObj ) {} 99 100 IMapUserData( const IMapUserData& rIMapUserData ) : 101 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), 102 mpObj ( rIMapUserData.mpObj ) {} 103 104 ~IMapUserData() { } 105 106 virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); } 107 108 void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; } 109 const IMapObjectPtr GetObject() const { return mpObj; } 110 void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; } 111 }; 112 113 114 /************************************************************************* 115 |* 116 |* 117 |* 118 \************************************************************************/ 119 /* move to cui //CHINA001 120 class URLDlg : public ModalDialog 121 { 122 FixedLine aFlURL; 123 FixedText aFtURL1; 124 Edit aEdtURL; 125 FixedText aFtURLDescription; 126 Edit aEdtURLDescription; 127 FixedText aFtTarget; 128 ComboBox aCbbTargets; 129 FixedText aFtName; 130 Edit aEdtName; 131 OKButton aBtnOk; 132 CancelButton aBtnCancel; 133 134 public: 135 136 URLDlg( Window* pWindow, 137 const String& rURL, const String& rDescription, 138 const String& rTarget, const String& rName, 139 TargetList& rTargetList ); 140 141 String GetURL() const { return aEdtURL.GetText(); } 142 String GetDescription() const { return aEdtURLDescription.GetText(); } 143 String GetTarget() const { return aCbbTargets.GetText(); } 144 String GetName() const { return aEdtName.GetText(); } 145 }; 146 */ 147 148 /************************************************************************* 149 |* 150 |* 151 |* 152 \************************************************************************/ 153 154 class IMapWindow : public GraphCtrl, public DropTargetHelper 155 { 156 NotifyInfo aInfo; 157 ImageMap aIMap; 158 TargetList aTargetList; 159 Link aInfoLink; 160 SfxItemPool* pIMapPool; 161 SfxItemInfo* pItemInfo; 162 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 163 mxDocumentFrame; 164 165 DECL_LINK( MenuSelectHdl, Menu* ); 166 DECL_LINK( MouseTimerHdl, Timer* ); 167 168 protected: 169 170 // GraphCtrl 171 virtual void MouseButtonUp(const MouseEvent& rMEvt); 172 virtual void Command(const CommandEvent& rCEvt); 173 virtual void RequestHelp( const HelpEvent& rHEvt ); 174 virtual void SdrObjCreated( const SdrObject& rObj ); 175 virtual void SdrObjChanged( const SdrObject& rObj ); 176 virtual void MarkListHasChanged(); 177 virtual void InitSdrModel(); 178 179 // DropTargetHelper 180 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 181 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 182 183 void CreateImageMap(); 184 void ReplaceImageMap( const ImageMap& rNewImageMap, sal_Bool bScaleToGraphic ); 185 186 void ClearTargetList(); 187 188 SdrObject* CreateObj( const IMapObject* pIMapObj ); 189 IMapObject* GetIMapObj( const SdrObject* pSdrObj ) const; 190 SdrObject* GetSdrObj( const IMapObject* pIMapObj ) const; 191 SdrObject* GetHitSdrObj( const Point& rPosPixel ) const; 192 193 void UpdateInfo( sal_Bool bNewObj ); 194 195 public: 196 197 IMapWindow( Window* pParent, const ResId& rResId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame ); 198 ~IMapWindow(); 199 200 sal_Bool ReplaceActualIMapInfo( const NotifyInfo& rNewInfo ); 201 202 void SetImageMap( const ImageMap& rImageMap ); 203 const ImageMap& GetImageMap(); 204 205 void SetCurrentObjState( sal_Bool bActive ); 206 void DoMacroAssign(); 207 void DoPropertyDialog(); 208 209 void SetInfoLink( const Link& rLink ) { aInfoLink = rLink; } 210 const Link& GetInfoLink() const { return aInfoLink; } 211 212 void SetTargetList( TargetList& rTargetList ); 213 const TargetList& GetTargetList() const { return aTargetList; } 214 215 const NotifyInfo& GetInfo() const { return aInfo; } 216 217 void CreateDefaultObject(); 218 void SelectFirstObject(); 219 void StartPolyEdit(); 220 221 virtual void KeyInput( const KeyEvent& rKEvt ); 222 }; 223 224 225 #endif 226 227