Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / svdraw / svdogrp.cxx
blobd693d8b2035d0b20ade6d09c59af3602a47544cc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <sfx2/linkmgr.hxx>
31 #include <ucbhelper/content.hxx>
32 #include <ucbhelper/contentbroker.hxx>
33 #include <unotools/datetime.hxx>
35 #include <svx/svdogrp.hxx>
37 #include <sfx2/lnkbase.hxx>
39 #include <svl/urihelper.hxx>
41 #include <svx/xpool.hxx>
42 #include <svx/xpoly.hxx>
44 #include <svx/svdmodel.hxx>
45 #include <svx/svdpage.hxx>
46 #include "svx/svditer.hxx"
47 #include <svx/svdobj.hxx>
48 #include <svx/svdtrans.hxx>
49 #include <svx/svdetc.hxx>
50 #include <svx/svdattrx.hxx> // NotPersistItems
51 #include <svx/svdoedge.hxx> // broadcast connectors to Move
52 #include "svx/svdglob.hxx" // StringCache
53 #include "svx/svdstr.hrc" // the object's name
55 #include <svx/svxids.hrc>
56 #include <svl/whiter.hxx>
57 #include <svx/svdpool.hxx>
58 #include <svx/sdr/properties/groupproperties.hxx>
59 #include <svx/sdr/contact/viewcontactofgroup.hxx>
60 #include <basegfx/range/b2drange.hxx>
61 #include <basegfx/polygon/b2dpolygontools.hxx>
62 #include <basegfx/polygon/b2dpolygon.hxx>
64 //////////////////////////////////////////////////////////////////////////////
65 // BaseProperties section
67 sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties()
69 return new sdr::properties::GroupProperties(*this);
72 //////////////////////////////////////////////////////////////////////////////
73 // DrawContact section
75 sdr::contact::ViewContact* SdrObjGroup::CreateObjectSpecificViewContact()
77 return new sdr::contact::ViewContactOfGroup(*this);
80 //////////////////////////////////////////////////////////////////////////////
82 TYPEINIT1(SdrObjGroup,SdrObject);
84 SdrObjGroup::SdrObjGroup()
86 pSub=new SdrObjList(NULL,NULL);
87 pSub->SetOwnerObj(this);
88 pSub->SetListKind(SDROBJLIST_GROUPOBJ);
89 bRefPoint=sal_False;
90 nDrehWink=0;
91 nShearWink=0;
92 bClosedObj=sal_False;
96 SdrObjGroup::~SdrObjGroup()
98 delete pSub;
101 void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
103 rInfo.bNoContortion=sal_False;
104 SdrObjList* pOL=pSub;
105 sal_uIntPtr nObjAnz=pOL->GetObjCount();
106 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
107 SdrObject* pObj=pOL->GetObj(i);
108 SdrObjTransformInfoRec aInfo;
109 pObj->TakeObjInfo(aInfo);
110 if (!aInfo.bMoveAllowed ) rInfo.bMoveAllowed =sal_False;
111 if (!aInfo.bResizeFreeAllowed ) rInfo.bResizeFreeAllowed =sal_False;
112 if (!aInfo.bResizePropAllowed ) rInfo.bResizePropAllowed =sal_False;
113 if (!aInfo.bRotateFreeAllowed ) rInfo.bRotateFreeAllowed =sal_False;
114 if (!aInfo.bRotate90Allowed ) rInfo.bRotate90Allowed =sal_False;
115 if (!aInfo.bMirrorFreeAllowed ) rInfo.bMirrorFreeAllowed =sal_False;
116 if (!aInfo.bMirror45Allowed ) rInfo.bMirror45Allowed =sal_False;
117 if (!aInfo.bMirror90Allowed ) rInfo.bMirror90Allowed =sal_False;
118 if (!aInfo.bShearAllowed ) rInfo.bShearAllowed =sal_False;
119 if (!aInfo.bEdgeRadiusAllowed ) rInfo.bEdgeRadiusAllowed =sal_False;
120 if (!aInfo.bNoOrthoDesired ) rInfo.bNoOrthoDesired =sal_False;
121 if (aInfo.bNoContortion ) rInfo.bNoContortion =sal_True;
122 if (!aInfo.bCanConvToPath ) rInfo.bCanConvToPath =sal_False;
124 if(!aInfo.bCanConvToContour)
125 rInfo.bCanConvToContour = sal_False;
127 if (!aInfo.bCanConvToPoly ) rInfo.bCanConvToPoly =sal_False;
128 if (!aInfo.bCanConvToPathLineToArea) rInfo.bCanConvToPathLineToArea=sal_False;
129 if (!aInfo.bCanConvToPolyLineToArea) rInfo.bCanConvToPolyLineToArea=sal_False;
131 if (nObjAnz==0) {
132 rInfo.bRotateFreeAllowed=sal_False;
133 rInfo.bRotate90Allowed =sal_False;
134 rInfo.bMirrorFreeAllowed=sal_False;
135 rInfo.bMirror45Allowed =sal_False;
136 rInfo.bMirror90Allowed =sal_False;
137 rInfo.bTransparenceAllowed = sal_False;
138 rInfo.bGradientAllowed = sal_False;
139 rInfo.bShearAllowed =sal_False;
140 rInfo.bEdgeRadiusAllowed=sal_False;
141 rInfo.bNoContortion =sal_True;
143 if(nObjAnz != 1)
145 // only allowed if single object selected
146 rInfo.bTransparenceAllowed = sal_False;
147 rInfo.bGradientAllowed = sal_False;
152 void SdrObjGroup::SetBoundRectDirty()
154 // avoid resetting aOutRect which in case of this object is model data,
155 // not re-creatable view data
158 sal_uInt16 SdrObjGroup::GetObjIdentifier() const
160 return sal_uInt16(OBJ_GRUP);
164 SdrLayerID SdrObjGroup::GetLayer() const
166 bool b1st = true;
167 SdrLayerID nLay=SdrLayerID(SdrObject::GetLayer());
168 SdrObjList* pOL=pSub;
169 sal_uIntPtr nObjAnz=pOL->GetObjCount();
170 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
171 SdrLayerID nLay1=pOL->GetObj(i)->GetLayer();
172 if (b1st) { nLay=nLay1; b1st = false; }
173 else if (nLay1!=nLay) return 0;
175 return nLay;
179 void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
181 SdrObject::NbcSetLayer(nLayer);
182 SdrObjList* pOL=pSub;
183 sal_uIntPtr nObjAnz=pOL->GetObjCount();
184 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
185 pOL->GetObj(i)->NbcSetLayer(nLayer);
190 void SdrObjGroup::SetObjList(SdrObjList* pNewObjList)
192 SdrObject::SetObjList(pNewObjList);
193 pSub->SetUpList(pNewObjList);
197 void SdrObjGroup::SetPage(SdrPage* pNewPage)
199 SdrObject::SetPage(pNewPage);
200 pSub->SetPage(pNewPage);
204 void SdrObjGroup::SetModel(SdrModel* pNewModel)
206 if(pNewModel!=pModel)
208 // #i30648#
209 // This method also needs to migrate the used ItemSet
210 // when the destination model uses a different pool
211 // than the current one. Else it is possible to create
212 // SdrObjGroups which reference the old pool which might
213 // be destroyed (as the bug shows).
214 SdrModel* pOldModel = pModel;
216 // test for correct pool in ItemSet; move to new pool if necessary
217 if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
219 MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
222 // call parent
223 SdrObject::SetModel(pNewModel);
225 // set new model at content
226 pSub->SetModel(pNewModel);
228 // modify properties
229 GetProperties().SetModel(pOldModel, pNewModel);
234 bool SdrObjGroup::HasRefPoint() const
236 return bRefPoint;
240 Point SdrObjGroup::GetRefPoint() const
242 return aRefPoint;
246 void SdrObjGroup::SetRefPoint(const Point& rPnt)
248 bRefPoint=sal_True;
249 aRefPoint=rPnt;
253 SdrObjList* SdrObjGroup::GetSubList() const
255 return pSub;
258 const Rectangle& SdrObjGroup::GetCurrentBoundRect() const
260 // <aOutRect> has to contain the bounding rectangle
261 if ( pSub->GetObjCount()!=0 )
263 const_cast<SdrObjGroup*>(this)->aOutRect = pSub->GetAllObjBoundRect();
266 return aOutRect;
269 const Rectangle& SdrObjGroup::GetSnapRect() const
271 // <aOutRect> has to contain the bounding rectangle
272 if ( pSub->GetObjCount()!=0 )
274 return pSub->GetAllObjSnapRect();
276 else
278 return aOutRect;
282 SdrObjGroup* SdrObjGroup::Clone() const
284 return CloneHelper< SdrObjGroup >();
287 SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj)
289 if( this == &rObj )
290 return *this;
291 // copy SdrObject stuff
292 SdrObject::operator=(rObj);
294 // #i36404#
295 // copy SubList, init model and page first
296 SdrObjList& rSourceSubList = *rObj.GetSubList();
297 pSub->SetPage(rSourceSubList.GetPage());
298 pSub->SetModel(rSourceSubList.GetModel());
299 pSub->CopyObjects(*rObj.GetSubList());
301 // copy local parameters
302 nDrehWink = rObj.nDrehWink;
303 nShearWink = rObj.nShearWink;
304 aRefPoint = rObj.aRefPoint;
305 bRefPoint = rObj.bRefPoint;
306 return *this;
310 void SdrObjGroup::TakeObjNameSingul(XubString& rName) const
312 if(!pSub->GetObjCount())
314 rName = ImpGetResStr(STR_ObjNameSingulGRUPEMPTY);
316 else
318 rName = ImpGetResStr(STR_ObjNameSingulGRUP);
321 const String aName(GetName());
323 if(aName.Len())
325 rName += sal_Unicode(' ');
326 rName += sal_Unicode('\'');
327 rName += aName;
328 rName += sal_Unicode('\'');
333 void SdrObjGroup::TakeObjNamePlural(XubString& rName) const
335 if (pSub->GetObjCount()==0) {
336 rName=ImpGetResStr(STR_ObjNamePluralGRUPEMPTY);
337 } else {
338 rName=ImpGetResStr(STR_ObjNamePluralGRUP);
343 void SdrObjGroup::RecalcSnapRect()
345 // TODO: unnecessary, because we use the Rects from the SubList
348 basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
350 basegfx::B2DPolyPolygon aRetval;
351 const sal_uInt32 nObjCount(pSub->GetObjCount());
353 for(sal_uInt32 a(0L); a < nObjCount; a++)
355 SdrObject* pObj = pSub->GetObj(a);
356 aRetval.append(pObj->TakeXorPoly());
359 if(!aRetval.count())
361 const basegfx::B2DRange aRange(aOutRect.Left(), aOutRect.Top(), aOutRect.Right(), aOutRect.Bottom());
362 aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
365 return aRetval;
368 bool SdrObjGroup::beginSpecialDrag(SdrDragStat& /*rDrag*/) const
370 return false;
374 bool SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/)
376 return sal_False;
380 long SdrObjGroup::GetRotateAngle() const
382 return nDrehWink;
386 long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
388 return nShearWink;
392 void SdrObjGroup::NbcSetSnapRect(const Rectangle& rRect)
394 Rectangle aOld(GetSnapRect());
395 long nMulX=rRect.Right()-rRect.Left();
396 long nDivX=aOld.Right()-aOld.Left();
397 long nMulY=rRect.Bottom()-rRect.Top();
398 long nDivY=aOld.Bottom()-aOld.Top();
399 if (nDivX==0) { nMulX=1; nDivX=1; }
400 if (nDivY==0) { nMulY=1; nDivY=1; }
401 if (nMulX!=nDivX || nMulY!=nDivY) {
402 Fraction aX(nMulX,nDivX);
403 Fraction aY(nMulY,nDivY);
404 NbcResize(aOld.TopLeft(),aX,aY);
406 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
407 NbcMove(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
412 void SdrObjGroup::NbcSetLogicRect(const Rectangle& rRect)
414 NbcSetSnapRect(rRect);
418 void SdrObjGroup::NbcMove(const Size& rSiz)
420 MovePoint(aRefPoint,rSiz);
421 if (pSub->GetObjCount()!=0) {
422 SdrObjList* pOL=pSub;
423 sal_uIntPtr nObjAnz=pOL->GetObjCount();
424 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
425 SdrObject* pObj=pOL->GetObj(i);
426 pObj->NbcMove(rSiz);
428 } else {
429 MoveRect(aOutRect,rSiz);
430 SetRectsDirty();
435 void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
437 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
438 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
439 if (bXMirr || bYMirr) {
440 Point aRef1(GetSnapRect().Center());
441 if (bXMirr) {
442 Point aRef2(aRef1);
443 aRef2.Y()++;
444 NbcMirrorGluePoints(aRef1,aRef2);
446 if (bYMirr) {
447 Point aRef2(aRef1);
448 aRef2.X()++;
449 NbcMirrorGluePoints(aRef1,aRef2);
452 ResizePoint(aRefPoint,rRef,xFact,yFact);
453 if (pSub->GetObjCount()!=0) {
454 SdrObjList* pOL=pSub;
455 sal_uIntPtr nObjAnz=pOL->GetObjCount();
456 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
457 SdrObject* pObj=pOL->GetObj(i);
458 pObj->NbcResize(rRef,xFact,yFact);
460 } else {
461 ResizeRect(aOutRect,rRef,xFact,yFact);
462 SetRectsDirty();
467 void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
469 SetGlueReallyAbsolute(sal_True);
470 nDrehWink=NormAngle360(nDrehWink+nWink);
471 RotatePoint(aRefPoint,rRef,sn,cs);
472 SdrObjList* pOL=pSub;
473 sal_uIntPtr nObjAnz=pOL->GetObjCount();
474 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
475 SdrObject* pObj=pOL->GetObj(i);
476 pObj->NbcRotate(rRef,nWink,sn,cs);
478 NbcRotateGluePoints(rRef,nWink,sn,cs);
479 SetGlueReallyAbsolute(sal_False);
483 void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
485 SetGlueReallyAbsolute(sal_True);
486 MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
487 SdrObjList* pOL=pSub;
488 sal_uIntPtr nObjAnz=pOL->GetObjCount();
489 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
490 SdrObject* pObj=pOL->GetObj(i);
491 pObj->NbcMirror(rRef1,rRef2);
493 NbcMirrorGluePoints(rRef1,rRef2);
494 SetGlueReallyAbsolute(sal_False);
498 void SdrObjGroup::NbcShear(const Point& rRef, long nWink, double tn, bool bVShear)
500 SetGlueReallyAbsolute(sal_True);
501 nShearWink+=nWink;
502 ShearPoint(aRefPoint,rRef,tn);
503 SdrObjList* pOL=pSub;
504 sal_uIntPtr nObjAnz=pOL->GetObjCount();
505 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
506 SdrObject* pObj=pOL->GetObj(i);
507 pObj->NbcShear(rRef,nWink,tn,bVShear);
509 NbcShearGluePoints(rRef,nWink,tn,bVShear);
510 SetGlueReallyAbsolute(sal_False);
514 void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
516 aAnchor=rPnt;
517 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
518 MovePoint(aRefPoint,aSiz);
519 SdrObjList* pOL=pSub;
520 sal_uIntPtr nObjAnz=pOL->GetObjCount();
521 for (sal_uIntPtr i=0; i<nObjAnz; i++) {
522 SdrObject* pObj=pOL->GetObj(i);
523 pObj->NbcSetAnchorPos(rPnt);
528 void SdrObjGroup::SetSnapRect(const Rectangle& rRect)
530 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
531 Rectangle aOld(GetSnapRect());
532 long nMulX=rRect.Right()-rRect.Left();
533 long nDivX=aOld.Right()-aOld.Left();
534 long nMulY=rRect.Bottom()-rRect.Top();
535 long nDivY=aOld.Bottom()-aOld.Top();
536 if (nDivX==0) { nMulX=1; nDivX=1; }
537 if (nDivY==0) { nMulY=1; nDivY=1; }
538 if (nMulX!=nDivX || nMulY!=nDivY) {
539 Fraction aX(nMulX,nDivX);
540 Fraction aY(nMulY,nDivY);
541 Resize(aOld.TopLeft(),aX,aY);
543 if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
544 Move(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
547 SetChanged();
548 BroadcastObjectChange();
549 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
553 void SdrObjGroup::SetLogicRect(const Rectangle& rRect)
555 SetSnapRect(rRect);
559 void SdrObjGroup::Move(const Size& rSiz)
561 if (rSiz.Width()!=0 || rSiz.Height()!=0) {
562 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
563 MovePoint(aRefPoint,rSiz);
564 if (pSub->GetObjCount()!=0) {
565 // first move the connectors, then everything else
566 SdrObjList* pOL=pSub;
567 sal_uIntPtr nObjAnz=pOL->GetObjCount();
568 sal_uIntPtr i;
569 for (i=0; i<nObjAnz; i++) {
570 SdrObject* pObj=pOL->GetObj(i);
571 if (pObj->IsEdgeObj()) pObj->Move(rSiz);
573 for (i=0; i<nObjAnz; i++) {
574 SdrObject* pObj=pOL->GetObj(i);
575 if (!pObj->IsEdgeObj()) pObj->Move(rSiz);
577 } else {
578 MoveRect(aOutRect,rSiz);
579 SetRectsDirty();
582 SetChanged();
583 BroadcastObjectChange();
584 SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
589 void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
591 if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
592 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
593 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
594 if (bXMirr || bYMirr) {
595 Point aRef1(GetSnapRect().Center());
596 if (bXMirr) {
597 Point aRef2(aRef1);
598 aRef2.Y()++;
599 NbcMirrorGluePoints(aRef1,aRef2);
601 if (bYMirr) {
602 Point aRef2(aRef1);
603 aRef2.X()++;
604 NbcMirrorGluePoints(aRef1,aRef2);
607 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
608 ResizePoint(aRefPoint,rRef,xFact,yFact);
609 if (pSub->GetObjCount()!=0) {
610 // move the connectors first, everything else afterwards
611 SdrObjList* pOL=pSub;
612 sal_uIntPtr nObjAnz=pOL->GetObjCount();
613 sal_uIntPtr i;
614 for (i=0; i<nObjAnz; i++) {
615 SdrObject* pObj=pOL->GetObj(i);
616 if (pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact);
618 for (i=0; i<nObjAnz; i++) {
619 SdrObject* pObj=pOL->GetObj(i);
620 if (!pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact);
622 } else {
623 ResizeRect(aOutRect,rRef,xFact,yFact);
624 SetRectsDirty();
627 SetChanged();
628 BroadcastObjectChange();
629 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
634 void SdrObjGroup::Rotate(const Point& rRef, long nWink, double sn, double cs)
636 if (nWink!=0) {
637 SetGlueReallyAbsolute(sal_True);
638 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
639 nDrehWink=NormAngle360(nDrehWink+nWink);
640 RotatePoint(aRefPoint,rRef,sn,cs);
641 // move the connectors first, everything else afterwards
642 SdrObjList* pOL=pSub;
643 sal_uIntPtr nObjAnz=pOL->GetObjCount();
644 sal_uIntPtr i;
645 for (i=0; i<nObjAnz; i++) {
646 SdrObject* pObj=pOL->GetObj(i);
647 if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
649 for (i=0; i<nObjAnz; i++) {
650 SdrObject* pObj=pOL->GetObj(i);
651 if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
653 NbcRotateGluePoints(rRef,nWink,sn,cs);
654 SetGlueReallyAbsolute(sal_False);
655 SetChanged();
656 BroadcastObjectChange();
657 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
662 void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
664 SetGlueReallyAbsolute(sal_True);
665 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
666 MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
667 // move the connectors first, everything else afterwards
668 SdrObjList* pOL=pSub;
669 sal_uIntPtr nObjAnz=pOL->GetObjCount();
670 sal_uIntPtr i;
671 for (i=0; i<nObjAnz; i++) {
672 SdrObject* pObj=pOL->GetObj(i);
673 if (pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
675 for (i=0; i<nObjAnz; i++) {
676 SdrObject* pObj=pOL->GetObj(i);
677 if (!pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
679 NbcMirrorGluePoints(rRef1,rRef2);
680 SetGlueReallyAbsolute(sal_False);
681 SetChanged();
682 BroadcastObjectChange();
683 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
687 void SdrObjGroup::Shear(const Point& rRef, long nWink, double tn, bool bVShear)
689 if (nWink!=0) {
690 SetGlueReallyAbsolute(sal_True);
691 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
692 nShearWink+=nWink;
693 ShearPoint(aRefPoint,rRef,tn);
694 // move the connectors first, everything else afterwards
695 SdrObjList* pOL=pSub;
696 sal_uIntPtr nObjAnz=pOL->GetObjCount();
697 sal_uIntPtr i;
698 for (i=0; i<nObjAnz; i++) {
699 SdrObject* pObj=pOL->GetObj(i);
700 if (pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
702 for (i=0; i<nObjAnz; i++) {
703 SdrObject* pObj=pOL->GetObj(i);
704 if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
706 NbcShearGluePoints(rRef,nWink,tn,bVShear);
707 SetGlueReallyAbsolute(sal_False);
708 SetChanged();
709 BroadcastObjectChange();
710 SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
715 void SdrObjGroup::SetAnchorPos(const Point& rPnt)
717 Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
718 bool bChg=aAnchor!=rPnt;
719 aAnchor=rPnt;
720 Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
721 MovePoint(aRefPoint,aSiz);
722 // move the connectors first, everything else afterwards
723 SdrObjList* pOL=pSub;
724 sal_uIntPtr nObjAnz=pOL->GetObjCount();
725 sal_uIntPtr i;
726 for (i=0; i<nObjAnz; i++) {
727 SdrObject* pObj=pOL->GetObj(i);
728 if (pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
730 for (i=0; i<nObjAnz; i++) {
731 SdrObject* pObj=pOL->GetObj(i);
732 if (!pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
734 if (bChg) {
735 SetChanged();
736 BroadcastObjectChange();
737 SendUserCall(SDRUSERCALL_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 pSub->NbcReformatAllTextObjects();
762 void SdrObjGroup::ReformatText()
764 pSub->ReformatAllTextObjects();
767 SdrObject* SdrObjGroup::DoConvertToPolyObj(sal_Bool bBezier) const
769 SdrObject* pGroup = new SdrObjGroup;
770 pGroup->SetModel(GetModel());
772 for(sal_uInt32 a=0;a<pSub->GetObjCount();a++)
774 SdrObject* pIterObj = pSub->GetObj(a);
775 SdrObject* pResult = pIterObj->DoConvertToPolyObj(bBezier);
777 // pResult can be NULL e.g. for empty objects
778 if( pResult )
779 pGroup->GetSubList()->NbcInsertObject(pResult);
782 return pGroup;
785 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */