LibreOffice Module svx (master)  1
svdobj.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 <svx/svdobj.hxx>
21 #include <config_features.h>
22 
23 #include <sal/config.h>
24 #include <sal/log.hxx>
25 
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/text/RelOrientation.hpp>
28 #include <com/sun/star/frame/XTerminateListener.hpp>
29 #include <com/sun/star/frame/Desktop.hpp>
30 
41 #include <editeng/editeng.hxx>
42 #include <editeng/outlobj.hxx>
43 #include <o3tl/deleter.hxx>
44 #include <math.h>
45 #include <svl/grabbagitem.hxx>
46 #include <tools/bigint.hxx>
47 #include <tools/diagnose_ex.h>
48 #include <tools/helpers.hxx>
49 #include <unotools/configmgr.hxx>
50 #include <vcl/canvastools.hxx>
51 #include <vcl/ptrstyle.hxx>
52 #include <vector>
53 
55 #include <svx/svdotable.hxx>
56 
61 #include <svx/sdrhittesthelper.hxx>
62 #include <svx/sdrobjectuser.hxx>
63 #include <svx/sdrobjectfilter.hxx>
64 #include <svx/svddrag.hxx>
65 #include <svx/svdetc.hxx>
66 #include <svx/svdhdl.hxx>
67 #include <svx/svditer.hxx>
68 #include <svx/svdmodel.hxx>
69 #include <svx/svdoashp.hxx>
70 #include <svx/svdocapt.hxx>
71 #include <svx/svdocirc.hxx>
72 #include <svx/svdoedge.hxx>
73 #include <svx/svdograf.hxx>
74 #include <svx/svdogrp.hxx>
75 #include <svx/svdomeas.hxx>
76 #include <svx/svdomedia.hxx>
77 #include <svx/svdoole2.hxx>
78 #include <svx/svdopage.hxx>
79 #include <svx/svdopath.hxx>
80 #include <svx/svdorect.hxx>
81 #include <svx/svdotext.hxx>
82 #include <svx/svdouno.hxx>
83 #include <svx/svdovirt.hxx>
84 #include <svx/svdpage.hxx>
85 #include <svx/svdpool.hxx>
86 #include <svx/strings.hrc>
87 #include <svx/dialmgr.hxx>
88 #include <svx/svdtrans.hxx>
89 #include <svx/svdundo.hxx>
90 #include <svx/svdview.hxx>
91 #include <sxlayitm.hxx>
92 #include <sxlogitm.hxx>
93 #include <sxmovitm.hxx>
94 #include <sxoneitm.hxx>
95 #include <sxopitm.hxx>
96 #include <sxreoitm.hxx>
97 #include <sxrooitm.hxx>
98 #include <sxsaitm.hxx>
99 #include <sxsoitm.hxx>
100 #include <sxtraitm.hxx>
101 #include <svx/unopage.hxx>
102 #include <svx/unoshape.hxx>
103 #include <svx/xfillit0.hxx>
104 #include <svx/xflclit.hxx>
105 #include <svx/xfltrit.hxx>
106 #include <svx/xlineit0.hxx>
107 #include <svx/xlnclit.hxx>
108 #include <svx/xlnedwit.hxx>
109 #include <svx/xlnstwit.hxx>
110 #include <svx/xlntrit.hxx>
111 #include <svx/xlnwtit.hxx>
112 #include <svx/svdglue.hxx>
113 #include <svx/svdsob.hxx>
114 #include <svdobjplusdata.hxx>
115 #include <svdobjuserdatalist.hxx>
116 
117 #include <unordered_set>
118 
119 #include <optional>
120 #include <libxml/xmlwriter.h>
121 #include <memory>
122 
123 #include <svx/scene3d.hxx>
124 #include <rtl/character.hxx>
125 #include <tools/UnitConversion.hxx>
126 #include <o3tl/string_view.hxx>
127 
128 using namespace ::com::sun::star;
129 
130 
132 {
133 }
134 
135 void SdrObjUserCall::Changed(const SdrObject& /*rObj*/, SdrUserCallType /*eType*/, const tools::Rectangle& /*rOldBoundRect*/)
136 {
137 }
138 
140  pVisiLayer(nullptr),
141  pPageView(nullptr),
142  nTol(0) {}
143 
144 
146  nInventor(nInv),
147  nIdentifier(nId) {}
148 
150  nInventor(rData.nInventor),
151  nIdentifier(rData.nIdentifier) {}
152 
154 
156  bMovProt(false),
157  bSizProt(false),
158  bNoPrint(false),
159  bClosedObj(false),
160  mbVisible(true),
161  mnLayerID(0)
162 {
163 }
164 
166 {
167 }
168 
170  bMoveAllowed(true),
171  bResizeFreeAllowed(true),
172  bResizePropAllowed(true),
173  bRotateFreeAllowed(true),
174  bRotate90Allowed(true),
175  bMirrorFreeAllowed(true),
176  bMirror45Allowed(true),
177  bMirror90Allowed(true),
178  bTransparenceAllowed(true),
179  bShearAllowed(true),
180  bEdgeRadiusAllowed(true),
181  bNoOrthoDesired(true),
182  bNoContortion(true),
183  bCanConvToPath(true),
184  bCanConvToPoly(true),
185  bCanConvToContour(false),
186  bCanConvToPathLineToArea(true),
187  bCanConvToPolyLineToArea(true) {}
188 
190 {
192  std::optional<double> mnRelativeWidth;
193  std::optional<double> mnRelativeHeight;
196 
197  Impl() :
198  meRelativeWidthRelation(text::RelOrientation::PAGE_FRAME),
199  meRelativeHeightRelation(text::RelOrientation::PAGE_FRAME) {}
200 };
201 
202 
203 // BaseProperties section
204 
205 std::unique_ptr<sdr::properties::BaseProperties> SdrObject::CreateObjectSpecificProperties()
206 {
207  return std::make_unique<sdr::properties::EmptyProperties>(*this);
208 }
209 
211 {
212  if(!mpProperties)
213  {
214  // CAUTION(!) Do *not* call this during SdrObject construction,
215  // that will lead to wrong type-casts (dependent on constructor-level)
216  // and thus eventually create the wrong sdr::properties (!). Is there
217  // a way to check if on the stack is a SdrObject-constructor (?)
218  const_cast< SdrObject* >(this)->mpProperties =
219  const_cast< SdrObject* >(this)->CreateObjectSpecificProperties();
220  }
221 
222  return *mpProperties;
223 }
224 
225 
226 // ObjectUser section
227 
229 {
230  mpImpl->maObjectUsers.push_back(&rNewUser);
231 }
232 
234 {
235  const sdr::ObjectUserVector::iterator aFindResult =
236  std::find(mpImpl->maObjectUsers.begin(), mpImpl->maObjectUsers.end(), &rOldUser);
237  if (aFindResult != mpImpl->maObjectUsers.end())
238  {
239  mpImpl->maObjectUsers.erase(aFindResult);
240  }
241 }
242 
243 
244 // DrawContact section
245 
246 std::unique_ptr<sdr::contact::ViewContact> SdrObject::CreateObjectSpecificViewContact()
247 {
248  return std::make_unique<sdr::contact::ViewContactOfSdrObj>(*this);
249 }
250 
252 {
253  if(!mpViewContact)
254  {
255  const_cast< SdrObject* >(this)->mpViewContact =
256  const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact();
257  }
258 
259  return *mpViewContact;
260 }
261 
262 // DrawContact support: Methods for handling Object changes
264 {
265  // Do necessary ViewContact actions
267 }
268 
270 {
271  if (SdrObjList* pParentList = getParentSdrObjListFromSdrObject())
272  {
273  return pParentList->getSdrPageFromSdrObjList();
274  }
275 
276  return nullptr;
277 }
278 
280 {
282 }
283 
285 {
286  if(getParentSdrObjListFromSdrObject() == pNewObjList)
287  return;
288 
289  // remember current page
290  SdrPage* pOldPage(getSdrPageFromSdrObject());
291 
292  // set new parent
293  mpParentOfSdrObject = pNewObjList;
294 
295  // get new page
296  SdrPage* pNewPage(getSdrPageFromSdrObject());
297 
298  // broadcast page change over objects if needed
299  if(pOldPage != pNewPage)
300  {
301  handlePageChange(pOldPage, pNewPage);
302  }
303 }
304 
306 {
307  return mpParentOfSdrObject;
308 }
309 
311 {
312  // default has no children
313  return nullptr;
314 }
315 
317 {
319 }
320 
321 #ifdef DBG_UTIL
322 // SdrObjectLifetimeWatchDog:
323 void impAddIncarnatedSdrObjectToSdrModel(const SdrObject& rSdrObject, SdrModel& rSdrModel)
324 {
325  rSdrModel.maAllIncarnatedObjects.insert(&rSdrObject);
326 }
327 void impRemoveIncarnatedSdrObjectToSdrModel(const SdrObject& rSdrObject, SdrModel& rSdrModel)
328 {
329  if(!rSdrModel.maAllIncarnatedObjects.erase(&rSdrObject))
330  {
331  SAL_WARN("svx","SdrObject::~SdrObject: Destructed incarnation of SdrObject not member of this SdrModel (!)");
332  }
333 }
334 #endif
335 
337 : mpFillGeometryDefiningShape(nullptr)
338  ,mrSdrModelFromSdrObject(rSdrModel)
339  ,m_pUserCall(nullptr)
340  ,mpImpl(new Impl)
341  ,mpParentOfSdrObject(nullptr)
342  ,m_nOrdNum(0)
343  ,mnNavigationPosition(SAL_MAX_UINT32)
344  ,mnLayerID(0)
345  ,mpSvxShape( nullptr )
346  ,mbDoNotInsertIntoPageAutomatically(false)
347 {
348  m_bVirtObj =false;
349  m_bSnapRectDirty =true;
350  m_bMovProt =false;
351  m_bSizProt =false;
352  m_bNoPrint =false;
353  m_bEmptyPresObj =false;
354  m_bNotVisibleAsMaster=false;
355  m_bClosedObj =false;
356  mbVisible = true;
357 
358  // #i25616#
359  mbLineIsOutsideGeometry = false;
360 
361  // #i25616#
363 
364  m_bIsEdge=false;
365  m_bIs3DObj=false;
366  m_bMarkProt=false;
367  m_bIsUnoObj=false;
368 #ifdef DBG_UTIL
369  // SdrObjectLifetimeWatchDog:
371 #endif
372 }
373 
374 SdrObject::SdrObject(SdrModel& rSdrModel, SdrObject const & rSource)
375 : mpFillGeometryDefiningShape(nullptr)
376  ,mrSdrModelFromSdrObject(rSdrModel)
377  ,m_pUserCall(nullptr)
378  ,mpImpl(new Impl)
379  ,mpParentOfSdrObject(nullptr)
380  ,m_nOrdNum(0)
381  ,mnNavigationPosition(SAL_MAX_UINT32)
382  ,mnLayerID(0)
383  ,mpSvxShape( nullptr )
384  ,mbDoNotInsertIntoPageAutomatically(false)
385 {
386  m_bVirtObj =false;
387  m_bSnapRectDirty =true;
388  m_bMovProt =false;
389  m_bSizProt =false;
390  m_bNoPrint =false;
391  m_bEmptyPresObj =false;
392  m_bNotVisibleAsMaster=false;
393  m_bClosedObj =false;
394  mbVisible = true;
395 
396  // #i25616#
397  mbLineIsOutsideGeometry = false;
398 
399  // #i25616#
401 
402  m_bIsEdge=false;
403  m_bIs3DObj=false;
404  m_bMarkProt=false;
405  m_bIsUnoObj=false;
406 #ifdef DBG_UTIL
407  // SdrObjectLifetimeWatchDog:
409 #endif
410 
411  mpProperties.reset();
412  mpViewContact.reset();
413 
414  // The CloneSdrObject() method uses the local copy constructor from the individual
415  // sdr::properties::BaseProperties class. Since the target class maybe for another
416  // draw object, an SdrObject needs to be provided, as in the normal constructor.
417  mpProperties = rSource.GetProperties().Clone(*this);
418 
419  m_aOutRect=rSource.m_aOutRect;
420  mnLayerID = rSource.mnLayerID;
421  m_aAnchor =rSource.m_aAnchor;
422  m_bVirtObj=rSource.m_bVirtObj;
423  m_bSizProt=rSource.m_bSizProt;
424  m_bMovProt=rSource.m_bMovProt;
425  m_bNoPrint=rSource.m_bNoPrint;
426  mbVisible=rSource.mbVisible;
427  m_bMarkProt=rSource.m_bMarkProt;
430  m_bSnapRectDirty=true;
431  m_pPlusData.reset();
432  if (rSource.m_pPlusData!=nullptr) {
433  m_pPlusData.reset(rSource.m_pPlusData->Clone(this));
434  }
435  if (m_pPlusData!=nullptr && m_pPlusData->pBroadcast!=nullptr) {
436  m_pPlusData->pBroadcast.reset(); // broadcaster isn't copied
437  }
438 
439  m_pGrabBagItem.reset();
440  if (rSource.m_pGrabBagItem!=nullptr)
441  m_pGrabBagItem.reset(rSource.m_pGrabBagItem->Clone());
442 }
443 
445 {
446  // Tell all the registered ObjectUsers that the page is in destruction.
447  // And clear the vector. This means that user do not need to call RemoveObjectUser()
448  // when they get called from ObjectInDestruction().
449  sdr::ObjectUserVector aList;
450  aList.swap(mpImpl->maObjectUsers);
451  for(sdr::ObjectUser* pObjectUser : aList)
452  {
453  DBG_ASSERT(pObjectUser, "SdrObject::~SdrObject: corrupt ObjectUser list (!)");
454  pObjectUser->ObjectInDestruction(*this);
455  }
456 
457  // UserCall
460 
461  m_pGrabBagItem.reset();
462  mpProperties.reset();
463  mpViewContact.reset();
464 
465 #ifdef DBG_UTIL
466  // SdrObjectLifetimeWatchDog:
468 #endif
469 }
470 
471 void SdrObject::Free( SdrObject*& _rpObject )
472 {
473  SdrObject* pObject = _rpObject; _rpObject = nullptr;
474 
475  if(nullptr == pObject)
476  {
477  // nothing to do
478  return;
479  }
480 
481  SvxShape* pShape(pObject->getSvxShape());
482 
483  if(pShape)
484  {
485  if(pShape->HasSdrObjectOwnership())
486  {
487  // only the SvxShape is allowed to delete me, and will reset
488  // the ownership before doing so
489  return;
490  }
491  else
492  {
493  // not only delete pObject, but also need to dispose uno shape
494  try
495  {
496  pShape->InvalidateSdrObject();
497  uno::Reference< lang::XComponent > xShapeComp( pObject->getWeakUnoShape().get(), uno::UNO_QUERY_THROW );
498  xShapeComp->dispose();
499  }
500  catch( const uno::Exception& )
501  {
503  }
504  }
505  }
506 
507  delete pObject;
508 }
509 
510 void SdrObject::SetBoundAndSnapRectsDirty(bool bNotMyself, bool bRecursive)
511 {
512  if (!bNotMyself)
513  {
515  m_bSnapRectDirty=true;
516  }
517 
518  if (bRecursive && nullptr != getParentSdrObjListFromSdrObject())
519  {
521  }
522 }
523 
524 void SdrObject::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
525 {
526  // The creation of the UNO shape in SdrObject::getUnoShape is influenced
527  // by pPage, so when the page changes we need to discard the cached UNO
528  // shape so that a new one will be created.
529  // If the page is changing to another page with the same model, we
530  // assume they create compatible UNO shape objects so we shouldn't have
531  // to invalidate.
532  // TTTT: This causes quite some problems in SvxDrawPage::add when used
533  // e.g. from Writer - the SdrObject may be cloned to target model, and
534  // the xShape was added to it by purpose (see there). Thus it will be
535  // good to think about if this is really needed - it *seems* to be intended
536  // for a xShape being a on-demand-creatable resource - with the argument that
537  // the SdrPage/UnoPage used influences the SvxShape creation. This uses
538  // resources and would be nice to get rid of anyways.
539  if(nullptr == pOldPage || nullptr == pNewPage)
540  {
541  SvxShape* const pShape(getSvxShape());
542 
543  if (pShape && !pShape->HasSdrObjectOwnership())
544  {
545  setUnoShape(nullptr);
546  }
547  }
548 }
549 
550 
551 // global static ItemPool for not-yet-inserted items
553 
555 namespace
556 {
557 class TerminateListener : public ::cppu::WeakImplHelper< css::frame::XTerminateListener >
558 {
559  void SAL_CALL queryTermination( const lang::EventObject& ) override
560  {}
561  void SAL_CALL notifyTermination( const lang::EventObject& ) override
562  {
563  mpGlobalItemPool.clear();
564  }
565  virtual void SAL_CALL disposing( const ::css::lang::EventObject& ) override
566  {}
567 };
568 };
569 
570 // init global static itempool
572 {
573  if(!mpGlobalItemPool)
574  {
575  mpGlobalItemPool = new SdrItemPool();
577  mpGlobalItemPool->SetSecondaryPool(pGlobalOutlPool.get());
578  mpGlobalItemPool->SetDefaultMetric(SdrEngineDefaults::GetMapUnit());
579  mpGlobalItemPool->FreezeIdRanges();
581  mpGlobalItemPool->acquire();
582  else
583  {
584  uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getProcessComponentContext());
585  uno::Reference< frame::XTerminateListener > xListener( new TerminateListener );
586  xDesktop->addTerminateListener( xListener );
587  }
588  }
589 
590  return *mpGlobalItemPool;
591 }
592 
594 {
595  mpImpl->mnRelativeWidth = nValue;
596 }
597 
598 void SdrObject::SetRelativeWidthRelation( sal_Int16 eValue )
599 {
600  mpImpl->meRelativeWidthRelation = eValue;
601 }
602 
604 {
605  mpImpl->mnRelativeHeight = nValue;
606 }
607 
608 void SdrObject::SetRelativeHeightRelation( sal_Int16 eValue )
609 {
610  mpImpl->meRelativeHeightRelation = eValue;
611 }
612 
613 const double* SdrObject::GetRelativeWidth( ) const
614 {
615  if (!mpImpl->mnRelativeWidth)
616  return nullptr;
617 
618  return &*mpImpl->mnRelativeWidth;
619 }
620 
622 {
623  return mpImpl->meRelativeWidthRelation;
624 }
625 
626 const double* SdrObject::GetRelativeHeight( ) const
627 {
628  if (!mpImpl->mnRelativeHeight)
629  return nullptr;
630 
631  return &*mpImpl->mnRelativeHeight;
632 }
633 
635 {
636  return mpImpl->meRelativeHeightRelation;
637 }
638 
640 {
642 }
643 
645 {
646  return SdrInventor::Default;
647 }
648 
650 {
651  return SdrObjKind::NONE;
652 }
653 
655 {
656  rInfo.bRotateFreeAllowed=false;
657  rInfo.bMirrorFreeAllowed=false;
658  rInfo.bTransparenceAllowed = false;
659  rInfo.bShearAllowed =false;
660  rInfo.bEdgeRadiusAllowed=false;
661  rInfo.bCanConvToPath =false;
662  rInfo.bCanConvToPoly =false;
663  rInfo.bCanConvToContour = false;
664  rInfo.bCanConvToPathLineToArea=false;
665  rInfo.bCanConvToPolyLineToArea=false;
666 }
667 
669 {
670  return mnLayerID;
671 }
672 
674 {
675  rSet.Set(GetLayer());
676  SdrObjList* pOL=GetSubList();
677  if (pOL!=nullptr) {
678  const size_t nObjCount = pOL->GetObjCount();
679  for (size_t nObjNum = 0; nObjNum<nObjCount; ++nObjNum) {
680  pOL->GetObj(nObjNum)->getMergedHierarchySdrLayerIDSet(rSet);
681  }
682  }
683 }
684 
686 {
687  mnLayerID = nLayer;
688 }
689 
691 {
692  NbcSetLayer(nLayer);
693  SetChanged();
695 }
696 
698 {
700  if (m_pPlusData->pBroadcast==nullptr) m_pPlusData->pBroadcast.reset(new SfxBroadcaster);
701 
702  // SdrEdgeObj may be connected to same SdrObject on both ends so allow it
703  // to listen twice
704  SdrEdgeObj const*const pEdge(dynamic_cast<SdrEdgeObj const*>(&rListener));
705  rListener.StartListening(*m_pPlusData->pBroadcast, pEdge ? DuplicateHandling::Allow : DuplicateHandling::Unexpected);
706 }
707 
709 {
710  if (m_pPlusData!=nullptr && m_pPlusData->pBroadcast!=nullptr) {
711  rListener.EndListening(*m_pPlusData->pBroadcast);
712  if (!m_pPlusData->pBroadcast->HasListeners()) {
713  m_pPlusData->pBroadcast.reset();
714  }
715  }
716 }
717 
719 {
720  return m_pPlusData!=nullptr ? m_pPlusData->pBroadcast.get() : nullptr;
721 }
722 
724 {
725  AddListener(rVrtObj);
726 }
727 
729 {
730  RemoveListener(rVrtObj);
731 }
732 
734 {
735  return GetSubList()!=nullptr;
736 }
737 
739 {
740  return nullptr;
741 }
742 
744 {
746 
747  if(nullptr == pParent)
748  {
749  return nullptr;
750  }
751 
752  return pParent->getSdrObjectFromSdrObjList();
753 }
754 
755 void SdrObject::SetName(const OUString& rStr, const bool bSetChanged)
756 {
757  if (!rStr.isEmpty() && !m_pPlusData)
758  {
760  }
761 
762  if(!(m_pPlusData && m_pPlusData->aObjName != rStr))
763  return;
764 
765  // Undo/Redo for setting object's name (#i73249#)
766  bool bUndo( false );
767  if ( getSdrModelFromSdrObject().IsUndoEnabled() )
768  {
769  bUndo = true;
770  std::unique_ptr<SdrUndoAction> pUndoAction =
772  *this,
774  GetName(),
775  rStr );
776  getSdrModelFromSdrObject().BegUndo( pUndoAction->GetComment() );
777  getSdrModelFromSdrObject().AddUndo( std::move(pUndoAction) );
778  }
779  m_pPlusData->aObjName = rStr;
780  // Undo/Redo for setting object's name (#i73249#)
781  if ( bUndo )
782  {
784  }
785  if (bSetChanged)
786  {
787  SetChanged();
789  }
790 }
791 
792 const OUString & SdrObject::GetName() const
793 {
794  static const OUString EMPTY = u"";
795 
796  if(m_pPlusData)
797  {
798  return m_pPlusData->aObjName;
799  }
800 
801  return EMPTY;
802 }
803 
804 void SdrObject::SetTitle(const OUString& rStr)
805 {
806  if (!rStr.isEmpty() && !m_pPlusData)
807  {
809  }
810 
811  if(!(m_pPlusData && m_pPlusData->aObjTitle != rStr))
812  return;
813 
814  // Undo/Redo for setting object's title (#i73249#)
815  bool bUndo( false );
816  if ( getSdrModelFromSdrObject().IsUndoEnabled() )
817  {
818  bUndo = true;
819  std::unique_ptr<SdrUndoAction> pUndoAction =
821  *this,
823  GetTitle(),
824  rStr );
825  getSdrModelFromSdrObject().BegUndo( pUndoAction->GetComment() );
826  getSdrModelFromSdrObject().AddUndo( std::move(pUndoAction) );
827  }
828  m_pPlusData->aObjTitle = rStr;
829  // Undo/Redo for setting object's title (#i73249#)
830  if ( bUndo )
831  {
833  }
834  SetChanged();
836 }
837 
838 OUString SdrObject::GetTitle() const
839 {
840  if(m_pPlusData)
841  {
842  return m_pPlusData->aObjTitle;
843  }
844 
845  return OUString();
846 }
847 
848 void SdrObject::SetDescription(const OUString& rStr)
849 {
850  if (!rStr.isEmpty() && !m_pPlusData)
851  {
853  }
854 
855  if(!(m_pPlusData && m_pPlusData->aObjDescription != rStr))
856  return;
857 
858  // Undo/Redo for setting object's description (#i73249#)
859  bool bUndo( false );
860  if ( getSdrModelFromSdrObject().IsUndoEnabled() )
861  {
862  bUndo = true;
863  std::unique_ptr<SdrUndoAction> pUndoAction =
865  *this,
867  GetDescription(),
868  rStr );
869  getSdrModelFromSdrObject().BegUndo( pUndoAction->GetComment() );
870  getSdrModelFromSdrObject().AddUndo( std::move(pUndoAction) );
871  }
872  m_pPlusData->aObjDescription = rStr;
873  // Undo/Redo for setting object's description (#i73249#)
874  if ( bUndo )
875  {
877  }
878  SetChanged();
880 }
881 
883 {
884  if(m_pPlusData)
885  {
886  return m_pPlusData->aObjDescription;
887  }
888 
889  return OUString();
890 }
891 
892 sal_uInt32 SdrObject::GetOrdNum() const
893 {
894  if (SdrObjList* pParentList = getParentSdrObjListFromSdrObject())
895  {
896  if (pParentList->IsObjOrdNumsDirty())
897  {
898  pParentList->RecalcObjOrdNums();
899  }
900  } else const_cast<SdrObject*>(this)->m_nOrdNum=0;
901  return m_nOrdNum;
902 }
903 
904 void SdrObject::SetOrdNum(sal_uInt32 nNum)
905 {
906  m_nOrdNum = nNum;
907 }
908 
909 void SdrObject::GetGrabBagItem(css::uno::Any& rVal) const
910 {
911  if (m_pGrabBagItem != nullptr)
912  m_pGrabBagItem->QueryValue(rVal);
913  else
914  rVal <<= uno::Sequence<beans::PropertyValue>();
915 }
916 
917 void SdrObject::SetGrabBagItem(const css::uno::Any& rVal)
918 {
919  if (m_pGrabBagItem == nullptr)
920  m_pGrabBagItem.reset(new SfxGrabBagItem);
921 
922  m_pGrabBagItem->PutValue(rVal, 0);
923 
924  SetChanged();
926 }
927 
929 {
930  if (nullptr != getParentSdrObjListFromSdrObject() && getParentSdrObjListFromSdrObject()->RecalcNavigationPositions())
931  {
932  return mnNavigationPosition;
933  }
934  else
935  return GetOrdNum();
936 }
937 
938 
939 void SdrObject::SetNavigationPosition (const sal_uInt32 nNewPosition)
940 {
941  mnNavigationPosition = nNewPosition;
942 }
943 
944 
945 // To make clearer that this method may trigger RecalcBoundRect and thus may be
946 // expensive and sometimes problematic (inside a bigger object change you will get
947 // non-useful BoundRects sometimes) I rename that method from GetBoundRect() to
948 // GetCurrentBoundRect().
950 {
951  if(m_aOutRect.IsEmpty())
952  {
953  const_cast< SdrObject* >(this)->RecalcBoundRect();
954  }
955 
956  return m_aOutRect;
957 }
958 
959 // To have a possibility to get the last calculated BoundRect e.g for producing
960 // the first rectangle for repaints (old and new need to be used) without forcing
961 // a RecalcBoundRect (which may be problematical and expensive sometimes) I add here
962 // a new method for accessing the last BoundRect.
964 {
965  return m_aOutRect;
966 }
967 
969 {
970  // #i101680# suppress BoundRect calculations on import(s)
972  return;
973 
974  // central new method which will calculate the BoundRect using primitive geometry
975  if(!m_aOutRect.IsEmpty())
976  return;
977 
978  // Use view-independent data - we do not want any connections
979  // to e.g. GridOffset in SdrObject-level
982 
983  if(xPrimitives.empty())
984  return;
985 
986  // use neutral ViewInformation and get the range of the primitives
987  const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
988  const basegfx::B2DRange aRange(xPrimitives.getB2DRange(aViewInformation2D));
989 
990  if(!aRange.isEmpty())
991  {
993  static_cast<tools::Long>(floor(aRange.getMinX())),
994  static_cast<tools::Long>(floor(aRange.getMinY())),
995  static_cast<tools::Long>(ceil(aRange.getMaxX())),
996  static_cast<tools::Long>(ceil(aRange.getMaxY())));
997  return;
998  }
999 }
1000 
1002 {
1004  return;
1005 
1006  bool bPlusDataBroadcast(m_pPlusData && m_pPlusData->pBroadcast);
1007  bool bObjectChange(IsInserted());
1008 
1009  if(!(bPlusDataBroadcast || bObjectChange))
1010  return;
1011 
1012  SdrHint aHint(SdrHintKind::ObjectChange, *this);
1013 
1014  if(bPlusDataBroadcast)
1015  {
1016  m_pPlusData->pBroadcast->Broadcast(aHint);
1017  }
1018 
1019  if(bObjectChange)
1020  {
1022  }
1023 }
1024 
1026 {
1027  // For testing purposes, use the new ViewContact for change
1028  // notification now.
1029  ActionChanged();
1030 
1031  // TTTT Need to check meaning/usage of IsInserted in one
1032  // of the next changes. It should not mean to have a SdrModel
1033  // set (this is guaranteed now), but should be connected to
1034  // being added to a SdrPage (?)
1035  // TTTT tdf#120066 Indeed - This triggers e.g. by CustomShape
1036  // geometry-presenting SdrObjects that are in a SdrObjGroup,
1037  // but the SdrObjGroup is *by purpose* not inserted.
1038  // Need to check deeper and maybe identify all ::IsInserted()
1039  // calls by rename and let the compiler work...
1040  if(nullptr != getSdrPageFromSdrObject())
1041  {
1043  }
1044 }
1045 
1046 // tooling for painting a single object to an OutputDevice.
1048 {
1049  sdr::contact::SdrObjectVector aObjectVector;
1050  aObjectVector.push_back(const_cast< SdrObject* >(this));
1051 
1052  sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, std::move(aObjectVector), getSdrPageFromSdrObject());
1053  sdr::contact::DisplayInfo aDisplayInfo;
1054 
1055  aPainter.ProcessDisplay(aDisplayInfo);
1056 }
1057 
1059 {
1060  drawing::LineStyle eXLS = GetMergedItem(XATTR_LINESTYLE).GetValue();
1061  return (eXLS != drawing::LineStyle_NONE);
1062 }
1063 
1065 {
1066  // RotGrfFlyFrame: Default is false, support full rotation
1067  return false;
1068 }
1069 
1071 {
1072  return new SdrObject(rTargetModel, *this);
1073 }
1074 
1076 {
1077  OUString sName(SvxResId(STR_ObjNameSingulNONE));
1078 
1079  OUString aName(GetName());
1080  if (!aName.isEmpty())
1081  sName += " '" + aName + "'";
1082  return sName;
1083 }
1084 
1086 {
1087  return SvxResId(STR_ObjNamePluralNONE);
1088 }
1089 
1091 {
1092  OUString aStr = SvxResId(pStrCacheID);
1093  sal_Int32 nPos = aStr.indexOf("%1");
1094  if (nPos >= 0)
1095  {
1096  // Replace '%1' with the object name.
1097  OUString aObjName(TakeObjNameSingul());
1098  aStr = aStr.replaceAt(nPos, 2, aObjName);
1099  }
1100 
1101  nPos = aStr.indexOf("%2");
1102  if (nPos >= 0)
1103  // Replace '%2' with the passed value.
1104  aStr = aStr.replaceAt(nPos, 2, u"0");
1105  return aStr;
1106 }
1107 
1109 {
1110  if (!m_pPlusData)
1111  m_pPlusData.reset( new SdrObjPlusData );
1112 }
1113 
1115 {
1117 }
1118 
1120 {
1121  basegfx::B2DPolyPolygon aRetval;
1124 
1125  return aRetval;
1126 }
1127 
1129 {
1130  basegfx::B2DPolyPolygon aRetval;
1131 
1132  // create cloned object without text, but with drawing::LineStyle_SOLID,
1133  // COL_BLACK as line color and drawing::FillStyle_NONE
1135 
1136  if(pClone)
1137  {
1138  const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(this);
1139 
1140  if(pTextObj)
1141  {
1142  // no text and no text animation
1144  pClone->SetOutlinerParaObject(std::nullopt);
1145  }
1146 
1147  const SdrEdgeObj* pEdgeObj = dynamic_cast< const SdrEdgeObj* >(this);
1148 
1149  if(pEdgeObj)
1150  {
1151  // create connections if connector, will be cleaned up when
1152  // deleting the connector again
1153  SdrObject* pLeft = pEdgeObj->GetConnectedNode(true);
1154  SdrObject* pRight = pEdgeObj->GetConnectedNode(false);
1155 
1156  if(pLeft)
1157  {
1158  pClone->ConnectToNode(true, pLeft);
1159  }
1160 
1161  if(pRight)
1162  {
1163  pClone->ConnectToNode(false, pRight);
1164  }
1165  }
1166 
1167  SfxItemSet aNewSet(GetObjectItemPool());
1168 
1169  // #i101980# ignore LineWidth; that's what the old implementation
1170  // did. With line width, the result may be huge due to fat/thick
1171  // line decompositions
1172  aNewSet.Put(XLineWidthItem(0));
1173 
1174  // solid black lines and no fill
1175  aNewSet.Put(XLineStyleItem(drawing::LineStyle_SOLID));
1176  aNewSet.Put(XLineColorItem(OUString(), COL_BLACK));
1177  aNewSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
1178  pClone->SetMergedItemSet(aNewSet);
1179 
1180  // get sequence from clone
1181  const sdr::contact::ViewContact& rVC(pClone->GetViewContact());
1183  rVC.getViewIndependentPrimitive2DContainer(xSequence);
1184 
1185  if(!xSequence.empty())
1186  {
1187  // use neutral ViewInformation
1188  const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
1189 
1190  // create extractor, process and get result (with hairlines as opened polygons)
1191  drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D, false);
1192  aExtractor.process(xSequence);
1193  const basegfx::B2DPolyPolygonVector& rResult(aExtractor.getExtractedContour());
1194  const sal_uInt32 nSize(rResult.size());
1195 
1196  // when count is one, it is implied that the object has only its normal
1197  // contour anyways and TakeContour() is to return an empty PolyPolygon
1198  // (see old implementation for historical reasons)
1199  if(nSize > 1)
1200  {
1201  // the topology for contour is correctly a vector of PolyPolygons; for
1202  // historical reasons cut it back to a single tools::PolyPolygon here
1203  for(sal_uInt32 a(0); a < nSize; a++)
1204  {
1205  aRetval.append(rResult[a]);
1206  }
1207  }
1208  }
1209 
1210  // Always use SdrObject::Free to delete SdrObjects (!)
1211  SdrObject::Free(pClone);
1212  }
1213 
1214  return aRetval;
1215 }
1216 
1217 sal_uInt32 SdrObject::GetHdlCount() const
1218 {
1219  return 8;
1220 }
1221 
1223 {
1224  const tools::Rectangle& rR=GetSnapRect();
1225  for (sal_uInt32 nHdlNum=0; nHdlNum<8; ++nHdlNum)
1226  {
1227  std::unique_ptr<SdrHdl> pH;
1228  switch (nHdlNum) {
1229  case 0: pH.reset(new SdrHdl(rR.TopLeft(), SdrHdlKind::UpperLeft)); break;
1230  case 1: pH.reset(new SdrHdl(rR.TopCenter(), SdrHdlKind::Upper)); break;
1231  case 2: pH.reset(new SdrHdl(rR.TopRight(), SdrHdlKind::UpperRight)); break;
1232  case 3: pH.reset(new SdrHdl(rR.LeftCenter(), SdrHdlKind::Left )); break;
1233  case 4: pH.reset(new SdrHdl(rR.RightCenter(), SdrHdlKind::Right)); break;
1234  case 5: pH.reset(new SdrHdl(rR.BottomLeft(), SdrHdlKind::LowerLeft)); break;
1235  case 6: pH.reset(new SdrHdl(rR.BottomCenter(),SdrHdlKind::Lower)); break;
1236  case 7: pH.reset(new SdrHdl(rR.BottomRight(), SdrHdlKind::LowerRight)); break;
1237  }
1238  rHdlList.AddHdl(std::move(pH));
1239  }
1240 }
1241 
1243 {
1244 }
1245 
1246 void SdrObject::addCropHandles(SdrHdlList& /*rTarget*/) const
1247 {
1248  // Default implementation, does nothing. Overloaded in
1249  // SdrGrafObj and SwVirtFlyDrawObj
1250 }
1251 
1253 {
1254  tools::Rectangle aTmpRect(GetSnapRect());
1255  tools::Rectangle aRect(aTmpRect);
1256  const SdrHdl* pHdl=rDrag.GetHdl();
1257  SdrHdlKind eHdl=pHdl==nullptr ? SdrHdlKind::Move : pHdl->GetKind();
1258  bool bEcke=(eHdl==SdrHdlKind::UpperLeft || eHdl==SdrHdlKind::UpperRight || eHdl==SdrHdlKind::LowerLeft || eHdl==SdrHdlKind::LowerRight);
1259  bool bOrtho=rDrag.GetView()!=nullptr && rDrag.GetView()->IsOrtho();
1260  bool bBigOrtho=bEcke && bOrtho && rDrag.GetView()->IsBigOrtho();
1261  Point aPos(rDrag.GetNow());
1262  bool bLft=(eHdl==SdrHdlKind::UpperLeft || eHdl==SdrHdlKind::Left || eHdl==SdrHdlKind::LowerLeft);
1263  bool bRgt=(eHdl==SdrHdlKind::UpperRight || eHdl==SdrHdlKind::Right || eHdl==SdrHdlKind::LowerRight);
1264  bool bTop=(eHdl==SdrHdlKind::UpperRight || eHdl==SdrHdlKind::Upper || eHdl==SdrHdlKind::UpperLeft);
1265  bool bBtm=(eHdl==SdrHdlKind::LowerRight || eHdl==SdrHdlKind::Lower || eHdl==SdrHdlKind::LowerLeft);
1266  if (bLft) aTmpRect.SetLeft(aPos.X() );
1267  if (bRgt) aTmpRect.SetRight(aPos.X() );
1268  if (bTop) aTmpRect.SetTop(aPos.Y() );
1269  if (bBtm) aTmpRect.SetBottom(aPos.Y() );
1270  if (bOrtho) { // Ortho
1271  tools::Long nWdt0=aRect.Right() -aRect.Left();
1272  tools::Long nHgt0=aRect.Bottom()-aRect.Top();
1273  tools::Long nXMul=aTmpRect.Right() -aTmpRect.Left();
1274  tools::Long nYMul=aTmpRect.Bottom()-aTmpRect.Top();
1275  tools::Long nXDiv=nWdt0;
1276  tools::Long nYDiv=nHgt0;
1277  bool bXNeg=(nXMul<0)!=(nXDiv<0);
1278  bool bYNeg=(nYMul<0)!=(nYDiv<0);
1279  nXMul=std::abs(nXMul);
1280  nYMul=std::abs(nYMul);
1281  nXDiv=std::abs(nXDiv);
1282  nYDiv=std::abs(nYDiv);
1283  Fraction aXFact(nXMul,nXDiv); // fractions for canceling
1284  Fraction aYFact(nYMul,nYDiv); // and for comparing
1285  nXMul=aXFact.GetNumerator();
1286  nYMul=aYFact.GetNumerator();
1287  nXDiv=aXFact.GetDenominator();
1288  nYDiv=aYFact.GetDenominator();
1289  if (bEcke) { // corner point handles
1290  bool bUseX=(aXFact<aYFact) != bBigOrtho;
1291  if (bUseX) {
1292  tools::Long nNeed=tools::Long(BigInt(nHgt0)*BigInt(nXMul)/BigInt(nXDiv));
1293  if (bYNeg) nNeed=-nNeed;
1294  if (bTop) aTmpRect.SetTop(aTmpRect.Bottom()-nNeed );
1295  if (bBtm) aTmpRect.SetBottom(aTmpRect.Top()+nNeed );
1296  } else {
1297  tools::Long nNeed=tools::Long(BigInt(nWdt0)*BigInt(nYMul)/BigInt(nYDiv));
1298  if (bXNeg) nNeed=-nNeed;
1299  if (bLft) aTmpRect.SetLeft(aTmpRect.Right()-nNeed );
1300  if (bRgt) aTmpRect.SetRight(aTmpRect.Left()+nNeed );
1301  }
1302  } else { // apex handles
1303  if ((bLft || bRgt) && nXDiv!=0) {
1304  tools::Long nHgt0b=aRect.Bottom()-aRect.Top();
1305  tools::Long nNeed=tools::Long(BigInt(nHgt0b)*BigInt(nXMul)/BigInt(nXDiv));
1306  aTmpRect.AdjustTop( -((nNeed-nHgt0b)/2) );
1307  aTmpRect.SetBottom(aTmpRect.Top()+nNeed );
1308  }
1309  if ((bTop || bBtm) && nYDiv!=0) {
1310  tools::Long nWdt0b=aRect.Right()-aRect.Left();
1311  tools::Long nNeed=tools::Long(BigInt(nWdt0b)*BigInt(nYMul)/BigInt(nYDiv));
1312  aTmpRect.AdjustLeft( -((nNeed-nWdt0b)/2) );
1313  aTmpRect.SetRight(aTmpRect.Left()+nNeed );
1314  }
1315  }
1316  }
1317  aTmpRect.Justify();
1318  return aTmpRect;
1319 }
1320 
1321 
1323 {
1324  return false;
1325 }
1326 
1328 {
1329  return true;
1330 }
1331 
1333 {
1334  // default uses simple clone
1336 }
1337 
1339 {
1340  const SdrHdl* pHdl = rDrag.GetHdl();
1341 
1342  SdrHdlKind eHdl = (pHdl == nullptr) ? SdrHdlKind::Move : pHdl->GetKind();
1343 
1344  return eHdl==SdrHdlKind::UpperLeft || eHdl==SdrHdlKind::Upper || eHdl==SdrHdlKind::UpperRight ||
1345  eHdl==SdrHdlKind::Left || eHdl==SdrHdlKind::Right || eHdl==SdrHdlKind::LowerLeft ||
1347 }
1348 
1350 {
1351  tools::Rectangle aNewRect(ImpDragCalcRect(rDrag));
1352 
1353  if(aNewRect != GetSnapRect())
1354  {
1355  NbcSetSnapRect(aNewRect);
1356  }
1357 
1358  return true;
1359 }
1360 
1361 OUString SdrObject::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const
1362 {
1363  return OUString();
1364 }
1365 
1367 {
1368  // default has nothing to add
1369  return basegfx::B2DPolyPolygon();
1370 }
1371 
1372 
1373 // Create
1375 {
1376  rStat.SetOrtho4Possible();
1377  tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
1378  aRect1.Justify();
1379  rStat.SetActionRect(aRect1);
1380  m_aOutRect = aRect1;
1381  return true;
1382 }
1383 
1385 {
1386  rStat.TakeCreateRect(m_aOutRect);
1387  rStat.SetActionRect(m_aOutRect);
1388  m_aOutRect.Justify();
1389 
1390  return true;
1391 }
1392 
1394 {
1395  rStat.TakeCreateRect(m_aOutRect);
1396  m_aOutRect.Justify();
1397 
1398  return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2);
1399 }
1400 
1402 {
1403 }
1404 
1406 {
1407  return false;
1408 }
1409 
1411 {
1412  tools::Rectangle aRect1;
1413  rDrag.TakeCreateRect(aRect1);
1414  aRect1.Justify();
1415 
1416  basegfx::B2DPolyPolygon aRetval;
1418  return aRetval;
1419 }
1420 
1422 {
1423  return PointerStyle::Cross;
1424 }
1425 
1426 // transformations
1427 void SdrObject::NbcMove(const Size& rSiz)
1428 {
1429  m_aOutRect.Move(rSiz);
1431 }
1432 
1433 void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
1434 {
1435  bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
1436  bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
1437  if (bXMirr || bYMirr) {
1438  Point aRef1(GetSnapRect().Center());
1439  if (bXMirr) {
1440  Point aRef2(aRef1);
1441  aRef2.AdjustY( 1 );
1442  NbcMirrorGluePoints(aRef1,aRef2);
1443  }
1444  if (bYMirr) {
1445  Point aRef2(aRef1);
1446  aRef2.AdjustX( 1 );
1447  NbcMirrorGluePoints(aRef1,aRef2);
1448  }
1449  }
1450  ResizeRect(m_aOutRect,rRef,xFact,yFact);
1452 }
1453 
1454 void SdrObject::NbcRotate(const Point& rRef, Degree100 nAngle)
1455 {
1456  if (nAngle)
1457  {
1458  double a = toRadians(nAngle);
1459  NbcRotate( rRef, nAngle, sin( a ), cos( a ) );
1460  }
1461 }
1462 
1463 void SdrObject::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
1464 {
1465  SetGlueReallyAbsolute(true);
1466  m_aOutRect.Move(-rRef.X(),-rRef.Y());
1468  if (sn==1.0 && cs==0.0) { // 90deg
1469  m_aOutRect.SetLeft(-R.Bottom() );
1470  m_aOutRect.SetRight(-R.Top() );
1471  m_aOutRect.SetTop(R.Left() );
1472  m_aOutRect.SetBottom(R.Right() );
1473  } else if (sn==0.0 && cs==-1.0) { // 180deg
1474  m_aOutRect.SetLeft(-R.Right() );
1475  m_aOutRect.SetRight(-R.Left() );
1476  m_aOutRect.SetTop(-R.Bottom() );
1477  m_aOutRect.SetBottom(-R.Top() );
1478  } else if (sn==-1.0 && cs==0.0) { // 270deg
1479  m_aOutRect.SetLeft(R.Top() );
1480  m_aOutRect.SetRight(R.Bottom() );
1481  m_aOutRect.SetTop(-R.Right() );
1482  m_aOutRect.SetBottom(-R.Left() );
1483  }
1484  m_aOutRect.Move(rRef.X(),rRef.Y());
1485  m_aOutRect.Justify(); // just in case
1487  NbcRotateGluePoints(rRef,nAngle,sn,cs);
1488  SetGlueReallyAbsolute(false);
1489 }
1490 
1491 void SdrObject::NbcMirror(const Point& rRef1, const Point& rRef2)
1492 {
1493  SetGlueReallyAbsolute(true);
1494  m_aOutRect.Move(-rRef1.X(),-rRef1.Y());
1496  tools::Long dx=rRef2.X()-rRef1.X();
1497  tools::Long dy=rRef2.Y()-rRef1.Y();
1498  if (dx==0) { // vertical axis
1499  m_aOutRect.SetLeft(-R.Right() );
1500  m_aOutRect.SetRight(-R.Left() );
1501  } else if (dy==0) { // horizontal axis
1502  m_aOutRect.SetTop(-R.Bottom() );
1503  m_aOutRect.SetBottom(-R.Top() );
1504  } else if (dx==dy) { // 45deg axis
1505  m_aOutRect.SetLeft(R.Top() );
1506  m_aOutRect.SetRight(R.Bottom() );
1507  m_aOutRect.SetTop(R.Left() );
1508  m_aOutRect.SetBottom(R.Right() );
1509  } else if (dx==-dy) { // 45deg axis
1510  m_aOutRect.SetLeft(-R.Bottom() );
1511  m_aOutRect.SetRight(-R.Top() );
1512  m_aOutRect.SetTop(-R.Right() );
1513  m_aOutRect.SetBottom(-R.Left() );
1514  }
1515  m_aOutRect.Move(rRef1.X(),rRef1.Y());
1516  m_aOutRect.Justify(); // just in case
1518  NbcMirrorGluePoints(rRef1,rRef2);
1519  SetGlueReallyAbsolute(false);
1520 }
1521 
1522 void SdrObject::NbcShear(const Point& rRef, Degree100 /*nAngle*/, double tn, bool bVShear)
1523 {
1524  SetGlueReallyAbsolute(true);
1525  NbcShearGluePoints(rRef,tn,bVShear);
1526  SetGlueReallyAbsolute(false);
1527 }
1528 
1529 void SdrObject::Move(const Size& rSiz)
1530 {
1531  if (rSiz.Width()!=0 || rSiz.Height()!=0) {
1532  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1533  NbcMove(rSiz);
1534  SetChanged();
1537  }
1538 }
1539 
1540 void SdrObject::NbcCrop(const basegfx::B2DPoint& /*aRef*/, double /*fxFact*/, double /*fyFact*/)
1541 {
1542  // Default: does nothing. Real behaviour in SwVirtFlyDrawObj and SdrDragCrop::EndSdrDrag.
1543  // Where SwVirtFlyDrawObj is the only real user of it to do something local
1544 }
1545 
1546 void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
1547 {
1548  if (xFact.GetNumerator() == xFact.GetDenominator() && yFact.GetNumerator() == yFact.GetDenominator())
1549  return;
1550 
1551  if (bUnsetRelative)
1552  {
1553  mpImpl->mnRelativeWidth.reset();
1554  mpImpl->meRelativeWidthRelation = text::RelOrientation::PAGE_FRAME;
1555  mpImpl->meRelativeHeightRelation = text::RelOrientation::PAGE_FRAME;
1556  mpImpl->mnRelativeHeight.reset();
1557  }
1558  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1559  NbcResize(rRef,xFact,yFact);
1560  SetChanged();
1563 }
1564 
1565 void SdrObject::Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact)
1566 {
1567  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1568  NbcCrop(rRef, fxFact, fyFact);
1569  SetChanged();
1572 }
1573 
1574 void SdrObject::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
1575 {
1576  if (nAngle) {
1577  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1578  NbcRotate(rRef,nAngle,sn,cs);
1579  SetChanged();
1582  }
1583 }
1584 
1585 void SdrObject::Mirror(const Point& rRef1, const Point& rRef2)
1586 {
1587  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1588  NbcMirror(rRef1,rRef2);
1589  SetChanged();
1592 }
1593 
1594 void SdrObject::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
1595 {
1596  if (nAngle) {
1597  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1598  NbcShear(rRef,nAngle,tn,bVShear);
1599  SetChanged();
1602  }
1603 }
1604 
1605 void SdrObject::NbcSetRelativePos(const Point& rPnt)
1606 {
1607  Point aRelPos0(GetSnapRect().TopLeft()-m_aAnchor);
1608  Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
1609  NbcMove(aSiz); // This also calls SetRectsDirty()
1610 }
1611 
1612 void SdrObject::SetRelativePos(const Point& rPnt)
1613 {
1614  if (rPnt!=GetRelativePos()) {
1615  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1616  NbcSetRelativePos(rPnt);
1617  SetChanged();
1620  }
1621 }
1622 
1624 {
1625  return GetSnapRect().TopLeft()-m_aAnchor;
1626 }
1627 
1628 void SdrObject::ImpSetAnchorPos(const Point& rPnt)
1629 {
1630  m_aAnchor = rPnt;
1631 }
1632 
1633 void SdrObject::NbcSetAnchorPos(const Point& rPnt)
1634 {
1635  Size aSiz(rPnt.X()-m_aAnchor.X(),rPnt.Y()-m_aAnchor.Y());
1636  m_aAnchor=rPnt;
1637  NbcMove(aSiz); // This also calls SetRectsDirty()
1638 }
1639 
1640 void SdrObject::SetAnchorPos(const Point& rPnt)
1641 {
1642  if (rPnt!=m_aAnchor) {
1643  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1644  NbcSetAnchorPos(rPnt);
1645  SetChanged();
1648  }
1649 }
1650 
1652 {
1653  return m_aAnchor;
1654 }
1655 
1657 {
1658 }
1659 
1661 {
1662  return m_aOutRect;
1663 }
1664 
1666 {
1667  m_aOutRect=rRect;
1668 }
1669 
1671 {
1672  return GetSnapRect();
1673 }
1674 
1676 {
1677  NbcSetSnapRect(rRect);
1678 }
1679 
1680 void SdrObject::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool /* bShrinkOnly = false */ )
1681 {
1682  SetLogicRect( rMaxRect );
1683 }
1684 
1686 {
1687  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1688  NbcSetSnapRect(rRect);
1689  SetChanged();
1692 }
1693 
1695 {
1696  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1697  NbcSetLogicRect(rRect);
1698  SetChanged();
1701 }
1702 
1704 {
1705  return 0_deg100;
1706 }
1707 
1708 Degree100 SdrObject::GetShearAngle(bool /*bVertical*/) const
1709 {
1710  return 0_deg100;
1711 }
1712 
1714 {
1715  return GetPointCount();
1716 }
1717 
1718 Point SdrObject::GetSnapPoint(sal_uInt32 i) const
1719 {
1720  return GetPoint(i);
1721 }
1722 
1724 {
1725  return false;
1726 }
1727 
1728 sal_uInt32 SdrObject::GetPointCount() const
1729 {
1730  return 0;
1731 }
1732 
1733 Point SdrObject::GetPoint(sal_uInt32 /*i*/) const
1734 {
1735  return Point();
1736 }
1737 
1738 void SdrObject::SetPoint(const Point& rPnt, sal_uInt32 i)
1739 {
1740  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1741  NbcSetPoint(rPnt, i);
1742  SetChanged();
1745 }
1746 
1747 void SdrObject::NbcSetPoint(const Point& /*rPnt*/, sal_uInt32 /*i*/)
1748 {
1749 }
1750 
1752 {
1753  return false;
1754 }
1755 
1756 bool SdrObject::Equals(const SdrObject& rOtherObj) const
1757 {
1758  return (m_aAnchor.X() == rOtherObj.m_aAnchor.X() && m_aAnchor.Y() == rOtherObj.m_aAnchor.Y() &&
1759  m_nOrdNum == rOtherObj.m_nOrdNum && mnNavigationPosition == rOtherObj.mnNavigationPosition &&
1762  m_bIs3DObj == rOtherObj.m_bIs3DObj && m_bIsEdge == rOtherObj.m_bIsEdge && m_bClosedObj == rOtherObj.m_bClosedObj &&
1764  mbVisible == rOtherObj.mbVisible && m_bNoPrint == rOtherObj.m_bNoPrint && m_bSizProt == rOtherObj.m_bSizProt &&
1765  m_bMovProt == rOtherObj.m_bMovProt && m_bVirtObj == rOtherObj.m_bVirtObj &&
1766  mnLayerID == rOtherObj.mnLayerID && GetMergedItemSet().Equals(rOtherObj.GetMergedItemSet(), false) );
1767 }
1768 
1770 {
1771  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrObject"));
1772  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1773  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name()));
1774  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("name"), "%s", BAD_CAST(GetName().toUtf8().getStr()));
1775  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("title"), "%s", BAD_CAST(GetTitle().toUtf8().getStr()));
1776  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("description"), "%s", BAD_CAST(GetDescription().toUtf8().getStr()));
1777  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nOrdNum"), "%" SAL_PRIuUINT32, GetOrdNumDirect());
1778  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aOutRect"), BAD_CAST(m_aOutRect.toString().getStr()));
1779 
1780  if (m_pGrabBagItem)
1781  {
1782  m_pGrabBagItem->dumpAsXml(pWriter);
1783  }
1784 
1785  if (mpProperties)
1786  {
1787  mpProperties->dumpAsXml(pWriter);
1788  }
1789 
1790  if (const OutlinerParaObject* pOutliner = GetOutlinerParaObject())
1791  pOutliner->dumpAsXml(pWriter);
1792 
1793  (void)xmlTextWriterEndElement(pWriter);
1794 }
1795 
1797 {
1798  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1799  NbcSetOutlinerParaObject(std::move(pTextObject));
1800  SetChanged();
1802  if (GetCurrentBoundRect()!=aBoundRect0) {
1804  }
1805 
1806  if (!getSdrModelFromSdrObject().IsUndoEnabled())
1807  return;
1808 
1809  // Don't do this during import.
1810  SdrObject* pTopGroupObj = nullptr;
1812  {
1813  pTopGroupObj = getParentSdrObjectFromSdrObject();
1814  while (pTopGroupObj->getParentSdrObjectFromSdrObject())
1815  {
1816  pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject();
1817  }
1818  }
1819  if (pTopGroupObj)
1820  {
1821  // A shape was modified, which is in a group shape. Empty the group shape's grab-bag,
1822  // which potentially contains the old text of the shapes in case of diagrams.
1823  pTopGroupObj->SetGrabBagItem(uno::Any(uno::Sequence<beans::PropertyValue>()));
1824  }
1825 }
1826 
1828 {
1829 }
1830 
1832 {
1833  return nullptr;
1834 }
1835 
1837 {
1838 }
1839 
1841 {
1843 }
1844 
1846 {
1847  return false;
1848 }
1849 
1851 {
1852  if(rRec.pPageView)
1853  {
1854  return SdrObjectPrimitiveHit(*this, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
1855  }
1856 
1857  return nullptr;
1858 }
1859 
1861 {
1862  return PointerStyle::RefHand;
1863 }
1864 
1866 {
1867  const RasterOp eRop(rOut.GetRasterOp());
1868  const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
1869 
1870  rOut.SetLineColor(COL_BLACK);
1871  rOut.SetFillColor();
1872  rOut.SetRasterOp(RasterOp::Invert);
1873 
1874  for(auto const& rPolygon : aPolyPolygon)
1875  {
1876  rOut.DrawPolyLine(rPolygon);
1877  }
1878 
1879  rOut.SetRasterOp(eRop);
1880 }
1881 
1883 {
1884  return false;
1885 }
1886 
1888 {
1889  return CheckMacroHit(rRec) != nullptr;
1890 }
1891 
1892 
1893 std::unique_ptr<SdrObjGeoData> SdrObject::NewGeoData() const
1894 {
1895  return std::make_unique<SdrObjGeoData>();
1896 }
1897 
1899 {
1901  rGeo.aAnchor =m_aAnchor ;
1902  rGeo.bMovProt =m_bMovProt ;
1903  rGeo.bSizProt =m_bSizProt ;
1904  rGeo.bNoPrint =m_bNoPrint ;
1905  rGeo.mbVisible =mbVisible ;
1906  rGeo.bClosedObj =m_bClosedObj ;
1907  rGeo.mnLayerID = mnLayerID;
1908 
1909  // user-defined gluepoints
1910  if (m_pPlusData!=nullptr && m_pPlusData->pGluePoints!=nullptr) {
1911  if (rGeo.pGPL!=nullptr) {
1912  *rGeo.pGPL=*m_pPlusData->pGluePoints;
1913  } else {
1914  rGeo.pGPL.reset( new SdrGluePointList(*m_pPlusData->pGluePoints) );
1915  }
1916  } else {
1917  rGeo.pGPL.reset();
1918  }
1919 }
1920 
1922 {
1924  m_aOutRect =rGeo.aBoundRect ;
1925  m_aAnchor =rGeo.aAnchor ;
1926  m_bMovProt =rGeo.bMovProt ;
1927  m_bSizProt =rGeo.bSizProt ;
1928  m_bNoPrint =rGeo.bNoPrint ;
1929  mbVisible =rGeo.mbVisible ;
1930  m_bClosedObj =rGeo.bClosedObj ;
1931  mnLayerID = rGeo.mnLayerID;
1932 
1933  // user-defined gluepoints
1934  if (rGeo.pGPL!=nullptr) {
1935  ImpForcePlusData();
1936  if (m_pPlusData->pGluePoints!=nullptr) {
1937  *m_pPlusData->pGluePoints=*rGeo.pGPL;
1938  } else {
1939  m_pPlusData->pGluePoints.reset(new SdrGluePointList(*rGeo.pGPL));
1940  }
1941  } else {
1942  if (m_pPlusData!=nullptr && m_pPlusData->pGluePoints!=nullptr) {
1943  m_pPlusData->pGluePoints.reset();
1944  }
1945  }
1946 }
1947 
1948 std::unique_ptr<SdrObjGeoData> SdrObject::GetGeoData() const
1949 {
1950  std::unique_ptr<SdrObjGeoData> pGeo = NewGeoData();
1951  SaveGeoData(*pGeo);
1952  return pGeo;
1953 }
1954 
1956 {
1957  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
1958  RestoreGeoData(rGeo);
1959  SetChanged();
1962 }
1963 
1964 
1965 // ItemSet access
1966 
1968 {
1969  return GetProperties().GetObjectItemSet();
1970 }
1971 
1973 {
1974  return GetProperties().GetMergedItemSet();
1975 }
1976 
1978 {
1979  GetProperties().SetObjectItem(rItem);
1980 }
1981 
1983 {
1984  GetProperties().SetMergedItem(rItem);
1985 }
1986 
1987 void SdrObject::ClearMergedItem(const sal_uInt16 nWhich)
1988 {
1989  GetProperties().ClearMergedItem(nWhich);
1990 }
1991 
1993 {
1995 }
1996 
1997 void SdrObject::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
1998 {
1999  GetProperties().SetMergedItemSet(rSet, bClearAllItems);
2000 }
2001 
2002 const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const
2003 {
2004  return GetObjectItemSet().Get(nWhich);
2005 }
2006 
2007 const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const
2008 {
2009  return GetMergedItemSet().Get(nWhich);
2010 }
2011 
2012 void SdrObject::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems)
2013 {
2014  GetProperties().SetMergedItemSetAndBroadcast(rSet, bClearAllItems);
2015 }
2016 
2018 {
2019  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
2020  NbcApplyNotPersistAttr(rAttr);
2021  SetChanged();
2024 }
2025 
2027 {
2028  const tools::Rectangle& rSnap=GetSnapRect();
2029  const tools::Rectangle& rLogic=GetLogicRect();
2030  Point aRef1(rSnap.Center());
2031 
2032  if (const SdrTransformRef1XItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF1X))
2033  {
2034  aRef1.setX(pPoolItem->GetValue() );
2035  }
2036  if (const SdrTransformRef1YItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF1Y))
2037  {
2038  aRef1.setY(pPoolItem->GetValue() );
2039  }
2040 
2041  tools::Rectangle aNewSnap(rSnap);
2042  if (const SdrMoveXItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_MOVEX))
2043  {
2044  tools::Long n = pPoolItem->GetValue();
2045  aNewSnap.Move(n,0);
2046  }
2047  if (const SdrMoveYItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_MOVEY))
2048  {
2049  tools::Long n = pPoolItem->GetValue();
2050  aNewSnap.Move(0,n);
2051  }
2052  if (const SdrOnePositionXItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONEPOSITIONX))
2053  {
2054  tools::Long n = pPoolItem->GetValue();
2055  aNewSnap.Move(n-aNewSnap.Left(),0);
2056  }
2057  if (const SdrOnePositionYItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONEPOSITIONY))
2058  {
2059  tools::Long n = pPoolItem->GetValue();
2060  aNewSnap.Move(0,n-aNewSnap.Top());
2061  }
2062  if (const SdrOneSizeWidthItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONESIZEWIDTH))
2063  {
2064  tools::Long n = pPoolItem->GetValue();
2065  aNewSnap.SetRight(aNewSnap.Left()+n );
2066  }
2067  if (const SdrOneSizeHeightItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONESIZEHEIGHT))
2068  {
2069  tools::Long n = pPoolItem->GetValue();
2070  aNewSnap.SetBottom(aNewSnap.Top()+n );
2071  }
2072  if (aNewSnap!=rSnap) {
2073  if (aNewSnap.GetSize()==rSnap.GetSize()) {
2074  NbcMove(Size(aNewSnap.Left()-rSnap.Left(),aNewSnap.Top()-rSnap.Top()));
2075  } else {
2076  NbcSetSnapRect(aNewSnap);
2077  }
2078  }
2079 
2080  if (const SdrShearAngleItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_SHEARANGLE))
2081  {
2082  Degree100 n = pPoolItem->GetValue();
2083  n-=GetShearAngle();
2084  if (n) {
2085  double nTan = tan(toRadians(n));
2086  NbcShear(aRef1,n,nTan,false);
2087  }
2088  }
2089  if (const SdrAngleItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ROTATEANGLE))
2090  {
2091  Degree100 n = pPoolItem->GetValue();
2092  n-=GetRotateAngle();
2093  if (n) {
2094  NbcRotate(aRef1,n);
2095  }
2096  }
2097  if (const SdrRotateOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ROTATEONE))
2098  {
2099  Degree100 n = pPoolItem->GetValue();
2100  NbcRotate(aRef1,n);
2101  }
2102  if (const SdrHorzShearOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_HORZSHEARONE))
2103  {
2104  Degree100 n = pPoolItem->GetValue();
2105  double nTan = tan(toRadians(n));
2106  NbcShear(aRef1,n,nTan,false);
2107  }
2108  if (const SdrVertShearOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_VERTSHEARONE))
2109  {
2110  Degree100 n = pPoolItem->GetValue();
2111  double nTan = tan(toRadians(n));
2112  NbcShear(aRef1,n,nTan,true);
2113  }
2114 
2115  if (const SdrYesNoItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJMOVEPROTECT))
2116  {
2117  bool b = pPoolItem->GetValue();
2118  SetMoveProtect(b);
2119  }
2120  if (const SdrYesNoItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJSIZEPROTECT))
2121  {
2122  bool b = pPoolItem->GetValue();
2123  SetResizeProtect(b);
2124  }
2125 
2126  /* move protect always sets size protect */
2127  if( IsMoveProtect() )
2128  SetResizeProtect( true );
2129 
2130  if (const SdrObjPrintableItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJPRINTABLE))
2131  {
2132  bool b = pPoolItem->GetValue();
2133  SetPrintable(b);
2134  }
2135 
2136  if (const SdrObjVisibleItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJVISIBLE))
2137  {
2138  bool b = pPoolItem->GetValue();
2139  SetVisible(b);
2140  }
2141 
2143  if (const SdrLayerIdItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LAYERID))
2144  {
2145  nLayer = pPoolItem->GetValue();
2146  }
2147  if (const SdrLayerNameItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LAYERNAME))
2148  {
2149  OUString aLayerName = pPoolItem->GetValue();
2150  const SdrLayerAdmin& rLayAd(nullptr != getSdrPageFromSdrObject()
2151  ? getSdrPageFromSdrObject()->GetLayerAdmin()
2152  : getSdrModelFromSdrObject().GetLayerAdmin());
2153  const SdrLayer* pLayer = rLayAd.GetLayer(aLayerName);
2154 
2155  if(nullptr != pLayer)
2156  {
2157  nLayer=pLayer->GetID();
2158  }
2159  }
2160  if (nLayer!=SDRLAYER_NOTFOUND) {
2161  NbcSetLayer(nLayer);
2162  }
2163 
2164  if (const SfxStringItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJECTNAME))
2165  {
2166  OUString aName = pPoolItem->GetValue();
2167  SetName(aName);
2168  }
2169  tools::Rectangle aNewLogic(rLogic);
2170  if (const SdrLogicSizeWidthItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LOGICSIZEWIDTH))
2171  {
2172  tools::Long n = pPoolItem->GetValue();
2173  aNewLogic.SetRight(aNewLogic.Left()+n );
2174  }
2175  if (const SdrLogicSizeHeightItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LOGICSIZEHEIGHT))
2176  {
2177  tools::Long n = pPoolItem->GetValue();
2178  aNewLogic.SetBottom(aNewLogic.Top()+n );
2179  }
2180  if (aNewLogic!=rLogic) {
2181  NbcSetLogicRect(aNewLogic);
2182  }
2183  Fraction aResizeX(1,1);
2184  Fraction aResizeY(1,1);
2185  if (const SdrResizeXOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEXONE))
2186  {
2187  aResizeX *= pPoolItem->GetValue();
2188  }
2189  if (const SdrResizeYOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEYONE))
2190  {
2191  aResizeY *= pPoolItem->GetValue();
2192  }
2193  if (aResizeX!=Fraction(1,1) || aResizeY!=Fraction(1,1)) {
2194  NbcResize(aRef1,aResizeX,aResizeY);
2195  }
2196 }
2197 
2199 {
2200  const tools::Rectangle& rSnap=GetSnapRect();
2201  const tools::Rectangle& rLogic=GetLogicRect();
2205  rAttr.Put(SdrObjVisibleItem(IsVisible()));
2208  rAttr.Put(SdrOneSizeWidthItem(rSnap.GetWidth()-1));
2209  rAttr.Put(SdrOneSizeHeightItem(rSnap.GetHeight()-1));
2210  rAttr.Put(SdrOnePositionXItem(rSnap.Left()));
2211  rAttr.Put(SdrOnePositionYItem(rSnap.Top()));
2212  if (rLogic.GetWidth()!=rSnap.GetWidth()) {
2213  rAttr.Put(SdrLogicSizeWidthItem(rLogic.GetWidth()-1));
2214  }
2215  if (rLogic.GetHeight()!=rSnap.GetHeight()) {
2216  rAttr.Put(SdrLogicSizeHeightItem(rLogic.GetHeight()-1));
2217  }
2218  OUString aName(GetName());
2219 
2220  if (!aName.isEmpty())
2221  {
2222  rAttr.Put(SfxStringItem(SDRATTR_OBJECTNAME, aName));
2223  }
2224 
2225  rAttr.Put(SdrLayerIdItem(GetLayer()));
2226  const SdrLayerAdmin& rLayAd(nullptr != getSdrPageFromSdrObject()
2227  ? getSdrPageFromSdrObject()->GetLayerAdmin()
2228  : getSdrModelFromSdrObject().GetLayerAdmin());
2229  const SdrLayer* pLayer = rLayAd.GetLayerPerID(GetLayer());
2230  if(nullptr != pLayer)
2231  {
2232  rAttr.Put(SdrLayerNameItem(pLayer->GetName()));
2233  }
2234  Point aRef1(rSnap.Center());
2235  Point aRef2(aRef1); aRef2.AdjustY( 1 );
2236  rAttr.Put(SdrTransformRef1XItem(aRef1.X()));
2237  rAttr.Put(SdrTransformRef1YItem(aRef1.Y()));
2238  rAttr.Put(SdrTransformRef2XItem(aRef2.X()));
2239  rAttr.Put(SdrTransformRef2YItem(aRef2.Y()));
2240 }
2241 
2243 {
2244  return GetProperties().GetStyleSheet();
2245 }
2246 
2247 void SdrObject::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
2248 {
2249  tools::Rectangle aBoundRect0;
2250 
2251  if(m_pUserCall)
2252  aBoundRect0 = GetLastBoundRect();
2253 
2254  InternalSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, true);
2255  SetChanged();
2258 }
2259 
2260 void SdrObject::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
2261 {
2262  InternalSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, false);
2263 }
2264 
2265 void SdrObject::InternalSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast)
2266 {
2267  GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
2268 }
2269 
2270 // Broadcasting while setting attributes is managed by the AttrObj.
2271 
2272 
2274 {
2275  // #i41936# Use SnapRect for default GluePoints
2276  const tools::Rectangle aR(GetSnapRect());
2277  Point aPt;
2278 
2279  switch(nPosNum)
2280  {
2281  case 0 : aPt = aR.TopCenter(); break;
2282  case 1 : aPt = aR.RightCenter(); break;
2283  case 2 : aPt = aR.BottomCenter(); break;
2284  case 3 : aPt = aR.LeftCenter(); break;
2285  }
2286 
2287  aPt -= aR.Center();
2288  SdrGluePoint aGP(aPt);
2289  aGP.SetPercent(false);
2290 
2291  return aGP;
2292 }
2293 
2295 {
2297  Point aPt;
2298  switch (nPosNum) {
2299  case 0 : aPt=aR.TopLeft(); break;
2300  case 1 : aPt=aR.TopRight(); break;
2301  case 2 : aPt=aR.BottomRight(); break;
2302  case 3 : aPt=aR.BottomLeft(); break;
2303  }
2304  aPt-=GetSnapRect().Center();
2305  SdrGluePoint aGP(aPt);
2306  aGP.SetPercent(false);
2307  return aGP;
2308 }
2309 
2311 {
2312  if (m_pPlusData!=nullptr) return m_pPlusData->pGluePoints.get();
2313  return nullptr;
2314 }
2315 
2316 
2318 {
2319  ImpForcePlusData();
2320  if (m_pPlusData->pGluePoints==nullptr) {
2321  m_pPlusData->pGluePoints.reset(new SdrGluePointList);
2322  }
2323  return m_pPlusData->pGluePoints.get();
2324 }
2325 
2327 {
2328  // First a const call to see whether there are any gluepoints.
2329  // Force const call!
2330  if (GetGluePointList()!=nullptr) {
2332  pGPL->SetReallyAbsolute(bOn,*this);
2333  }
2334 }
2335 
2336 void SdrObject::NbcRotateGluePoints(const Point& rRef, Degree100 nAngle, double sn, double cs)
2337 {
2338  // First a const call to see whether there are any gluepoints.
2339  // Force const call!
2340  if (GetGluePointList()!=nullptr) {
2342  pGPL->Rotate(rRef,nAngle,sn,cs,this);
2343  }
2344 }
2345 
2346 void SdrObject::NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2)
2347 {
2348  // First a const call to see whether there are any gluepoints.
2349  // Force const call!
2350  if (GetGluePointList()!=nullptr) {
2352  pGPL->Mirror(rRef1,rRef2,this);
2353  }
2354 }
2355 
2356 void SdrObject::NbcShearGluePoints(const Point& rRef, double tn, bool bVShear)
2357 {
2358  // First a const call to see whether there are any gluepoints.
2359  // Force const call!
2360  if (GetGluePointList()!=nullptr) {
2362  pGPL->Shear(rRef,tn,bVShear,this);
2363  }
2364 }
2365 
2366 void SdrObject::ConnectToNode(bool /*bTail1*/, SdrObject* /*pObj*/)
2367 {
2368 }
2369 
2370 void SdrObject::DisconnectFromNode(bool /*bTail1*/)
2371 {
2372 }
2373 
2375 {
2376  return nullptr;
2377 }
2378 
2379 
2382  basegfx::B2DPolygonVector& rExtractedHairlines,
2383  basegfx::B2DPolyPolygonVector& rExtractedLineFills)
2384 {
2385  rExtractedHairlines.clear();
2386  rExtractedLineFills.clear();
2387 
2388  if(rxSequence.empty())
2389  return;
2390 
2391  // use neutral ViewInformation
2392  const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
2393 
2394  // create extractor, process and get result
2395  drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D);
2396  aExtractor.process(rxSequence);
2397 
2398  // copy line results
2399  rExtractedHairlines = aExtractor.getExtractedHairlines();
2400 
2401  // copy fill rsults
2402  rExtractedLineFills = aExtractor.getExtractedLineFills();
2403 }
2404 
2405 
2407 {
2408  SdrObject* pRetval(nullptr);
2409 
2411  {
2412  basegfx::B2DPolyPolygon aMergedLineFillPolyPolygon;
2413  basegfx::B2DPolyPolygon aMergedHairlinePolyPolygon;
2416 
2417  if(!xSequence.empty())
2418  {
2419  basegfx::B2DPolygonVector aExtractedHairlines;
2420  basegfx::B2DPolyPolygonVector aExtractedLineFills;
2421 
2422  extractLineContourFromPrimitive2DSequence(xSequence, aExtractedHairlines, aExtractedLineFills);
2423 
2424  // for SdrObject creation, just copy all to a single Hairline-PolyPolygon
2425  for(const basegfx::B2DPolygon & rExtractedHairline : aExtractedHairlines)
2426  {
2427  aMergedHairlinePolyPolygon.append(rExtractedHairline);
2428  }
2429 
2430  // check for fill rsults
2431  if (!aExtractedLineFills.empty() && !utl::ConfigManager::IsFuzzing())
2432  {
2433  // merge to a single tools::PolyPolygon (OR)
2434  aMergedLineFillPolyPolygon = basegfx::utils::mergeToSinglePolyPolygon(std::move(aExtractedLineFills));
2435  }
2436  }
2437 
2438  if(aMergedLineFillPolyPolygon.count() || (bForceLineDash && aMergedHairlinePolyPolygon.count()))
2439  {
2440  SfxItemSet aSet(GetMergedItemSet());
2441  drawing::FillStyle eOldFillStyle = aSet.Get(XATTR_FILLSTYLE).GetValue();
2442  SdrPathObj* aLinePolygonPart = nullptr;
2443  SdrPathObj* aLineHairlinePart = nullptr;
2444  bool bBuildGroup(false);
2445 
2446  if(aMergedLineFillPolyPolygon.count())
2447  {
2448  // create SdrObject for filled line geometry
2449  aLinePolygonPart = new SdrPathObj(
2452  aMergedLineFillPolyPolygon);
2453 
2454  // correct item properties
2455  aSet.Put(XLineWidthItem(0));
2456  aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
2457  Color aColorLine = aSet.Get(XATTR_LINECOLOR).GetColorValue();
2458  sal_uInt16 nTransLine = aSet.Get(XATTR_LINETRANSPARENCE).GetValue();
2459  aSet.Put(XFillColorItem(OUString(), aColorLine));
2460  aSet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
2461  aSet.Put(XFillTransparenceItem(nTransLine));
2462 
2463  aLinePolygonPart->SetMergedItemSet(aSet);
2464  }
2465 
2466  if(aMergedHairlinePolyPolygon.count())
2467  {
2468  // create SdrObject for hairline geometry
2469  // OBJ_PATHLINE is necessary here, not OBJ_PATHFILL. This is intended
2470  // to get a non-filled object. If the poly is closed, the PathObj takes care for
2471  // the correct closed state.
2472  aLineHairlinePart = new SdrPathObj(
2475  aMergedHairlinePolyPolygon);
2476 
2477  aSet.Put(XLineWidthItem(0));
2478  aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
2479  aSet.Put(XLineStyleItem(drawing::LineStyle_SOLID));
2480 
2481  // it is also necessary to switch off line start and ends here
2482  aSet.Put(XLineStartWidthItem(0));
2483  aSet.Put(XLineEndWidthItem(0));
2484 
2485  aLineHairlinePart->SetMergedItemSet(aSet);
2486 
2487  if(aLinePolygonPart)
2488  {
2489  bBuildGroup = true;
2490  }
2491  }
2492 
2493  // check if original geometry should be added (e.g. filled and closed)
2494  bool bAddOriginalGeometry(false);
2495  SdrPathObj* pPath = dynamic_cast<SdrPathObj*>(this);
2496 
2497  if(pPath && pPath->IsClosed())
2498  {
2499  if(eOldFillStyle != drawing::FillStyle_NONE)
2500  {
2501  bAddOriginalGeometry = true;
2502  }
2503  }
2504 
2505  // do we need a group?
2506  if(bBuildGroup || bAddOriginalGeometry)
2507  {
2509 
2510  if(bAddOriginalGeometry)
2511  {
2512  // Add a clone of the original geometry.
2513  aSet.ClearItem();
2514  aSet.Put(GetMergedItemSet());
2515  aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
2516  aSet.Put(XLineWidthItem(0));
2517 
2519  pClone->SetMergedItemSet(aSet);
2520 
2521  pGroup->GetSubList()->NbcInsertObject(pClone);
2522  }
2523 
2524  if(aLinePolygonPart)
2525  {
2526  pGroup->GetSubList()->NbcInsertObject(aLinePolygonPart);
2527  }
2528 
2529  if(aLineHairlinePart)
2530  {
2531  pGroup->GetSubList()->NbcInsertObject(aLineHairlinePart);
2532  }
2533 
2534  pRetval = pGroup;
2535  }
2536  else
2537  {
2538  if(aLinePolygonPart)
2539  {
2540  pRetval = aLinePolygonPart;
2541  }
2542  else if(aLineHairlinePart)
2543  {
2544  pRetval = aLineHairlinePart;
2545  }
2546  }
2547  }
2548  }
2549 
2550  if(nullptr == pRetval)
2551  {
2552  // due to current method usage, create and return a clone when nothing has changed
2554  pRetval = pClone;
2555  }
2556 
2557  return pRetval;
2558 }
2559 
2560 
2562 {
2563  m_bMarkProt = bProt;
2564 }
2565 
2566 
2568 {
2569  m_bEmptyPresObj = bEpt;
2570 }
2571 
2572 
2574 {
2575  m_bNotVisibleAsMaster=bFlg;
2576 }
2577 
2578 
2579 // convert this path object to contour object, even when it is a group
2580 SdrObject* SdrObject::ConvertToContourObj(SdrObject* pRet, bool bForceLineDash) const
2581 {
2582  if(dynamic_cast<const SdrObjGroup*>( pRet) != nullptr)
2583  {
2584  SdrObjList* pObjList2 = pRet->GetSubList();
2586 
2587  for(size_t a=0; a<pObjList2->GetObjCount(); ++a)
2588  {
2589  SdrObject* pIterObj = pObjList2->GetObj(a);
2590  pGroup->GetSubList()->NbcInsertObject(ConvertToContourObj(pIterObj, bForceLineDash));
2591  }
2592 
2593  pRet = pGroup;
2594  }
2595  else
2596  {
2597  if (SdrPathObj *pPathObj = dynamic_cast<SdrPathObj*>(pRet))
2598  {
2599  // bezier geometry got created, even for straight edges since the given
2600  // object is a result of DoConvertToPolyObj. For conversion to contour
2601  // this is not really needed and can be reduced again AFAP
2602  pPathObj->SetPathPoly(basegfx::utils::simplifyCurveSegments(pPathObj->GetPathPoly()));
2603  }
2604 
2605  pRet = pRet->ImpConvertToContourObj(bForceLineDash);
2606  }
2607 
2608  // #i73441# preserve LayerID
2609  if(pRet && pRet->GetLayer() != GetLayer())
2610  {
2611  pRet->SetLayer(GetLayer());
2612  }
2613 
2614  return pRet;
2615 }
2616 
2617 
2618 SdrObjectUniquePtr SdrObject::ConvertToPolyObj(bool bBezier, bool bLineToArea) const
2619 {
2620  SdrObjectUniquePtr pRet = DoConvertToPolyObj(bBezier, true);
2621 
2622  if(pRet && bLineToArea)
2623  {
2624  SdrObject* pNewRet = ConvertToContourObj(pRet.get());
2625  pRet.reset(pNewRet);
2626  }
2627 
2628  // #i73441# preserve LayerID
2629  if(pRet && pRet->GetLayer() != GetLayer())
2630  {
2631  pRet->SetLayer(GetLayer());
2632  }
2633 
2634  return pRet;
2635 }
2636 
2637 
2638 SdrObjectUniquePtr SdrObject::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) const
2639 {
2640  return nullptr;
2641 }
2642 
2643 
2645 {
2646  const bool bIsInserted(nullptr != getParentSdrObjListFromSdrObject());
2647  const tools::Rectangle aBoundRect0(GetLastBoundRect());
2648 
2649  if(bIsInserted)
2650  {
2652  }
2653  else
2654  {
2655  SendUserCall(SdrUserCallType::Removed, aBoundRect0);
2656  }
2657 
2658  if(nullptr != m_pPlusData && nullptr != m_pPlusData->pBroadcast)
2659  {
2660  SdrHint aHint(bIsInserted ? SdrHintKind::ObjectInserted : SdrHintKind::ObjectRemoved, *this);
2661  m_pPlusData->pBroadcast->Broadcast(aHint);
2662  }
2663 }
2664 
2666 {
2667  if(IsMoveProtect() != bProt)
2668  {
2669  // #i77187# secured and simplified
2670  m_bMovProt = bProt;
2671  SetChanged();
2673  }
2674 }
2675 
2677 {
2678  if(IsResizeProtect() != bProt)
2679  {
2680  // #i77187# secured and simplified
2681  m_bSizProt = bProt;
2682  SetChanged();
2684  }
2685 }
2686 
2688 {
2689  if( bPrn == m_bNoPrint )
2690  {
2691  m_bNoPrint=!bPrn;
2692  SetChanged();
2693  if (IsInserted())
2694  {
2695  SdrHint aHint(SdrHintKind::ObjectChange, *this);
2697  }
2698  }
2699 }
2700 
2701 void SdrObject::SetVisible(bool bVisible)
2702 {
2703  if( bVisible != mbVisible )
2704  {
2705  mbVisible = bVisible;
2706  SetChanged();
2707  if (IsInserted())
2708  {
2709  SdrHint aHint(SdrHintKind::ObjectChange, *this);
2711  }
2712  }
2713 }
2714 
2715 
2717 {
2718  if (m_pPlusData==nullptr || m_pPlusData->pUserDataList==nullptr) return 0;
2719  return m_pPlusData->pUserDataList->GetUserDataCount();
2720 }
2721 
2723 {
2724  if (m_pPlusData==nullptr || m_pPlusData->pUserDataList==nullptr) return nullptr;
2725  return &m_pPlusData->pUserDataList->GetUserData(nNum);
2726 }
2727 
2728 void SdrObject::AppendUserData(std::unique_ptr<SdrObjUserData> pData)
2729 {
2730  if (!pData)
2731  {
2732  OSL_FAIL("SdrObject::AppendUserData(): pData is NULL pointer.");
2733  return;
2734  }
2735 
2736  ImpForcePlusData();
2737  if (!m_pPlusData->pUserDataList)
2738  m_pPlusData->pUserDataList.reset( new SdrObjUserDataList );
2739 
2740  m_pPlusData->pUserDataList->AppendUserData(std::move(pData));
2741 }
2742 
2743 void SdrObject::DeleteUserData(sal_uInt16 nNum)
2744 {
2745  sal_uInt16 nCount=GetUserDataCount();
2746  if (nNum<nCount) {
2747  m_pPlusData->pUserDataList->DeleteUserData(nNum);
2748  if (nCount==1) {
2749  m_pPlusData->pUserDataList.reset();
2750  }
2751  } else {
2752  OSL_FAIL("SdrObject::DeleteUserData(): Invalid Index.");
2753  }
2754 }
2755 
2757 {
2758  m_pUserCall = pUser;
2759 }
2760 
2761 
2762 void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& rBoundRect) const
2763 {
2765 
2766  if ( m_pUserCall )
2767  {
2768  m_pUserCall->Changed( *this, eUserCall, rBoundRect );
2769  }
2770 
2771  if(nullptr != pGroup && pGroup->GetUserCall())
2772  {
2773  // broadcast to group
2775 
2776  switch( eUserCall )
2777  {
2779  eChildUserType = SdrUserCallType::ChildMoveOnly;
2780  break;
2781 
2783  eChildUserType = SdrUserCallType::ChildResize;
2784  break;
2785 
2787  eChildUserType = SdrUserCallType::ChildChangeAttr;
2788  break;
2789 
2791  eChildUserType = SdrUserCallType::ChildDelete;
2792  break;
2793 
2795  eChildUserType = SdrUserCallType::ChildInserted;
2796  break;
2797 
2799  eChildUserType = SdrUserCallType::ChildRemoved;
2800  break;
2801 
2802  default: break;
2803  }
2804 
2805  pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect );
2806  }
2807 
2808  // notify our UNO shape listeners
2809  switch ( eUserCall )
2810  {
2813  [[fallthrough]]; // RESIZE might also imply a change of the position
2816  break;
2817  default:
2818  // not interested in
2819  break;
2820  }
2821 }
2822 
2823 void SdrObject::setUnoShape( const uno::Reference< drawing::XShape >& _rxUnoShape )
2824 {
2825  const uno::Reference< uno::XInterface>& xOldUnoShape( maWeakUnoShape );
2826  // the UNO shape would be gutted by the following code; return early
2827  if ( _rxUnoShape == xOldUnoShape )
2828  {
2829  if ( !xOldUnoShape.is() )
2830  {
2831  // make sure there is no stale impl. pointer if the UNO
2832  // shape was destroyed meanwhile (remember we only hold weak
2833  // reference to it!)
2834  mpSvxShape = nullptr;
2835  }
2836  return;
2837  }
2838 
2839  bool bTransferOwnership( false );
2840  if ( xOldUnoShape.is() )
2841  {
2842  bTransferOwnership = mpSvxShape->HasSdrObjectOwnership();
2843  // Remove yourself from the current UNO shape. Its destructor
2844  // will reset our UNO shape otherwise.
2846  }
2847 
2848  maWeakUnoShape = _rxUnoShape;
2849  mpSvxShape = comphelper::getFromUnoTunnel<SvxShape>( _rxUnoShape );
2850 
2851  // I think this may never happen... But I am not sure enough .-)
2852  if ( bTransferOwnership )
2853  {
2854  if (mpSvxShape)
2856  SAL_WARN( "svx.uno", "a UNO shape took over an SdrObject previously owned by another UNO shape!");
2857  }
2858 }
2859 
2862 {
2864  // retrieving the impl pointer and subsequently using it is not thread-safe, of course, so it needs to be
2865  // guarded by the SolarMutex
2866 
2867  uno::Reference< uno::XInterface > xShape( maWeakUnoShape );
2868 #if OSL_DEBUG_LEVEL > 0
2869  OSL_ENSURE( !( !xShape.is() && mpSvxShape ),
2870  "SdrObject::getSvxShape: still having IMPL-Pointer to dead object!" );
2871 #endif
2872  //#113608#, make sure mpSvxShape is always synchronized with maWeakUnoShape
2873  if ( mpSvxShape && !xShape.is() )
2874  mpSvxShape = nullptr;
2875 
2876  return mpSvxShape;
2877 }
2878 
2879 css::uno::Reference< css::drawing::XShape > SdrObject::getUnoShape()
2880 {
2881  // try weak reference first
2882  uno::Reference< css::drawing::XShape > xShape( getWeakUnoShape() );
2883  if( xShape )
2884  return xShape;
2885 
2886  OSL_ENSURE( mpSvxShape == nullptr, "SdrObject::getUnoShape: XShape already dead, but still an IMPL pointer!" );
2887 
2888  // try to access SdrPage from this SdrObject. This will only exist if the SdrObject is
2889  // inserted in a SdrObjList (page/group/3dScene)
2890  SdrPage* pPageCandidate(getSdrPageFromSdrObject());
2891 
2892  // tdf#12152, tdf#120728
2893  //
2894  // With the paradigm change to only get a SdrPage for a SdrObject when the SdrObject
2895  // is *inserted*, the functionality for creating 1:1 associated UNO API implementation
2896  // SvxShapes was partially broken: The used ::CreateShape relies on the SvxPage being
2897  // derived and the CreateShape method overloaded, implementing additional SdrInventor
2898  // types as needed.
2899  //
2900  // The fallback to use SvxDrawPage::CreateShapeByTypeAndInventor is a trap: It's only
2901  // a static fallback that handles the SdrInventor types SdrInventor::E3d and
2902  // SdrInventor::Default. Due to that, e.g. the ReportDesigner broke in various conditions.
2903  //
2904  // That again has to do with the ReportDesigner being implemented using the UNO API
2905  // aspects of SdrObjects early during their construction, not just after these are
2906  // inserted to a SdrPage - but that is not illegal or wrong, the SdrObject exists already.
2907  //
2908  // As a current solution, use the (now always available) SdrModel and any of the
2909  // existing SdrPages. The only important thing is to get a SdrPage where ::CreateShape is
2910  // overloaded and implemented as needed.
2911  //
2912  // Note for the future:
2913  // In a more ideal world there would be only one factory method for creating SdrObjects (not
2914  // ::CreateShape and ::CreateShapeByTypeAndInventor). This also would not be placed at
2915  // SdrPage/SvxPage at all, but at the Model where it belongs - where else would you expect
2916  // objects for the current Model to be constructed? To have this at the Page only would make
2917  // sense if different shapes would need to be constructed for different Pages in the same Model
2918  // - this is never the case.
2919  // At that Model extended functionality for that factory (or overloads and implementations)
2920  // should be placed. But to be realistic, migrating the factories to Model now is too much
2921  // work - maybe over time when melting SdrObject/SvxObject one day...
2922  //
2923  // More Note (added by noel grandin)
2924  // Except that sd/ is being naughty and doing all kinds of magic during CreateShape that
2925  // requires knowing which page the object is being created for. Fixing that would require
2926  // moving a bunch of nasty logic from object creation time, to the point in time when
2927  // it is actually added to a page.
2928  if(nullptr == pPageCandidate)
2929  {
2930  // If not inserted, alternatively access a SdrPage using the SdrModel. There is
2931  // no reason not to create and return a UNO API XShape when the SdrObject is not
2932  // inserted - it may be in construction. Main paradigm is that it exists.
2933  if(0 != getSdrModelFromSdrObject().GetPageCount())
2934  {
2935  // Take 1st SdrPage. That may be e.g. a special page (in SD), but the
2936  // to-be-used method ::CreateShape will be correctly overloaded in
2937  // all cases
2938  pPageCandidate = getSdrModelFromSdrObject().GetPage(0);
2939  }
2940  }
2941 
2942  if(nullptr != pPageCandidate)
2943  {
2944  uno::Reference< uno::XInterface > xPage(pPageCandidate->getUnoPage());
2945  if( xPage.is() )
2946  {
2947  SvxDrawPage* pDrawPage = comphelper::getFromUnoTunnel<SvxDrawPage>(xPage);
2948  if( pDrawPage )
2949  {
2950  // create one
2951  xShape = pDrawPage->CreateShape( this );
2952  setUnoShape( xShape );
2953  }
2954  }
2955  }
2956  else
2957  {
2958  // Fallback to static base functionality. CAUTION: This will only support
2959  // the most basic stuff like SdrInventor::E3d and SdrInventor::Default. All
2960  // the other SdrInventor enum entries are from overloads and are *not accessible*
2961  // using this fallback (!) - what a bad trap
2963  mpSvxShape = xNewShape.get();
2964  maWeakUnoShape = xShape = mpSvxShape;
2965  }
2966 
2967  return xShape;
2968 }
2969 
2971 {
2973 
2974  SvxShape* pSvxShape = getSvxShape();
2975  ENSURE_OR_THROW( pSvxShape, "no SvxShape, yet!" );
2976  return pSvxShape->getShapePropertyChangeNotifier();
2977 }
2978 
2980 {
2982 
2983  SvxShape* pSvxShape = const_cast< SdrObject* >( this )->getSvxShape();
2984  if ( pSvxShape )
2985  return pSvxShape->getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty );
2986 }
2987 
2988 
2989 // transformation interface for StarOfficeAPI. This implements support for
2990 // homogeneous 3x3 matrices containing the transformation of the SdrObject. At the
2991 // moment it contains a shearX, rotation and translation, but for setting all linear
2992 // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
2993 
2994 
2995 // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
2996 // with the base geometry and returns TRUE. Otherwise it returns FALSE.
2998 {
2999  // any kind of SdrObject, just use SnapRect
3000  tools::Rectangle aRectangle(GetSnapRect());
3001 
3002  // convert to transformation values
3003  basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
3004  basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
3005 
3006  // position maybe relative to anchorpos, convert
3008  {
3009  if(GetAnchorPos().X() || GetAnchorPos().Y())
3010  {
3011  aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
3012  }
3013  }
3014 
3015  // build matrix
3016  rMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix(aScale, aTranslate);
3017 
3018  return false;
3019 }
3020 
3021 // sets the base geometry of the object using infos contained in the homogeneous 3x3 matrix.
3022 // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
3023 // to use (0,0) as upper left and will be scaled to the given size in the matrix.
3025 {
3026  // break up matrix
3027  basegfx::B2DTuple aScale;
3028  basegfx::B2DTuple aTranslate;
3029  double fRotate, fShearX;
3030  rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
3031 
3032  // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
3033  // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
3034  if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
3035  {
3036  aScale.setX(fabs(aScale.getX()));
3037  aScale.setY(fabs(aScale.getY()));
3038  }
3039 
3040  // if anchor is used, make position relative to it
3042  {
3043  if(GetAnchorPos().X() || GetAnchorPos().Y())
3044  {
3045  aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
3046  }
3047  }
3048 
3049  // build BaseRect
3050  Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
3051  tools::Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
3052 
3053  // set BaseRect
3054  SetSnapRect(aBaseRect);
3055 }
3056 
3057 // Give info if object is in destruction
3059 {
3061 }
3062 
3063 // return if fill is != drawing::FillStyle_NONE
3065 {
3066  return GetObjectItem(XATTR_FILLSTYLE).GetValue() != drawing::FillStyle_NONE;
3067 }
3068 
3070 {
3071  return GetObjectItem(XATTR_LINESTYLE).GetValue() != drawing::LineStyle_NONE;
3072 }
3073 
3074 
3075 // #i52224#
3076 // on import of OLE object from MS documents the BLIP size might be retrieved,
3077 // the following four methods are used to control it;
3078 // usually this data makes no sense after the import is finished, since the object
3079 // might be resized
3080 
3081 
3083 {
3084  maBLIPSizeRectangle = aRect;
3085 }
3086 
3087 void SdrObject::SetContextWritingMode( const sal_Int16 /*_nContextWritingMode*/ )
3088 {
3089  // this base class does not support different writing modes, so ignore the call
3090 }
3091 
3093 {
3095 }
3096 
3097 
3098 // #i121917#
3100 {
3101  return false;
3102 }
3103 
3105 {
3106  return false;
3107 }
3108 
3110 {
3111  if (GetName().isEmpty())
3112  {
3113  if (const E3dScene* pE3dObj = dynamic_cast<const E3dScene*>(this))
3114  {
3115  SdrObjList* pObjList = pE3dObj->GetSubList();
3116  if (pObjList)
3117  {
3118  SdrObject* pObj0 = pObjList->GetObj(0);
3119  if (pObj0)
3120  SetName(pObj0->TakeObjNameSingul());
3121  }
3122  }
3123  else
3125  }
3126 
3127  std::unordered_set<OUString> aNameSet;
3128  MakeNameUnique(aNameSet);
3129 }
3130 
3131 void SdrObject::MakeNameUnique(std::unordered_set<OUString>& rNameSet)
3132 {
3133  if (GetName().isEmpty())
3134  return;
3135 
3136  if (rNameSet.empty())
3137  {
3138  SdrPage* pPage;
3139  SdrObject* pObj;
3140  for (sal_uInt16 nPage(0); nPage < mrSdrModelFromSdrObject.GetPageCount(); ++nPage)
3141  {
3142  pPage = mrSdrModelFromSdrObject.GetPage(nPage);
3144  while (aIter.IsMore())
3145  {
3146  pObj = aIter.Next();
3147  if (pObj != this)
3148  rNameSet.insert(pObj->GetName());
3149  }
3150  }
3151  }
3152 
3153  OUString sName(GetName().trim());
3154  OUString sRootName(sName);
3155 
3156  if (!sName.isEmpty() && rtl::isAsciiDigit(sName[sName.getLength() - 1]))
3157  {
3158  sal_Int32 nPos(sName.getLength() - 1);
3159  while (nPos > 0 && rtl::isAsciiDigit(sName[--nPos]));
3160  sRootName = o3tl::trim(sName.subView(0, nPos + 1));
3161  }
3162  else
3163  sName += " 1";
3164 
3165  for (sal_uInt32 n = 1; rNameSet.find(sName) != rNameSet.end(); n++)
3166  sName = sRootName + " " + OUString::number(n);
3167  rNameSet.insert(sName);
3168 
3169  SetName(sName);
3170 }
3171 
3173 {
3174  MapUnit eMapUnit(getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
3175  if(eMapUnit == MapUnit::Map100thMM)
3176  return;
3177 
3178  if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
3179  {
3180  const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo));
3181  rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert));
3182  }
3183  else
3184  {
3185  OSL_FAIL("Missing unit translation to PoolMetric!");
3186  }
3187 }
3188 
3190 {
3191  SdrObjCreatorParams aParams { nInventor, nObjIdentifier, rSdrModel };
3192  for (const auto & i : ImpGetUserMakeObjHdl()) {
3193  SdrObject* pObj = i.Call(aParams);
3194  if (pObj) {
3195  return pObj;
3196  }
3197  }
3198  return nullptr;
3199 }
3200 
3202  SdrModel& rSdrModel,
3203  SdrInventor nInventor,
3204  SdrObjKind nIdentifier,
3205  const tools::Rectangle* pSnapRect)
3206 {
3207  SdrObject* pObj(nullptr);
3208  bool bSetSnapRect(nullptr != pSnapRect);
3209 
3210  if (nInventor == SdrInventor::Default)
3211  {
3212  switch (nIdentifier)
3213  {
3214  case SdrObjKind::Measure:
3215  {
3216  if(nullptr != pSnapRect)
3217  {
3218  pObj = new SdrMeasureObj(
3219  rSdrModel,
3220  pSnapRect->TopLeft(),
3221  pSnapRect->BottomRight());
3222  }
3223  else
3224  {
3225  pObj = new SdrMeasureObj(rSdrModel);
3226  }
3227  }
3228  break;
3229  case SdrObjKind::Line:
3230  {
3231  if(nullptr != pSnapRect)
3232  {
3233  basegfx::B2DPolygon aPoly;
3234 
3235  aPoly.append(
3237  pSnapRect->Left(),
3238  pSnapRect->Top()));
3239  aPoly.append(
3241  pSnapRect->Right(),
3242  pSnapRect->Bottom()));
3243  pObj = new SdrPathObj(
3244  rSdrModel,
3246  basegfx::B2DPolyPolygon(aPoly));
3247  }
3248  else
3249  {
3250  pObj = new SdrPathObj(
3251  rSdrModel,
3253  }
3254  }
3255  break;
3256  case SdrObjKind::Text:
3257  case SdrObjKind::TitleText:
3259  {
3260  if(nullptr != pSnapRect)
3261  {
3262  pObj = new SdrRectObj(
3263  rSdrModel,
3264  nIdentifier,
3265  *pSnapRect);
3266  bSetSnapRect = false;
3267  }
3268  else
3269  {
3270  pObj = new SdrRectObj(
3271  rSdrModel,
3272  nIdentifier);
3273  }
3274  }
3275  break;
3278  case SdrObjKind::CircleArc:
3279  case SdrObjKind::CircleCut:
3280  {
3281  SdrCircKind eCircKind = ToSdrCircKind(nIdentifier);
3282  if(nullptr != pSnapRect)
3283  {
3284  pObj = new SdrCircObj(rSdrModel, eCircKind, *pSnapRect);
3285  bSetSnapRect = false;
3286  }
3287  else
3288  {
3289  pObj = new SdrCircObj(rSdrModel, eCircKind);
3290  }
3291  }
3292  break;
3293  case SdrObjKind::NONE : pObj=new SdrObject(rSdrModel); break;
3294  case SdrObjKind::Group : pObj=new SdrObjGroup(rSdrModel); break;
3295  case SdrObjKind::Polygon : pObj=new SdrPathObj(rSdrModel, SdrObjKind::Polygon ); break;
3296  case SdrObjKind::PolyLine : pObj=new SdrPathObj(rSdrModel, SdrObjKind::PolyLine ); break;
3297  case SdrObjKind::PathLine : pObj=new SdrPathObj(rSdrModel, SdrObjKind::PathLine ); break;
3298  case SdrObjKind::PathFill : pObj=new SdrPathObj(rSdrModel, SdrObjKind::PathFill ); break;
3299  case SdrObjKind::FreehandLine : pObj=new SdrPathObj(rSdrModel, SdrObjKind::FreehandLine ); break;
3300  case SdrObjKind::FreehandFill : pObj=new SdrPathObj(rSdrModel, SdrObjKind::FreehandFill ); break;
3301  case SdrObjKind::PathPoly : pObj=new SdrPathObj(rSdrModel, SdrObjKind::Polygon ); break;
3302  case SdrObjKind::PathPolyLine : pObj=new SdrPathObj(rSdrModel, SdrObjKind::PolyLine ); break;
3303  case SdrObjKind::Edge : pObj=new SdrEdgeObj(rSdrModel); break;
3304  case SdrObjKind::Rectangle : pObj=new SdrRectObj(rSdrModel); break;
3305  case SdrObjKind::Graphic : pObj=new SdrGrafObj(rSdrModel); break;
3306  case SdrObjKind::OLE2 : pObj=new SdrOle2Obj(rSdrModel); break;
3307  case SdrObjKind::OLEPluginFrame : pObj=new SdrOle2Obj(rSdrModel, true); break;
3308  case SdrObjKind::Caption : pObj=new SdrCaptionObj(rSdrModel); break;
3309  case SdrObjKind::Page : pObj=new SdrPageObj(rSdrModel); break;
3310  case SdrObjKind::UNO : pObj=new SdrUnoObj(rSdrModel, OUString()); break;
3311  case SdrObjKind::CustomShape: pObj=new SdrObjCustomShape(rSdrModel); break;
3312 #if HAVE_FEATURE_AVMEDIA
3313  case SdrObjKind::Media : pObj=new SdrMediaObj(rSdrModel); break;
3314 #endif
3315  case SdrObjKind::Table : pObj=new sdr::table::SdrTableObj(rSdrModel); break;
3316  default: break;
3317  }
3318  }
3319 
3320  if (!pObj)
3321  {
3322  pObj = CreateObjectFromFactory(rSdrModel, nInventor, nIdentifier);
3323  }
3324 
3325  if (!pObj)
3326  {
3327  // Well, if no one wants it...
3328  return nullptr;
3329  }
3330 
3331  if(bSetSnapRect && nullptr != pSnapRect)
3332  {
3333  pObj->SetSnapRect(*pSnapRect);
3334  }
3335 
3336  return pObj;
3337 }
3338 
3340 {
3341  std::vector<Link<SdrObjCreatorParams, SdrObject*>>& rLL=ImpGetUserMakeObjHdl();
3342  auto it = std::find(rLL.begin(), rLL.end(), rLink);
3343  if (it != rLL.end()) {
3344  OSL_FAIL("SdrObjFactory::InsertMakeObjectHdl(): Link already in place.");
3345  } else {
3346  rLL.push_back(rLink);
3347  }
3348 }
3349 
3351 {
3352  std::vector<Link<SdrObjCreatorParams, SdrObject*>>& rLL=ImpGetUserMakeObjHdl();
3353  auto it = std::find(rLL.begin(), rLL.end(), rLink);
3354  if (it != rLL.end())
3355  rLL.erase(it);
3356 }
3357 
3358 namespace svx
3359 {
3361  {
3362  }
3363 }
3364 
3365 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void TakeNotPersistAttr(SfxItemSet &rAttr) const
Definition: svdobj.cxx:2198
virtual void Shear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1594
SdrCircKind
Definition: svdocirc.hxx:38
virtual bool HasTextEdit() const
Definition: svdobj.cxx:1751
virtual const SfxItemSet & GetObjectItemSet() const =0
virtual bool BckCreate(SdrDragStat &rStat)
Definition: svdobj.cxx:1405
double getY() const
User data of a drawing object, e.g.
Definition: svdobj.hxx:151
void SetRelativeWidthRelation(sal_Int16 eValue)
Definition: svdobj.cxx:598
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
Definition: svdobj.cxx:1119
bool IsMacroHit(const SdrObjMacroHitRec &rRec) const
Definition: svdobj.cxx:1887
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdobj.cxx:1893
void SetNavigationPosition(const sal_uInt32 nPosition)
Definition: svdobj.cxx:939
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
Definition: svdobj.cxx:654
static std::unique_ptr< SdrUndoAction > CreateUndoObjectStrAttr(SdrObject &rObject, SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType, const OUString &sOldStr, const OUString &sNewStr)
Definition: svdundo.cxx:1787
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
OLE object.
svx::PropertyChangeNotifier & getShapePropertyChangeNotifier()
Definition: svdobj.cxx:2970
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:949
std::optional< double > mnRelativeHeight
Definition: svdobj.cxx:193
virtual bool BegCreate(SdrDragStat &rStat)
Every object must be able to create itself interactively.
Definition: svdobj.cxx:1374
void Set(SdrLayerID a)
Definition: svdsob.hxx:47
SfxItemPool & GetObjectItemPool() const
Definition: svdobj.cxx:639
bool m_bNoPrint
Definition: svdobj.hxx:957
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true)
Definition: svdobj.cxx:1546
bool mbVisible
Definition: svdobj.hxx:958
static SVX_DLLPRIVATE SdrObject * CreateObjectFromFactory(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nIdentifier)
Definition: svdobj.cxx:3189
void SetResizeProtect(bool bProt)
Definition: svdobj.cxx:2676
void SetPoint(const Point &rPnt, sal_uInt32 i)
Definition: svdobj.cxx:1738
struct _xmlTextWriter * xmlTextWriterPtr
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const
Definition: svdobj.cxx:1361
constexpr TypedWhichId< SdrTransformRef1XItem > SDRATTR_TRANSFORMREF1X(SDRATTR_NOTPERSIST_FIRST+30)
void DelReference(SdrVirtObj &rVrtObj)
Definition: svdobj.cxx:728
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage)
Definition: svdobj.cxx:524
sal_uInt32 m_nOrdNum
Definition: svdobj.hxx:952
void SetName(const OUString &rStr, const bool bSetChanged=true)
Definition: svdobj.cxx:755
virtual SdrObjList * getChildrenOfSdrObject() const
Definition: svdobj.cxx:310
bool m_bClosedObj
Definition: svdobj.hxx:902
virtual bool IsPolyObj() const
Definition: svdobj.cxx:1723
media shape
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact)
Definition: svdobj.cxx:1433
OUString GetMetrStr(tools::Long nVal) const
Definition: svdobj.cxx:1114
bool m_bSizProt
Definition: svdobj.hxx:892
void RemoveObjectUser(sdr::ObjectUser &rOldUser)
Definition: svdobj.cxx:233
constexpr tools::Long Left() const
const Point & GetStart() const
Definition: svddrag.hxx:102
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs)
Definition: svdobj.cxx:1463
SdrHdlKind
Definition: svdhdl.hxx:52
constexpr Point RightCenter() const
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties()
Definition: svdobj.cxx:205
std::vector< Link< SdrObjCreatorParams, SdrObject * > > & ImpGetUserMakeObjHdl()
Definition: svdetc.cxx:354
constexpr TypedWhichId< SdrObjPrintableItem > SDRATTR_OBJPRINTABLE(SDRATTR_NOTPERSIST_FIRST+2)
long Long
bool IsInDestruction() const
Definition: svdobj.cxx:3058
constexpr TypedWhichId< SdrMoveYItem > SDRATTR_MOVEY(SDRATTR_NOTPERSIST_FIRST+19)
void impAddIncarnatedSdrObjectToSdrModel(const SdrObject &rSdrObject, SdrModel &rSdrModel)
Definition: svdobj.cxx:323
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:278
OUString GetDescription() const
Definition: svdobj.cxx:882
bool HasFillStyle() const
Definition: svdobj.cxx:3064
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
virtual Point GetRelativePos() const
Definition: svdobj.cxx:1623
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const
Definition: svdobj.cxx:2638
class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) ObjectContactPainter typedef::std::vector< SdrObject * > SdrObjectVector
void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2247
SdrUserCallType
Definition: svdobj.hxx:113
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1522
sal_Int64 n
periodic cubic Spline (ni)
virtual bool HasText() const
Definition: svdobj.cxx:3099
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:807
const css::uno::WeakReference< css::drawing::XShape > & getWeakUnoShape() const
Definition: svdobj.hxx:870
bool IsInserted() const
Definition: svdobj.hxx:739
virtual bool IsTextBox() const
Is this a textbox of a drawinglayer shape?
Definition: svdobj.cxx:3104
size_t GetObjCount() const
Definition: svdpage.cxx:801
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:316
void SetGlueReallyAbsolute(bool bOn)
Definition: svdobj.cxx:2326
virtual ~SdrObjUserCall()
Definition: svdobj.cxx:131
virtual void addCropHandles(SdrHdlList &rTarget) const
Definition: svdobj.cxx:1246
void SetRelativeHeightRelation(sal_Int16 eValue)
Definition: svdobj.cxx:608
continuously activated OLE (PlugIn-Frame or similar)
virtual bool hasSpecialDrag() const
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdobj.cxx:1322
static SdrObject * MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
Definition: svdobj.cxx:3201
void DrawPolyLine(const tools::Polygon &rPoly)
SdrObjUserData(SdrInventor nInv, sal_uInt16 nId)
Definition: svdobj.cxx:145
static void extractLineContourFromPrimitive2DSequence(const drawinglayer::primitive2d::Primitive2DContainer &rxSequence, basegfx::B2DPolygonVector &rExtractedHairlines, basegfx::B2DPolyPolygonVector &rExtractedLineFills)
Definition: svdobj.cxx:2380
SdrInventor
Definition: svdobj.hxx:99
virtual OUString TakeObjNameSingul() const
Definition: svdobj.cxx:1075
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
const SfxBroadcaster * GetBroadcaster() const
Definition: svdobj.cxx:718
static void InsertMakeObjectHdl(Link< SdrObjCreatorParams, SdrObject * > const &rLink)
Definition: svdobj.cxx:3339
constexpr TypedWhichId< SdrVertShearOneItem > SDRATTR_VERTSHEARONE(SDRATTR_NOTPERSIST_FIRST+24)
constexpr TypedWhichId< SdrYesNoItem > SDRATTR_OBJMOVEPROTECT(SDRATTR_NOTPERSIST_FIRST+0)
constexpr Point BottomCenter() const
tools::Rectangle ImpDragCalcRect(const SdrDragStat &rDrag) const
Definition: svdobj.cxx:1252
tools::Rectangle m_aOutRect
Definition: svdobj.hxx:882
abstract object (SdrObject)
virtual void ConnectToNode(bool bTail1, SdrObject *pObj)
Definition: svdobj.cxx:2366
virtual void AddToHdlList(SdrHdlList &rHdlList) const
Definition: svdobj.cxx:1222
void NbcMirrorGluePoints(const Point &rRef1, const Point &rRef2)
Definition: svdobj.cxx:2346
css::uno::WeakReference< css::drawing::XShape > maWeakUnoShape
Definition: svdobj.hxx:971
void SetEmptyPresObj(bool bEpt)
Definition: svdobj.cxx:2567
open free-hand line
open Bezier-curve
virtual sal_uInt32 GetPointCount() const
Definition: svdobj.cxx:1728
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:471
virtual SdrObjKind GetObjIdentifier() const
Definition: svdobj.cxx:649
virtual ~SdrObject() override
Definition: svdobj.cxx:444
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:210
::std::vector< ObjectUser * > ObjectUserVector
Center
EmbeddedObjectRef * pObject
bool bSizProt
Definition: svdobj.hxx:181
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:173
SVX_DLLPRIVATE void setParentOfSdrObject(SdrObjList *pNew)
Definition: svdobj.cxx:284
void SetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
Definition: svdobj.cxx:1796
static rtl::Reference< SdrItemPool > mpGlobalItemPool
Definition: svdobj.cxx:552
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:738
void BegUndo()
Definition: svdmodel.cxx:368
void AddListener(SfxListener &rListener)
Definition: svdobj.cxx:697
void setX(double fX)
virtual void AddToPlusHdlList(SdrHdlList &rHdlList, SdrHdl &rHdl) const
Definition: svdobj.cxx:1242
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:251
B2DPolyPolygon mergeToSinglePolyPolygon(const B2DPolyPolygonVector &rInput)
virtual void SetGrabBagItem(const css::uno::Any &rVal)
Definition: svdobj.cxx:917
SdrCircKind ToSdrCircKind(SdrObjKind eKind)
Definition: svdocirc.cxx:104
void AddObjectUser(sdr::ObjectUser &rNewUser)
Definition: svdobj.cxx:228
virtual const SfxItemSet & GetMergedItemSet() const
Definition: properties.cxx:53
void ImpSetAnchorPos(const Point &rPnt)
Definition: svdobj.cxx:1628
virtual const tools::Rectangle & GetSnapRect() const
Definition: svdobj.cxx:1660
constexpr TypedWhichId< SdrOneSizeHeightItem > SDRATTR_ONESIZEHEIGHT(SDRATTR_NOTPERSIST_FIRST+13)
void impRemoveIncarnatedSdrObjectToSdrModel(const SdrObject &rSdrObject, SdrModel &rSdrModel)
Definition: svdobj.cxx:327
virtual void ForceStyleToHardAttributes()
Definition: properties.cxx:83
SdrObjKind
Definition: svdobjkind.hxx:24
bool IsVisible() const
Definition: svdobj.hxx:751
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:38
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const
Definition: svdobj.cxx:1850
virtual void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: properties.cxx:59
bool m_bIsEdge
Definition: svdobj.hxx:903
#define SAL_MAX_UINT32
constexpr TypedWhichId< XLineTransparenceItem > XATTR_LINETRANSPARENCE(XATTR_LINE_FIRST+10)
constexpr tools::Long Width() const
Provides information about various ZObject properties.
Definition: svdobj.hxx:195
static rtl::Reference< SfxItemPool > CreatePool()
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:111
SdrObjList * mpParentOfSdrObject
Definition: svdobj.hxx:951
virtual std::unique_ptr< SdrObjGeoData > GetGeoData() const
Definition: svdobj.cxx:1948
void ClearMergedItem(const sal_uInt16 nWhich=0)
Definition: svdobj.cxx:1987
virtual void BrkCreate(SdrDragStat &rStat)
Definition: svdobj.cxx:1401
void reset_preserve_ptr_during(uniqueptr &ptr)
constexpr TypedWhichId< SdrResizeYOneItem > SDRATTR_RESIZEYONE(SDRATTR_NOTPERSIST_FIRST+21)
bool m_bMarkProt
Definition: svdobj.hxx:959
bool IsOrtho() const
Definition: svdsnpv.hxx:246
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd)
Definition: svdobj.cxx:1393
void Mirror(const Point &rRef1, const Point &rRef2, const SdrObject *pObj)
Definition: svdglue.cxx:375
bool IsMore() const
Definition: svditer.hxx:62
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:269
SdrLayerID GetID() const
Definition: svdlayer.hxx:94
virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const
Definition: svdobj.cxx:2273
bool m_bIsUnoObj
Definition: svdobj.hxx:905
virtual Point GetSnapPoint(sal_uInt32 i) const
Definition: svdobj.cxx:1718
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
virtual void SetAnchorPos(const Point &rPnt)
Definition: svdobj.cxx:1640
caption object
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdmodel.cxx:502
constexpr Point BottomLeft() const
static bool IsFuzzing()
measurement object
int nCount
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
constexpr Point TopCenter() const
bool IsClosed() const
Definition: svdopath.hxx:146
bool m_bMovProt
Definition: svdobj.hxx:891
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
Definition: svdobj.cxx:2879
void SetRelativeHeight(double nValue)
Definition: svdobj.cxx:603
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1967
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2242
SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, sal_uInt16 nTol, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer)
virtual SdrPage * getSdrPageFromSdrObjList() const override
Definition: svdpage.cxx:1619
void MakeNameUnique()
Definition: svdobj.cxx:3109
constexpr tools::Long GetWidth() const
void SetOrtho4Possible(bool bOn=true)
Definition: svddrag.hxx:136
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact)
Definition: svdobj.cxx:1565
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1997
void getMergedHierarchySdrLayerIDSet(SdrLayerIDSet &rSet) const
Definition: svdobj.cxx:673
void TakeCreateRect(tools::Rectangle &rRect) const
Definition: svddrag.cxx:115
void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs, const SdrObject *pObj)
Definition: svdglue.cxx:369
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
virtual void RecalcSnapRect()
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdobj.cxx:1656
void BurnInStyleSheetAttributes()
Definition: svdobj.cxx:1840
constexpr TypedWhichId< SdrOnePositionYItem > SDRATTR_ONEPOSITIONY(SDRATTR_NOTPERSIST_FIRST+11)
SdrLayerID mnLayerID
Definition: svdobj.hxx:956
constexpr TypedWhichId< SdrAngleItem > SDRATTR_ROTATEANGLE(SDRATTR_NOTPERSIST_FIRST+16)
void SetObjectItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1977
void SetRelativeWidth(double nValue)
Definition: svdobj.cxx:593
bool Equals(const SfxItemSet &, bool bComparePool) const
virtual ~SdrObjUserData()
Definition: svdobj.cxx:153
void NbcApplyNotPersistAttr(const SfxItemSet &rAttr)
Definition: svdobj.cxx:2026
void SetMoveProtect(bool bProt)
Definition: svdobj.cxx:2665
virtual void SetChanged(bool bFlg=true)
Definition: svdmodel.cxx:1154
std::optional< double > mnRelativeWidth
Definition: svdobj.cxx:192
virtual SdrObject * GetConnectedNode(bool bTail1) const
Definition: svdobj.cxx:2374
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect)
Definition: svdobj.cxx:135
virtual bool HasLimitedRotation() const
Definition: svdobj.cxx:1064
SdrLayer * GetLayer(sal_uInt16 i)
Definition: svdlayer.hxx:137
void SetMarkProtect(bool bProt)
Definition: svdobj.cxx:2561
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:510
sal_uInt32 GetOrdNumDirect() const
Definition: svdobj.hxx:838
SdrObject * GetConnectedNode(bool bTail1) const override
Definition: svdoedge.cxx:494
void ImpForcePlusData()
Definition: svdobj.cxx:1108
constexpr bool IsEmpty() const
constexpr TypedWhichId< SdrHorzShearOneItem > SDRATTR_HORZSHEARONE(SDRATTR_NOTPERSIST_FIRST+23)
constexpr void SetLeft(tools::Long v)
virtual ~ISdrObjectFilter()=0
Definition: svdobj.cxx:3360
virtual void ProcessDisplay(DisplayInfo &rDisplayInfo) override
bool m_bNotVisibleAsMaster
Definition: svdobj.hxx:900
virtual SfxStyleSheet * GetStyleSheet() const =0
exports com.sun.star. text
foreign graphic (StarView Graphic)
constexpr TypedWhichId< SdrOneSizeWidthItem > SDRATTR_ONESIZEWIDTH(SDRATTR_NOTPERSIST_FIRST+12)
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:2002
SdrLayerID mnLayerID
Definition: svdobj.hxx:185
virtual bool MovCreate(SdrDragStat &rStat)
Definition: svdobj.cxx:1384
std::unordered_set< const SdrObject * > maAllIncarnatedObjects
Definition: svdmodel.hxx:170
connector object
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i)
Definition: svdobj.cxx:1747
void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &rxFact, const Fraction &ryFact)
Definition: svdtrans.cxx:38
virtual void SetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:690
#define DBG_UNHANDLED_EXCEPTION(...)
void SetLineColor()
void AddReference(SdrVirtObj &rVrtObj)
Definition: svdobj.cxx:723
virtual void RestoreGeoData(const SdrObjGeoData &rGeo)
Definition: svdobj.cxx:1921
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Polygon/PolyPolygon represented by SdrPathObj.
virtual const SdrGluePointList * GetGluePointList() const
Definition: svdobj.cxx:2310
bool mbSupportTextIndentingOnLineWidthChange
Definition: svdobj.hxx:909
virtual void SetObjectItem(const SfxPoolItem &rItem)=0
#define DBG_ASSERT(sCon, aError)
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: properties.cxx:90
std::unique_ptr< sdr::properties::BaseProperties > mpProperties
Definition: svdobj.hxx:964
int i
const basegfx::B2DPolyPolygonVector & getExtractedLineFills() const
uno_Any a
bool IsWriter() const
Definition: svdmodel.hxx:582
virtual void InternalSetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast)
Definition: svdobj.cxx:2265
void SingleObjectPainter(OutputDevice &rOut) const
Definition: svdobj.cxx:1047
OUString sName
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
tools::Long FRound(double fVal)
virtual void NbcMirror(const Point &rRef1, const Point &rRef2)
Definition: svdobj.cxx:1491
SdrObject(SdrModel &rSdrModel)
Definition: svdobj.cxx:336
void TakeSdrObjectOwnership()
takes the ownership of the SdrObject.
Definition: unoshape.cxx:246
constexpr TypedWhichId< SdrLayerNameItem > SDRATTR_LAYERNAME(SDRATTR_NOTPERSIST_FIRST+4)
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon)
Definition: svdobj.cxx:3024
bool Equals(const SdrObject &) const
Definition: svdobj.cxx:1756
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false)
Definition: svdobj.cxx:1680
void notifyShapePropertyChange(const svx::ShapePropertyProviderId _eProperty) const
Definition: svdobj.cxx:2979
void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon &rPolyPolygon) const noexcept
Definition: svdobj.cxx:3172
void BroadcastObjectChange() const
Definition: svdobj.cxx:1001
constexpr TypedWhichId< SdrMoveXItem > SDRATTR_MOVEX(SDRATTR_NOTPERSIST_FIRST+18)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:101
virtual void SetGeoData(const SdrObjGeoData &rGeo)
Definition: svdobj.cxx:1955
virtual Degree100 GetShearAngle(bool bVertical=false) const
Definition: svdobj.cxx:1708
OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const
Definition: svdobj.cxx:1090
virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat &rDrag) const
Definition: svdobj.cxx:1366
virtual bool supportsFullDrag() const
Definition: svdobj.cxx:1327
sal_uInt32 mnNavigationPosition
Definition: svdobj.hxx:955
bool IsPrintable() const
Definition: svdobj.hxx:749
const SdrPage * GetPage(sal_uInt16 nPgNum) const
Definition: svdmodel.cxx:1801
void ActionChanged() const
Definition: svdobj.cxx:263
SdrView * GetView() const
Definition: svddrag.hxx:96
virtual void SaveGeoData(SdrObjGeoData &rGeo) const
Definition: svdobj.cxx:1898
constexpr tools::Long Right() const
constexpr TypedWhichId< SdrObjVisibleItem > SDRATTR_OBJVISIBLE(SDRATTR_NOTPERSIST_FIRST+35)
void SetFillColor()
const OUString & GetName() const
Definition: svdlayer.hxx:77
TitleText, special text object for StarDraw.
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:2012
const basegfx::B2DPolygonVector & getExtractedHairlines() const
float u
void DeleteUserData(sal_uInt16 nNum)
Definition: svdobj.cxx:2743
OUString GetTitle() const
Definition: svdobj.cxx:838
void NbcShearGluePoints(const Point &rRef, double tn, bool bVShear)
Definition: svdobj.cxx:2356
virtual basegfx::B2DPolyPolygon TakeContour() const
contour for TextToContour
Definition: svdobj.cxx:1128
Universal Network Object packed into SvDraw object.
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:279
SdrObjUserCall * m_pUserCall
Definition: svdobj.hxx:884
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
Definition: svdobj.cxx:892
void process(const primitive2d::Primitive2DContainer &rSource)
SdrLayer * GetLayerPerID(SdrLayerID nID)
Definition: svdlayer.hxx:145
virtual bool HasMacro() const
Definition: svdobj.cxx:1845
void SetPercent(bool bOn)
Definition: svdglue.hxx:124
constexpr tools::Long Top() const
bool IsGroupObject() const
Definition: svdobj.cxx:733
void SetVisible(bool bVisible)
Definition: svdobj.cxx:2701
constexpr TypedWhichId< SdrLogicSizeWidthItem > SDRATTR_LOGICSIZEWIDTH(SDRATTR_NOTPERSIST_FIRST+14)
sal_Int16 meRelativeWidthRelation
Definition: svdobj.cxx:194
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1694
double toRadians(D x)
virtual void Move(const Size &rSiz)
Definition: svdobj.cxx:1529
constexpr void SetRight(tools::Long v)
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1982
bool IsResizeProtect() const
Definition: svdobj.hxx:747
constexpr void SetBottom(tools::Long v)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
polygon, PolyPolygon
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)
virtual void RecalcBoundRect()
Definition: svdobj.cxx:968
virtual void SetRelativePos(const Point &rPnt)
Definition: svdobj.cxx:1612
void SetUserCall(SdrObjUserCall *pUser)
Definition: svdobj.cxx:2756
constexpr TypedWhichId< SdrShearAngleItem > SDRATTR_SHEARANGLE(SDRATTR_NOTPERSIST_FIRST+17)
circle section
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:2007
const basegfx::B2DPolyPolygonVector & getExtractedContour() const
virtual void PaintMacro(OutputDevice &rOut, const tools::Rectangle &rDirtyRect, const SdrObjMacroHitRec &rRec) const
Definition: svdobj.cxx:1865
virtual css::uno::Reference< css::drawing::XShape > CreateShape(SdrObject *pObj) const
Definition: unopage.cxx:821
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:67
constexpr TypedWhichId< SdrLayerIdItem > SDRATTR_LAYERID(SDRATTR_NOTPERSIST_FIRST+3)
const SdrLayerIDSet * pVisiLayer
Definition: svdobj.hxx:139
virtual sal_uInt32 GetHdlCount() const
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdobj.cxx:1217
RasterOp
Abstract DrawObject.
Definition: svdobj.hxx:259
void SetReallyAbsolute(bool bOn, const SdrObject &rObj)
Definition: svdglue.cxx:363
virtual void ActionChanged()
bool bNoPrint
Definition: svdobj.hxx:182
virtual void setUnoShape(const css::uno::Reference< css::drawing::XShape > &_rxUnoShape)
Sets a new UNO representation of the shape.
Definition: svdobj.cxx:2823
constexpr Point LeftCenter() const
const double * GetRelativeWidth() const
Definition: svdobj.cxx:613
virtual void Mirror(const Point &rRef1, const Point &rRef2)
Definition: svdobj.cxx:1585
constexpr void SetTop(tools::Long v)
sal_Int16 GetRelativeWidthRelation() const
Definition: svdobj.cxx:621
Polyline represented by SdrPathObj.
#define Y
virtual SdrInventor GetObjInventor() const
Definition: svdobj.cxx:644
virtual void DisconnectFromNode(bool bTail1)
Definition: svdobj.cxx:2370
constexpr TypedWhichId< SdrYesNoItem > SDRATTR_OBJSIZEPROTECT(SDRATTR_NOTPERSIST_FIRST+1)
static rtl::Reference< SvxShape > CreateShapeByTypeAndInventor(SdrObjKind nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage=nullptr, OUString const &referer=OUString())
Definition: unopage.cxx:608
SdrModel & mrSdrModelFromSdrObject
Definition: svdobj.hxx:289
constexpr Point Center() const
void AppendUserData(std::unique_ptr< SdrObjUserData > pData)
Definition: svdobj.cxx:2728
constexpr Point TopLeft() const
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:668
bool HasLineStyle() const
Definition: svdobj.cxx:3069
tools::Long AdjustTop(tools::Long nVertMoveDelta)
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
MapUnit GetMapUnit()
Definition: svdetc.hxx:79
constexpr TypedWhichId< SdrRotateOneItem > SDRATTR_ROTATEONE(SDRATTR_NOTPERSIST_FIRST+22)
constexpr tools::Long Bottom() const
SvxShape * getSvxShape()
only for internal use!
Definition: svdobj.cxx:2861
void EndUndo()
Definition: svdmodel.cxx:439
Point aAnchor
Definition: svdobj.hxx:177
void setY(double fY)
#define ENSURE_OR_THROW(c, m)
SvxShape * mpSvxShape
Definition: svdobj.hxx:969
Point m_aAnchor
Definition: svdobj.hxx:883
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
static void RemoveMakeObjectHdl(Link< SdrObjCreatorParams, SdrObject * > const &rLink)
Definition: svdobj.cxx:3350
bool bMovProt
Definition: svdobj.hxx:180
rectangle (round corners optional)
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:963
virtual void NbcReformatText()
Definition: svdobj.cxx:1836
virtual void NbcSetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
Definition: svdobj.cxx:1827
SdrObject * Next()
Definition: svditer.hxx:63
void InsertedStateChange()
Definition: svdobj.cxx:2644
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const
Definition: svdobj.cxx:2294
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:167
constexpr OUStringLiteral EMPTY
void Broadcast(const SfxHint &rHint)
SdrObjectUniquePtr ConvertToPolyObj(bool bBezier, bool bLineToArea) const
Definition: svdobj.cxx:2618
constexpr Size GetSize() const
void SetDoNotInsertIntoPageAutomatically(bool bSet)
Definition: svdobj.cxx:3092
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact()
Definition: svdobj.cxx:246
sal_uInt32 count() const
void getViewIndependentPrimitive2DContainer(drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const
bool mbVisible
sal_Int32 GetDenominator() const
virtual SdrGluePointList * ForceGluePointList()
Definition: svdobj.cxx:2317
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const
Definition: svdobj.cxx:1860
static SdrItemPool & GetGlobalDrawObjectItemPool()
Definition: svdobj.cxx:571
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast)=0
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void NbcSetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1665
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: svdobj.cxx:909
object group
constexpr tools::Long Height() const
virtual void NbcSetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1675
virtual std::unique_ptr< BaseProperties > Clone(SdrObject &rObj) const =0
void SetBLIPSizeRectangle(const tools::Rectangle &aRect)
Definition: svdobj.cxx:3082
void SetOrdNum(sal_uInt32 nNum)
Definition: svdobj.cxx:904
void SetObjectItemSet(const SfxItemSet &rSet)
Definition: svdobj.cxx:1992
bool less(const T &rfValA, const T &rfValB)
constexpr o3tl::Length MapToO3tlLength(MapUnit eU, o3tl::Length ePixelValue=o3tl::Length::px)
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
Definition: svdpage.cxx:1762
SdrObject * ConvertToContourObj(SdrObject *pRet, bool bForceLineDash=false) const
Definition: svdobj.cxx:2580
virtual void NbcMove(const Size &rSiz)
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdobj.cxx:1427
std::unique_ptr< SfxGrabBagItem > m_pGrabBagItem
Definition: svdobj.hxx:953
bool mbVisible
Definition: svdobj.hxx:184
OUString aName
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1972
constexpr Point TopRight() const
bool m_bEmptyPresObj
Definition: svdobj.hxx:898
SdrObjUserData * GetUserData(sal_uInt16 nNum) const
Definition: svdobj.cxx:2722
void SetRasterOp(RasterOp eRasterOp)
virtual PointerStyle GetCreatePointer() const
get the cursor/pointer that signals creating this object
Definition: svdobj.cxx:1421
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: svdobj.cxx:1769
std::u16string_view trim(std::u16string_view str)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
Definition: svdobj.cxx:1070
void SetDescription(const OUString &rStr)
Definition: svdobj.cxx:848
void RemoveListener(SfxListener &rListener)
Definition: svdobj.cxx:708
virtual ~SdrObjGeoData()
Definition: svdobj.cxx:165
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact)
Definition: svdobj.cxx:1540
Reference< XComponentContext > getProcessComponentContext()
custom shape
FIXME: The virtual object is not yet fully implemented and tested.
Definition: svdovirt.hxx:29
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
sal_Int32 GetNumerator() const
tools::Rectangle aBoundRect
Definition: svdobj.hxx:176
sal_uInt32 GetNavigationPosition() const
Definition: svdobj.cxx:928
constexpr TypedWhichId< SdrLogicSizeHeightItem > SDRATTR_LOGICSIZEHEIGHT(SDRATTR_NOTPERSIST_FIRST+15)
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:97
RasterOp GetRasterOp() const
virtual SdrObjectUniquePtr getFullDragClone() const
Definition: svdobj.cxx:1332
void SetSdrObjListRectsDirty()
Definition: svdpage.cxx:257
const Point & GetNow() const
Definition: svddrag.hxx:105
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const
Definition: svdobj.cxx:1338
sal_uInt16 GetUserDataCount() const
Definition: svdobj.cxx:2716
PointerStyle
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1651
virtual OUString TakeObjNamePlural() const
Definition: svdobj.cxx:1085
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs)
Definition: svdobj.cxx:1574
SdrObject * getParentSdrObjectFromSdrObject() const
Definition: svdobj.cxx:743
constexpr Point BottomRight() const
bool m_bIs3DObj
Definition: svdobj.hxx:904
std::unique_ptr< SdrGluePointList > pGPL
Definition: svdobj.hxx:179
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1685
virtual bool applySpecialDrag(SdrDragStat &rDrag)
Definition: svdobj.cxx:1349
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr TypedWhichId< SdrTransformRef1YItem > SDRATTR_TRANSFORMREF1Y(SDRATTR_NOTPERSIST_FIRST+31)
sal_Int16 GetRelativeHeightRelation() const
Definition: svdobj.cxx:634
virtual void SetMergedItem(const SfxPoolItem &rItem)
Definition: properties.cxx:71
std::unique_ptr< sdr::contact::ViewContact > mpViewContact
Definition: svdobj.hxx:966
MapUnit
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
#define SAL_WARN(area, stream)
void SetNotVisibleAsMaster(bool bFlg)
Definition: svdobj.cxx:2573
double getX() const
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:317
virtual void NbcSetAnchorPos(const Point &rPnt)
Definition: svdobj.cxx:1633
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
virtual Degree100 GetRotateAngle() const
Definition: svdobj.cxx:1703
OUString GetMetricString(tools::Long nVal, bool bNoUnitChars=false, sal_Int32 nNumDigits=-1) const
Definition: svdmodel.cxx:976
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:1058
bool m_bVirtObj
Definition: svdobj.hxx:888
virtual void SetContextWritingMode(const sal_Int16 _nContextWritingMode)
Definition: svdobj.cxx:3087
tools::Rectangle maBLIPSizeRectangle
Definition: svdobj.hxx:962
#define DBG_TESTSOLARMUTEX()
bool m_bSnapRectDirty
Definition: svdobj.hxx:889
std::unique_ptr< Impl > mpImpl
Definition: svdobj.hxx:949
virtual const tools::Rectangle & GetLogicRect() const
Definition: svdobj.cxx:1670
sal_uInt16 nTol
Definition: svdobj.hxx:141
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:373
virtual bool DoMacro(const SdrObjMacroHitRec &rRec)
Definition: svdobj.cxx:1882
void Shear(const Point &rRef, double tn, bool bVShear, const SdrObject *pObj)
Definition: svdglue.cxx:388
sdr::ObjectUserVector maObjectUsers
Definition: svdobj.cxx:191
bool IsInDestruction() const
Definition: svdmodel.hxx:595
B2DPolygon simplifyCurveSegments(const B2DPolygon &rCandidate)
SdrObjList * getParentSdrObjListFromSdrObject() const
Definition: svdobj.cxx:305
void InvalidateSdrObject()
Definition: unoshape.cxx:252
void NbcSetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2260
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const
Definition: svdobj.cxx:2997
void notifyPropertyChange(const ShapePropertyProviderId _eProperty) const
notifies changes in the given property to all registered listeners
SdrCreateCmd
Definition: svdtypes.hxx:26
helper class for notifying XPropertyChangeListeners
bool IsBigOrtho() const
Definition: svdsnpv.hxx:258
virtual void SetChanged()
Definition: svdobj.cxx:1025
closed Bezier-curve
rtl::OString toString() const
constexpr TypedWhichId< SdrOnePositionXItem > SDRATTR_ONEPOSITIONX(SDRATTR_NOTPERSIST_FIRST+10)
void SetPrintable(bool bPrn)
Definition: svdobj.cxx:2687
std::unique_ptr< SdrObjPlusData > m_pPlusData
Definition: svdobj.hxx:886
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
virtual Point GetPoint(sal_uInt32 i) const
Definition: svdobj.cxx:1733
bool HasSdrObjectOwnership() const
Definition: unoshape.cxx:265
virtual void NbcSetRelativePos(const Point &rPnt)
The relative position of a SdrObject is the distance of the upper left corner of the logic bounding r...
Definition: svdobj.cxx:1605
SdrObjUserCall * GetUserCall() const
Definition: svdobj.hxx:831
virtual SdrObject * getSdrObjectFromSdrObjList() const
Definition: svdpage.cxx:123
virtual OutlinerParaObject * GetOutlinerParaObject() const
Definition: svdobj.cxx:1831
bool bClosedObj
Definition: svdobj.hxx:183
aStr
const OUString & GetName() const
Definition: svdobj.cxx:792
void SetTitle(const OUString &rStr)
Definition: svdobj.cxx:804
bool mbLineIsOutsideGeometry
Definition: svdobj.hxx:907
virtual void ClearMergedItem(const sal_uInt16 nWhich)
Definition: properties.cxx:77
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const
Polygon dragged by the user when creating the object.
Definition: svdobj.cxx:1410
const SdrPageView * pPageView
Definition: svdobj.hxx:140
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2762
void ApplyNotPersistAttr(const SfxItemSet &rAttr)
Definition: svdobj.cxx:2017
svx::PropertyChangeNotifier & getShapePropertyChangeNotifier()
Definition: unoshape.cxx:317
bool mbDoNotInsertIntoPageAutomatically
Definition: svdobj.hxx:974
::std::vector< B2DPolygon > B2DPolygonVector
SdrObject * ImpConvertToContourObj(bool bForceLineDash)
Definition: svdobj.cxx:2406
constexpr TypedWhichId< SfxStringItem > SDRATTR_OBJECTNAME(SDRATTR_NOTPERSIST_FIRST+5)
sal_Int16 meRelativeHeightRelation
Definition: svdobj.cxx:195
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2290
sal_uInt16 GetPageCount() const
Definition: svdmodel.cxx:1811
bool IsMoveProtect() const
Definition: svdobj.hxx:745
virtual void SetObjectItemSet(const SfxItemSet &rSet)=0
sal_uInt16 nPos
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
const double * GetRelativeHeight() const
Definition: svdobj.cxx:626
Utility class SdrEdgeObj.
Definition: svdoedge.hxx:129
virtual sal_uInt32 GetSnapPointCount() const
snap to special points of an Object (polygon points, center of circle)
Definition: svdobj.cxx:1713
sal_Int16 nValue
Definition: fmsrccfg.cxx:81
OutlineText, special text object for StarDraw.
object that represents a SdrPage
bool m_bDetectedRangeSegmentation false
constexpr tools::Long GetHeight() const
constexpr TypedWhichId< SdrResizeXOneItem > SDRATTR_RESIZEXONE(SDRATTR_NOTPERSIST_FIRST+20)
const sal_uInt8 R
void NbcRotateGluePoints(const Point &rRef, Degree100 nAngle, double sn, double cs)
Definition: svdobj.cxx:2336
::std::vector< B2DPolyPolygon > B2DPolyPolygonVector
virtual void NbcSetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:685
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo