LibreOffice Module svx (master)  1
imapwnd.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SVX_SOURCE_DIALOG_IMAPWND_HXX
20 #define INCLUDED_SVX_SOURCE_DIALOG_IMAPWND_HXX
21 
22 #include <vcl/imapobj.hxx>
23 #include <vcl/transfer.hxx>
24 #include <vcl/imap.hxx>
25 #include <sfx2/frame.hxx>
26 #include <svx/graphctl.hxx>
27 #include <svl/itempool.hxx>
28 
29 #include <com/sun/star/frame/XFrame.hpp>
30 
31 struct NotifyInfo
32 {
33  OUString aMarkURL;
34  OUString aMarkAltText;
35  OUString aMarkTarget;
36  bool bNewObj;
37  bool bOneMarked;
38  bool bActivated;
39 };
40 
41 
42 #define SVD_IMAP_USERDATA 0x0001
43 
44 typedef std::shared_ptr< IMapObject > IMapObjectPtr;
45 
47 {
48  // #i98386# use std::shared_ptr here due to cloning possibilities
50 
51 public:
52 
53  explicit IMapUserData( const IMapObjectPtr& rIMapObj ) :
55  mpObj ( rIMapObj ) {}
56 
57  IMapUserData( const IMapUserData& rIMapUserData ) :
59  mpObj ( rIMapUserData.mpObj ) {}
60 
61  virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject * ) const override { return std::unique_ptr<SdrObjUserData>(new IMapUserData( *this )); }
62 
63  const IMapObjectPtr& GetObject() const { return mpObj; }
64  void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; }
65 };
66 
67 class IMapWindow;
68 
70 {
72 public:
73  IMapDropTargetHelper(IMapWindow& rImapWindow);
74 
75  // DropTargetHelper
76  virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
77  virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
78 };
79 
80 class IMapWindow final : public GraphCtrl
81 {
88  css::uno::Reference< css::frame::XFrame >
90  std::unique_ptr<IMapDropTargetHelper> mxDropTargetHelper;
91  std::unique_ptr<weld::Menu> mxPopupMenu;
92 
93  void MenuSelectHdl(const OString& rId);
94 
95  // GraphCtrl
96  virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
97  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
98  virtual bool Command(const CommandEvent& rCEvt) override;
99  virtual OUString RequestHelp(tools::Rectangle& rHelpArea) override;
100  virtual void SdrObjCreated( const SdrObject& rObj ) override;
101  virtual void SdrObjChanged( const SdrObject& rObj ) override;
102  virtual void MarkListHasChanged() override;
103  virtual void InitSdrModel() override;
104 
105  void ReplaceImageMap( const ImageMap& rNewImageMap );
106 
107  SdrObject* CreateObj( const IMapObject* pIMapObj );
108  static IMapObject* GetIMapObj( const SdrObject* pSdrObj );
109  SdrObject* GetHitSdrObj( const Point& rPosPixel ) const;
110 
111  void UpdateInfo( bool bNewObj );
112 
113 public:
114 
115  IMapWindow(const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame,
116  weld::Dialog* pDialog);
117  virtual ~IMapWindow() override;
118 
119  sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
120  sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
121 
122  void ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
123 
124  void SetImageMap( const ImageMap& rImageMap );
125  const ImageMap& GetImageMap();
126 
127  void SetCurrentObjState( bool bActive );
128  void DoMacroAssign();
129  void DoPropertyDialog();
130 
131  void SetInfoLink( const Link<IMapWindow&,void>& rLink ) { aInfoLink = rLink; }
132 
133  void SetTargetList( TargetList& rTargetList );
134 
135  const NotifyInfo& GetInfo() const { return aInfo; }
136 };
137 
138 
139 #endif
140 
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
User data of a drawing object, e.g.
Definition: svdobj.hxx:204
virtual bool Command(const CommandEvent &rCEvt) override
Definition: imapwnd.cxx:484
std::shared_ptr< IMapObject > IMapObjectPtr
Definition: imapwnd.hxx:44
void SetImageMap(const ImageMap &rImageMap)
Definition: imapwnd.cxx:85
signed char sal_Int8
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: imapwnd.cxx:73
OUString aMarkURL
Definition: imapwnd.hxx:33
SdrInventor
Definition: svdobj.hxx:152
bool bNewObj
Definition: imapwnd.hxx:36
#define SVD_IMAP_USERDATA
Definition: imapwnd.hxx:42
virtual std::unique_ptr< SdrObjUserData > Clone(SdrObject *) const override
Definition: imapwnd.hxx:61
void DoPropertyDialog()
Definition: imapwnd.cxx:690
SfxItemPool * pIMapPool
Definition: imapwnd.hxx:86
void SetCurrentObjState(bool bActive)
Definition: imapwnd.cxx:601
bool bActivated
Definition: imapwnd.hxx:38
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: imapwnd.cxx:551
Link< IMapWindow &, void > aInfoLink
Definition: imapwnd.hxx:85
std::unique_ptr< IMapDropTargetHelper > mxDropTargetHelper
Definition: imapwnd.hxx:90
virtual void SdrObjChanged(const SdrObject &rObj) override
Definition: imapwnd.cxx:354
SdrObject * CreateObj(const IMapObject *pIMapObj)
Definition: imapwnd.cxx:179
IMapWindow(const css::uno::Reference< css::frame::XFrame > &rxDocumentFrame, weld::Dialog *pDialog)
Definition: imapwnd.cxx:59
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: imapwnd.cxx:536
void ReplaceImageMap(const ImageMap &rNewImageMap)
Definition: imapwnd.cxx:90
virtual void MarkListHasChanged() override
Definition: imapwnd.cxx:433
virtual ~IMapWindow() override
Definition: imapwnd.cxx:68
virtual void InitSdrModel() override
Definition: imapwnd.cxx:291
SfxItemInfo maItemInfos[1]
Definition: imapwnd.hxx:87
bool bOneMarked
Definition: imapwnd.hxx:37
void DoMacroAssign()
Definition: imapwnd.cxx:659
virtual OUString RequestHelp(tools::Rectangle &rHelpArea) override
Definition: imapwnd.cxx:578
const NotifyInfo & GetInfo() const
Definition: imapwnd.hxx:135
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: imapwnd.cxx:426
sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
Definition: imapwnd.cxx:546
IMapWindow & m_rImapWindow
Definition: imapwnd.hxx:71
OUString aMarkAltText
Definition: imapwnd.hxx:34
IMapObjectPtr mpObj
Definition: imapwnd.hxx:49
static IMapObject * GetIMapObj(const SdrObject *pSdrObj)
Definition: imapwnd.cxx:469
const ImageMap & GetImageMap()
Definition: imapwnd.cxx:142
virtual void SdrObjCreated(const SdrObject &rObj) override
Definition: imapwnd.cxx:303
NotifyInfo aInfo
Definition: imapwnd.hxx:82
std::unique_ptr< weld::Menu > mxPopupMenu
Definition: imapwnd.hxx:91
void SetTargetList(TargetList &rTargetList)
Definition: imapwnd.cxx:167
void MenuSelectHdl(const OString &rId)
Definition: imapwnd.cxx:723
TargetList aTargetList
Definition: imapwnd.hxx:84
SdrObject * GetHitSdrObj(const Point &rPosPixel) const
Definition: imapwnd.cxx:439
IMapDropTargetHelper(IMapWindow &rImapWindow)
Definition: imapwnd.cxx:530
IMapUserData(const IMapUserData &rIMapUserData)
Definition: imapwnd.hxx:57
ImageMap aIMap
Definition: imapwnd.hxx:83
::std::vector< OUString > TargetList
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: imapwnd.cxx:541
void ReplaceActualIMapInfo(const NotifyInfo &rNewInfo)
Definition: imapwnd.cxx:127
void UpdateInfo(bool bNewObj)
Definition: imapwnd.cxx:628
void ReplaceObject(const IMapObjectPtr &pNewIMapObject)
Definition: imapwnd.hxx:64
OUString aMarkTarget
Definition: imapwnd.hxx:35
css::uno::Reference< css::frame::XFrame > mxDocumentFrame
Definition: imapwnd.hxx:89
const IMapObjectPtr & GetObject() const
Definition: imapwnd.hxx:63
void SetInfoLink(const Link< IMapWindow &, void > &rLink)
Definition: imapwnd.hxx:131
IMapUserData(const IMapObjectPtr &rIMapObj)
Definition: imapwnd.hxx:53