xref: /trunk/main/svx/source/dialog/imapwnd.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir #ifndef _IMAPWND_HXX
24cdf0e10cSrcweir #define _IMAPWND_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <vcl/dialog.hxx>
27cdf0e10cSrcweir #include <vcl/fixed.hxx>
28cdf0e10cSrcweir #include <vcl/button.hxx>
29cdf0e10cSrcweir #include <vcl/menu.hxx>
30cdf0e10cSrcweir #include <svl/itempool.hxx>
31cdf0e10cSrcweir #include <svtools/imapobj.hxx>
32cdf0e10cSrcweir #include <svtools/transfer.hxx>
33cdf0e10cSrcweir #include <svtools/imap.hxx>
34cdf0e10cSrcweir #include <sfx2/frame.hxx>
35cdf0e10cSrcweir #include <svx/graphctl.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir /*************************************************************************
40cdf0e10cSrcweir |*
41cdf0e10cSrcweir |*
42cdf0e10cSrcweir |*
43cdf0e10cSrcweir \************************************************************************/
44cdf0e10cSrcweir 
45cdf0e10cSrcweir struct NotifyInfo
46cdf0e10cSrcweir {
47cdf0e10cSrcweir     String  aMarkURL;
48cdf0e10cSrcweir     String  aMarkAltText;
49cdf0e10cSrcweir     String  aMarkTarget;
50cdf0e10cSrcweir     sal_Bool    bNewObj;
51cdf0e10cSrcweir     sal_Bool    bOneMarked;
52cdf0e10cSrcweir     sal_Bool    bActivated;
53cdf0e10cSrcweir };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir struct NotifyPosSize
57cdf0e10cSrcweir {
58cdf0e10cSrcweir     Size    aPictureSize;
59cdf0e10cSrcweir     Point   aMousePos;
60cdf0e10cSrcweir     sal_Bool    bPictureSize;
61cdf0e10cSrcweir     sal_Bool    bMousePos;
62cdf0e10cSrcweir };
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir /*************************************************************************
66cdf0e10cSrcweir |*
67cdf0e10cSrcweir |*
68cdf0e10cSrcweir |*
69cdf0e10cSrcweir \************************************************************************/
70cdf0e10cSrcweir 
71cdf0e10cSrcweir #define SVD_IMAP_USERDATA   0x0001
72cdf0e10cSrcweir 
73cdf0e10cSrcweir const sal_uInt32 IMapInventor = sal_uInt32('I') * 0x00000001+
74cdf0e10cSrcweir                             sal_uInt32('M') * 0x00000100+
75cdf0e10cSrcweir                             sal_uInt32('A') * 0x00010000+
76cdf0e10cSrcweir                             sal_uInt32('P') * 0x01000000;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 
79cdf0e10cSrcweir typedef boost::shared_ptr< IMapObject > IMapObjectPtr;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir class IMapUserData : public SdrObjUserData
82cdf0e10cSrcweir {
83cdf0e10cSrcweir     // #i98386# use boost::shared_ptr here due to cloning possibilities
84cdf0e10cSrcweir     IMapObjectPtr           mpObj;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir public:
87cdf0e10cSrcweir 
IMapUserData()88cdf0e10cSrcweir                             IMapUserData() :
89cdf0e10cSrcweir                                 SdrObjUserData  ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
90cdf0e10cSrcweir                                 mpObj           ( ) {}
91cdf0e10cSrcweir 
IMapUserData(const IMapObjectPtr & rIMapObj)92cdf0e10cSrcweir                             IMapUserData( const IMapObjectPtr& rIMapObj ) :
93cdf0e10cSrcweir                                 SdrObjUserData  ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
94cdf0e10cSrcweir                                 mpObj           ( rIMapObj ) {}
95cdf0e10cSrcweir 
IMapUserData(const IMapUserData & rIMapUserData)96cdf0e10cSrcweir                             IMapUserData( const IMapUserData& rIMapUserData ) :
97cdf0e10cSrcweir                                 SdrObjUserData  ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
98cdf0e10cSrcweir                                 mpObj           ( rIMapUserData.mpObj ) {}
99cdf0e10cSrcweir 
~IMapUserData()100cdf0e10cSrcweir                             ~IMapUserData() { }
101cdf0e10cSrcweir 
Clone(SdrObject *) const102cdf0e10cSrcweir     virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); }
103cdf0e10cSrcweir 
SetObject(const IMapObjectPtr & rIMapObj)104cdf0e10cSrcweir     void                    SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; }
GetObject() const105cdf0e10cSrcweir     const IMapObjectPtr     GetObject() const { return mpObj; }
ReplaceObject(const IMapObjectPtr & pNewIMapObject)106cdf0e10cSrcweir     void                    ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; }
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 
110cdf0e10cSrcweir /*************************************************************************
111cdf0e10cSrcweir |*
112cdf0e10cSrcweir |*
113cdf0e10cSrcweir |*
114cdf0e10cSrcweir \************************************************************************/
115cdf0e10cSrcweir /* move to cui //CHINA001
116cdf0e10cSrcweir class URLDlg : public ModalDialog
117cdf0e10cSrcweir {
118cdf0e10cSrcweir     FixedLine           aFlURL;
119cdf0e10cSrcweir     FixedText           aFtURL1;
120cdf0e10cSrcweir     Edit                aEdtURL;
121cdf0e10cSrcweir     FixedText           aFtURLDescription;
122cdf0e10cSrcweir     Edit                aEdtURLDescription;
123cdf0e10cSrcweir     FixedText           aFtTarget;
124cdf0e10cSrcweir     ComboBox            aCbbTargets;
125cdf0e10cSrcweir     FixedText           aFtName;
126cdf0e10cSrcweir     Edit                aEdtName;
127cdf0e10cSrcweir     OKButton            aBtnOk;
128cdf0e10cSrcweir     CancelButton        aBtnCancel;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir public:
131cdf0e10cSrcweir 
132cdf0e10cSrcweir                         URLDlg( Window* pWindow,
133cdf0e10cSrcweir                                 const String& rURL, const String& rDescription,
134cdf0e10cSrcweir                                 const String& rTarget, const String& rName,
135cdf0e10cSrcweir                                 TargetList& rTargetList );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     String              GetURL() const { return aEdtURL.GetText(); }
138cdf0e10cSrcweir     String              GetDescription() const { return aEdtURLDescription.GetText(); }
139cdf0e10cSrcweir     String              GetTarget() const { return aCbbTargets.GetText(); }
140cdf0e10cSrcweir     String              GetName() const { return aEdtName.GetText(); }
141cdf0e10cSrcweir };
142cdf0e10cSrcweir */
143cdf0e10cSrcweir 
144cdf0e10cSrcweir /*************************************************************************
145cdf0e10cSrcweir |*
146cdf0e10cSrcweir |*
147cdf0e10cSrcweir |*
148cdf0e10cSrcweir \************************************************************************/
149cdf0e10cSrcweir 
150cdf0e10cSrcweir class IMapWindow : public GraphCtrl, public DropTargetHelper
151cdf0e10cSrcweir {
152cdf0e10cSrcweir     NotifyInfo          aInfo;
153cdf0e10cSrcweir     ImageMap            aIMap;
154cdf0e10cSrcweir     TargetList          aTargetList;
155cdf0e10cSrcweir     Link                aInfoLink;
156cdf0e10cSrcweir     SfxItemPool*        pIMapPool;
157cdf0e10cSrcweir     SfxItemInfo*        pItemInfo;
158cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
159cdf0e10cSrcweir                         mxDocumentFrame;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir                         DECL_LINK( MenuSelectHdl, Menu* );
162cdf0e10cSrcweir                         DECL_LINK( MouseTimerHdl, Timer* );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir protected:
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     // GraphCtrl
167cdf0e10cSrcweir     virtual void        MouseButtonUp(const MouseEvent& rMEvt);
168cdf0e10cSrcweir     virtual void        Command(const CommandEvent& rCEvt);
169cdf0e10cSrcweir     virtual void        RequestHelp( const HelpEvent& rHEvt );
170cdf0e10cSrcweir     virtual void        SdrObjCreated( const SdrObject& rObj );
171cdf0e10cSrcweir     virtual void        SdrObjChanged( const SdrObject& rObj );
172cdf0e10cSrcweir     virtual void        MarkListHasChanged();
173cdf0e10cSrcweir     virtual void        InitSdrModel();
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     // DropTargetHelper
176cdf0e10cSrcweir     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
177cdf0e10cSrcweir     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     void                CreateImageMap();
180cdf0e10cSrcweir     void                ReplaceImageMap( const ImageMap& rNewImageMap, sal_Bool bScaleToGraphic );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     void                ClearTargetList();
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     SdrObject*          CreateObj( const IMapObject* pIMapObj );
185cdf0e10cSrcweir     IMapObject*         GetIMapObj( const SdrObject* pSdrObj ) const;
186cdf0e10cSrcweir     SdrObject*          GetSdrObj( const IMapObject* pIMapObj ) const;
187cdf0e10cSrcweir     SdrObject*          GetHitSdrObj( const Point& rPosPixel ) const;
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     void                UpdateInfo( sal_Bool bNewObj );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir public:
192cdf0e10cSrcweir 
193cdf0e10cSrcweir                         IMapWindow( Window* pParent, const ResId& rResId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame );
194cdf0e10cSrcweir                         ~IMapWindow();
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     sal_Bool                ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     void                SetImageMap( const ImageMap& rImageMap );
199cdf0e10cSrcweir     const ImageMap&     GetImageMap();
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     void                SetCurrentObjState( sal_Bool bActive );
202cdf0e10cSrcweir     void                DoMacroAssign();
203cdf0e10cSrcweir     void                DoPropertyDialog();
204cdf0e10cSrcweir 
SetInfoLink(const Link & rLink)205cdf0e10cSrcweir     void                SetInfoLink( const Link& rLink ) { aInfoLink = rLink; }
GetInfoLink() const206cdf0e10cSrcweir     const Link&         GetInfoLink() const { return aInfoLink; }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir     void                SetTargetList( TargetList& rTargetList );
GetTargetList() const209cdf0e10cSrcweir     const TargetList&   GetTargetList() const { return aTargetList; }
210cdf0e10cSrcweir 
GetInfo() const211cdf0e10cSrcweir     const NotifyInfo&   GetInfo() const { return aInfo; }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     void                CreateDefaultObject();
214cdf0e10cSrcweir     void                SelectFirstObject();
215cdf0e10cSrcweir     void                StartPolyEdit();
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     virtual void        KeyInput( const KeyEvent& rKEvt );
218cdf0e10cSrcweir };
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
221cdf0e10cSrcweir #endif
222