1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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>
30 #include <com/sun/star/frame/XFrame.hpp>
35 OUString aMarkAltText
;
43 #define SVD_IMAP_USERDATA 0x0001
45 typedef std::shared_ptr
< IMapObject
> IMapObjectPtr
;
47 class IMapUserData
: public SdrObjUserData
49 // #i98386# use std::shared_ptr here due to cloning possibilities
54 explicit IMapUserData( IMapObjectPtr xIMapObj
) :
55 SdrObjUserData ( SdrInventor::IMap
, SVD_IMAP_USERDATA
),
56 mpObj (std::move( xIMapObj
)) {}
58 IMapUserData( const IMapUserData
& rIMapUserData
) :
59 SdrObjUserData ( SdrInventor::IMap
, SVD_IMAP_USERDATA
),
60 mpObj ( rIMapUserData
.mpObj
) {}
62 virtual std::unique_ptr
<SdrObjUserData
> Clone( SdrObject
* ) const override
{ return std::unique_ptr
<SdrObjUserData
>(new IMapUserData( *this )); }
64 const IMapObjectPtr
& GetObject() const { return mpObj
; }
65 void ReplaceObject( const IMapObjectPtr
& pNewIMapObject
) { mpObj
= pNewIMapObject
; }
70 class IMapDropTargetHelper final
: public DropTargetHelper
72 IMapWindow
& m_rImapWindow
;
74 IMapDropTargetHelper(IMapWindow
& rImapWindow
);
77 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
) override
;
78 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
) override
;
81 class IMapWindow final
: public GraphCtrl
85 TargetList aTargetList
;
86 Link
<IMapWindow
&,void> aInfoLink
;
87 rtl::Reference
<SfxItemPool
> pIMapPool
;
88 css::uno::Reference
< css::frame::XFrame
>
90 std::unique_ptr
<IMapDropTargetHelper
> mxDropTargetHelper
;
91 std::unique_ptr
<weld::Menu
> mxPopupMenu
;
93 void MenuSelectHdl(const OUString
& rId
);
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
;
105 void ReplaceImageMap( const ImageMap
& rNewImageMap
);
107 rtl::Reference
<SdrObject
> CreateObj( const IMapObject
* pIMapObj
);
108 static IMapObject
* GetIMapObj( const SdrObject
* pSdrObj
);
109 SdrObject
* GetHitSdrObj( const Point
& rPosPixel
) const;
111 void UpdateInfo( bool bNewObj
);
115 IMapWindow(const css::uno::Reference
< css::frame::XFrame
>& rxDocumentFrame
,
116 weld::Dialog
* pDialog
);
117 virtual ~IMapWindow() override
;
119 sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
120 sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
122 void ReplaceActualIMapInfo( const NotifyInfo
& rNewInfo
);
124 void SetImageMap( const ImageMap
& rImageMap
);
125 const ImageMap
& GetImageMap();
127 void SetCurrentObjState( bool bActive
);
128 void DoMacroAssign();
129 void DoPropertyDialog();
131 void SetInfoLink( const Link
<IMapWindow
&,void>& rLink
) { aInfoLink
= rLink
; }
133 void SetTargetList( const TargetList
& rTargetList
);
135 const NotifyInfo
& GetInfo() const { return aInfo
; }
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */