Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / svx / source / svdraw / svdogrp.cxx
blobb78a02cdfafec241d617a015d7cf6adcad338e80
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 <basegfx/polygon/b2dpolygon.hxx>
34 #include <libxml/xmlwriter.h>
35 #include <rtl/ustrbuf.hxx>
36 #include <vcl/canvastools.hxx>
38 // BaseProperties section
39 std::unique_ptr<sdr::properties::BaseProperties> SdrObjGroup::CreateObjectSpecificProperties()
41 return std::make_unique<sdr::properties::GroupProperties>(*this);
44 // DrawContact section
45 std::unique_ptr<sdr::contact::ViewContact> SdrObjGroup::CreateObjectSpecificViewContact()
47 return std::make_unique<sdr::contact::ViewContactOfGroup>(*this);
50 SdrObjGroup::SdrObjGroup(SdrModel& rSdrModel)
51 : SdrObject(rSdrModel),
52 SdrObjList(),
53 aRefPoint(0, 0)
55 bClosedObj=false;
58 SdrObjGroup::~SdrObjGroup()
62 SdrPage* SdrObjGroup::getSdrPageFromSdrObjList() const
64 return getSdrPageFromSdrObject();
67 SdrObject* SdrObjGroup::getSdrObjectFromSdrObjList() const
69 return const_cast< SdrObjGroup* >(this);
72 SdrObjList* SdrObjGroup::getChildrenOfSdrObject() const
74 return const_cast< SdrObjGroup* >(this);
77 void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
79 rInfo.bNoContortion=false;
80 const size_t nObjCount(GetObjCount());
81 for (size_t i=0; i<nObjCount; ++i) {
82 SdrObject* pObj(GetObj(i));
83 SdrObjTransformInfoRec aInfo;
84 pObj->TakeObjInfo(aInfo);
85 if (!aInfo.bMoveAllowed ) rInfo.bMoveAllowed =false;
86 if (!aInfo.bResizeFreeAllowed ) rInfo.bResizeFreeAllowed =false;
87 if (!aInfo.bResizePropAllowed ) rInfo.bResizePropAllowed =false;
88 if (!aInfo.bRotateFreeAllowed ) rInfo.bRotateFreeAllowed =false;
89 if (!aInfo.bRotate90Allowed ) rInfo.bRotate90Allowed =false;
90 if (!aInfo.bMirrorFreeAllowed ) rInfo.bMirrorFreeAllowed =false;
91 if (!aInfo.bMirror45Allowed ) rInfo.bMirror45Allowed =false;
92 if (!aInfo.bMirror90Allowed ) rInfo.bMirror90Allowed =false;
93 if (!aInfo.bShearAllowed ) rInfo.bShearAllowed =false;
94 if (!aInfo.bEdgeRadiusAllowed ) rInfo.bEdgeRadiusAllowed =false;
95 if (!aInfo.bNoOrthoDesired ) rInfo.bNoOrthoDesired =false;
96 if (aInfo.bNoContortion ) rInfo.bNoContortion =true;
97 if (!aInfo.bCanConvToPath ) rInfo.bCanConvToPath =false;
99 if(!aInfo.bCanConvToContour)
100 rInfo.bCanConvToContour = false;
102 if (!aInfo.bCanConvToPoly ) rInfo.bCanConvToPoly =false;
103 if (!aInfo.bCanConvToPathLineToArea) rInfo.bCanConvToPathLineToArea=false;
104 if (!aInfo.bCanConvToPolyLineToArea) rInfo.bCanConvToPolyLineToArea=false;
106 if (nObjCount==0) {
107 rInfo.bRotateFreeAllowed=false;
108 rInfo.bRotate90Allowed =false;
109 rInfo.bMirrorFreeAllowed=false;
110 rInfo.bMirror45Allowed =false;
111 rInfo.bMirror90Allowed =false;
112 rInfo.bTransparenceAllowed = false;
113 rInfo.bShearAllowed =false;
114 rInfo.bEdgeRadiusAllowed=false;
115 rInfo.bNoContortion =true;
117 if(nObjCount != 1)
119 // only allowed if single object selected
120 rInfo.bTransparenceAllowed = false;
124 void SdrObjGroup::SetBoundRectDirty()
126 // avoid resetting aOutRect which in case of this object is model data,
127 // not re-creatable view data
130 SdrObjKind SdrObjGroup::GetObjIdentifier() const
132 return OBJ_GRUP;
135 SdrLayerID SdrObjGroup::GetLayer() const
137 bool b1st = true;
138 SdrLayerID nLay = SdrObject::GetLayer();
139 const size_t nObjCount(GetObjCount());
140 for (size_t i=0; i<nObjCount; ++i) {
141 SdrLayerID nLay1(GetObj(i)->GetLayer());
142 if (b1st) { nLay=nLay1; b1st = false; }
143 else if (nLay1!=nLay) return SdrLayerID(0);
145 return nLay;
148 void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
150 SdrObject::NbcSetLayer(nLayer);
151 const size_t nObjCount(GetObjCount());
152 for (size_t i=0; i<nObjCount; ++i) {
153 GetObj(i)->NbcSetLayer(nLayer);
157 void SdrObjGroup::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
159 // call parent
160 SdrObject::handlePageChange(pOldPage, pNewPage);
162 for(size_t i(0); i < GetObjCount(); i++)
164 GetObj(i)->handlePageChange(pOldPage, pNewPage);
168 SdrObjList* SdrObjGroup::GetSubList() const
170 return const_cast< SdrObjGroup* >(this);
173 const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
175 // <aOutRect> has to contain the bounding rectangle
176 if(0 != GetObjCount())
178 const_cast< SdrObjGroup* >(this)->aOutRect = GetAllObjBoundRect();
181 return aOutRect;
184 const tools::Rectangle& SdrObjGroup::GetSnapRect() const
186 // <aOutRect> has to contain the bounding rectangle
187 if(0 != GetObjCount())
189 return GetAllObjSnapRect();
191 else
193 return aOutRect;
197 SdrObjGroup* SdrObjGroup::CloneSdrObject(SdrModel& rTargetModel) const
199 return CloneHelper< SdrObjGroup >(rTargetModel);
202 SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj)
204 if( this == &rObj )
205 return *this;
207 // copy SdrObject stuff
208 SdrObject::operator=(rObj);
210 // copy child SdrObjects
211 if(nullptr != rObj.GetSubList())
213 // #i36404# Copy SubList, init model and page first
214 const SdrObjList& rSourceSubList(*rObj.GetSubList());
216 CopyObjects(rSourceSubList);
218 // tdf#116979: needed here, we need bSnapRectDirty to be true
219 // which it is after using SdrObject::operator= (see above),
220 // but set to false again using CopyObjects
221 SetRectsDirty();
224 // copy local parameters
225 aRefPoint = rObj.aRefPoint;
226 return *this;
230 OUString SdrObjGroup::TakeObjNameSingul() const
232 OUStringBuffer sName;
234 if(0 == GetObjCount())
236 sName.append(SvxResId(STR_ObjNameSingulGRUPEMPTY));
238 else
240 sName.append(SvxResId(STR_ObjNameSingulGRUP));
243 const OUString aName(GetName());
245 if (!aName.isEmpty())
247 sName.append(' ');
248 sName.append('\'');
249 sName.append(aName);
250 sName.append('\'');
253 return sName.makeStringAndClear();
257 OUString SdrObjGroup::TakeObjNamePlural() const
259 if(0 == GetObjCount())
260 return SvxResId(STR_ObjNamePluralGRUPEMPTY);
261 return SvxResId(STR_ObjNamePluralGRUP);
265 void SdrObjGroup::RecalcSnapRect()
267 // TODO: unnecessary, because we use the Rects from the SubList
270 basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
272 basegfx::B2DPolyPolygon aRetval;
273 const size_t nObjCount(GetObjCount());
275 for(size_t a = 0; a < nObjCount; ++a)
277 SdrObject* pObj(GetObj(a));
278 aRetval.append(pObj->TakeXorPoly());
281 if(!aRetval.count())
283 const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aOutRect);
284 aRetval.append(basegfx::utils::createPolygonFromRect(aRange));
287 return aRetval;
290 bool SdrObjGroup::beginSpecialDrag(SdrDragStat& /*rDrag*/) const
292 return false;
296 bool SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/)
298 return false;
302 tools::Long SdrObjGroup::GetRotateAngle() const
304 tools::Long nRetval(0);
306 if(0 != GetObjCount())
308 SdrObject* pObj(GetObj(0));
310 nRetval = pObj->GetRotateAngle();
313 return nRetval;
317 tools::Long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
319 tools::Long nRetval(0);
321 if(0 != GetObjCount())
323 SdrObject* pObj(GetObj(0));
325 nRetval = pObj->GetShearAngle();
328 return nRetval;
332 void SdrObjGroup::NbcSetSnapRect(const tools::Rectangle& rRect)
334 tools::Rectangle aOld(GetSnapRect());
335 tools::Long nMulX=rRect.Right()-rRect.Left();
336 tools::Long nDivX=aOld.Right()-aOld.Left();
337 tools::Long nMulY=rRect.Bottom()-rRect.Top();
338 tools::Long nDivY=aOld.Bottom()-aOld.Top();
339 if (nDivX==0) { nMulX=1; nDivX=1; }
340 if (nDivY==0) { nMulY=1; nDivY=1; }
341 if (nMulX!=nDivX || nMulY!=nDivY) {
342 Fraction aX(nMulX,nDivX);
343 Fraction aY(nMulY,nDivY);
344 NbcResize(aOld.TopLeft(),aX,aY);
346 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
347 NbcMove(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
352 void SdrObjGroup::NbcSetLogicRect(const tools::Rectangle& rRect)
354 NbcSetSnapRect(rRect);
358 void SdrObjGroup::NbcMove(const Size& rSiz)
360 aRefPoint.Move(rSiz);
361 const size_t nObjCount(GetObjCount());
363 if(0 != nObjCount)
365 for (size_t i=0; i<nObjCount; ++i)
367 SdrObject* pObj(GetObj(i));
368 pObj->NbcMove(rSiz);
371 else
373 aOutRect.Move(rSiz);
374 SetRectsDirty();
379 void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
381 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
382 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
383 if (bXMirr || bYMirr) {
384 Point aRef1(GetSnapRect().Center());
385 if (bXMirr) {
386 Point aRef2(aRef1);
387 aRef2.AdjustY( 1 );
388 NbcMirrorGluePoints(aRef1,aRef2);
390 if (bYMirr) {
391 Point aRef2(aRef1);
392 aRef2.AdjustX( 1 );
393 NbcMirrorGluePoints(aRef1,aRef2);
397 ResizePoint(aRefPoint,rRef,xFact,yFact);
399 const size_t nObjCount(GetObjCount());
400 if(0 != nObjCount)
402 for (size_t i=0; i<nObjCount; ++i)
404 SdrObject* pObj(GetObj(i));
405 pObj->NbcResize(rRef,xFact,yFact);
408 else
410 ResizeRect(aOutRect,rRef,xFact,yFact);
411 SetRectsDirty();
416 void SdrObjGroup::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
418 SetGlueReallyAbsolute(true);
419 RotatePoint(aRefPoint,rRef,sn,cs);
420 const size_t nObjCount(GetObjCount());
422 for (size_t i=0; i<nObjCount; ++i)
424 SdrObject* pObj(GetObj(i));
425 pObj->NbcRotate(rRef,nAngle,sn,cs);
428 NbcRotateGluePoints(rRef,nAngle,sn,cs);
429 SetGlueReallyAbsolute(false);
433 void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
435 SetGlueReallyAbsolute(true);
436 MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
437 const size_t nObjCount(GetObjCount());
439 for (size_t i=0; i<nObjCount; ++i)
441 SdrObject* pObj(GetObj(i));
442 pObj->NbcMirror(rRef1,rRef2);
445 NbcMirrorGluePoints(rRef1,rRef2);
446 SetGlueReallyAbsolute(false);
450 void SdrObjGroup::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
452 SetGlueReallyAbsolute(true);
453 ShearPoint(aRefPoint,rRef,tn);
454 const size_t nObjCount(GetObjCount());
456 for (size_t i=0; i<nObjCount; ++i)
458 SdrObject* pObj(GetObj(i));
459 pObj->NbcShear(rRef,nAngle,tn,bVShear);
462 NbcShearGluePoints(rRef,tn,bVShear);
463 SetGlueReallyAbsolute(false);
467 void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
469 aAnchor=rPnt;
470 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
471 aRefPoint.Move(aSiz);
472 const size_t nObjCount(GetObjCount());
474 for (size_t i=0; i<nObjCount; ++i)
476 SdrObject* pObj(GetObj(i));
477 pObj->NbcSetAnchorPos(rPnt);
482 void SdrObjGroup::SetSnapRect(const tools::Rectangle& rRect)
484 tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
485 tools::Rectangle aOld(GetSnapRect());
486 if (aOld.IsEmpty())
488 Fraction aX(1,1);
489 Fraction aY(1,1);
490 Resize(aOld.TopLeft(),aX,aY);
492 else
494 tools::Long nMulX=rRect.Right()-rRect.Left();
495 tools::Long nDivX=aOld.Right()-aOld.Left();
496 tools::Long nMulY=rRect.Bottom()-rRect.Top();
497 tools::Long nDivY=aOld.Bottom()-aOld.Top();
498 if (nDivX==0) { nMulX=1; nDivX=1; }
499 if (nDivY==0) { nMulY=1; nDivY=1; }
500 if (nMulX!=nDivX || nMulY!=nDivY) {
501 Fraction aX(nMulX,nDivX);
502 Fraction aY(nMulY,nDivY);
503 Resize(aOld.TopLeft(),aX,aY);
506 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
507 Move(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
510 SetChanged();
511 BroadcastObjectChange();
512 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
516 void SdrObjGroup::SetLogicRect(const tools::Rectangle& rRect)
518 SetSnapRect(rRect);
522 void SdrObjGroup::Move(const Size& rSiz)
524 if (rSiz.Width()==0 && rSiz.Height()==0)
525 return;
527 tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
528 aRefPoint.Move(rSiz);
529 const size_t nObjCount(GetObjCount());
531 if(0 != nObjCount)
533 // first move the connectors, then everything else
534 for (size_t i=0; i<nObjCount; ++i)
536 SdrObject* pObj(GetObj(i));
537 if (pObj->IsEdgeObj())
538 pObj->Move(rSiz);
541 for (size_t i=0; i<nObjCount; ++i)
543 SdrObject* pObj(GetObj(i));
544 if (!pObj->IsEdgeObj())
545 pObj->Move(rSiz);
548 else
550 aOutRect.Move(rSiz);
551 SetRectsDirty();
554 SetChanged();
555 BroadcastObjectChange();
556 SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0);
560 void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
562 if (xFact.GetNumerator()==xFact.GetDenominator() && yFact.GetNumerator()==yFact.GetDenominator())
563 return;
565 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
566 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
567 if (bXMirr || bYMirr) {
568 Point aRef1(GetSnapRect().Center());
569 if (bXMirr) {
570 Point aRef2(aRef1);
571 aRef2.AdjustY( 1 );
572 NbcMirrorGluePoints(aRef1,aRef2);
574 if (bYMirr) {
575 Point aRef2(aRef1);
576 aRef2.AdjustX( 1 );
577 NbcMirrorGluePoints(aRef1,aRef2);
580 tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
581 ResizePoint(aRefPoint,rRef,xFact,yFact);
582 const size_t nObjCount(GetObjCount());
584 if(0 != nObjCount)
586 // move the connectors first, everything else afterwards
587 for (size_t i=0; i<nObjCount; ++i)
589 SdrObject* pObj(GetObj(i));
590 if (pObj->IsEdgeObj())
591 pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
594 for (size_t i=0; i<nObjCount; ++i)
596 SdrObject* pObj(GetObj(i));
597 if (!pObj->IsEdgeObj())
598 pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
601 else
603 ResizeRect(aOutRect,rRef,xFact,yFact);
604 SetRectsDirty();
607 SetChanged();
608 BroadcastObjectChange();
609 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
613 void SdrObjGroup::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
615 if (nAngle==0)
616 return;
618 SetGlueReallyAbsolute(true);
619 tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
620 RotatePoint(aRefPoint,rRef,sn,cs);
621 // move the connectors first, everything else afterwards
622 const size_t nObjCount(GetObjCount());
624 for (size_t i=0; i<nObjCount; ++i)
626 SdrObject* pObj(GetObj(i));
627 if (pObj->IsEdgeObj())
628 pObj->Rotate(rRef,nAngle,sn,cs);
631 for (size_t i=0; i<nObjCount; ++i)
633 SdrObject* pObj(GetObj(i));
634 if (!pObj->IsEdgeObj())
635 pObj->Rotate(rRef,nAngle,sn,cs);
638 NbcRotateGluePoints(rRef,nAngle,sn,cs);
639 SetGlueReallyAbsolute(false);
640 SetChanged();
641 BroadcastObjectChange();
642 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
646 void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
648 SetGlueReallyAbsolute(true);
649 tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
650 MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
651 // move the connectors first, everything else afterwards
652 const size_t nObjCount(GetObjCount());
654 for (size_t i=0; i<nObjCount; ++i)
656 SdrObject* pObj(GetObj(i));
657 if (pObj->IsEdgeObj())
658 pObj->Mirror(rRef1,rRef2);
661 for (size_t i=0; i<nObjCount; ++i)
663 SdrObject* pObj(GetObj(i));
664 if (!pObj->IsEdgeObj())
665 pObj->Mirror(rRef1,rRef2);
668 NbcMirrorGluePoints(rRef1,rRef2);
669 SetGlueReallyAbsolute(false);
670 SetChanged();
671 BroadcastObjectChange();
672 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
676 void SdrObjGroup::Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
678 if (nAngle==0)
679 return;
681 SetGlueReallyAbsolute(true);
682 tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
683 ShearPoint(aRefPoint,rRef,tn);
684 // move the connectors first, everything else afterwards
685 const size_t nObjCount(GetObjCount());
687 for (size_t i=0; i<nObjCount; ++i)
689 SdrObject* pObj(GetObj(i));
690 if (pObj->IsEdgeObj())
691 pObj->Shear(rRef,nAngle,tn,bVShear);
694 for (size_t i=0; i<nObjCount; ++i)
696 SdrObject* pObj(GetObj(i));
697 if (!pObj->IsEdgeObj())
698 pObj->Shear(rRef,nAngle,tn,bVShear);
701 NbcShearGluePoints(rRef,tn,bVShear);
702 SetGlueReallyAbsolute(false);
703 SetChanged();
704 BroadcastObjectChange();
705 SendUserCall(SdrUserCallType::Resize,aBoundRect0);
710 void SdrObjGroup::SetAnchorPos(const Point& rPnt)
712 tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
713 bool bChg=aAnchor!=rPnt;
714 aAnchor=rPnt;
715 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
716 aRefPoint.Move(aSiz);
717 // move the connectors first, everything else afterwards
718 const size_t nObjCount(GetObjCount());
720 for (size_t i=0; i<nObjCount; ++i)
722 SdrObject* pObj(GetObj(i));
723 if (pObj->IsEdgeObj())
724 pObj->SetAnchorPos(rPnt);
727 for (size_t i=0; i<nObjCount; ++i)
729 SdrObject* pObj(GetObj(i));
730 if (!pObj->IsEdgeObj())
731 pObj->SetAnchorPos(rPnt);
734 if (bChg)
736 SetChanged();
737 BroadcastObjectChange();
738 SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0);
743 void SdrObjGroup::NbcSetRelativePos(const Point& rPnt)
745 Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
746 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
747 NbcMove(aSiz); // this also calls SetRectsDirty()
750 void SdrObjGroup::SetRelativePos(const Point& rPnt)
752 Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
753 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
754 if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // this also calls SetRectsDirty() and Broadcast, ...
757 void SdrObjGroup::NbcReformatText()
759 NbcReformatAllTextObjects();
762 SdrObjectUniquePtr SdrObjGroup::DoConvertToPolyObj(bool bBezier, bool bAddText) const
764 SdrObjectUniquePtr pGroup( new SdrObjGroup(getSdrModelFromSdrObject()) );
765 const size_t nObjCount(GetObjCount());
767 for(size_t a=0; a < nObjCount; ++a)
769 SdrObject* pIterObj(GetObj(a));
770 SdrObjectUniquePtr pResult(pIterObj->DoConvertToPolyObj(bBezier, bAddText));
772 // pResult can be NULL e.g. for empty objects
773 if( pResult )
774 pGroup->GetSubList()->NbcInsertObject(pResult.release());
777 return pGroup;
780 void SdrObjGroup::dumpAsXml(xmlTextWriterPtr pWriter) const
782 xmlTextWriterStartElement(pWriter, BAD_CAST("SdrObjGroup"));
783 xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
785 SdrObject::dumpAsXml(pWriter);
786 SdrObjList::dumpAsXml(pWriter);
788 xmlTextWriterEndElement(pWriter);
791 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */