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