Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / svdraw / svdogrp.cxx
blob3c30b4dd16dae0789ff2e3e1a026620ab2fbc171
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 <sfx2/linkmgr.hxx>
22 #include <unotools/datetime.hxx>
24 #include <svx/svdogrp.hxx>
26 #include <sfx2/lnkbase.hxx>
28 #include <svl/urihelper.hxx>
30 #include <svx/xpool.hxx>
31 #include <svx/xpoly.hxx>
33 #include <svx/svdmodel.hxx>
34 #include <svx/svdpage.hxx>
35 #include "svx/svditer.hxx"
36 #include <svx/svdobj.hxx>
37 #include <svx/svdtrans.hxx>
38 #include <svx/svdetc.hxx>
39 #include <svx/svdoedge.hxx>
40 #include "svdglob.hxx"
41 #include "svx/svdstr.hrc"
43 #include <svx/svxids.hrc>
44 #include <svl/whiter.hxx>
45 #include <svx/svdpool.hxx>
46 #include <sdr/properties/groupproperties.hxx>
47 #include <sdr/contact/viewcontactofgroup.hxx>
48 #include <basegfx/range/b2drange.hxx>
49 #include <basegfx/polygon/b2dpolygontools.hxx>
50 #include <basegfx/polygon/b2dpolygon.hxx>
53 // BaseProperties section
55 sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties()
57 return new sdr::properties::GroupProperties(*this);
61 // DrawContact section
63 sdr::contact::ViewContact* SdrObjGroup::CreateObjectSpecificViewContact()
65 return new sdr::contact::ViewContactOfGroup(*this);
70 TYPEINIT1(SdrObjGroup,SdrObject);
72 SdrObjGroup::SdrObjGroup()
74 pSub=new SdrObjList(NULL,NULL);
75 pSub->SetOwnerObj(this);
76 pSub->SetListKind(SDROBJLIST_GROUPOBJ);
77 bRefPoint=false;
78 bClosedObj=false;
82 SdrObjGroup::~SdrObjGroup()
84 delete pSub;
87 void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
89 rInfo.bNoContortion=false;
90 SdrObjList* pOL=pSub;
91 sal_uIntPtr nObjAnz=pOL->GetObjCount();
92 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
93 SdrObject* pObj=pOL->GetObj(i);
94 SdrObjTransformInfoRec aInfo;
95 pObj->TakeObjInfo(aInfo);
96 if (!aInfo.bMoveAllowed ) rInfo.bMoveAllowed =false;
97 if (!aInfo.bResizeFreeAllowed ) rInfo.bResizeFreeAllowed =false;
98 if (!aInfo.bResizePropAllowed ) rInfo.bResizePropAllowed =false;
99 if (!aInfo.bRotateFreeAllowed ) rInfo.bRotateFreeAllowed =false;
100 if (!aInfo.bRotate90Allowed ) rInfo.bRotate90Allowed =false;
101 if (!aInfo.bMirrorFreeAllowed ) rInfo.bMirrorFreeAllowed =false;
102 if (!aInfo.bMirror45Allowed ) rInfo.bMirror45Allowed =false;
103 if (!aInfo.bMirror90Allowed ) rInfo.bMirror90Allowed =false;
104 if (!aInfo.bShearAllowed ) rInfo.bShearAllowed =false;
105 if (!aInfo.bEdgeRadiusAllowed ) rInfo.bEdgeRadiusAllowed =false;
106 if (!aInfo.bNoOrthoDesired ) rInfo.bNoOrthoDesired =false;
107 if (aInfo.bNoContortion ) rInfo.bNoContortion =true;
108 if (!aInfo.bCanConvToPath ) rInfo.bCanConvToPath =false;
110 if(!aInfo.bCanConvToContour)
111 rInfo.bCanConvToContour = false;
113 if (!aInfo.bCanConvToPoly ) rInfo.bCanConvToPoly =false;
114 if (!aInfo.bCanConvToPathLineToArea) rInfo.bCanConvToPathLineToArea=false;
115 if (!aInfo.bCanConvToPolyLineToArea) rInfo.bCanConvToPolyLineToArea=false;
117 if (nObjAnz==0) {
118 rInfo.bRotateFreeAllowed=false;
119 rInfo.bRotate90Allowed =false;
120 rInfo.bMirrorFreeAllowed=false;
121 rInfo.bMirror45Allowed =false;
122 rInfo.bMirror90Allowed =false;
123 rInfo.bTransparenceAllowed = false;
124 rInfo.bGradientAllowed = false;
125 rInfo.bShearAllowed =false;
126 rInfo.bEdgeRadiusAllowed=false;
127 rInfo.bNoContortion =true;
129 if(nObjAnz != 1)
131 // only allowed if single object selected
132 rInfo.bTransparenceAllowed = false;
133 rInfo.bGradientAllowed = false;
138 void SdrObjGroup::SetBoundRectDirty()
140 // avoid resetting aOutRect which in case of this object is model data,
141 // not re-creatable view data
144 sal_uInt16 SdrObjGroup::GetObjIdentifier() const
146 return sal_uInt16(OBJ_GRUP);
150 SdrLayerID SdrObjGroup::GetLayer() const
152 bool b1st = true;
153 SdrLayerID nLay=SdrLayerID(SdrObject::GetLayer());
154 SdrObjList* pOL=pSub;
155 sal_uIntPtr nObjAnz=pOL->GetObjCount();
156 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
157 SdrLayerID nLay1=pOL->GetObj(i)->GetLayer();
158 if (b1st) { nLay=nLay1; b1st = false; }
159 else if (nLay1!=nLay) return 0;
161 return nLay;
165 void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
167 SdrObject::NbcSetLayer(nLayer);
168 SdrObjList* pOL=pSub;
169 sal_uIntPtr nObjAnz=pOL->GetObjCount();
170 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
171 pOL->GetObj(i)->NbcSetLayer(nLayer);
176 void SdrObjGroup::SetObjList(SdrObjList* pNewObjList)
178 SdrObject::SetObjList(pNewObjList);
179 pSub->SetUpList(pNewObjList);
183 void SdrObjGroup::SetPage(SdrPage* pNewPage)
185 SdrObject::SetPage(pNewPage);
186 pSub->SetPage(pNewPage);
190 void SdrObjGroup::SetModel(SdrModel* pNewModel)
192 if(pNewModel!=pModel)
194 // #i30648#
195 // This method also needs to migrate the used ItemSet
196 // when the destination model uses a different pool
197 // than the current one. Else it is possible to create
198 // SdrObjGroups which reference the old pool which might
199 // be destroyed (as the bug shows).
200 SdrModel* pOldModel = pModel;
202 // test for correct pool in ItemSet; move to new pool if necessary
203 if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
205 MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
208 // call parent
209 SdrObject::SetModel(pNewModel);
211 // set new model at content
212 pSub->SetModel(pNewModel);
214 // modify properties
215 GetProperties().SetModel(pOldModel, pNewModel);
220 bool SdrObjGroup::HasRefPoint() const
222 return bRefPoint;
226 Point SdrObjGroup::GetRefPoint() const
228 return aRefPoint;
232 void SdrObjGroup::SetRefPoint(const Point& rPnt)
234 bRefPoint=true;
235 aRefPoint=rPnt;
239 SdrObjList* SdrObjGroup::GetSubList() const
241 return pSub;
244 const Rectangle& SdrObjGroup::GetCurrentBoundRect() const
246 // <aOutRect> has to contain the bounding rectangle
247 if ( pSub->GetObjCount()!=0 )
249 const_cast<SdrObjGroup*>(this)->aOutRect = pSub->GetAllObjBoundRect();
252 return aOutRect;
255 const Rectangle& SdrObjGroup::GetSnapRect() const
257 // <aOutRect> has to contain the bounding rectangle
258 if ( pSub->GetObjCount()!=0 )
260 return pSub->GetAllObjSnapRect();
262 else
264 return aOutRect;
268 SdrObjGroup* SdrObjGroup::Clone() const
270 return CloneHelper< SdrObjGroup >();
273 SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj)
275 if( this == &rObj )
276 return *this;
277 // copy SdrObject stuff
278 SdrObject::operator=(rObj);
280 // #i36404#
281 // copy SubList, init model and page first
282 SdrObjList& rSourceSubList = *rObj.GetSubList();
283 pSub->SetPage(rSourceSubList.GetPage());
284 pSub->SetModel(rSourceSubList.GetModel());
285 pSub->CopyObjects(*rObj.GetSubList());
287 // copy local parameters
288 aRefPoint = rObj.aRefPoint;
289 bRefPoint = rObj.bRefPoint;
290 return *this;
294 OUString SdrObjGroup::TakeObjNameSingul() const
296 OUStringBuffer sName;
298 if(!pSub->GetObjCount())
300 sName.append(ImpGetResStr(STR_ObjNameSingulGRUPEMPTY));
302 else
304 sName.append(ImpGetResStr(STR_ObjNameSingulGRUP));
307 const OUString aName(GetName());
309 if (!aName.isEmpty())
311 sName.append(' ');
312 sName.append('\'');
313 sName.append(aName);
314 sName.append('\'');
317 return sName.makeStringAndClear();
321 OUString SdrObjGroup::TakeObjNamePlural() const
323 if (pSub->GetObjCount()==0)
324 return ImpGetResStr(STR_ObjNamePluralGRUPEMPTY);
325 return ImpGetResStr(STR_ObjNamePluralGRUP);
329 void SdrObjGroup::RecalcSnapRect()
331 // TODO: unnecessary, because we use the Rects from the SubList
334 basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
336 basegfx::B2DPolyPolygon aRetval;
337 const sal_uInt32 nObjCount(pSub->GetObjCount());
339 for(sal_uInt32 a(0L); a < nObjCount; a++)
341 SdrObject* pObj = pSub->GetObj(a);
342 aRetval.append(pObj->TakeXorPoly());
345 if(!aRetval.count())
347 const basegfx::B2DRange aRange(aOutRect.Left(), aOutRect.Top(), aOutRect.Right(), aOutRect.Bottom());
348 aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
351 return aRetval;
354 bool SdrObjGroup::beginSpecialDrag(SdrDragStat& /*rDrag*/) const
356 return false;
360 bool SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/)
362 return false;
366 long SdrObjGroup::GetRotateAngle() const
368 const sal_uInt32 nObjCount(pSub->GetObjCount());
369 long nRetval(0);
371 if(nObjCount)
373 SdrObject* pObj = pSub->GetObj(0);
375 nRetval = pObj->GetRotateAngle();
378 return nRetval;
382 long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
384 const sal_uInt32 nObjCount(pSub->GetObjCount());
385 long nRetval(0);
387 if(nObjCount)
389 SdrObject* pObj = pSub->GetObj(0);
391 nRetval = pObj->GetShearAngle();
394 return nRetval;
398 void SdrObjGroup::NbcSetSnapRect(const Rectangle& rRect)
400 Rectangle aOld(GetSnapRect());
401 long nMulX=rRect.Right()-rRect.Left();
402 long nDivX=aOld.Right()-aOld.Left();
403 long nMulY=rRect.Bottom()-rRect.Top();
404 long nDivY=aOld.Bottom()-aOld.Top();
405 if (nDivX==0) { nMulX=1; nDivX=1; }
406 if (nDivY==0) { nMulY=1; nDivY=1; }
407 if (nMulX!=nDivX || nMulY!=nDivY) {
408 Fraction aX(nMulX,nDivX);
409 Fraction aY(nMulY,nDivY);
410 NbcResize(aOld.TopLeft(),aX,aY);
412 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
413 NbcMove(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
418 void SdrObjGroup::NbcSetLogicRect(const Rectangle& rRect)
420 NbcSetSnapRect(rRect);
424 void SdrObjGroup::NbcMove(const Size& rSiz)
426 MovePoint(aRefPoint,rSiz);
427 if (pSub->GetObjCount()!=0) {
428 SdrObjList* pOL=pSub;
429 sal_uIntPtr nObjAnz=pOL->GetObjCount();
430 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
431 SdrObject* pObj=pOL->GetObj(i);
432 pObj->NbcMove(rSiz);
434 } else {
435 MoveRect(aOutRect,rSiz);
436 SetRectsDirty();
441 void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
443 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
444 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
445 if (bXMirr || bYMirr) {
446 Point aRef1(GetSnapRect().Center());
447 if (bXMirr) {
448 Point aRef2(aRef1);
449 aRef2.Y()++;
450 NbcMirrorGluePoints(aRef1,aRef2);
452 if (bYMirr) {
453 Point aRef2(aRef1);
454 aRef2.X()++;
455 NbcMirrorGluePoints(aRef1,aRef2);
458 ResizePoint(aRefPoint,rRef,xFact,yFact);
459 if (pSub->GetObjCount()!=0) {
460 SdrObjList* pOL=pSub;
461 sal_uIntPtr nObjAnz=pOL->GetObjCount();
462 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
463 SdrObject* pObj=pOL->GetObj(i);
464 pObj->NbcResize(rRef,xFact,yFact);
466 } else {
467 ResizeRect(aOutRect,rRef,xFact,yFact);
468 SetRectsDirty();
473 void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
475 SetGlueReallyAbsolute(true);
476 RotatePoint(aRefPoint,rRef,sn,cs);
477 SdrObjList* pOL=pSub;
478 sal_uIntPtr nObjAnz=pOL->GetObjCount();
479 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
480 SdrObject* pObj=pOL->GetObj(i);
481 pObj->NbcRotate(rRef,nWink,sn,cs);
483 NbcRotateGluePoints(rRef,nWink,sn,cs);
484 SetGlueReallyAbsolute(false);
488 void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
490 SetGlueReallyAbsolute(true);
491 MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
492 SdrObjList* pOL=pSub;
493 sal_uIntPtr nObjAnz=pOL->GetObjCount();
494 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
495 SdrObject* pObj=pOL->GetObj(i);
496 pObj->NbcMirror(rRef1,rRef2);
498 NbcMirrorGluePoints(rRef1,rRef2);
499 SetGlueReallyAbsolute(false);
503 void SdrObjGroup::NbcShear(const Point& rRef, long nWink, double tn, bool bVShear)
505 SetGlueReallyAbsolute(true);
506 ShearPoint(aRefPoint,rRef,tn);
507 SdrObjList* pOL=pSub;
508 sal_uIntPtr nObjAnz=pOL->GetObjCount();
509 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
510 SdrObject* pObj=pOL->GetObj(i);
511 pObj->NbcShear(rRef,nWink,tn,bVShear);
513 NbcShearGluePoints(rRef,nWink,tn,bVShear);
514 SetGlueReallyAbsolute(false);
518 void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
520 aAnchor=rPnt;
521 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
522 MovePoint(aRefPoint,aSiz);
523 SdrObjList* pOL=pSub;
524 sal_uIntPtr nObjAnz=pOL->GetObjCount();
525 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
526 SdrObject* pObj=pOL->GetObj(i);
527 pObj->NbcSetAnchorPos(rPnt);
532 void SdrObjGroup::SetSnapRect(const Rectangle& rRect)
534 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
535 Rectangle aOld(GetSnapRect());
536 long nMulX=rRect.Right()-rRect.Left();
537 long nDivX=aOld.Right()-aOld.Left();
538 long nMulY=rRect.Bottom()-rRect.Top();
539 long nDivY=aOld.Bottom()-aOld.Top();
540 if (nDivX==0) { nMulX=1; nDivX=1; }
541 if (nDivY==0) { nMulY=1; nDivY=1; }
542 if (nMulX!=nDivX || nMulY!=nDivY) {
543 Fraction aX(nMulX,nDivX);
544 Fraction aY(nMulY,nDivY);
545 Resize(aOld.TopLeft(),aX,aY);
547 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
548 Move(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
551 SetChanged();
552 BroadcastObjectChange();
553 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
557 void SdrObjGroup::SetLogicRect(const Rectangle& rRect)
559 SetSnapRect(rRect);
563 void SdrObjGroup::Move(const Size& rSiz)
565 if (rSiz.Width()!=0 || rSiz.Height()!=0) {
566 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
567 MovePoint(aRefPoint,rSiz);
568 if (pSub->GetObjCount()!=0) {
569 // first move the connectors, then everything else
570 SdrObjList* pOL=pSub;
571 sal_uIntPtr nObjAnz=pOL->GetObjCount();
572 sal_uIntPtr i;
573 for (i=0; i<nObjAnz; i++) {
574 SdrObject* pObj=pOL->GetObj(i);
575 if (pObj->IsEdgeObj()) pObj->Move(rSiz);
577 for (i=0; i<nObjAnz; i++) {
578 SdrObject* pObj=pOL->GetObj(i);
579 if (!pObj->IsEdgeObj()) pObj->Move(rSiz);
581 } else {
582 MoveRect(aOutRect,rSiz);
583 SetRectsDirty();
586 SetChanged();
587 BroadcastObjectChange();
588 SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
593 void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
595 if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
596 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
597 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
598 if (bXMirr || bYMirr) {
599 Point aRef1(GetSnapRect().Center());
600 if (bXMirr) {
601 Point aRef2(aRef1);
602 aRef2.Y()++;
603 NbcMirrorGluePoints(aRef1,aRef2);
605 if (bYMirr) {
606 Point aRef2(aRef1);
607 aRef2.X()++;
608 NbcMirrorGluePoints(aRef1,aRef2);
611 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
612 ResizePoint(aRefPoint,rRef,xFact,yFact);
613 if (pSub->GetObjCount()!=0) {
614 // move the connectors first, everything else afterwards
615 SdrObjList* pOL=pSub;
616 sal_uIntPtr nObjAnz=pOL->GetObjCount();
617 sal_uIntPtr i;
618 for (i=0; i<nObjAnz; i++) {
619 SdrObject* pObj=pOL->GetObj(i);
620 if (pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
622 for (i=0; i<nObjAnz; i++) {
623 SdrObject* pObj=pOL->GetObj(i);
624 if (!pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
626 } else {
627 ResizeRect(aOutRect,rRef,xFact,yFact);
628 SetRectsDirty();
631 SetChanged();
632 BroadcastObjectChange();
633 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
638 void SdrObjGroup::Rotate(const Point& rRef, long nWink, double sn, double cs)
640 if (nWink!=0) {
641 SetGlueReallyAbsolute(true);
642 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
643 RotatePoint(aRefPoint,rRef,sn,cs);
644 // move the connectors first, everything else afterwards
645 SdrObjList* pOL=pSub;
646 sal_uIntPtr nObjAnz=pOL->GetObjCount();
647 sal_uIntPtr i;
648 for (i=0; i<nObjAnz; i++) {
649 SdrObject* pObj=pOL->GetObj(i);
650 if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
652 for (i=0; i<nObjAnz; i++) {
653 SdrObject* pObj=pOL->GetObj(i);
654 if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
656 NbcRotateGluePoints(rRef,nWink,sn,cs);
657 SetGlueReallyAbsolute(false);
658 SetChanged();
659 BroadcastObjectChange();
660 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
665 void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
667 SetGlueReallyAbsolute(true);
668 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
669 MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
670 // move the connectors first, everything else afterwards
671 SdrObjList* pOL=pSub;
672 sal_uIntPtr nObjAnz=pOL->GetObjCount();
673 sal_uIntPtr i;
674 for (i=0; i<nObjAnz; i++) {
675 SdrObject* pObj=pOL->GetObj(i);
676 if (pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
678 for (i=0; i<nObjAnz; i++) {
679 SdrObject* pObj=pOL->GetObj(i);
680 if (!pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
682 NbcMirrorGluePoints(rRef1,rRef2);
683 SetGlueReallyAbsolute(false);
684 SetChanged();
685 BroadcastObjectChange();
686 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
690 void SdrObjGroup::Shear(const Point& rRef, long nWink, double tn, bool bVShear)
692 if (nWink!=0) {
693 SetGlueReallyAbsolute(true);
694 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
695 ShearPoint(aRefPoint,rRef,tn);
696 // move the connectors first, everything else afterwards
697 SdrObjList* pOL=pSub;
698 sal_uIntPtr nObjAnz=pOL->GetObjCount();
699 sal_uIntPtr i;
700 for (i=0; i<nObjAnz; i++) {
701 SdrObject* pObj=pOL->GetObj(i);
702 if (pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
704 for (i=0; i<nObjAnz; i++) {
705 SdrObject* pObj=pOL->GetObj(i);
706 if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
708 NbcShearGluePoints(rRef,nWink,tn,bVShear);
709 SetGlueReallyAbsolute(false);
710 SetChanged();
711 BroadcastObjectChange();
712 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
717 void SdrObjGroup::SetAnchorPos(const Point& rPnt)
719 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
720 bool bChg=aAnchor!=rPnt;
721 aAnchor=rPnt;
722 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
723 MovePoint(aRefPoint,aSiz);
724 // move the connectors first, everything else afterwards
725 SdrObjList* pOL=pSub;
726 sal_uIntPtr nObjAnz=pOL->GetObjCount();
727 sal_uIntPtr i;
728 for (i=0; i<nObjAnz; i++) {
729 SdrObject* pObj=pOL->GetObj(i);
730 if (pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
732 for (i=0; i<nObjAnz; i++) {
733 SdrObject* pObj=pOL->GetObj(i);
734 if (!pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
736 if (bChg) {
737 SetChanged();
738 BroadcastObjectChange();
739 SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
745 void SdrObjGroup::NbcSetRelativePos(const Point& rPnt)
747 Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
748 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
749 NbcMove(aSiz); // this also calls SetRectsDirty()
752 void SdrObjGroup::SetRelativePos(const Point& rPnt)
754 Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
755 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
756 if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // this also calls SetRectsDirty() and Broadcast, ...
759 void SdrObjGroup::NbcReformatText()
761 pSub->NbcReformatAllTextObjects();
764 void SdrObjGroup::ReformatText()
766 pSub->ReformatAllTextObjects();
769 SdrObject* SdrObjGroup::DoConvertToPolyObj(bool bBezier, bool bAddText) const
771 SdrObject* pGroup = new SdrObjGroup;
772 pGroup->SetModel(GetModel());
774 for(sal_uInt32 a=0;a<pSub->GetObjCount();a++)
776 SdrObject* pIterObj = pSub->GetObj(a);
777 SdrObject* pResult = pIterObj->DoConvertToPolyObj(bBezier, bAddText);
779 // pResult can be NULL e.g. for empty objects
780 if( pResult )
781 pGroup->GetSubList()->NbcInsertObject(pResult);
784 return pGroup;
787 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */