tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / svx / source / svdraw / svdogrp.cxx
blob849a0f106053c7cb2dbfeead1ee6aab65d9a327a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/svdogrp.hxx>
22 #include <svx/svdmodel.hxx>
23 #include <svx/svdpage.hxx>
24 #include <svx/svdobj.hxx>
25 #include <svx/svdtrans.hxx>
26 #include <svx/dialmgr.hxx>
27 #include <svx/strings.hrc>
29 #include <sdr/properties/groupproperties.hxx>
30 #include <sdr/contact/viewcontactofgroup.hxx>
31 #include <basegfx/range/b2drange.hxx>
32 #include <basegfx/polygon/b2dpolygontools.hxx>
33 #include <libxml/xmlwriter.h>
34 #include <vcl/canvastools.hxx>
35 #include <svx/diagram/IDiagramHelper.hxx>
37 const std::shared_ptr< svx::diagram::IDiagramHelper >& SdrObjGroup::getDiagramHelper() const
39 return mp_DiagramHelper;
42 // BaseProperties section
43 std::unique_ptr<sdr::properties::BaseProperties> SdrObjGroup::CreateObjectSpecificProperties()
45 return std::make_unique<sdr::properties::GroupProperties>(*this);
48 // DrawContact section
49 std::unique_ptr<sdr::contact::ViewContact> SdrObjGroup::CreateObjectSpecificViewContact()
51 return std::make_unique<sdr::contact::ViewContactOfGroup>(*this);
54 SdrObjGroup::SdrObjGroup(SdrModel& rSdrModel)
55 : SdrObject(rSdrModel)
56 , SdrObjList()
57 , maRefPoint(0, 0)
58 , mp_DiagramHelper()
60 m_bClosedObj=false;
63 SdrObjGroup::SdrObjGroup(SdrModel& rSdrModel, SdrObjGroup const & rSource)
64 : SdrObject(rSdrModel, rSource)
65 , SdrObjList()
66 , maRefPoint(0, 0)
67 , mp_DiagramHelper()
69 m_bClosedObj=false;
71 // copy child SdrObjects
72 if(nullptr != rSource.GetSubList())
74 // #i36404# Copy SubList, init model and page first
75 const SdrObjList& rSourceSubList(*rSource.GetSubList());
77 CopyObjects(rSourceSubList);
79 // tdf#116979: needed here, we need bSnapRectDirty to be true
80 // which it is after using SdrObject::operator= (see above),
81 // but set to false again using CopyObjects
82 SetBoundAndSnapRectsDirty();
85 // copy local parameters
86 maRefPoint = rSource.maRefPoint;
89 void SdrObjGroup::AddToHdlList(SdrHdlList& rHdlList) const
91 // only for diagram, so do nothing for just groups
92 if(!isDiagram())
93 return;
95 svx::diagram::IDiagramHelper::AddAdditionalVisualization(*this, rHdlList);
98 SdrObjGroup::~SdrObjGroup()
102 SdrPage* SdrObjGroup::getSdrPageFromSdrObjList() const
104 return getSdrPageFromSdrObject();
107 SdrObject* SdrObjGroup::getSdrObjectFromSdrObjList() const
109 return const_cast< SdrObjGroup* >(this);
112 SdrObjList* SdrObjGroup::getChildrenOfSdrObject() const
114 return const_cast< SdrObjGroup* >(this);
117 void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
119 rInfo.bNoContortion=false;
120 const size_t nObjCount(GetObjCount());
121 for (const rtl::Reference<SdrObject>& pObj : *this) {
122 SdrObjTransformInfoRec aInfo;
123 pObj->TakeObjInfo(aInfo);
124 if (!aInfo.bMoveAllowed ) rInfo.bMoveAllowed =false;
125 if (!aInfo.bResizeFreeAllowed ) rInfo.bResizeFreeAllowed =false;
126 if (!aInfo.bResizePropAllowed ) rInfo.bResizePropAllowed =false;
127 if (!aInfo.bRotateFreeAllowed ) rInfo.bRotateFreeAllowed =false;
128 if (!aInfo.bRotate90Allowed ) rInfo.bRotate90Allowed =false;
129 if (!aInfo.bMirrorFreeAllowed ) rInfo.bMirrorFreeAllowed =false;
130 if (!aInfo.bMirror45Allowed ) rInfo.bMirror45Allowed =false;
131 if (!aInfo.bMirror90Allowed ) rInfo.bMirror90Allowed =false;
132 if (!aInfo.bShearAllowed ) rInfo.bShearAllowed =false;
133 if (!aInfo.bEdgeRadiusAllowed ) rInfo.bEdgeRadiusAllowed =false;
134 if (!aInfo.bNoOrthoDesired ) rInfo.bNoOrthoDesired =false;
135 if (aInfo.bNoContortion ) rInfo.bNoContortion =true;
136 if (!aInfo.bCanConvToPath ) rInfo.bCanConvToPath =false;
138 if(!aInfo.bCanConvToContour)
139 rInfo.bCanConvToContour = false;
141 if (!aInfo.bCanConvToPoly ) rInfo.bCanConvToPoly =false;
142 if (!aInfo.bCanConvToPathLineToArea) rInfo.bCanConvToPathLineToArea=false;
143 if (!aInfo.bCanConvToPolyLineToArea) rInfo.bCanConvToPolyLineToArea=false;
145 if (nObjCount==0) {
146 rInfo.bRotateFreeAllowed=false;
147 rInfo.bRotate90Allowed =false;
148 rInfo.bMirrorFreeAllowed=false;
149 rInfo.bMirror45Allowed =false;
150 rInfo.bMirror90Allowed =false;
151 rInfo.bTransparenceAllowed = false;
152 rInfo.bShearAllowed =false;
153 rInfo.bEdgeRadiusAllowed=false;
154 rInfo.bNoContortion =true;
156 if(nObjCount != 1)
158 // only allowed if single object selected
159 rInfo.bTransparenceAllowed = false;
163 void SdrObjGroup::SetBoundRectDirty()
165 // avoid resetting aOutRect which in case of this object is model data,
166 // not re-creatable view data
169 SdrObjKind SdrObjGroup::GetObjIdentifier() const
171 return SdrObjKind::Group;
174 SdrLayerID SdrObjGroup::GetLayer() const
176 SdrLayerID nLay = SdrObject::GetLayer();
177 bool b1st = true;
178 for (const rtl::Reference<SdrObject>& pObject : *this)
180 SdrLayerID nLay1(pObject->GetLayer());
181 if (b1st) { nLay=nLay1; b1st = false; }
182 else if (nLay1!=nLay) return SdrLayerID(0);
184 return nLay;
187 void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
189 SdrObject::NbcSetLayer(nLayer);
190 for (const rtl::Reference<SdrObject>& pObj : *this)
191 pObj->NbcSetLayer(nLayer);
194 void SdrObjGroup::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
196 // call parent
197 SdrObject::handlePageChange(pOldPage, pNewPage);
199 for (const rtl::Reference<SdrObject>& pObj : *this)
200 pObj->handlePageChange(pOldPage, pNewPage);
203 SdrObjList* SdrObjGroup::GetSubList() const
205 return const_cast< SdrObjGroup* >(this);
208 static bool containsOOXData(const css::uno::Any& rVal)
210 const css::uno::Sequence<css::beans::PropertyValue> propList(rVal.get< css::uno::Sequence<css::beans::PropertyValue> >());
211 for (const auto& rProp : propList)
213 if(rProp.Name.startsWith("OOX"))
215 return true;
219 return false;
222 void SdrObjGroup::SetGrabBagItem(const css::uno::Any& rVal)
224 // detect if the intention is to disable Diagram functionality
225 if(isDiagram() && !containsOOXData(rVal))
227 css::uno::Any aOld;
228 GetGrabBagItem(aOld);
230 if(containsOOXData(aOld))
232 mp_DiagramHelper.reset();
236 // call parent
237 SdrObject::SetGrabBagItem(rVal);
240 const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
242 // <aOutRect> has to contain the bounding rectangle
243 if(0 != GetObjCount())
245 setOutRectangleConst(GetAllObjBoundRect());
248 return getOutRectangle();
251 const tools::Rectangle& SdrObjGroup::GetSnapRect() const
253 // <aOutRect> has to contain the bounding rectangle
254 if(0 != GetObjCount())
256 return GetAllObjSnapRect();
258 else
260 return getOutRectangle();
264 rtl::Reference<SdrObject> SdrObjGroup::CloneSdrObject(SdrModel& rTargetModel) const
266 return new SdrObjGroup(rTargetModel, *this);
269 OUString SdrObjGroup::TakeObjNameSingul() const
271 OUString sName;
273 if(0 == GetObjCount())
275 sName = SvxResId(STR_ObjNameSingulGRUPEMPTY);
277 else
279 if(isDiagram())
280 sName = SvxResId(STR_ObjNameSingulDIAGRAM);
281 else
282 sName = SvxResId(STR_ObjNameSingulGRUP);
285 const OUString aName(GetName());
287 if (!aName.isEmpty())
288 sName += " '" + aName + "'";
290 return sName;
294 OUString SdrObjGroup::TakeObjNamePlural() const
296 if(0 == GetObjCount())
297 return SvxResId(STR_ObjNamePluralGRUPEMPTY);
298 if(isDiagram())
299 return SvxResId(RID_GALLERYSTR_THEME_DIAGRAMS);
300 return SvxResId(STR_ObjNamePluralGRUP);
304 void SdrObjGroup::RecalcSnapRect()
306 // TODO: unnecessary, because we use the Rects from the SubList
309 basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
311 basegfx::B2DPolyPolygon aRetval;
313 for (const rtl::Reference<SdrObject>& pObj : *this)
314 aRetval.append(pObj->TakeXorPoly());
316 if(!aRetval.count())
318 const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(getOutRectangle());
319 aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
322 return aRetval;
325 bool SdrObjGroup::beginSpecialDrag(SdrDragStat& /*rDrag*/) const
327 return false;
331 bool SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/)
333 return false;
337 Degree100 SdrObjGroup::GetRotateAngle() const
339 Degree100 nRetval(0);
341 if(0 != GetObjCount())
343 SdrObject* pObj(GetObj(0));
345 nRetval = pObj->GetRotateAngle();
348 return nRetval;
352 Degree100 SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
354 Degree100 nRetval(0);
356 if(0 != GetObjCount())
358 SdrObject* pObj(GetObj(0));
360 nRetval = pObj->GetShearAngle();
363 return nRetval;
367 void SdrObjGroup::NbcSetSnapRect(const tools::Rectangle& rRect)
369 tools::Rectangle aOld(GetSnapRect());
370 tools::Long nMulX=rRect.Right()-rRect.Left();
371 tools::Long nDivX=aOld.Right()-aOld.Left();
372 tools::Long nMulY=rRect.Bottom()-rRect.Top();
373 tools::Long nDivY=aOld.Bottom()-aOld.Top();
374 if (nDivX==0) { nMulX=1; nDivX=1; }
375 if (nDivY==0) { nMulY=1; nDivY=1; }
376 if (nMulX!=nDivX || nMulY!=nDivY) {
377 Fraction aX(nMulX,nDivX);
378 Fraction aY(nMulY,nDivY);
379 NbcResize(aOld.TopLeft(),aX,aY);
381 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
382 NbcMove(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
387 void SdrObjGroup::NbcSetLogicRect(const tools::Rectangle& rRect, bool /*bAdaptTextMinSize*/)
389 NbcSetSnapRect(rRect);
393 void SdrObjGroup::NbcMove(const Size& rSize)
395 maRefPoint.Move(rSize);
396 const size_t nObjCount(GetObjCount());
398 if(0 != nObjCount)
400 for (const rtl::Reference<SdrObject>& pObj : *this)
401 pObj->NbcMove(rSize);
403 else
405 moveOutRectangle(rSize.Width(), rSize.Height());
406 SetBoundAndSnapRectsDirty();
411 void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
413 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
414 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
415 if (bXMirr || bYMirr) {
416 Point aRef1(GetSnapRect().Center());
417 if (bXMirr) {
418 Point aRef2(aRef1);
419 aRef2.AdjustY( 1 );
420 NbcMirrorGluePoints(aRef1,aRef2);
422 if (bYMirr) {
423 Point aRef2(aRef1);
424 aRef2.AdjustX( 1 );
425 NbcMirrorGluePoints(aRef1,aRef2);
429 ResizePoint(maRefPoint, rRef, xFact, yFact);
431 const size_t nObjCount(GetObjCount());
432 if(0 != nObjCount)
434 for (const rtl::Reference<SdrObject>& pObj : *this)
435 pObj->NbcResize(rRef,xFact,yFact);
437 else
439 auto aRectangle = getOutRectangle();
440 ResizeRect(aRectangle, rRef, xFact, yFact);
441 setOutRectangle(aRectangle);
443 SetBoundAndSnapRectsDirty();
448 void SdrObjGroup::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
450 SetGlueReallyAbsolute(true);
451 RotatePoint(maRefPoint, rRef, sn, cs);
453 for (const rtl::Reference<SdrObject>& pObj : *this)
454 pObj->NbcRotate(rRef,nAngle,sn,cs);
456 NbcRotateGluePoints(rRef,nAngle,sn,cs);
457 SetGlueReallyAbsolute(false);
461 void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
463 SetGlueReallyAbsolute(true);
464 MirrorPoint(maRefPoint, rRef1, rRef2); // implementation missing in SvdEtc!
466 for (const rtl::Reference<SdrObject>& pObj : *this)
467 pObj->NbcMirror(rRef1,rRef2);
469 NbcMirrorGluePoints(rRef1,rRef2);
470 SetGlueReallyAbsolute(false);
474 void SdrObjGroup::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
476 SetGlueReallyAbsolute(true);
477 ShearPoint(maRefPoint, rRef, tn);
479 for (const rtl::Reference<SdrObject>& pObj : *this)
481 pObj->NbcShear(rRef,nAngle,tn,bVShear);
484 NbcShearGluePoints(rRef,tn,bVShear);
485 SetGlueReallyAbsolute(false);
489 void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
491 m_aAnchor=rPnt;
492 Size aSiz(rPnt.X()-m_aAnchor.X(),rPnt.Y()-m_aAnchor.Y());
493 maRefPoint.Move(aSiz);
495 for (const rtl::Reference<SdrObject>& pObj : *this)
496 pObj->NbcSetAnchorPos(rPnt);
500 void SdrObjGroup::SetSnapRect(const tools::Rectangle& rRect)
502 tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
503 tools::Rectangle aOld(GetSnapRect());
504 if (aOld.IsEmpty())
506 Fraction aX(1,1);
507 Fraction aY(1,1);
508 Resize(aOld.TopLeft(),aX,aY);
510 else
512 tools::Long nMulX=rRect.Right()-rRect.Left();
513 tools::Long nDivX=aOld.Right()-aOld.Left();
514 tools::Long nMulY=rRect.Bottom()-rRect.Top();
515 tools::Long nDivY=aOld.Bottom()-aOld.Top();
516 if (nDivX==0) { nMulX=1; nDivX=1; }
517 if (nDivY==0) { nMulY=1; nDivY=1; }
518 if (nMulX!=nDivX || nMulY!=nDivY) {
519 Fraction aX(nMulX,nDivX);
520 Fraction aY(nMulY,nDivY);
521 Resize(aOld.TopLeft(),aX,aY);
524 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
525 Move(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
528 SetChanged();
529 BroadcastObjectChange();
530 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
534 void SdrObjGroup::SetLogicRect(const tools::Rectangle& rRect)
536 SetSnapRect(rRect);
540 void SdrObjGroup::Move(const Size& rSiz)
542 if (rSiz.Width()==0 && rSiz.Height()==0)
543 return;
545 tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
546 maRefPoint.Move(rSiz);
547 const size_t nObjCount(GetObjCount());
549 if(0 != nObjCount)
551 // first move the connectors, then everything else
552 for (const rtl::Reference<SdrObject>& pObj : *this)
554 if (pObj->IsEdgeObj())
555 pObj->Move(rSiz);
558 for (const rtl::Reference<SdrObject>& pObj : *this)
560 if (!pObj->IsEdgeObj())
561 pObj->Move(rSiz);
564 else
566 moveOutRectangle(rSiz.Width(), rSiz.Height());
567 SetBoundAndSnapRectsDirty();
570 SetChanged();
571 BroadcastObjectChange();
572 SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0);
576 void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
578 if (xFact.GetNumerator()==xFact.GetDenominator() && yFact.GetNumerator()==yFact.GetDenominator())
579 return;
581 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
582 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
583 if (bXMirr || bYMirr) {
584 Point aRef1(GetSnapRect().Center());
585 if (bXMirr) {
586 Point aRef2(aRef1);
587 aRef2.AdjustY( 1 );
588 NbcMirrorGluePoints(aRef1,aRef2);
590 if (bYMirr) {
591 Point aRef2(aRef1);
592 aRef2.AdjustX( 1 );
593 NbcMirrorGluePoints(aRef1,aRef2);
596 tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
597 ResizePoint(maRefPoint, rRef, xFact, yFact);
598 const size_t nObjCount(GetObjCount());
600 if(0 != nObjCount)
602 // move the connectors first, everything else afterwards
603 for (const rtl::Reference<SdrObject>& pObj : *this)
605 if (pObj->IsEdgeObj())
606 pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
609 for (const rtl::Reference<SdrObject>& pObj : *this)
611 if (!pObj->IsEdgeObj())
612 pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
615 else
617 auto aRectangle = getOutRectangle();
618 ResizeRect(aRectangle, rRef, xFact, yFact);
619 setOutRectangle(aRectangle);
621 SetBoundAndSnapRectsDirty();
624 SetChanged();
625 BroadcastObjectChange();
626 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
630 void SdrObjGroup::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
632 if (nAngle==0_deg100)
633 return;
635 SetGlueReallyAbsolute(true);
636 tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
637 RotatePoint(maRefPoint, rRef, sn, cs);
638 // move the connectors first, everything else afterwards
640 for (const rtl::Reference<SdrObject>& pObj : *this)
642 if (pObj->IsEdgeObj())
643 pObj->Rotate(rRef,nAngle,sn,cs);
646 for (const rtl::Reference<SdrObject>& pObj : *this)
648 if (!pObj->IsEdgeObj())
649 pObj->Rotate(rRef,nAngle,sn,cs);
652 NbcRotateGluePoints(rRef,nAngle,sn,cs);
653 SetGlueReallyAbsolute(false);
654 SetChanged();
655 BroadcastObjectChange();
656 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
660 void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
662 SetGlueReallyAbsolute(true);
663 tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
664 MirrorPoint(maRefPoint, rRef1, rRef2); // implementation missing in SvdEtc!
665 // move the connectors first, everything else afterwards
667 for (const rtl::Reference<SdrObject>& pObj : *this)
669 if (pObj->IsEdgeObj())
670 pObj->Mirror(rRef1,rRef2);
673 for (const rtl::Reference<SdrObject>& pObj : *this)
675 if (!pObj->IsEdgeObj())
676 pObj->Mirror(rRef1,rRef2);
679 NbcMirrorGluePoints(rRef1,rRef2);
680 SetGlueReallyAbsolute(false);
681 SetChanged();
682 BroadcastObjectChange();
683 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
687 void SdrObjGroup::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
689 if (nAngle==0_deg100)
690 return;
692 SetGlueReallyAbsolute(true);
693 tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
694 ShearPoint(maRefPoint, rRef, tn);
695 // move the connectors first, everything else afterwards
697 for (const rtl::Reference<SdrObject>& pObj : *this)
699 if (pObj->IsEdgeObj())
700 pObj->Shear(rRef,nAngle,tn,bVShear);
703 for (const rtl::Reference<SdrObject>& pObj : *this)
705 if (!pObj->IsEdgeObj())
706 pObj->Shear(rRef,nAngle,tn,bVShear);
709 NbcShearGluePoints(rRef,tn,bVShear);
710 SetGlueReallyAbsolute(false);
711 SetChanged();
712 BroadcastObjectChange();
713 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
718 void SdrObjGroup::SetAnchorPos(const Point& rPnt)
720 tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
721 bool bChg=m_aAnchor!=rPnt;
722 m_aAnchor=rPnt;
723 Size aSiz(rPnt.X()-m_aAnchor.X(),rPnt.Y()-m_aAnchor.Y());
724 maRefPoint.Move(aSiz);
725 // move the connectors first, everything else afterwards
727 for (const rtl::Reference<SdrObject>& pObj : *this)
729 if (pObj->IsEdgeObj())
730 pObj->SetAnchorPos(rPnt);
733 for (const rtl::Reference<SdrObject>& pObj : *this)
735 if (!pObj->IsEdgeObj())
736 pObj->SetAnchorPos(rPnt);
739 if (bChg)
741 SetChanged();
742 BroadcastObjectChange();
743 SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0);
748 void SdrObjGroup::NbcSetRelativePos(const Point& rPnt)
750 Point aRelPos0(GetSnapRect().TopLeft()-m_aAnchor);
751 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
752 NbcMove(aSiz); // this also calls SetRectsDirty()
755 void SdrObjGroup::SetRelativePos(const Point& rPnt)
757 Point aRelPos0(GetSnapRect().TopLeft()-m_aAnchor);
758 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
759 if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // this also calls SetRectsDirty() and Broadcast, ...
762 void SdrObjGroup::NbcReformatText()
764 NbcReformatAllTextObjects();
767 rtl::Reference<SdrObject> SdrObjGroup::DoConvertToPolyObj(bool bBezier, bool bAddText) const
769 rtl::Reference<SdrObject> pGroup( new SdrObjGroup(getSdrModelFromSdrObject()) );
771 for (const rtl::Reference<SdrObject>& pIterObj : *this)
773 rtl::Reference<SdrObject> pResult(pIterObj->DoConvertToPolyObj(bBezier, bAddText));
775 // pResult can be NULL e.g. for empty objects
776 if( pResult )
777 pGroup->GetSubList()->NbcInsertObject(pResult.get());
780 return pGroup;
783 void SdrObjGroup::dumpAsXml(xmlTextWriterPtr pWriter) const
785 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrObjGroup"));
786 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
788 SdrObject::dumpAsXml(pWriter);
789 SdrObjList::dumpAsXml(pWriter);
791 (void)xmlTextWriterEndElement(pWriter);
794 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */