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