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 .
20 #include <tools/urlobj.hxx>
21 #include <vcl/commandevent.hxx>
22 #include <vcl/imaprect.hxx>
23 #include <vcl/imapcirc.hxx>
24 #include <vcl/imappoly.hxx>
25 #include <vcl/svapp.hxx>
26 #include <svl/urlbmk.hxx>
28 #include <svx/svxids.hrc>
29 #include "imapwnd.hxx"
30 #include <svx/svdpage.hxx>
31 #include <svx/svdorect.hxx>
32 #include <svx/svdocirc.hxx>
33 #include <svx/svdopath.hxx>
34 #include <svx/xfltrit.hxx>
35 #include <svx/svdpagv.hxx>
36 #include <svx/xfillit0.hxx>
37 #include <svx/xflclit.hxx>
38 #include <svx/xlnclit.hxx>
40 #include <sfx2/evntconf.hxx>
42 #include <sot/formats.hxx>
44 #include <svx/svxdlg.hxx>
45 #include <basegfx/polygon/b2dpolygon.hxx>
48 using namespace com::sun::star
;
49 using ::com::sun::star::frame::XFrame
;
50 using ::com::sun::star::uno::Reference
;
52 #define TRANSCOL COL_WHITE
54 static ItemInfoPackage
& getItemInfoPackageIMapWindow()
56 class ItemInfoPackageIMapWindow
: public ItemInfoPackage
58 typedef std::array
<ItemInfoStatic
, 1> ItemInfoArrayIMapWindow
;
59 ItemInfoArrayIMapWindow maItemInfos
{{
60 // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
61 { SID_ATTR_MACROITEM
, new SvxMacroItem(SID_ATTR_MACROITEM
), 0, SFX_ITEMINFOFLAG_NONE
}
64 virtual const ItemInfoStatic
& getItemInfoStatic(size_t nIndex
) const override
{ return maItemInfos
[nIndex
]; }
67 virtual size_t size() const override
{ return maItemInfos
.size(); }
68 virtual const ItemInfo
& getItemInfo(size_t nIndex
, SfxItemPool
& /*rPool*/) override
{ return maItemInfos
[nIndex
]; }
71 static std::unique_ptr
<ItemInfoPackageIMapWindow
> g_aItemInfoPackageIMapWindow
;
72 if (!g_aItemInfoPackageIMapWindow
)
73 g_aItemInfoPackageIMapWindow
.reset(new ItemInfoPackageIMapWindow
);
74 return *g_aItemInfoPackageIMapWindow
;
77 IMapWindow::IMapWindow(const Reference
< XFrame
>& rxDocumentFrame
, weld::Dialog
* pDialog
)
79 , mxDocumentFrame(rxDocumentFrame
)
81 pIMapPool
= new SfxItemPool(u
"IMapItemPool"_ustr
);
82 pIMapPool
->registerItemInfoPackage(getItemInfoPackageIMapWindow());
85 IMapWindow::~IMapWindow()
89 void IMapWindow::SetDrawingArea(weld::DrawingArea
* pDrawingArea
)
91 Size
aSize(pDrawingArea
->get_ref_device().LogicToPixel(Size(270, 170), MapMode(MapUnit::MapAppFont
)));
92 pDrawingArea
->set_size_request(aSize
.Width(), aSize
.Height());
93 SetOutputSizePixel(aSize
);
94 weld::CustomWidgetController::SetDrawingArea(pDrawingArea
);
98 mxDropTargetHelper
.reset(new IMapDropTargetHelper(*this));
101 void IMapWindow::SetImageMap( const ImageMap
& rImageMap
)
103 ReplaceImageMap( rImageMap
);
106 void IMapWindow::ReplaceImageMap( const ImageMap
& rImageMap
)
108 SdrPage
* pPage
= nullptr;
113 // try to access page
114 pPage
= GetSdrModel()->GetPage(0);
119 // clear SdrObjects with broadcasting
120 pPage
->ClearSdrObjList();
125 // #i63762# reset selection at view
126 GetSdrView()->UnmarkAllObj();
129 // create new drawing objects
130 const sal_uInt16
nCount(rImageMap
.GetIMapObjectCount());
132 for ( sal_uInt16
i(nCount
); i
> 0; i
-- )
134 rtl::Reference
<SdrObject
> pNewObj
= CreateObj( rImageMap
.GetIMapObject( i
- 1 ) );
136 if (pNewObj
&& pPage
)
138 pPage
->InsertObject( pNewObj
.get() );
143 void IMapWindow::ReplaceActualIMapInfo( const NotifyInfo
& rNewInfo
)
145 const SdrObject
* pSdrObj
= GetSelectedSdrObject();
149 IMapObject
* pIMapObj
= GetIMapObj( pSdrObj
);
152 pIMapObj
->SetURL( rNewInfo
.aMarkURL
);
153 pIMapObj
->SetAltText( rNewInfo
.aMarkAltText
);
154 pIMapObj
->SetTarget( rNewInfo
.aMarkTarget
);
155 pModel
->SetChanged();
161 const ImageMap
& IMapWindow::GetImageMap()
163 if ( pModel
->IsChanged() )
165 SdrPage
* pPage
= pModel
->GetPage( 0 );
169 const size_t nCount
= pPage
->GetObjCount();
171 aIMap
.ClearImageMap();
173 for ( size_t i
= nCount
; i
; )
176 aIMap
.InsertIMapObject( *( static_cast<IMapUserData
*>( pPage
->GetObj( i
)->GetUserData( 0 ) )->GetObject() ) );
180 pModel
->SetChanged( false );
186 void IMapWindow::SetTargetList( const TargetList
& rTargetList
)
189 // Fill with the provided list
190 aTargetList
= rTargetList
;
192 pModel
->SetChanged( false );
195 rtl::Reference
<SdrObject
> IMapWindow::CreateObj( const IMapObject
* pIMapObj
)
197 tools::Rectangle
aClipRect( Point(), GetGraphicSize() );
198 rtl::Reference
<SdrObject
> pSdrObj
;
199 IMapObjectPtr pCloneIMapObj
;
201 switch( pIMapObj
->GetType() )
203 case IMapObjectType::Rectangle
:
205 const IMapRectangleObject
* pIMapRectObj
= static_cast<const IMapRectangleObject
*>(pIMapObj
);
206 tools::Rectangle
aDrawRect( pIMapRectObj
->GetRectangle( false ) );
208 // clipped on CanvasPane
209 aDrawRect
.Intersection( aClipRect
);
211 pSdrObj
= new SdrRectObj(*pModel
, aDrawRect
);
212 pCloneIMapObj
.reset(static_cast<IMapObject
*>(new IMapRectangleObject( *pIMapRectObj
)));
216 case IMapObjectType::Circle
:
218 const IMapCircleObject
* pIMapCircleObj
= static_cast<const IMapCircleObject
*>(pIMapObj
);
219 const Point
aCenter( pIMapCircleObj
->GetCenter( false ) );
220 const tools::Long nRadius
= pIMapCircleObj
->GetRadius( false );
221 const Point
aOffset( nRadius
, nRadius
);
222 tools::Rectangle
aCircle( aCenter
- aOffset
, aCenter
+ aOffset
);
224 // limited to CanvasPane
225 aCircle
.Intersection( aClipRect
);
227 pSdrObj
= new SdrCircObj(
233 pCloneIMapObj
.reset(static_cast<IMapObject
*>(new IMapCircleObject( *pIMapCircleObj
)));
237 case IMapObjectType::Polygon
:
239 const IMapPolygonObject
* pIMapPolyObj
= static_cast<const IMapPolygonObject
*>(pIMapObj
);
241 // If it actually is an ellipse, then another ellipse is created again
242 if ( pIMapPolyObj
->HasExtraEllipse() )
244 tools::Rectangle
aDrawRect( pIMapPolyObj
->GetExtraEllipse() );
246 // clipped on CanvasPane
247 aDrawRect
.Intersection( aClipRect
);
249 pSdrObj
= new SdrCircObj(
258 const tools::Polygon aPoly
= pIMapPolyObj
->GetPolygon( false );
259 tools::Polygon
aDrawPoly( aPoly
);
261 // clipped on CanvasPane
262 aDrawPoly
.Clip( aClipRect
);
264 basegfx::B2DPolygon aPolygon
;
265 aPolygon
.append(aDrawPoly
.getB2DPolygon());
266 pSdrObj
= new SdrPathObj(
269 basegfx::B2DPolyPolygon(aPolygon
));
272 pCloneIMapObj
.reset(static_cast<IMapObject
*>(new IMapPolygonObject( *pIMapPolyObj
)));
282 SfxItemSet
aSet( pModel
->GetItemPool() );
284 aSet
.Put( XFillStyleItem( drawing::FillStyle_SOLID
) );
285 aSet
.Put( XFillColorItem( u
""_ustr
, TRANSCOL
) );
287 if ( !pIMapObj
->IsActive() )
289 aSet
.Put( XFillTransparenceItem( 100 ) );
290 aSet
.Put( XLineColorItem( u
""_ustr
, COL_RED
) );
294 aSet
.Put( XFillTransparenceItem( 50 ) );
295 aSet
.Put( XLineColorItem( u
""_ustr
, COL_BLACK
) );
298 pSdrObj
->SetMergedItemSetAndBroadcast(aSet
);
300 pSdrObj
->AppendUserData( std::unique_ptr
<SdrObjUserData
>(new IMapUserData( std::move(pCloneIMapObj
) )) );
301 pSdrObj
->SetUserCall( GetSdrUserCall() );
307 void IMapWindow::InitSdrModel()
309 GraphCtrl::InitSdrModel();
311 SfxItemSet
aSet( pModel
->GetItemPool() );
313 aSet
.Put( XFillColorItem( u
""_ustr
, TRANSCOL
) );
314 aSet
.Put( XFillTransparenceItem( 50 ) );
315 pView
->SetAttributes( aSet
);
316 pView
->SetFrameDragSingles();
319 void IMapWindow::SdrObjCreated( const SdrObject
& rObj
)
321 switch( rObj
.GetObjIdentifier() )
323 case SdrObjKind::Rectangle
:
325 SdrRectObj
* pRectObj
= const_cast<SdrRectObj
*>(static_cast<const SdrRectObj
*>(&rObj
));
326 auto pObj
= std::make_shared
<IMapRectangleObject
>( pRectObj
->GetLogicRect(), "", "", "", "", "", true, false );
328 pRectObj
->AppendUserData( std::unique_ptr
<SdrObjUserData
>(new IMapUserData( pObj
)) );
332 case SdrObjKind::CircleOrEllipse
:
334 SdrCircObj
* pCircObj
= const_cast<SdrCircObj
*>( static_cast<const SdrCircObj
*>(&rObj
) );
335 rtl::Reference
<SdrPathObj
> pPathObj
= static_cast<SdrPathObj
*>( pCircObj
->ConvertToPolyObj( false, false ).get() );
336 tools::Polygon
aPoly(pPathObj
->GetPathPoly().getB2DPolygon(0));
340 auto pObj
= std::make_shared
<IMapPolygonObject
>( aPoly
, "", "", "", "", "", true, false );
341 pObj
->SetExtraEllipse( aPoly
.GetBoundRect() );
342 pCircObj
->AppendUserData( std::unique_ptr
<SdrObjUserData
>(new IMapUserData( pObj
)) );
346 case SdrObjKind::Polygon
:
347 case SdrObjKind::FreehandFill
:
348 case SdrObjKind::PathPoly
:
349 case SdrObjKind::PathFill
:
351 SdrPathObj
* pPathObj
= const_cast<SdrPathObj
*>( static_cast<const SdrPathObj
*>(&rObj
) );
352 const basegfx::B2DPolyPolygon
& rXPolyPoly
= pPathObj
->GetPathPoly();
354 if ( rXPolyPoly
.count() )
356 tools::Polygon
aPoly(rXPolyPoly
.getB2DPolygon(0));
357 auto pObj
= std::make_shared
<IMapPolygonObject
>( aPoly
, "", "", "", "", "", true, false );
358 pPathObj
->AppendUserData( std::unique_ptr
<SdrObjUserData
>(new IMapUserData( pObj
)) );
368 void IMapWindow::SdrObjChanged( const SdrObject
& rObj
)
370 IMapUserData
* pUserData
= static_cast<IMapUserData
*>( rObj
.GetUserData( 0 ) );
379 IMapObjectPtr pIMapObj
= pUserData
->GetObject();
384 aURL
= pIMapObj
->GetURL();
385 aAltText
= pIMapObj
->GetAltText();
386 aDesc
= pIMapObj
->GetDesc();
387 aTarget
= pIMapObj
->GetTarget();
388 bActive
= pIMapObj
->IsActive();
391 switch( rObj
.GetObjIdentifier() )
393 case SdrObjKind::Rectangle
:
395 pUserData
->ReplaceObject( std::make_shared
<IMapRectangleObject
>( static_cast<const SdrRectObj
&>(rObj
).GetLogicRect(),
396 aURL
, aAltText
, aDesc
, aTarget
, "", bActive
, false ) );
400 case SdrObjKind::CircleOrEllipse
:
402 const SdrCircObj
& rCircObj
= static_cast<const SdrCircObj
&>(rObj
);
403 rtl::Reference
<SdrPathObj
> pPathObj
= static_cast<SdrPathObj
*>( rCircObj
.ConvertToPolyObj( false, false ).get() );
404 tools::Polygon
aPoly(pPathObj
->GetPathPoly().getB2DPolygon(0));
406 auto pObj
= std::make_shared
<IMapPolygonObject
>( aPoly
, aURL
, aAltText
, aDesc
, aTarget
, "", bActive
, false );
407 pObj
->SetExtraEllipse( aPoly
.GetBoundRect() );
411 pUserData
->ReplaceObject( pObj
);
415 case SdrObjKind::Polygon
:
416 case SdrObjKind::FreehandFill
:
417 case SdrObjKind::PathPoly
:
418 case SdrObjKind::PathFill
:
420 const SdrPathObj
& rPathObj
= static_cast<const SdrPathObj
&>(rObj
);
421 const basegfx::B2DPolyPolygon
& rXPolyPoly
= rPathObj
.GetPathPoly();
423 if ( rXPolyPoly
.count() )
425 tools::Polygon
aPoly(rPathObj
.GetPathPoly().getB2DPolygon(0));
426 auto pObj
= std::make_shared
<IMapPolygonObject
>( aPoly
, aURL
, aAltText
, aDesc
, aTarget
, "", bActive
, false );
427 pUserData
->ReplaceObject( pObj
);
437 bool IMapWindow::MouseButtonUp(const MouseEvent
& rMEvt
)
439 bool bRet
= GraphCtrl::MouseButtonUp( rMEvt
);
444 void IMapWindow::MarkListHasChanged()
446 GraphCtrl::MarkListHasChanged();
450 SdrObject
* IMapWindow::GetHitSdrObj( const Point
& rPosPixel
) const
452 OutputDevice
& rDevice
= GetDrawingArea()->get_ref_device();
454 SdrObject
* pObj
= nullptr;
455 Point aPt
= rDevice
.PixelToLogic( rPosPixel
);
457 if ( tools::Rectangle( Point(), GetGraphicSize() ).Contains( aPt
) )
459 SdrPage
* pPage
= pModel
->GetPage( 0 );
462 for ( size_t i
= pPage
->GetObjCount(); i
> 0; )
465 SdrObject
* pTestObj
= pPage
->GetObj( i
);
466 IMapObject
* pIMapObj
= GetIMapObj( pTestObj
);
468 if ( pIMapObj
&& pIMapObj
->IsHit( aPt
) )
480 IMapObject
* IMapWindow::GetIMapObj( const SdrObject
* pSdrObj
)
482 IMapObject
* pIMapObj
= nullptr;
486 IMapUserData
* pUserData
= static_cast<IMapUserData
*>( pSdrObj
->GetUserData( 0 ) );
489 pIMapObj
= pUserData
->GetObject().get();
495 bool IMapWindow::Command(const CommandEvent
& rCEvt
)
497 if ( rCEvt
.GetCommand() == CommandEventId::ContextMenu
)
499 std::unique_ptr
<weld::Builder
> xBuilder(Application::CreateBuilder(GetDrawingArea(), u
"svx/ui/imapmenu.ui"_ustr
));
500 mxPopupMenu
= xBuilder
->weld_menu(u
"menu"_ustr
);
501 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
502 const size_t nMarked
= rMarkList
.GetMarkCount();
504 mxPopupMenu
->set_sensitive(u
"url"_ustr
, false);
505 mxPopupMenu
->set_sensitive(u
"active"_ustr
, false);
506 mxPopupMenu
->set_sensitive(u
"macro"_ustr
, false);
507 mxPopupMenu
->set_sensitive(u
"selectall"_ustr
, pModel
->GetPage(0)->GetObjCount() != rMarkList
.GetMarkCount());
511 mxPopupMenu
->set_sensitive(u
"arrange"_ustr
, false);
512 mxPopupMenu
->set_sensitive(u
"delete"_ustr
, false);
518 SdrObject
* pSdrObj
= GetSelectedSdrObject();
520 mxPopupMenu
->set_sensitive(u
"url"_ustr
, true);
521 mxPopupMenu
->set_sensitive(u
"active"_ustr
, true);
522 mxPopupMenu
->set_sensitive(u
"macro"_ustr
, true);
523 mxPopupMenu
->set_active(u
"active"_ustr
, GetIMapObj(pSdrObj
)->IsActive());
526 mxPopupMenu
->set_sensitive(u
"arrange"_ustr
, true);
527 mxPopupMenu
->set_sensitive(u
"delete"_ustr
, true);
530 MenuSelectHdl(mxPopupMenu
->popup_at_rect(GetDrawingArea(), tools::Rectangle(rCEvt
.GetMousePosPixel(), Size(1,1))));
536 return CustomWidgetController::Command(rCEvt
);
539 IMapDropTargetHelper::IMapDropTargetHelper(IMapWindow
& rImapWindow
)
540 : DropTargetHelper(rImapWindow
.GetDrawingArea()->get_drop_target())
541 , m_rImapWindow(rImapWindow
)
545 sal_Int8
IMapDropTargetHelper::AcceptDrop( const AcceptDropEvent
& rEvt
)
547 return m_rImapWindow
.AcceptDrop(rEvt
);
550 sal_Int8
IMapDropTargetHelper::ExecuteDrop( const ExecuteDropEvent
& rEvt
)
552 return m_rImapWindow
.ExecuteDrop(rEvt
);
555 sal_Int8
IMapWindow::AcceptDrop( const AcceptDropEvent
& rEvt
)
557 return( ( GetHitSdrObj( rEvt
.maPosPixel
) != nullptr ) ? rEvt
.mnAction
: DND_ACTION_NONE
);
560 sal_Int8
IMapWindow::ExecuteDrop( const ExecuteDropEvent
& rEvt
)
562 sal_Int8 nRet
= DND_ACTION_NONE
;
564 if (mxDropTargetHelper
->IsDropFormatSupported(SotClipboardFormatId::NETSCAPE_BOOKMARK
))
566 INetBookmark
aBookMark( u
""_ustr
, u
""_ustr
);
567 SdrObject
* pSdrObj
= GetHitSdrObj( rEvt
.maPosPixel
);
569 if( pSdrObj
&& TransferableDataHelper( rEvt
.maDropEvent
.Transferable
).GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK
, aBookMark
) )
571 IMapObject
* pIMapObj
= GetIMapObj( pSdrObj
);
573 pIMapObj
->SetURL( aBookMark
.GetURL() );
574 pIMapObj
->SetAltText( aBookMark
.GetDescription() );
575 pModel
->SetChanged();
577 pView
->MarkObj( pSdrObj
, pView
->GetSdrPageView() );
579 nRet
= rEvt
.mnAction
;
586 OUString
IMapWindow::RequestHelp(tools::Rectangle
& rHelpArea
)
588 OutputDevice
& rDevice
= GetDrawingArea()->get_ref_device();
590 Point aPos
= rDevice
.PixelToLogic(rHelpArea
.TopLeft());
592 SdrPageView
* pPageView
= nullptr;
593 SdrObject
* pSdrObj
= pView
->PickObj(aPos
, pView
->getHitTolLog(), pPageView
);
596 const IMapObject
* pIMapObj
= GetIMapObj( pSdrObj
);
599 OUString aStr
= pIMapObj
->GetURL();
600 if ( !aStr
.isEmpty() )
602 rHelpArea
= rDevice
.LogicToPixel(tools::Rectangle( Point(), GetGraphicSize()));
611 void IMapWindow::SetCurrentObjState( bool bActive
)
613 SdrObject
* pObj
= GetSelectedSdrObject();
618 SfxItemSet
aSet( pModel
->GetItemPool() );
620 GetIMapObj( pObj
)->SetActive( bActive
);
622 aSet
.Put( XFillColorItem( u
""_ustr
, TRANSCOL
) );
626 aSet
.Put( XFillTransparenceItem( 100 ) );
627 aSet
.Put( XLineColorItem( u
""_ustr
, COL_RED
) );
631 aSet
.Put( XFillTransparenceItem( 50 ) );
632 aSet
.Put( XLineColorItem( u
""_ustr
, COL_BLACK
) );
635 pView
->SetAttributes( aSet
);
638 void IMapWindow::UpdateInfo( bool bNewObj
)
640 if ( !aInfoLink
.IsSet() )
643 const SdrObject
* pSdrObj
= GetSelectedSdrObject();
644 const IMapObject
* pIMapObj
= pSdrObj
? GetIMapObj( pSdrObj
) : nullptr;
646 aInfo
.bNewObj
= bNewObj
;
650 aInfo
.bOneMarked
= true;
651 aInfo
.aMarkURL
= pIMapObj
->GetURL();
652 aInfo
.aMarkAltText
= pIMapObj
->GetAltText();
653 aInfo
.aMarkTarget
= pIMapObj
->GetTarget();
654 aInfo
.bActivated
= pIMapObj
->IsActive();
655 aInfoLink
.Call( *this );
659 aInfo
.aMarkURL
.clear();
660 aInfo
.aMarkAltText
.clear();
661 aInfo
.aMarkTarget
.clear();
662 aInfo
.bOneMarked
= false;
663 aInfo
.bActivated
= false;
666 aInfoLink
.Call( *this );
669 void IMapWindow::DoMacroAssign()
671 SdrObject
* pSdrObj
= GetSelectedSdrObject();
676 auto xSet
= std::make_unique
<SfxItemSetFixed
<SID_ATTR_MACROITEM
, SID_ATTR_MACROITEM
, SID_EVENTCONFIG
, SID_EVENTCONFIG
>>
679 SfxEventNamesItem
aNamesItem(SID_EVENTCONFIG
);
680 aNamesItem
.AddEvent( u
"MouseOver"_ustr
, u
""_ustr
, SvMacroItemId::OnMouseOver
);
681 aNamesItem
.AddEvent( u
"MouseOut"_ustr
, u
""_ustr
, SvMacroItemId::OnMouseOut
);
682 xSet
->Put( aNamesItem
);
684 SvxMacroItem
aMacroItem(SID_ATTR_MACROITEM
);
685 IMapObject
* pIMapObj
= GetIMapObj( pSdrObj
);
686 aMacroItem
.SetMacroTable( pIMapObj
->GetMacroTable() );
687 xSet
->Put( aMacroItem
);
689 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
690 VclPtr
<SfxAbstractDialog
> pMacroDlg(pFact
->CreateEventConfigDialog(GetDrawingArea(), std::move(xSet
), mxDocumentFrame
));
692 pMacroDlg
->StartExecuteAsync(
693 [this, pMacroDlg
, pIMapObj
] (sal_Int32 nResult
)->void
695 if (nResult
== RET_OK
)
697 const SfxItemSet
* pOutSet
= pMacroDlg
->GetOutputItemSet();
698 pIMapObj
->SetMacroTable( pOutSet
->Get( SID_ATTR_MACROITEM
).GetMacroTable() );
699 pModel
->SetChanged();
702 pMacroDlg
->disposeOnce();
707 void IMapWindow::DoPropertyDialog()
709 SdrObject
* pSdrObj
= GetSelectedSdrObject();
714 IMapObject
* pIMapObj
= GetIMapObj( pSdrObj
);
715 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
716 ScopedVclPtr
<AbstractURLDlg
> aDlg(pFact
->CreateURLDialog(GetDrawingArea(), pIMapObj
->GetURL(), pIMapObj
->GetAltText(), pIMapObj
->GetDesc(),
717 pIMapObj
->GetTarget(), pIMapObj
->GetName(), aTargetList
));
718 if ( aDlg
->Execute() != RET_OK
)
721 const OUString
aURLText( aDlg
->GetURL() );
723 if ( !aURLText
.isEmpty() )
725 INetURLObject
aObj( aURLText
, INetProtocol::File
);
726 DBG_ASSERT( aObj
.GetProtocol() != INetProtocol::NotValid
, "Invalid URL" );
727 pIMapObj
->SetURL( aObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
) );
730 pIMapObj
->SetURL( aURLText
);
732 pIMapObj
->SetAltText( aDlg
->GetAltText() );
733 pIMapObj
->SetDesc( aDlg
->GetDesc() );
734 pIMapObj
->SetTarget( aDlg
->GetTarget() );
735 pIMapObj
->SetName( aDlg
->GetName() );
736 pModel
->SetChanged();
740 void IMapWindow::MenuSelectHdl(const OUString
& rId
)
744 else if (rId
== "macro")
746 else if (rId
== "active")
748 const bool bNewState
= !mxPopupMenu
->get_active(rId
);
749 SetCurrentObjState(bNewState
);
752 else if (rId
== "front")
753 pView
->PutMarkedToTop();
754 else if (rId
== "forward")
755 pView
->MovMarkedToTop();
756 else if (rId
== "backward")
757 pView
->MovMarkedToBtm();
758 else if (rId
== "back")
759 pView
->PutMarkedToBtm();
760 else if (rId
== "selectall")
762 else if (rId
== "delete")
763 pView
->DeleteMarked();
766 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */