Update ooo320-m1
[ooovba.git] / svx / source / svdraw / svdogrp.cxx
blobd1966d1bfcda14ed8c5eb478a289b161bb0eea33
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdogrp.cxx,v $
10 * $Revision: 1.38.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <linkmgr.hxx>
35 #include <ucbhelper/content.hxx>
36 #include <ucbhelper/contentbroker.hxx>
37 #include <unotools/datetime.hxx>
39 #include <svx/svdogrp.hxx>
41 #include <sfx2/lnkbase.hxx>
42 #include <tools/urlobj.hxx>
44 #include <svtools/urihelper.hxx>
46 #include <svx/xpool.hxx>
47 #include <svx/xpoly.hxx>
49 #include <svx/svdmodel.hxx>
50 #include <svx/svdpage.hxx>
51 #include "svditer.hxx"
52 #include <svx/svdobj.hxx>
53 #include <svx/svdtrans.hxx>
54 #include <svx/svdetc.hxx>
55 #include <svx/svdattrx.hxx> // NotPersistItems
56 #include <svx/svdoedge.hxx> // #32383# Die Verbinder nach Move nochmal anbroadcasten
57 #include "svdglob.hxx" // StringCache
58 #include "svdstr.hrc" // Objektname
60 #include <svx/svxids.hrc>
61 #include <svtools/whiter.hxx>
62 #include <svx/svdpool.hxx>
63 #include <svx/sdr/properties/groupproperties.hxx>
65 // #110094#
66 #include <svx/sdr/contact/viewcontactofgroup.hxx>
67 #include <basegfx/range/b2drange.hxx>
68 #include <basegfx/polygon/b2dpolygontools.hxx>
69 #include <basegfx/polygon/b2dpolygon.hxx>
71 ////////////////////////////////////////////////////////////////////////////////////////////////////
73 // @@@@ @@@@@ @@@@@@ @@@@ @@@@@ @@@@ @@ @@ @@@@@
74 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
75 // @@ @@ @@@@@ @@ @@ @@@ @@@@@ @@ @@ @@ @@ @@@@@
76 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
77 // @@@@ @@@@@ @@@@ @@@@@ @@ @@ @@@@ @@@@ @@
79 ////////////////////////////////////////////////////////////////////////////////////////////////////
81 //////////////////////////////////////////////////////////////////////////////
82 // BaseProperties section
84 sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties()
86 return new sdr::properties::GroupProperties((SdrObject&)(*this));
89 //////////////////////////////////////////////////////////////////////////////
90 // #110094# DrawContact section
92 sdr::contact::ViewContact* SdrObjGroup::CreateObjectSpecificViewContact()
94 return new sdr::contact::ViewContactOfGroup(*this);
97 //////////////////////////////////////////////////////////////////////////////
99 TYPEINIT1(SdrObjGroup,SdrObject);
101 SdrObjGroup::SdrObjGroup()
103 pSub=new SdrObjList(NULL,NULL);
104 pSub->SetOwnerObj(this);
105 pSub->SetListKind(SDROBJLIST_GROUPOBJ);
106 bRefPoint=FALSE;
107 nDrehWink=0;
108 nShearWink=0;
109 bClosedObj=FALSE;
113 SdrObjGroup::~SdrObjGroup()
115 delete pSub;
118 void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
120 rInfo.bNoContortion=FALSE;
121 SdrObjList* pOL=pSub;
122 ULONG nObjAnz=pOL->GetObjCount();
123 for (ULONG i=0; i<nObjAnz; i++) {
124 SdrObject* pObj=pOL->GetObj(i);
125 SdrObjTransformInfoRec aInfo;
126 pObj->TakeObjInfo(aInfo);
127 if (!aInfo.bMoveAllowed ) rInfo.bMoveAllowed =FALSE;
128 if (!aInfo.bResizeFreeAllowed ) rInfo.bResizeFreeAllowed =FALSE;
129 if (!aInfo.bResizePropAllowed ) rInfo.bResizePropAllowed =FALSE;
130 if (!aInfo.bRotateFreeAllowed ) rInfo.bRotateFreeAllowed =FALSE;
131 if (!aInfo.bRotate90Allowed ) rInfo.bRotate90Allowed =FALSE;
132 if (!aInfo.bMirrorFreeAllowed ) rInfo.bMirrorFreeAllowed =FALSE;
133 if (!aInfo.bMirror45Allowed ) rInfo.bMirror45Allowed =FALSE;
134 if (!aInfo.bMirror90Allowed ) rInfo.bMirror90Allowed =FALSE;
135 if (!aInfo.bShearAllowed ) rInfo.bShearAllowed =FALSE;
136 if (!aInfo.bEdgeRadiusAllowed ) rInfo.bEdgeRadiusAllowed =FALSE;
137 if (!aInfo.bNoOrthoDesired ) rInfo.bNoOrthoDesired =FALSE;
138 if (aInfo.bNoContortion ) rInfo.bNoContortion =TRUE;
139 if (!aInfo.bCanConvToPath ) rInfo.bCanConvToPath =FALSE;
141 if(!aInfo.bCanConvToContour)
142 rInfo.bCanConvToContour = FALSE;
144 if (!aInfo.bCanConvToPoly ) rInfo.bCanConvToPoly =FALSE;
145 if (!aInfo.bCanConvToPathLineToArea) rInfo.bCanConvToPathLineToArea=FALSE;
146 if (!aInfo.bCanConvToPolyLineToArea) rInfo.bCanConvToPolyLineToArea=FALSE;
148 if (nObjAnz==0) {
149 rInfo.bRotateFreeAllowed=FALSE;
150 rInfo.bRotate90Allowed =FALSE;
151 rInfo.bMirrorFreeAllowed=FALSE;
152 rInfo.bMirror45Allowed =FALSE;
153 rInfo.bMirror90Allowed =FALSE;
154 rInfo.bTransparenceAllowed = FALSE;
155 rInfo.bGradientAllowed = FALSE;
156 rInfo.bShearAllowed =FALSE;
157 rInfo.bEdgeRadiusAllowed=FALSE;
158 rInfo.bNoContortion =TRUE;
160 if(nObjAnz != 1)
162 // only allowed if single object selected
163 rInfo.bTransparenceAllowed = FALSE;
164 rInfo.bGradientAllowed = FALSE;
169 UINT16 SdrObjGroup::GetObjIdentifier() const
171 return UINT16(OBJ_GRUP);
175 SdrLayerID SdrObjGroup::GetLayer() const
177 FASTBOOL b1st=TRUE;
178 SdrLayerID nLay=SdrLayerID(SdrObject::GetLayer());
179 SdrObjList* pOL=pSub;
180 ULONG nObjAnz=pOL->GetObjCount();
181 for (ULONG i=0; i<nObjAnz; i++) {
182 SdrLayerID nLay1=pOL->GetObj(i)->GetLayer();
183 if (b1st) { nLay=nLay1; b1st=FALSE; }
184 else if (nLay1!=nLay) return 0;
186 return nLay;
190 void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
192 SdrObject::NbcSetLayer(nLayer);
193 SdrObjList* pOL=pSub;
194 ULONG nObjAnz=pOL->GetObjCount();
195 for (ULONG i=0; i<nObjAnz; i++) {
196 pOL->GetObj(i)->NbcSetLayer(nLayer);
201 void SdrObjGroup::SetObjList(SdrObjList* pNewObjList)
203 SdrObject::SetObjList(pNewObjList);
204 pSub->SetUpList(pNewObjList);
208 void SdrObjGroup::SetPage(SdrPage* pNewPage)
210 SdrObject::SetPage(pNewPage);
211 pSub->SetPage(pNewPage);
215 void SdrObjGroup::SetModel(SdrModel* pNewModel)
217 if(pNewModel!=pModel)
219 // #i30648#
220 // This method also needs to migrate the used ItemSet
221 // when the destination model uses a different pool
222 // than the current one. Else it is possible to create
223 // SdrObjGroups which reference the old pool which might
224 // be destroyed (as the bug shows).
225 SdrModel* pOldModel = pModel;
227 // test for correct pool in ItemSet; move to new pool if necessary
228 if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
230 MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
233 // call parent
234 SdrObject::SetModel(pNewModel);
236 // set new model at content
237 pSub->SetModel(pNewModel);
239 // modify properties
240 GetProperties().SetModel(pOldModel, pNewModel);
245 FASTBOOL SdrObjGroup::HasRefPoint() const
247 return bRefPoint;
251 Point SdrObjGroup::GetRefPoint() const
253 return aRefPoint;
257 void SdrObjGroup::SetRefPoint(const Point& rPnt)
259 bRefPoint=TRUE;
260 aRefPoint=rPnt;
264 SdrObjList* SdrObjGroup::GetSubList() const
266 return pSub;
269 const Rectangle& SdrObjGroup::GetCurrentBoundRect() const
271 // --> OD 2007-02-01 #144962#
272 // <aOutRect> has to contain the bounding rectangle
273 if ( pSub->GetObjCount()!=0 )
275 const_cast<SdrObjGroup*>(this)->aOutRect = pSub->GetAllObjBoundRect();
278 return aOutRect;
279 // <--
283 const Rectangle& SdrObjGroup::GetSnapRect() const
285 // --> OD 2007-02-01 #144962#
286 // <aOutRect> has to contain the bounding rectangle
287 if ( pSub->GetObjCount()!=0 )
289 return pSub->GetAllObjSnapRect();
291 else
293 return aOutRect;
295 // <--
298 void SdrObjGroup::operator=(const SdrObject& rObj)
300 if(rObj.IsGroupObject())
302 // copy SdrObject stuff
303 SdrObject::operator=(rObj);
305 // #i36404#
306 // copy SubList, init model and page first
307 SdrObjList& rSourceSubList = *rObj.GetSubList();
308 pSub->SetPage(rSourceSubList.GetPage());
309 pSub->SetModel(rSourceSubList.GetModel());
310 pSub->CopyObjects(*rObj.GetSubList());
312 // copy local paremeters
313 nDrehWink =((SdrObjGroup&)rObj).nDrehWink;
314 nShearWink =((SdrObjGroup&)rObj).nShearWink;
315 aRefPoint =((SdrObjGroup&)rObj).aRefPoint;
316 bRefPoint =((SdrObjGroup&)rObj).bRefPoint;
321 void SdrObjGroup::TakeObjNameSingul(XubString& rName) const
323 if(!pSub->GetObjCount())
325 rName = ImpGetResStr(STR_ObjNameSingulGRUPEMPTY);
327 else
329 rName = ImpGetResStr(STR_ObjNameSingulGRUP);
332 const String aName(GetName());
334 if(aName.Len())
336 rName += sal_Unicode(' ');
337 rName += sal_Unicode('\'');
338 rName += aName;
339 rName += sal_Unicode('\'');
344 void SdrObjGroup::TakeObjNamePlural(XubString& rName) const
346 if (pSub->GetObjCount()==0) {
347 rName=ImpGetResStr(STR_ObjNamePluralGRUPEMPTY);
348 } else {
349 rName=ImpGetResStr(STR_ObjNamePluralGRUP);
354 void SdrObjGroup::RecalcSnapRect()
356 // nicht erforderlich, da die Rects von der SubList verwendet werden.
359 basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
361 basegfx::B2DPolyPolygon aRetval;
362 const sal_uInt32 nObjCount(pSub->GetObjCount());
364 for(sal_uInt32 a(0L); a < nObjCount; a++)
366 SdrObject* pObj = pSub->GetObj(a);
367 aRetval.append(pObj->TakeXorPoly());
370 if(!aRetval.count())
372 const basegfx::B2DRange aRange(aOutRect.Left(), aOutRect.Top(), aOutRect.Right(), aOutRect.Bottom());
373 aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
376 return aRetval;
379 bool SdrObjGroup::beginSpecialDrag(SdrDragStat& /*rDrag*/) const
381 return false;
385 FASTBOOL SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/)
387 return FALSE;
391 long SdrObjGroup::GetRotateAngle() const
393 return nDrehWink;
397 long SdrObjGroup::GetShearAngle(FASTBOOL /*bVertical*/) const
399 return nShearWink;
403 void SdrObjGroup::NbcSetSnapRect(const Rectangle& rRect)
405 Rectangle aOld(GetSnapRect());
406 long nMulX=rRect.Right()-rRect.Left();
407 long nDivX=aOld.Right()-aOld.Left();
408 long nMulY=rRect.Bottom()-rRect.Top();
409 long nDivY=aOld.Bottom()-aOld.Top();
410 if (nDivX==0) { nMulX=1; nDivX=1; }
411 if (nDivY==0) { nMulY=1; nDivY=1; }
412 if (nMulX!=nDivX || nMulY!=nDivY) {
413 Fraction aX(nMulX,nDivX);
414 Fraction aY(nMulY,nDivY);
415 NbcResize(aOld.TopLeft(),aX,aY);
417 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
418 NbcMove(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
423 void SdrObjGroup::NbcSetLogicRect(const Rectangle& rRect)
425 NbcSetSnapRect(rRect);
429 void SdrObjGroup::NbcMove(const Size& rSiz)
431 MovePoint(aRefPoint,rSiz);
432 if (pSub->GetObjCount()!=0) {
433 SdrObjList* pOL=pSub;
434 ULONG nObjAnz=pOL->GetObjCount();
435 for (ULONG i=0; i<nObjAnz; i++) {
436 SdrObject* pObj=pOL->GetObj(i);
437 pObj->NbcMove(rSiz);
439 } else {
440 MoveRect(aOutRect,rSiz);
441 SetRectsDirty();
446 void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
448 FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
449 FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
450 if (bXMirr || bYMirr) {
451 Point aRef1(GetSnapRect().Center());
452 if (bXMirr) {
453 Point aRef2(aRef1);
454 aRef2.Y()++;
455 NbcMirrorGluePoints(aRef1,aRef2);
457 if (bYMirr) {
458 Point aRef2(aRef1);
459 aRef2.X()++;
460 NbcMirrorGluePoints(aRef1,aRef2);
463 ResizePoint(aRefPoint,rRef,xFact,yFact);
464 if (pSub->GetObjCount()!=0) {
465 SdrObjList* pOL=pSub;
466 ULONG nObjAnz=pOL->GetObjCount();
467 for (ULONG i=0; i<nObjAnz; i++) {
468 SdrObject* pObj=pOL->GetObj(i);
469 pObj->NbcResize(rRef,xFact,yFact);
471 } else {
472 ResizeRect(aOutRect,rRef,xFact,yFact);
473 SetRectsDirty();
478 void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
480 SetGlueReallyAbsolute(TRUE);
481 nDrehWink=NormAngle360(nDrehWink+nWink);
482 RotatePoint(aRefPoint,rRef,sn,cs);
483 SdrObjList* pOL=pSub;
484 ULONG nObjAnz=pOL->GetObjCount();
485 for (ULONG i=0; i<nObjAnz; i++) {
486 SdrObject* pObj=pOL->GetObj(i);
487 pObj->NbcRotate(rRef,nWink,sn,cs);
489 NbcRotateGluePoints(rRef,nWink,sn,cs);
490 SetGlueReallyAbsolute(FALSE);
494 void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
496 SetGlueReallyAbsolute(TRUE);
497 MirrorPoint(aRefPoint,rRef1,rRef2); // fehlende Implementation in SvdEtc !!!
498 SdrObjList* pOL=pSub;
499 ULONG nObjAnz=pOL->GetObjCount();
500 for (ULONG i=0; i<nObjAnz; i++) {
501 SdrObject* pObj=pOL->GetObj(i);
502 pObj->NbcMirror(rRef1,rRef2);
504 NbcMirrorGluePoints(rRef1,rRef2);
505 SetGlueReallyAbsolute(FALSE);
509 void SdrObjGroup::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
511 SetGlueReallyAbsolute(TRUE);
512 nShearWink+=nWink;
513 ShearPoint(aRefPoint,rRef,tn);
514 SdrObjList* pOL=pSub;
515 ULONG nObjAnz=pOL->GetObjCount();
516 for (ULONG i=0; i<nObjAnz; i++) {
517 SdrObject* pObj=pOL->GetObj(i);
518 pObj->NbcShear(rRef,nWink,tn,bVShear);
520 NbcShearGluePoints(rRef,nWink,tn,bVShear);
521 SetGlueReallyAbsolute(FALSE);
525 void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
527 aAnchor=rPnt;
528 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
529 MovePoint(aRefPoint,aSiz);
530 SdrObjList* pOL=pSub;
531 ULONG nObjAnz=pOL->GetObjCount();
532 for (ULONG i=0; i<nObjAnz; i++) {
533 SdrObject* pObj=pOL->GetObj(i);
534 pObj->NbcSetAnchorPos(rPnt);
539 void SdrObjGroup::SetSnapRect(const Rectangle& rRect)
541 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
542 Rectangle aOld(GetSnapRect());
543 long nMulX=rRect.Right()-rRect.Left();
544 long nDivX=aOld.Right()-aOld.Left();
545 long nMulY=rRect.Bottom()-rRect.Top();
546 long nDivY=aOld.Bottom()-aOld.Top();
547 if (nDivX==0) { nMulX=1; nDivX=1; }
548 if (nDivY==0) { nMulY=1; nDivY=1; }
549 if (nMulX!=nDivX || nMulY!=nDivY) {
550 Fraction aX(nMulX,nDivX);
551 Fraction aY(nMulY,nDivY);
552 Resize(aOld.TopLeft(),aX,aY);
554 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
555 Move(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
558 SetChanged();
559 BroadcastObjectChange();
560 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
564 void SdrObjGroup::SetLogicRect(const Rectangle& rRect)
566 SetSnapRect(rRect);
570 void SdrObjGroup::Move(const Size& rSiz)
572 if (rSiz.Width()!=0 || rSiz.Height()!=0) {
573 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
574 MovePoint(aRefPoint,rSiz);
575 if (pSub->GetObjCount()!=0) {
576 // #32383# Erst die Verbinder verschieben, dann den Rest
577 SdrObjList* pOL=pSub;
578 ULONG nObjAnz=pOL->GetObjCount();
579 ULONG i;
580 for (i=0; i<nObjAnz; i++) {
581 SdrObject* pObj=pOL->GetObj(i);
582 if (pObj->IsEdgeObj()) pObj->Move(rSiz);
584 for (i=0; i<nObjAnz; i++) {
585 SdrObject* pObj=pOL->GetObj(i);
586 if (!pObj->IsEdgeObj()) pObj->Move(rSiz);
588 } else {
589 // #110094#-14 SendRepaintBroadcast();
590 MoveRect(aOutRect,rSiz);
591 SetRectsDirty();
594 SetChanged();
595 BroadcastObjectChange();
596 SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
601 void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
603 if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
604 FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
605 FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
606 if (bXMirr || bYMirr) {
607 Point aRef1(GetSnapRect().Center());
608 if (bXMirr) {
609 Point aRef2(aRef1);
610 aRef2.Y()++;
611 NbcMirrorGluePoints(aRef1,aRef2);
613 if (bYMirr) {
614 Point aRef2(aRef1);
615 aRef2.X()++;
616 NbcMirrorGluePoints(aRef1,aRef2);
619 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
620 ResizePoint(aRefPoint,rRef,xFact,yFact);
621 if (pSub->GetObjCount()!=0) {
622 // #32383# Erst die Verbinder verschieben, dann den Rest
623 SdrObjList* pOL=pSub;
624 ULONG nObjAnz=pOL->GetObjCount();
625 ULONG i;
626 for (i=0; i<nObjAnz; i++) {
627 SdrObject* pObj=pOL->GetObj(i);
628 if (pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact);
630 for (i=0; i<nObjAnz; i++) {
631 SdrObject* pObj=pOL->GetObj(i);
632 if (!pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact);
634 } else {
635 // #110094#-14 SendRepaintBroadcast();
636 ResizeRect(aOutRect,rRef,xFact,yFact);
637 SetRectsDirty();
640 SetChanged();
641 BroadcastObjectChange();
642 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
647 void SdrObjGroup::Rotate(const Point& rRef, long nWink, double sn, double cs)
649 if (nWink!=0) {
650 SetGlueReallyAbsolute(TRUE);
651 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
652 nDrehWink=NormAngle360(nDrehWink+nWink);
653 RotatePoint(aRefPoint,rRef,sn,cs);
654 // #32383# Erst die Verbinder verschieben, dann den Rest
655 SdrObjList* pOL=pSub;
656 ULONG nObjAnz=pOL->GetObjCount();
657 ULONG i;
658 for (i=0; i<nObjAnz; i++) {
659 SdrObject* pObj=pOL->GetObj(i);
660 if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
662 for (i=0; i<nObjAnz; i++) {
663 SdrObject* pObj=pOL->GetObj(i);
664 if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
666 NbcRotateGluePoints(rRef,nWink,sn,cs);
667 SetGlueReallyAbsolute(FALSE);
668 SetChanged();
669 BroadcastObjectChange();
670 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
675 void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
677 SetGlueReallyAbsolute(TRUE);
678 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
679 MirrorPoint(aRefPoint,rRef1,rRef2); // fehlende Implementation in SvdEtc !!!
680 // #32383# Erst die Verbinder verschieben, dann den Rest
681 SdrObjList* pOL=pSub;
682 ULONG nObjAnz=pOL->GetObjCount();
683 ULONG i;
684 for (i=0; i<nObjAnz; i++) {
685 SdrObject* pObj=pOL->GetObj(i);
686 if (pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
688 for (i=0; i<nObjAnz; i++) {
689 SdrObject* pObj=pOL->GetObj(i);
690 if (!pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
692 NbcMirrorGluePoints(rRef1,rRef2);
693 SetGlueReallyAbsolute(FALSE);
694 SetChanged();
695 BroadcastObjectChange();
696 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
700 void SdrObjGroup::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
702 if (nWink!=0) {
703 SetGlueReallyAbsolute(TRUE);
704 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
705 nShearWink+=nWink;
706 ShearPoint(aRefPoint,rRef,tn);
707 // #32383# Erst die Verbinder verschieben, dann den Rest
708 SdrObjList* pOL=pSub;
709 ULONG nObjAnz=pOL->GetObjCount();
710 ULONG i;
711 for (i=0; i<nObjAnz; i++) {
712 SdrObject* pObj=pOL->GetObj(i);
713 if (pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
715 for (i=0; i<nObjAnz; i++) {
716 SdrObject* pObj=pOL->GetObj(i);
717 if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
719 NbcShearGluePoints(rRef,nWink,tn,bVShear);
720 SetGlueReallyAbsolute(FALSE);
721 SetChanged();
722 BroadcastObjectChange();
723 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
728 void SdrObjGroup::SetAnchorPos(const Point& rPnt)
730 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
731 FASTBOOL bChg=aAnchor!=rPnt;
732 aAnchor=rPnt;
733 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
734 MovePoint(aRefPoint,aSiz);
735 // #32383# Erst die Verbinder verschieben, dann den Rest
736 SdrObjList* pOL=pSub;
737 ULONG nObjAnz=pOL->GetObjCount();
738 ULONG i;
739 for (i=0; i<nObjAnz; i++) {
740 SdrObject* pObj=pOL->GetObj(i);
741 if (pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
743 for (i=0; i<nObjAnz; i++) {
744 SdrObject* pObj=pOL->GetObj(i);
745 if (!pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
747 if (bChg) {
748 SetChanged();
749 BroadcastObjectChange();
750 SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
756 void SdrObjGroup::NbcSetRelativePos(const Point& rPnt)
758 Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
759 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
760 NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
763 void SdrObjGroup::SetRelativePos(const Point& rPnt)
765 Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
766 Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
767 if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // Der ruft auch das SetRectsDirty() und Broadcast, ...
770 void SdrObjGroup::NbcReformatText()
772 pSub->NbcReformatAllTextObjects();
775 void SdrObjGroup::ReformatText()
777 pSub->ReformatAllTextObjects();
780 SdrObject* SdrObjGroup::DoConvertToPolyObj(BOOL bBezier) const
782 SdrObject* pGroup = new SdrObjGroup;
783 pGroup->SetModel(GetModel());
785 for(UINT32 a=0;a<pSub->GetObjCount();a++)
787 SdrObject* pIterObj = pSub->GetObj(a);
788 SdrObject* pResult = pIterObj->DoConvertToPolyObj(bBezier);
790 // pResult can be NULL e.g. for empty objects
791 if( pResult )
792 pGroup->GetSubList()->NbcInsertObject(pResult);
795 return pGroup;
798 // eof