fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / svx / source / dialog / imapwnd.hxx
blobee823a521b37033d17344b41b8c888341aa0fde8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVX_SOURCE_DIALOG_IMAPWND_HXX
20 #define INCLUDED_SVX_SOURCE_DIALOG_IMAPWND_HXX
22 #include <vcl/dialog.hxx>
23 #include <vcl/fixed.hxx>
24 #include <vcl/button.hxx>
25 #include <vcl/menu.hxx>
26 #include <svl/itempool.hxx>
27 #include <svtools/imapobj.hxx>
28 #include <svtools/transfer.hxx>
29 #include <svtools/imap.hxx>
30 #include <sfx2/frame.hxx>
31 #include <svx/graphctl.hxx>
33 #include <com/sun/star/frame/XFrame.hpp>
35 struct NotifyInfo
37 OUString aMarkURL;
38 OUString aMarkAltText;
39 OUString aMarkTarget;
40 bool bNewObj;
41 bool bOneMarked;
42 bool bActivated;
46 struct NotifyPosSize
48 Size aPictureSize;
49 Point aMousePos;
50 bool bPictureSize;
51 bool bMousePos;
54 #define SVD_IMAP_USERDATA 0x0001
56 const sal_uInt32 IMapInventor = sal_uInt32('I') * 0x00000001+
57 sal_uInt32('M') * 0x00000100+
58 sal_uInt32('A') * 0x00010000+
59 sal_uInt32('P') * 0x01000000;
62 typedef boost::shared_ptr< IMapObject > IMapObjectPtr;
64 class IMapUserData : public SdrObjUserData
66 // #i98386# use boost::shared_ptr here due to cloning possibilities
67 IMapObjectPtr mpObj;
69 public:
71 IMapUserData() :
72 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
73 mpObj ( ) {}
75 IMapUserData( const IMapObjectPtr& rIMapObj ) :
76 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
77 mpObj ( rIMapObj ) {}
79 IMapUserData( const IMapUserData& rIMapUserData ) :
80 SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
81 mpObj ( rIMapUserData.mpObj ) {}
83 virtual ~IMapUserData() { }
85 virtual SdrObjUserData* Clone( SdrObject * ) const SAL_OVERRIDE { return new IMapUserData( *this ); }
87 void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; }
88 const IMapObjectPtr GetObject() const { return mpObj; }
89 void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; }
92 class IMapWindow : public GraphCtrl, public DropTargetHelper
94 NotifyInfo aInfo;
95 ImageMap aIMap;
96 TargetList aTargetList;
97 Link<> aInfoLink;
98 SfxItemPool* pIMapPool;
99 SfxItemInfo* pItemInfo;
100 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
101 mxDocumentFrame;
103 DECL_LINK( MenuSelectHdl, Menu* );
104 DECL_LINK( MouseTimerHdl, Timer* );
106 protected:
108 // GraphCtrl
109 virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
110 virtual Size GetOptimalSize() const SAL_OVERRIDE;
111 virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
112 virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
113 virtual void SdrObjCreated( const SdrObject& rObj ) SAL_OVERRIDE;
114 virtual void SdrObjChanged( const SdrObject& rObj ) SAL_OVERRIDE;
115 virtual void MarkListHasChanged() SAL_OVERRIDE;
116 virtual void InitSdrModel() SAL_OVERRIDE;
118 // DropTargetHelper
119 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
120 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
122 void CreateImageMap();
123 void ReplaceImageMap( const ImageMap& rNewImageMap, bool bScaleToGraphic );
125 void ClearTargetList();
127 SdrObject* CreateObj( const IMapObject* pIMapObj );
128 static IMapObject* GetIMapObj( const SdrObject* pSdrObj );
129 SdrObject* GetHitSdrObj( const Point& rPosPixel ) const;
131 void UpdateInfo( bool bNewObj );
133 public:
135 IMapWindow( vcl::Window* pParent, WinBits nBits, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame );
136 virtual ~IMapWindow();
137 virtual void dispose() SAL_OVERRIDE;
139 bool ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
141 void SetImageMap( const ImageMap& rImageMap );
142 const ImageMap& GetImageMap();
144 void SetCurrentObjState( bool bActive );
145 void DoMacroAssign();
146 void DoPropertyDialog();
148 void SetInfoLink( const Link<>& rLink ) { aInfoLink = rLink; }
149 const Link<>& GetInfoLink() const { return aInfoLink; }
151 void SetTargetList( TargetList& rTargetList );
152 const TargetList& GetTargetList() const { return aTargetList; }
154 const NotifyInfo& GetInfo() const { return aInfo; }
156 void CreateDefaultObject();
157 void SelectFirstObject();
158 void StartPolyEdit();
160 virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
164 #endif
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */