LibreOffice Module svx (master)  1
imapwnd.cxx
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 
20 #include <tools/urlobj.hxx>
21 #include <vcl/help.hxx>
22 #include <sfx2/sfxsids.hrc>
23 #include <vcl/commandevent.hxx>
24 #include <vcl/imaprect.hxx>
25 #include <vcl/imapcirc.hxx>
26 #include <vcl/imappoly.hxx>
27 #include <vcl/svapp.hxx>
28 #include <svl/urlbmk.hxx>
29 
30 #include <svx/xoutbmp.hxx>
31 #include <svx/svxids.hrc>
32 #include "imapwnd.hxx"
33 #include <svx/svdpage.hxx>
34 #include <svx/svdorect.hxx>
35 #include <svx/svdocirc.hxx>
36 #include <svx/svdopath.hxx>
37 #include <svx/xfltrit.hxx>
38 #include <svx/svdpagv.hxx>
39 #include <svl/urihelper.hxx>
40 #include <svx/xfillit0.hxx>
41 #include <svx/xflclit.hxx>
42 #include <svx/xlnclit.hxx>
43 
44 #include <sfx2/evntconf.hxx>
45 
46 #include <sot/formats.hxx>
47 
48 #include <svx/svxdlg.hxx>
51 #include <memory>
52 
53 using namespace com::sun::star;
54 using ::com::sun::star::frame::XFrame;
55 using ::com::sun::star::uno::Reference;
56 
57 #define TRANSCOL COL_WHITE
58 
59 IMapWindow::IMapWindow(const Reference< XFrame >& rxDocumentFrame, weld::Dialog* pDialog)
60  : GraphCtrl(pDialog)
61  , mxDocumentFrame(rxDocumentFrame)
62 {
63  pIMapPool = new SfxItemPool( "IMapItemPool",
64  SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, maItemInfos );
66 }
67 
69 {
71 }
72 
74 {
75  Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(270, 170), MapMode(MapUnit::MapAppFont)));
76  pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
77  SetOutputSizePixel(aSize);
79 
80  SetSdrMode(true);
81 
82  mxDropTargetHelper.reset(new IMapDropTargetHelper(*this));
83 }
84 
85 void IMapWindow::SetImageMap( const ImageMap& rImageMap )
86 {
87  ReplaceImageMap( rImageMap );
88 }
89 
90 void IMapWindow::ReplaceImageMap( const ImageMap& rImageMap )
91 {
92  SdrPage* pPage = nullptr;
93  aIMap = rImageMap;
94 
95  if(GetSdrModel())
96  {
97  // try to access page
98  pPage = GetSdrModel()->GetPage(0);
99  }
100 
101  if(pPage)
102  {
103  // clear SdrObjects with broadcasting
104  pPage->ClearSdrObjList();
105  }
106 
107  if(GetSdrView())
108  {
109  // #i63762# reset selection at view
111  }
112 
113  // create new drawing objects
114  const sal_uInt16 nCount(rImageMap.GetIMapObjectCount());
115 
116  for ( sal_uInt16 i(nCount); i > 0; i-- )
117  {
118  SdrObject* pNewObj = CreateObj( rImageMap.GetIMapObject( i - 1 ) );
119 
120  if (pNewObj && pPage)
121  {
122  pPage->InsertObject( pNewObj );
123  }
124  }
125 }
126 
128 {
129  const SdrObject* pSdrObj = GetSelectedSdrObject();
130  IMapObject* pIMapObj;
131 
132  if ( pSdrObj && ( ( pIMapObj = GetIMapObj( pSdrObj ) ) != nullptr ) )
133  {
134  pIMapObj->SetURL( rNewInfo.aMarkURL );
135  pIMapObj->SetAltText( rNewInfo.aMarkAltText );
136  pIMapObj->SetTarget( rNewInfo.aMarkTarget );
137  pModel->SetChanged();
138  UpdateInfo( false );
139  }
140 }
141 
143 {
144  if ( pModel->IsChanged() )
145  {
146  SdrPage* pPage = pModel->GetPage( 0 );
147 
148  if ( pPage )
149  {
150  const size_t nCount = pPage->GetObjCount();
151 
153 
154  for ( size_t i = nCount; i; )
155  {
156  --i;
157  aIMap.InsertIMapObject( *( static_cast<IMapUserData*>( pPage->GetObj( i )->GetUserData( 0 ) )->GetObject() ) );
158  }
159  }
160 
161  pModel->SetChanged( false );
162  }
163 
164  return aIMap;
165 }
166 
168 {
169  // Delete old List
170  aTargetList.clear();
171 
172  // Fill with the provided list
173  for(const OUString & s : rTargetList)
174  aTargetList.push_back( s );
175 
176  pModel->SetChanged( false );
177 }
178 
180 {
181  tools::Rectangle aClipRect( Point(), GetGraphicSize() );
182  SdrObject* pSdrObj = nullptr;
183  IMapObjectPtr pCloneIMapObj;
184 
185  switch( pIMapObj->GetType() )
186  {
187  case IMAP_OBJ_RECTANGLE:
188  {
189  const IMapRectangleObject* pIMapRectObj = static_cast<const IMapRectangleObject*>(pIMapObj);
190  tools::Rectangle aDrawRect( pIMapRectObj->GetRectangle( false ) );
191 
192  // clipped on CanvasPane
193  aDrawRect.Intersection( aClipRect );
194 
195  pSdrObj = new SdrRectObj(*pModel, aDrawRect);
196  pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapRectangleObject( *pIMapRectObj )));
197  }
198  break;
199 
200  case IMAP_OBJ_CIRCLE:
201  {
202  const IMapCircleObject* pIMapCircleObj = static_cast<const IMapCircleObject*>(pIMapObj);
203  const Point aCenter( pIMapCircleObj->GetCenter( false ) );
204  const long nRadius = pIMapCircleObj->GetRadius( false );
205  const Point aOffset( nRadius, nRadius );
206  tools::Rectangle aCircle( aCenter - aOffset, aCenter + aOffset );
207 
208  // limited to CanvasPane
209  aCircle.Intersection( aClipRect );
210 
211  pSdrObj = new SdrCircObj(
212  *pModel,
214  aCircle,
215  0,
216  36000);
217  pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapCircleObject( *pIMapCircleObj )));
218  }
219  break;
220 
221  case IMAP_OBJ_POLYGON:
222  {
223  const IMapPolygonObject* pIMapPolyObj = static_cast<const IMapPolygonObject*>(pIMapObj);
224 
225  // If it actually is an ellipse, then another ellipse is created again
226  if ( pIMapPolyObj->HasExtraEllipse() )
227  {
228  tools::Rectangle aDrawRect( pIMapPolyObj->GetExtraEllipse() );
229 
230  // clipped on CanvasPane
231  aDrawRect.Intersection( aClipRect );
232 
233  pSdrObj = new SdrCircObj(
234  *pModel,
236  aDrawRect,
237  0,
238  36000);
239  }
240  else
241  {
242  const tools::Polygon& rPoly = pIMapPolyObj->GetPolygon( false );
243  tools::Polygon aDrawPoly( rPoly );
244 
245  // clipped on CanvasPane
246  aDrawPoly.Clip( aClipRect );
247 
248  basegfx::B2DPolygon aPolygon;
249  aPolygon.append(aDrawPoly.getB2DPolygon());
250  pSdrObj = new SdrPathObj(
251  *pModel,
252  OBJ_POLY,
253  basegfx::B2DPolyPolygon(aPolygon));
254  }
255 
256  pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapPolygonObject( *pIMapPolyObj )));
257  }
258  break;
259 
260  default:
261  break;
262  }
263 
264  if ( pSdrObj )
265  {
266  SfxItemSet aSet( pModel->GetItemPool() );
267 
268  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
269  aSet.Put( XFillColorItem( "", TRANSCOL ) );
270 
271  if ( !pIMapObj->IsActive() )
272  {
273  aSet.Put( XFillTransparenceItem( 100 ) );
274  aSet.Put( XLineColorItem( "", COL_RED ) );
275  }
276  else
277  {
278  aSet.Put( XFillTransparenceItem( 50 ) );
279  aSet.Put( XLineColorItem( "", COL_BLACK ) );
280  }
281 
282  pSdrObj->SetMergedItemSetAndBroadcast(aSet);
283 
284  pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( pCloneIMapObj )) );
285  pSdrObj->SetUserCall( GetSdrUserCall() );
286  }
287 
288  return pSdrObj;
289 }
290 
292 {
294 
295  SfxItemSet aSet( pModel->GetItemPool() );
296 
297  aSet.Put( XFillColorItem( "", TRANSCOL ) );
298  aSet.Put( XFillTransparenceItem( 50 ) );
299  pView->SetAttributes( aSet );
300  pView->SetFrameDragSingles();
301 }
302 
304 {
305  switch( rObj.GetObjIdentifier() )
306  {
307  case OBJ_RECT:
308  {
309  SdrRectObj* pRectObj = const_cast<SdrRectObj*>(static_cast<const SdrRectObj*>(&rObj));
310  IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(), "", "", "", "", "", true, false );
311 
312  pRectObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( IMapObjectPtr(pObj) )) );
313  }
314  break;
315 
316  case OBJ_CIRC:
317  {
318  SdrCircObj* pCircObj = const_cast<SdrCircObj*>( static_cast<const SdrCircObj*>(&rObj) );
319  SdrPathObj* pPathObj = static_cast<SdrPathObj*>( pCircObj->ConvertToPolyObj( false, false ).release() );
320  tools::Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0));
321 
322  // always use SdrObject::Free(...) for SdrObjects (!)
323  SdrObject* pTemp(pPathObj);
324  SdrObject::Free(pTemp);
325 
326  IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, "", "", "", "", "", true, false );
327  pObj->SetExtraEllipse( aPoly.GetBoundRect() );
328  pCircObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( IMapObjectPtr(pObj) )) );
329  }
330  break;
331 
332  case OBJ_POLY:
333  case OBJ_FREEFILL:
334  case OBJ_PATHPOLY:
335  case OBJ_PATHFILL:
336  {
337  SdrPathObj* pPathObj = const_cast<SdrPathObj*>( static_cast<const SdrPathObj*>(&rObj) );
338  const basegfx::B2DPolyPolygon& rXPolyPoly = pPathObj->GetPathPoly();
339 
340  if ( rXPolyPoly.count() )
341  {
342  tools::Polygon aPoly(rXPolyPoly.getB2DPolygon(0));
343  IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, "", "", "", "", "", true, false );
344  pPathObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( IMapObjectPtr(pObj) )) );
345  }
346  }
347  break;
348 
349  default:
350  break;
351  }
352 }
353 
355 {
356  IMapUserData* pUserData = static_cast<IMapUserData*>( rObj.GetUserData( 0 ) );
357 
358  if ( pUserData )
359  {
360  OUString aURL;
361  OUString aAltText;
362  OUString aDesc;
363  OUString aTarget;
364  IMapObjectPtr pIMapObj = pUserData->GetObject();
365  bool bActive = true;
366 
367  if ( pIMapObj.get() )
368  {
369  aURL = pIMapObj->GetURL();
370  aAltText = pIMapObj->GetAltText();
371  aDesc = pIMapObj->GetDesc();
372  aTarget = pIMapObj->GetTarget();
373  bActive = pIMapObj->IsActive();
374  }
375 
376  switch( rObj.GetObjIdentifier() )
377  {
378  case OBJ_RECT:
379  {
380  pUserData->ReplaceObject( IMapObjectPtr(new IMapRectangleObject( static_cast<const SdrRectObj&>(rObj).GetLogicRect(),
381  aURL, aAltText, aDesc, aTarget, "", bActive, false ) ) );
382  }
383  break;
384 
385  case OBJ_CIRC:
386  {
387  const SdrCircObj& rCircObj = static_cast<const SdrCircObj&>(rObj);
388  SdrPathObj* pPathObj = static_cast<SdrPathObj*>( rCircObj.ConvertToPolyObj( false, false ).release() );
389  tools::Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0));
390 
391  IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, "", bActive, false );
392  pObj->SetExtraEllipse( aPoly.GetBoundRect() );
393 
394  // was only created by us temporarily
395  // always use SdrObject::Free(...) for SdrObjects (!)
396  SdrObject* pTemp(pPathObj);
397  SdrObject::Free(pTemp);
398 
399  pUserData->ReplaceObject( IMapObjectPtr(pObj) );
400  }
401  break;
402 
403  case OBJ_POLY:
404  case OBJ_FREEFILL:
405  case OBJ_PATHPOLY:
406  case OBJ_PATHFILL:
407  {
408  const SdrPathObj& rPathObj = static_cast<const SdrPathObj&>(rObj);
409  const basegfx::B2DPolyPolygon& rXPolyPoly = rPathObj.GetPathPoly();
410 
411  if ( rXPolyPoly.count() )
412  {
413  tools::Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0));
414  IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, "", bActive, false );
415  pUserData->ReplaceObject( IMapObjectPtr(pObj) );
416  }
417  }
418  break;
419 
420  default:
421  break;
422  }
423  }
424 }
425 
427 {
428  bool bRet = GraphCtrl::MouseButtonUp( rMEvt );
429  UpdateInfo( true );
430  return bRet;
431 }
432 
434 {
436  UpdateInfo( false );
437 }
438 
439 SdrObject* IMapWindow::GetHitSdrObj( const Point& rPosPixel ) const
440 {
442 
443  SdrObject* pObj = nullptr;
444  Point aPt = rDevice.PixelToLogic( rPosPixel );
445 
446  if ( tools::Rectangle( Point(), GetGraphicSize() ).IsInside( aPt ) )
447  {
448  SdrPage* pPage = pModel->GetPage( 0 );
449  if ( pPage )
450  {
451  for ( size_t i = pPage->GetObjCount(); i > 0; )
452  {
453  --i;
454  SdrObject* pTestObj = pPage->GetObj( i );
455  IMapObject* pIMapObj = GetIMapObj( pTestObj );
456 
457  if ( pIMapObj && pIMapObj->IsHit( aPt ) )
458  {
459  pObj = pTestObj;
460  break;
461  }
462  }
463  }
464  }
465 
466  return pObj;
467 }
468 
470 {
471  IMapObject* pIMapObj = nullptr;
472 
473  if ( pSdrObj )
474  {
475  IMapUserData* pUserData = static_cast<IMapUserData*>( pSdrObj->GetUserData( 0 ) );
476 
477  if ( pUserData )
478  pIMapObj = pUserData->GetObject().get();
479  }
480 
481  return pIMapObj;
482 }
483 
485 {
486  vcl::Region aRegion;
487 
488  if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
489  {
490  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/imapmenu.ui"));
491  mxPopupMenu = xBuilder->weld_menu("menu");
492  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
493  const size_t nMarked = rMarkList.GetMarkCount();
494 
495  mxPopupMenu->set_sensitive("url", false);
496  mxPopupMenu->set_sensitive("active", false);
497  mxPopupMenu->set_sensitive("macro", false);
498  mxPopupMenu->set_sensitive("selectall", pModel->GetPage(0)->GetObjCount() != pView->GetMarkedObjectCount());
499 
500  if ( !nMarked )
501  {
502  mxPopupMenu->set_sensitive("arrange", false);
503  mxPopupMenu->set_sensitive("delete", false);
504  }
505  else
506  {
507  if ( nMarked == 1 )
508  {
509  SdrObject* pSdrObj = GetSelectedSdrObject();
510 
511  mxPopupMenu->set_sensitive("url", true);
512  mxPopupMenu->set_sensitive("active", true);
513  mxPopupMenu->set_sensitive("macro", true);
514  mxPopupMenu->set_active("active", GetIMapObj(pSdrObj)->IsActive());
515  }
516 
517  mxPopupMenu->set_sensitive("arrange", true);
518  mxPopupMenu->set_sensitive("delete", true);
519  }
520 
522 
523  mxPopupMenu.reset();
524 
525  return true;
526  }
527  return CustomWidgetController::Command(rCEvt);
528 }
529 
531  : DropTargetHelper(rImapWindow.GetDrawingArea()->get_drop_target())
532  , m_rImapWindow(rImapWindow)
533 {
534 }
535 
537 {
538  return m_rImapWindow.AcceptDrop(rEvt);
539 }
540 
542 {
543  return m_rImapWindow.ExecuteDrop(rEvt);
544 }
545 
547 {
548  return( ( GetHitSdrObj( rEvt.maPosPixel ) != nullptr ) ? rEvt.mnAction : DND_ACTION_NONE );
549 }
550 
552 {
553  sal_Int8 nRet = DND_ACTION_NONE;
554 
555  if (mxDropTargetHelper->IsDropFormatSupported(SotClipboardFormatId::NETSCAPE_BOOKMARK))
556  {
557  const OUString aString;
558  INetBookmark aBookMark( aString, aString );
559  SdrObject* pSdrObj = GetHitSdrObj( rEvt.maPosPixel );
560 
561  if( pSdrObj && TransferableDataHelper( rEvt.maDropEvent.Transferable ).GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aBookMark ) )
562  {
563  IMapObject* pIMapObj = GetIMapObj( pSdrObj );
564 
565  pIMapObj->SetURL( aBookMark.GetURL() );
566  pIMapObj->SetAltText( aBookMark.GetDescription() );
567  pModel->SetChanged();
568  pView->UnmarkAll();
569  pView->MarkObj( pSdrObj, pView->GetSdrPageView() );
570  UpdateInfo( true );
571  nRet = rEvt.mnAction;
572  }
573  }
574 
575  return nRet;
576 }
577 
579 {
581 
582  Point aPos = rDevice.PixelToLogic(rHelpArea.TopLeft());
583 
584  SdrPageView* pPageView = nullptr;
585  SdrObject* pSdrObj = pView->PickObj(aPos, pView->getHitTolLog(), pPageView);
586  if (pSdrObj)
587  {
588  const IMapObject* pIMapObj = GetIMapObj( pSdrObj );
589  OUString aStr;
590 
591  if ( pIMapObj && !( aStr = pIMapObj->GetURL() ).isEmpty() )
592  {
593  rHelpArea = rDevice.LogicToPixel(tools::Rectangle( Point(), GetGraphicSize()));
594  return aStr;
595  }
596  }
597 
598  return OUString();
599 }
600 
601 void IMapWindow::SetCurrentObjState( bool bActive )
602 {
604 
605  if ( pObj )
606  {
607  SfxItemSet aSet( pModel->GetItemPool() );
608 
609  GetIMapObj( pObj )->SetActive( bActive );
610 
611  aSet.Put( XFillColorItem( "", TRANSCOL ) );
612 
613  if ( !bActive )
614  {
615  aSet.Put( XFillTransparenceItem( 100 ) );
616  aSet.Put( XLineColorItem( "", COL_RED ) );
617  }
618  else
619  {
620  aSet.Put( XFillTransparenceItem( 50 ) );
621  aSet.Put( XLineColorItem( "", COL_BLACK ) );
622  }
623 
624  pView->SetAttributes( aSet );
625  }
626 }
627 
628 void IMapWindow::UpdateInfo( bool bNewObj )
629 {
630  if ( aInfoLink.IsSet() )
631  {
632  const SdrObject* pSdrObj = GetSelectedSdrObject();
633  const IMapObject* pIMapObj = pSdrObj ? GetIMapObj( pSdrObj ) : nullptr;
634 
635  aInfo.bNewObj = bNewObj;
636 
637  if ( pIMapObj )
638  {
639  aInfo.bOneMarked = true;
640  aInfo.aMarkURL = pIMapObj->GetURL();
641  aInfo.aMarkAltText = pIMapObj->GetAltText();
642  aInfo.aMarkTarget = pIMapObj->GetTarget();
643  aInfo.bActivated = pIMapObj->IsActive();
644  aInfoLink.Call( *this );
645  }
646  else
647  {
648  aInfo.aMarkURL.clear();
649  aInfo.aMarkAltText.clear();
650  aInfo.aMarkTarget.clear();
651  aInfo.bOneMarked = false;
652  aInfo.bActivated = false;
653  }
654 
655  aInfoLink.Call( *this );
656  }
657 }
658 
660 {
661  SdrObject* pSdrObj = GetSelectedSdrObject();
662 
663  if ( !pSdrObj )
664  return;
665 
667 
668  SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
669  aNamesItem.AddEvent( "MouseOver", "", SvMacroItemId::OnMouseOver );
670  aNamesItem.AddEvent( "MouseOut", "", SvMacroItemId::OnMouseOut );
671  aSet.Put( aNamesItem );
672 
673  SvxMacroItem aMacroItem(SID_ATTR_MACROITEM);
674  IMapObject* pIMapObj = GetIMapObj( pSdrObj );
675  aMacroItem.SetMacroTable( pIMapObj->GetMacroTable() );
676  aSet.Put( aMacroItem );
677 
680 
681  if ( pMacroDlg->Execute() == RET_OK )
682  {
683  const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
684  pIMapObj->SetMacroTable( pOutSet->Get( SID_ATTR_MACROITEM ).GetMacroTable() );
685  pModel->SetChanged();
686  UpdateInfo( false );
687  }
688 }
689 
691 {
692  SdrObject* pSdrObj = GetSelectedSdrObject();
693 
694  if ( pSdrObj )
695  {
696  IMapObject* pIMapObj = GetIMapObj( pSdrObj );
698  ScopedVclPtr<AbstractURLDlg> aDlg(pFact->CreateURLDialog(GetDrawingArea(), pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(),
699  pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList));
700  if ( aDlg->Execute() == RET_OK )
701  {
702  const OUString aURLText( aDlg->GetURL() );
703 
704  if ( !aURLText.isEmpty() )
705  {
706  INetURLObject aObj( aURLText, INetProtocol::File );
707  DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL" );
709  }
710  else
711  pIMapObj->SetURL( aURLText );
712 
713  pIMapObj->SetAltText( aDlg->GetAltText() );
714  pIMapObj->SetDesc( aDlg->GetDesc() );
715  pIMapObj->SetTarget( aDlg->GetTarget() );
716  pIMapObj->SetName( aDlg->GetName() );
717  pModel->SetChanged();
718  UpdateInfo( true );
719  }
720  }
721 }
722 
723 void IMapWindow::MenuSelectHdl(const OString& rId)
724 {
725  if (rId == "url")
727  else if (rId == "macro")
728  DoMacroAssign();
729  else if (rId == "active")
730  {
731  const bool bNewState = !mxPopupMenu->get_active(rId);
732  SetCurrentObjState(bNewState);
733  UpdateInfo( false );
734  }
735  else if (rId == "front")
736  pView->PutMarkedToTop();
737  else if (rId == "forward")
738  pView->MovMarkedToTop();
739  else if (rId == "backward")
740  pView->MovMarkedToBtm();
741  else if (rId == "back")
742  pView->PutMarkedToBtm();
743  else if (rId == "selectall")
744  pView->MarkAll();
745  else if (rId == "delete")
746  pView->DeleteMarked();
747 }
748 
749 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsActive() const
Point TopLeft() const
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
Definition: svdmrkv.cxx:2297
const OUString & GetTarget() const
virtual bool IsHit(const Point &rPoint) const =0
URL aURL
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
virtual bool Command(const CommandEvent &rCEvt) override
Definition: imapwnd.cxx:484
size_t GetMarkCount() const
Definition: svdmark.hxx:179
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
std::unique_ptr< SdrModel > pModel
Definition: graphctl.hxx:74
std::shared_ptr< IMapObject > IMapObjectPtr
Definition: imapwnd.hxx:44
void SetImageMap(const ImageMap &rImageMap)
Definition: imapwnd.cxx:85
tools::Rectangle & Intersection(const tools::Rectangle &rRect)
const OUString & GetName() const
void InsertIMapObject(const IMapObject &rIMapObject)
signed char sal_Int8
virtual OUString GetAltText() const =0
constexpr::Color COL_RED(0x80, 0x00, 0x00)
static SvxAbstractDialogFactory * Create()
Definition: svxdlg.cxx:23
#define IMAP_OBJ_RECTANGLE
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:773
caption object
Definition: svdobj.hxx:140
size_t GetObjCount() const
Definition: svdpage.cxx:767
virtual VclPtr< SfxAbstractDialog > CreateEventConfigDialog(weld::Widget *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
virtual sal_uInt16 GetType() const =0
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: imapwnd.cxx:73
OUString aMarkURL
Definition: imapwnd.hxx:33
virtual void MarkListHasChanged()
Definition: graphctl.cxx:278
bool bNewObj
Definition: imapwnd.hxx:36
tools::Rectangle GetRectangle(bool bPixelCoords=true) const
size_t GetIMapObjectCount() const
circle cut
Definition: svdobj.hxx:125
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:423
void SetTarget(const OUString &rTarget)
bool GetINetBookmark(SotClipboardFormatId nFormat, INetBookmark &rBmk)
open free-hand line
Definition: svdobj.hxx:130
virtual short Execute()=0
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:358
void FreezeIdRanges()
SdrObjUserCall * GetSdrUserCall()
Definition: graphctl.hxx:92
line
Definition: svdobj.hxx:120
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
void DoPropertyDialog()
Definition: imapwnd.cxx:690
SfxItemPool * pIMapPool
Definition: imapwnd.hxx:86
Point GetCenter(bool bPixelCoords=true) const
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void SetCurrentObjState(bool bActive)
Definition: imapwnd.cxx:601
bool bActivated
Definition: imapwnd.hxx:38
virtual OUString GetName() const =0
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
int nCount
tools::Polygon GetPolygon(bool bPixelCoords=true) const
#define DND_ACTION_NONE
const Size & GetGraphicSize() const
Definition: graphctl.hxx:102
#define IMAP_OBJ_POLYGON
virtual void SdrObjChanged(const SdrObject &rObj) override
Definition: imapwnd.cxx:354
virtual OutputDevice & get_ref_device()=0
SdrObject * CreateObj(const IMapObject *pIMapObj)
Definition: imapwnd.cxx:179
void SetExtraEllipse(const tools::Rectangle &rEllipse)
void SetAltText(const OUString &rAltText)
void SetDesc(const OUString &rDesc)
IMapWindow(const css::uno::Reference< css::frame::XFrame > &rxDocumentFrame, weld::Dialog *pDialog)
Definition: imapwnd.cxx:59
void SetMacroTable(const SvxMacroTableDtor &rTbl)
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: imapwnd.cxx:536
#define DBG_ASSERT(sCon, aError)
void ReplaceImageMap(const ImageMap &rNewImageMap)
Definition: imapwnd.cxx:90
virtual void InitSdrModel()
Definition: graphctl.cxx:112
const OUString & GetAltText() const
virtual sal_uInt16 GetObjIdentifier() const
Definition: svdobj.cxx:585
virtual OUString GetDesc() const =0
const SvxMacroTableDtor & GetMacroTable() const
virtual void MarkListHasChanged() override
Definition: imapwnd.cxx:433
int i
const SdrPage * GetPage(sal_uInt16 nPgNum) const
Definition: svdmodel.cxx:1917
virtual ~IMapWindow() override
Definition: imapwnd.cxx:68
CommandEventId GetCommand() const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1951
virtual void InitSdrModel() override
Definition: imapwnd.cxx:291
virtual VclPtr< AbstractURLDlg > CreateURLDialog(weld::Widget *pParent, const OUString &rURL, const OUString &rAltText, const OUString &rDescription, const OUString &rTarget, const OUString &rName, TargetList &rTargetList)=0
sal_uLong GetRadius(bool bPixelCoords=true) const
SdrView * GetSdrView() const
Definition: graphctl.hxx:114
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 OUString & GetDescription() const
void SetName(const OUString &rName)
SdrModel * GetSdrModel() const
Definition: graphctl.hxx:113
::basegfx::B2DPolygon getB2DPolygon() const
void SetUserCall(SdrObjUserCall *pUser)
Definition: svdobj.cxx:2670
bool HasExtraEllipse() const
virtual OUString GetURL() const =0
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: imapwnd.cxx:426
void SetOutputSizePixel(const Size &rSize)
sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
Definition: imapwnd.cxx:546
IMapWindow & m_rImapWindow
Definition: imapwnd.hxx:71
OUString aMarkAltText
Definition: imapwnd.hxx:34
static IMapObject * GetIMapObj(const SdrObject *pSdrObj)
Definition: imapwnd.cxx:469
void AppendUserData(std::unique_ptr< SdrObjUserData > pData)
Definition: svdobj.cxx:2642
const ImageMap & GetImageMap()
Definition: imapwnd.cxx:142
const Point & GetMousePosPixel() const
#define TRANSCOL
Definition: imapwnd.cxx:57
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const tools::Rectangle & GetExtraEllipse() const
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
static void Free(SfxItemPool *pPool)
SdrObjectUniquePtr ConvertToPolyObj(bool bBezier, bool bLineToArea) const
Definition: svdobj.cxx:2532
weld::DrawingArea * GetDrawingArea() const
sal_uInt32 count() const
void SetTargetList(TargetList &rTargetList)
Definition: imapwnd.cxx:167
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void MenuSelectHdl(const OString &rId)
Definition: imapwnd.cxx:723
void ClearSdrObjList()
Definition: svdpage.cxx:134
void SetActive(bool bSetActive)
void SetMacroTable(const SvxMacroTableDtor &rTbl)
INetProtocol GetProtocol() const
SdrObjUserData * GetUserData(sal_uInt16 nNum) const
Definition: svdobj.cxx:2636
RET_OK
TargetList aTargetList
Definition: imapwnd.hxx:84
std::unique_ptr< SdrView > pView
Definition: graphctl.hxx:75
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
SdrObject * GetSelectedSdrObject() const
Definition: graphctl.cxx:688
const OUString & GetURL() const
void Clip(const tools::Rectangle &rRect)
SdrObject * GetHitSdrObj(const Point &rPosPixel) const
Definition: imapwnd.cxx:439
IMapDropTargetHelper(IMapWindow &rImapWindow)
Definition: imapwnd.cxx:530
const basegfx::B2DPolyPolygon & GetPathPoly() const
Definition: svdopath.hxx:139
ImageMap aIMap
Definition: imapwnd.hxx:83
::std::vector< OUString > TargetList
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: imapwnd.cxx:541
#define IMAP_OBJ_CIRCLE
IMapObject * GetIMapObject(size_t nPos) const
void SetURL(const OUString &rURL)
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile)
void SetSdrMode(bool b)
Definition: graphctl.cxx:92
const OUString & GetDesc() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
virtual OUString GetTarget() const =0
void ReplaceActualIMapInfo(const NotifyInfo &rNewInfo)
Definition: imapwnd.cxx:127
void UpdateInfo(bool bNewObj)
Definition: imapwnd.cxx:628
sal_Int8 mnAction
virtual void set_size_request(int nWidth, int nHeight)=0
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: graphctl.cxx:666
void ReplaceObject(const IMapObjectPtr &pNewIMapObject)
Definition: imapwnd.hxx:64
aStr
const OUString & GetURL() const
OUString aMarkTarget
Definition: imapwnd.hxx:35
open Bezier-curve
Definition: svdobj.hxx:128
css::uno::Reference< css::frame::XFrame > mxDocumentFrame
Definition: imapwnd.hxx:89
void ClearImageMap()
const IMapObjectPtr & GetObject() const
Definition: imapwnd.hxx:63
rectangle (round corners optional)
Definition: svdobj.hxx:121
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdotxtr.cxx:73