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