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 <utility>
23#include <vcl/imapobj.hxx>
24#include <vcl/transfer.hxx>
25#include <vcl/imap.hxx>
26#include <sfx2/frame.hxx>
27#include <svx/graphctl.hxx>
28#include <svl/itempool.hxx>
29
30#include <com/sun/star/frame/XFrame.hpp>
31
33{
34 OUString aMarkURL;
35 OUString aMarkAltText;
36 OUString aMarkTarget;
37 bool bNewObj;
40};
41
42
43#define SVD_IMAP_USERDATA 0x0001
44
45typedef std::shared_ptr< IMapObject > IMapObjectPtr;
46
48{
49 // #i98386# use std::shared_ptr here due to cloning possibilities
51
52public:
53
54 explicit IMapUserData( IMapObjectPtr xIMapObj ) :
56 mpObj (std::move( xIMapObj )) {}
57
58 IMapUserData( const IMapUserData& rIMapUserData ) :
60 mpObj ( rIMapUserData.mpObj ) {}
61
62 virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject * ) const override { return std::unique_ptr<SdrObjUserData>(new IMapUserData( *this )); }
63
64 const IMapObjectPtr& GetObject() const { return mpObj; }
65 void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; }
66};
67
68class IMapWindow;
69
70class IMapDropTargetHelper final : public DropTargetHelper
71{
73public:
74 IMapDropTargetHelper(IMapWindow& rImapWindow);
75
76 // DropTargetHelper
77 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
78 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
79};
80
81class IMapWindow final : public GraphCtrl
82{
89 css::uno::Reference< css::frame::XFrame >
91 std::unique_ptr<IMapDropTargetHelper> mxDropTargetHelper;
92 std::unique_ptr<weld::Menu> mxPopupMenu;
93
94 void MenuSelectHdl(const OUString& rId);
95
96 // GraphCtrl
97 virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
98 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
99 virtual bool Command(const CommandEvent& rCEvt) override;
100 virtual OUString RequestHelp(tools::Rectangle& rHelpArea) override;
101 virtual void SdrObjCreated( const SdrObject& rObj ) override;
102 virtual void SdrObjChanged( const SdrObject& rObj ) override;
103 virtual void MarkListHasChanged() override;
104 virtual void InitSdrModel() override;
105
106 void ReplaceImageMap( const ImageMap& rNewImageMap );
107
109 static IMapObject* GetIMapObj( const SdrObject* pSdrObj );
110 SdrObject* GetHitSdrObj( const Point& rPosPixel ) const;
111
112 void UpdateInfo( bool bNewObj );
113
114public:
115
116 IMapWindow(const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame,
117 weld::Dialog* pDialog);
118 virtual ~IMapWindow() override;
119
120 sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
122
123 void ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
124
125 void SetImageMap( const ImageMap& rImageMap );
126 const ImageMap& GetImageMap();
127
128 void SetCurrentObjState( bool bActive );
129 void DoMacroAssign();
130 void DoPropertyDialog();
131
132 void SetInfoLink( const Link<IMapWindow&,void>& rLink ) { aInfoLink = rLink; }
133
134 void SetTargetList( const TargetList& rTargetList );
135
136 const NotifyInfo& GetInfo() const { return aInfo; }
137};
138
139
140#endif
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
IMapWindow & m_rImapWindow
Definition: imapwnd.hxx:72
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: imapwnd.cxx:528
IMapDropTargetHelper(IMapWindow &rImapWindow)
Definition: imapwnd.cxx:517
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: imapwnd.cxx:523
IMapObjectPtr mpObj
Definition: imapwnd.hxx:50
void ReplaceObject(const IMapObjectPtr &pNewIMapObject)
Definition: imapwnd.hxx:65
const IMapObjectPtr & GetObject() const
Definition: imapwnd.hxx:64
IMapUserData(IMapObjectPtr xIMapObj)
Definition: imapwnd.hxx:54
virtual std::unique_ptr< SdrObjUserData > Clone(SdrObject *) const override
Definition: imapwnd.hxx:62
IMapUserData(const IMapUserData &rIMapUserData)
Definition: imapwnd.hxx:58
TargetList aTargetList
Definition: imapwnd.hxx:85
void SetTargetList(const TargetList &rTargetList)
Definition: imapwnd.cxx:164
const NotifyInfo & GetInfo() const
Definition: imapwnd.hxx:136
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: imapwnd.cxx:67
void MenuSelectHdl(const OUString &rId)
Definition: imapwnd.cxx:712
NotifyInfo aInfo
Definition: imapwnd.hxx:83
static IMapObject * GetIMapObj(const SdrObject *pSdrObj)
Definition: imapwnd.cxx:458
Link< IMapWindow &, void > aInfoLink
Definition: imapwnd.hxx:86
void DoMacroAssign()
Definition: imapwnd.cxx:647
void SetInfoLink(const Link< IMapWindow &, void > &rLink)
Definition: imapwnd.hxx:132
ImageMap aIMap
Definition: imapwnd.hxx:84
void SetImageMap(const ImageMap &rImageMap)
Definition: imapwnd.cxx:79
css::uno::Reference< css::frame::XFrame > mxDocumentFrame
Definition: imapwnd.hxx:90
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: imapwnd.cxx:538
SdrObject * GetHitSdrObj(const Point &rPosPixel) const
Definition: imapwnd.cxx:428
std::unique_ptr< IMapDropTargetHelper > mxDropTargetHelper
Definition: imapwnd.hxx:91
const ImageMap & GetImageMap()
Definition: imapwnd.cxx:139
virtual void InitSdrModel() override
Definition: imapwnd.cxx:285
void DoPropertyDialog()
Definition: imapwnd.cxx:679
rtl::Reference< SfxItemPool > pIMapPool
Definition: imapwnd.hxx:87
virtual bool Command(const CommandEvent &rCEvt) override
Definition: imapwnd.cxx:473
void ReplaceActualIMapInfo(const NotifyInfo &rNewInfo)
Definition: imapwnd.cxx:121
sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
Definition: imapwnd.cxx:533
virtual OUString RequestHelp(tools::Rectangle &rHelpArea) override
Definition: imapwnd.cxx:564
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: imapwnd.cxx:415
void SetCurrentObjState(bool bActive)
Definition: imapwnd.cxx:589
virtual void SdrObjChanged(const SdrObject &rObj) override
Definition: imapwnd.cxx:346
SfxItemInfo maItemInfos[1]
Definition: imapwnd.hxx:88
virtual ~IMapWindow() override
Definition: imapwnd.cxx:63
std::unique_ptr< weld::Menu > mxPopupMenu
Definition: imapwnd.hxx:92
void ReplaceImageMap(const ImageMap &rNewImageMap)
Definition: imapwnd.cxx:84
void UpdateInfo(bool bNewObj)
Definition: imapwnd.cxx:616
virtual void MarkListHasChanged() override
Definition: imapwnd.cxx:422
virtual void SdrObjCreated(const SdrObject &rObj) override
Definition: imapwnd.cxx:297
rtl::Reference< SdrObject > CreateObj(const IMapObject *pIMapObj)
Definition: imapwnd.cxx:173
IMapWindow(const css::uno::Reference< css::frame::XFrame > &rxDocumentFrame, weld::Dialog *pDialog)
Definition: imapwnd.cxx:54
User data of a drawing object, e.g.
Definition: svdobj.hxx:152
Abstract DrawObject.
Definition: svdobj.hxx:260
::std::vector< OUString > TargetList
#define SVD_IMAP_USERDATA
Definition: imapwnd.hxx:43
std::shared_ptr< IMapObject > IMapObjectPtr
Definition: imapwnd.hxx:45
bool bOneMarked
Definition: imapwnd.hxx:38
bool bNewObj
Definition: imapwnd.hxx:37
OUString aMarkURL
Definition: imapwnd.hxx:34
OUString aMarkTarget
Definition: imapwnd.hxx:36
OUString aMarkAltText
Definition: imapwnd.hxx:35
bool bActivated
Definition: imapwnd.hxx:39
SdrInventor
Definition: svdobj.hxx:98
signed char sal_Int8