1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/svdattrx.hxx> // NotPersistItems
40 #include <svx/svdoedge.hxx> // broadcast connectors to Move
41 #include "svx/svdglob.hxx" // StringCache
42 #include "svx/svdstr.hrc" // the object's name
44 #include <svx/svxids.hrc>
45 #include <svl/whiter.hxx>
46 #include <svx/svdpool.hxx>
47 #include <svx/sdr/properties/groupproperties.hxx>
48 #include <svx/sdr/contact/viewcontactofgroup.hxx>
49 #include <basegfx/range/b2drange.hxx>
50 #include <basegfx/polygon/b2dpolygontools.hxx>
51 #include <basegfx/polygon/b2dpolygon.hxx>
53 //////////////////////////////////////////////////////////////////////////////
54 // BaseProperties section
56 sdr::properties::BaseProperties
* SdrObjGroup::CreateObjectSpecificProperties()
58 return new sdr::properties::GroupProperties(*this);
61 //////////////////////////////////////////////////////////////////////////////
62 // DrawContact section
64 sdr::contact::ViewContact
* SdrObjGroup::CreateObjectSpecificViewContact()
66 return new sdr::contact::ViewContactOfGroup(*this);
69 //////////////////////////////////////////////////////////////////////////////
71 TYPEINIT1(SdrObjGroup
,SdrObject
);
73 SdrObjGroup::SdrObjGroup()
75 pSub
=new SdrObjList(NULL
,NULL
);
76 pSub
->SetOwnerObj(this);
77 pSub
->SetListKind(SDROBJLIST_GROUPOBJ
);
83 SdrObjGroup::~SdrObjGroup()
88 void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const
90 rInfo
.bNoContortion
=sal_False
;
92 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
93 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
94 SdrObject
* pObj
=pOL
->GetObj(i
);
95 SdrObjTransformInfoRec aInfo
;
96 pObj
->TakeObjInfo(aInfo
);
97 if (!aInfo
.bMoveAllowed
) rInfo
.bMoveAllowed
=sal_False
;
98 if (!aInfo
.bResizeFreeAllowed
) rInfo
.bResizeFreeAllowed
=sal_False
;
99 if (!aInfo
.bResizePropAllowed
) rInfo
.bResizePropAllowed
=sal_False
;
100 if (!aInfo
.bRotateFreeAllowed
) rInfo
.bRotateFreeAllowed
=sal_False
;
101 if (!aInfo
.bRotate90Allowed
) rInfo
.bRotate90Allowed
=sal_False
;
102 if (!aInfo
.bMirrorFreeAllowed
) rInfo
.bMirrorFreeAllowed
=sal_False
;
103 if (!aInfo
.bMirror45Allowed
) rInfo
.bMirror45Allowed
=sal_False
;
104 if (!aInfo
.bMirror90Allowed
) rInfo
.bMirror90Allowed
=sal_False
;
105 if (!aInfo
.bShearAllowed
) rInfo
.bShearAllowed
=sal_False
;
106 if (!aInfo
.bEdgeRadiusAllowed
) rInfo
.bEdgeRadiusAllowed
=sal_False
;
107 if (!aInfo
.bNoOrthoDesired
) rInfo
.bNoOrthoDesired
=sal_False
;
108 if (aInfo
.bNoContortion
) rInfo
.bNoContortion
=sal_True
;
109 if (!aInfo
.bCanConvToPath
) rInfo
.bCanConvToPath
=sal_False
;
111 if(!aInfo
.bCanConvToContour
)
112 rInfo
.bCanConvToContour
= sal_False
;
114 if (!aInfo
.bCanConvToPoly
) rInfo
.bCanConvToPoly
=sal_False
;
115 if (!aInfo
.bCanConvToPathLineToArea
) rInfo
.bCanConvToPathLineToArea
=sal_False
;
116 if (!aInfo
.bCanConvToPolyLineToArea
) rInfo
.bCanConvToPolyLineToArea
=sal_False
;
119 rInfo
.bRotateFreeAllowed
=sal_False
;
120 rInfo
.bRotate90Allowed
=sal_False
;
121 rInfo
.bMirrorFreeAllowed
=sal_False
;
122 rInfo
.bMirror45Allowed
=sal_False
;
123 rInfo
.bMirror90Allowed
=sal_False
;
124 rInfo
.bTransparenceAllowed
= sal_False
;
125 rInfo
.bGradientAllowed
= sal_False
;
126 rInfo
.bShearAllowed
=sal_False
;
127 rInfo
.bEdgeRadiusAllowed
=sal_False
;
128 rInfo
.bNoContortion
=sal_True
;
132 // only allowed if single object selected
133 rInfo
.bTransparenceAllowed
= sal_False
;
134 rInfo
.bGradientAllowed
= sal_False
;
139 void SdrObjGroup::SetBoundRectDirty()
141 // avoid resetting aOutRect which in case of this object is model data,
142 // not re-creatable view data
145 sal_uInt16
SdrObjGroup::GetObjIdentifier() const
147 return sal_uInt16(OBJ_GRUP
);
151 SdrLayerID
SdrObjGroup::GetLayer() const
154 SdrLayerID nLay
=SdrLayerID(SdrObject::GetLayer());
155 SdrObjList
* pOL
=pSub
;
156 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
157 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
158 SdrLayerID nLay1
=pOL
->GetObj(i
)->GetLayer();
159 if (b1st
) { nLay
=nLay1
; b1st
= false; }
160 else if (nLay1
!=nLay
) return 0;
166 void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer
)
168 SdrObject::NbcSetLayer(nLayer
);
169 SdrObjList
* pOL
=pSub
;
170 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
171 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
172 pOL
->GetObj(i
)->NbcSetLayer(nLayer
);
177 void SdrObjGroup::SetObjList(SdrObjList
* pNewObjList
)
179 SdrObject::SetObjList(pNewObjList
);
180 pSub
->SetUpList(pNewObjList
);
184 void SdrObjGroup::SetPage(SdrPage
* pNewPage
)
186 SdrObject::SetPage(pNewPage
);
187 pSub
->SetPage(pNewPage
);
191 void SdrObjGroup::SetModel(SdrModel
* pNewModel
)
193 if(pNewModel
!=pModel
)
196 // This method also needs to migrate the used ItemSet
197 // when the destination model uses a different pool
198 // than the current one. Else it is possible to create
199 // SdrObjGroups which reference the old pool which might
200 // be destroyed (as the bug shows).
201 SdrModel
* pOldModel
= pModel
;
203 // test for correct pool in ItemSet; move to new pool if necessary
204 if(pNewModel
&& GetObjectItemPool() && GetObjectItemPool() != &pNewModel
->GetItemPool())
206 MigrateItemPool(GetObjectItemPool(), &pNewModel
->GetItemPool(), pNewModel
);
210 SdrObject::SetModel(pNewModel
);
212 // set new model at content
213 pSub
->SetModel(pNewModel
);
216 GetProperties().SetModel(pOldModel
, pNewModel
);
221 bool SdrObjGroup::HasRefPoint() const
227 Point
SdrObjGroup::GetRefPoint() const
233 void SdrObjGroup::SetRefPoint(const Point
& rPnt
)
240 SdrObjList
* SdrObjGroup::GetSubList() const
245 const Rectangle
& SdrObjGroup::GetCurrentBoundRect() const
247 // <aOutRect> has to contain the bounding rectangle
248 if ( pSub
->GetObjCount()!=0 )
250 const_cast<SdrObjGroup
*>(this)->aOutRect
= pSub
->GetAllObjBoundRect();
256 const Rectangle
& SdrObjGroup::GetSnapRect() const
258 // <aOutRect> has to contain the bounding rectangle
259 if ( pSub
->GetObjCount()!=0 )
261 return pSub
->GetAllObjSnapRect();
269 SdrObjGroup
* SdrObjGroup::Clone() const
271 return CloneHelper
< SdrObjGroup
>();
274 SdrObjGroup
& SdrObjGroup::operator=(const SdrObjGroup
& rObj
)
278 // copy SdrObject stuff
279 SdrObject::operator=(rObj
);
282 // copy SubList, init model and page first
283 SdrObjList
& rSourceSubList
= *rObj
.GetSubList();
284 pSub
->SetPage(rSourceSubList
.GetPage());
285 pSub
->SetModel(rSourceSubList
.GetModel());
286 pSub
->CopyObjects(*rObj
.GetSubList());
288 // copy local parameters
289 aRefPoint
= rObj
.aRefPoint
;
290 bRefPoint
= rObj
.bRefPoint
;
295 void SdrObjGroup::TakeObjNameSingul(XubString
& rName
) const
297 if(!pSub
->GetObjCount())
299 rName
= ImpGetResStr(STR_ObjNameSingulGRUPEMPTY
);
303 rName
= ImpGetResStr(STR_ObjNameSingulGRUP
);
306 const String
aName(GetName());
310 rName
+= sal_Unicode(' ');
311 rName
+= sal_Unicode('\'');
313 rName
+= sal_Unicode('\'');
318 void SdrObjGroup::TakeObjNamePlural(XubString
& rName
) const
320 if (pSub
->GetObjCount()==0) {
321 rName
=ImpGetResStr(STR_ObjNamePluralGRUPEMPTY
);
323 rName
=ImpGetResStr(STR_ObjNamePluralGRUP
);
328 void SdrObjGroup::RecalcSnapRect()
330 // TODO: unnecessary, because we use the Rects from the SubList
333 basegfx::B2DPolyPolygon
SdrObjGroup::TakeXorPoly() const
335 basegfx::B2DPolyPolygon aRetval
;
336 const sal_uInt32
nObjCount(pSub
->GetObjCount());
338 for(sal_uInt32
a(0L); a
< nObjCount
; a
++)
340 SdrObject
* pObj
= pSub
->GetObj(a
);
341 aRetval
.append(pObj
->TakeXorPoly());
346 const basegfx::B2DRange
aRange(aOutRect
.Left(), aOutRect
.Top(), aOutRect
.Right(), aOutRect
.Bottom());
347 aRetval
.append(basegfx::tools::createPolygonFromRect(aRange
));
353 bool SdrObjGroup::beginSpecialDrag(SdrDragStat
& /*rDrag*/) const
359 bool SdrObjGroup::BegCreate(SdrDragStat
& /*rStat*/)
365 long SdrObjGroup::GetRotateAngle() const
367 const sal_uInt32
nObjCount(pSub
->GetObjCount());
372 SdrObject
* pObj
= pSub
->GetObj(0);
374 nRetval
= pObj
->GetRotateAngle();
381 long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
383 const sal_uInt32
nObjCount(pSub
->GetObjCount());
388 SdrObject
* pObj
= pSub
->GetObj(0);
390 nRetval
= pObj
->GetShearAngle();
397 void SdrObjGroup::NbcSetSnapRect(const Rectangle
& rRect
)
399 Rectangle
aOld(GetSnapRect());
400 long nMulX
=rRect
.Right()-rRect
.Left();
401 long nDivX
=aOld
.Right()-aOld
.Left();
402 long nMulY
=rRect
.Bottom()-rRect
.Top();
403 long nDivY
=aOld
.Bottom()-aOld
.Top();
404 if (nDivX
==0) { nMulX
=1; nDivX
=1; }
405 if (nDivY
==0) { nMulY
=1; nDivY
=1; }
406 if (nMulX
!=nDivX
|| nMulY
!=nDivY
) {
407 Fraction
aX(nMulX
,nDivX
);
408 Fraction
aY(nMulY
,nDivY
);
409 NbcResize(aOld
.TopLeft(),aX
,aY
);
411 if (rRect
.Left()!=aOld
.Left() || rRect
.Top()!=aOld
.Top()) {
412 NbcMove(Size(rRect
.Left()-aOld
.Left(),rRect
.Top()-aOld
.Top()));
417 void SdrObjGroup::NbcSetLogicRect(const Rectangle
& rRect
)
419 NbcSetSnapRect(rRect
);
423 void SdrObjGroup::NbcMove(const Size
& rSiz
)
425 MovePoint(aRefPoint
,rSiz
);
426 if (pSub
->GetObjCount()!=0) {
427 SdrObjList
* pOL
=pSub
;
428 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
429 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
430 SdrObject
* pObj
=pOL
->GetObj(i
);
434 MoveRect(aOutRect
,rSiz
);
440 void SdrObjGroup::NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
)
442 bool bXMirr
=(xFact
.GetNumerator()<0) != (xFact
.GetDenominator()<0);
443 bool bYMirr
=(yFact
.GetNumerator()<0) != (yFact
.GetDenominator()<0);
444 if (bXMirr
|| bYMirr
) {
445 Point
aRef1(GetSnapRect().Center());
449 NbcMirrorGluePoints(aRef1
,aRef2
);
454 NbcMirrorGluePoints(aRef1
,aRef2
);
457 ResizePoint(aRefPoint
,rRef
,xFact
,yFact
);
458 if (pSub
->GetObjCount()!=0) {
459 SdrObjList
* pOL
=pSub
;
460 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
461 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
462 SdrObject
* pObj
=pOL
->GetObj(i
);
463 pObj
->NbcResize(rRef
,xFact
,yFact
);
466 ResizeRect(aOutRect
,rRef
,xFact
,yFact
);
472 void SdrObjGroup::NbcRotate(const Point
& rRef
, long nWink
, double sn
, double cs
)
474 SetGlueReallyAbsolute(sal_True
);
475 RotatePoint(aRefPoint
,rRef
,sn
,cs
);
476 SdrObjList
* pOL
=pSub
;
477 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
478 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
479 SdrObject
* pObj
=pOL
->GetObj(i
);
480 pObj
->NbcRotate(rRef
,nWink
,sn
,cs
);
482 NbcRotateGluePoints(rRef
,nWink
,sn
,cs
);
483 SetGlueReallyAbsolute(sal_False
);
487 void SdrObjGroup::NbcMirror(const Point
& rRef1
, const Point
& rRef2
)
489 SetGlueReallyAbsolute(sal_True
);
490 MirrorPoint(aRefPoint
,rRef1
,rRef2
); // implementation missing in SvdEtc!
491 SdrObjList
* pOL
=pSub
;
492 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
493 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
494 SdrObject
* pObj
=pOL
->GetObj(i
);
495 pObj
->NbcMirror(rRef1
,rRef2
);
497 NbcMirrorGluePoints(rRef1
,rRef2
);
498 SetGlueReallyAbsolute(sal_False
);
502 void SdrObjGroup::NbcShear(const Point
& rRef
, long nWink
, double tn
, bool bVShear
)
504 SetGlueReallyAbsolute(sal_True
);
505 ShearPoint(aRefPoint
,rRef
,tn
);
506 SdrObjList
* pOL
=pSub
;
507 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
508 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
509 SdrObject
* pObj
=pOL
->GetObj(i
);
510 pObj
->NbcShear(rRef
,nWink
,tn
,bVShear
);
512 NbcShearGluePoints(rRef
,nWink
,tn
,bVShear
);
513 SetGlueReallyAbsolute(sal_False
);
517 void SdrObjGroup::NbcSetAnchorPos(const Point
& rPnt
)
520 Size
aSiz(rPnt
.X()-aAnchor
.X(),rPnt
.Y()-aAnchor
.Y());
521 MovePoint(aRefPoint
,aSiz
);
522 SdrObjList
* pOL
=pSub
;
523 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
524 for (sal_uIntPtr i
=0; i
<nObjAnz
; i
++) {
525 SdrObject
* pObj
=pOL
->GetObj(i
);
526 pObj
->NbcSetAnchorPos(rPnt
);
531 void SdrObjGroup::SetSnapRect(const Rectangle
& rRect
)
533 Rectangle aBoundRect0
; if (pUserCall
!=NULL
) aBoundRect0
=GetLastBoundRect();
534 Rectangle
aOld(GetSnapRect());
535 long nMulX
=rRect
.Right()-rRect
.Left();
536 long nDivX
=aOld
.Right()-aOld
.Left();
537 long nMulY
=rRect
.Bottom()-rRect
.Top();
538 long nDivY
=aOld
.Bottom()-aOld
.Top();
539 if (nDivX
==0) { nMulX
=1; nDivX
=1; }
540 if (nDivY
==0) { nMulY
=1; nDivY
=1; }
541 if (nMulX
!=nDivX
|| nMulY
!=nDivY
) {
542 Fraction
aX(nMulX
,nDivX
);
543 Fraction
aY(nMulY
,nDivY
);
544 Resize(aOld
.TopLeft(),aX
,aY
);
546 if (rRect
.Left()!=aOld
.Left() || rRect
.Top()!=aOld
.Top()) {
547 Move(Size(rRect
.Left()-aOld
.Left(),rRect
.Top()-aOld
.Top()));
551 BroadcastObjectChange();
552 SendUserCall(SDRUSERCALL_RESIZE
,aBoundRect0
);
556 void SdrObjGroup::SetLogicRect(const Rectangle
& rRect
)
562 void SdrObjGroup::Move(const Size
& rSiz
)
564 if (rSiz
.Width()!=0 || rSiz
.Height()!=0) {
565 Rectangle aBoundRect0
; if (pUserCall
!=NULL
) aBoundRect0
=GetLastBoundRect();
566 MovePoint(aRefPoint
,rSiz
);
567 if (pSub
->GetObjCount()!=0) {
568 // first move the connectors, then everything else
569 SdrObjList
* pOL
=pSub
;
570 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
572 for (i
=0; i
<nObjAnz
; i
++) {
573 SdrObject
* pObj
=pOL
->GetObj(i
);
574 if (pObj
->IsEdgeObj()) pObj
->Move(rSiz
);
576 for (i
=0; i
<nObjAnz
; i
++) {
577 SdrObject
* pObj
=pOL
->GetObj(i
);
578 if (!pObj
->IsEdgeObj()) pObj
->Move(rSiz
);
581 MoveRect(aOutRect
,rSiz
);
586 BroadcastObjectChange();
587 SendUserCall(SDRUSERCALL_MOVEONLY
,aBoundRect0
);
592 void SdrObjGroup::Resize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
, bool bUnsetRelative
)
594 if (xFact
.GetNumerator()!=xFact
.GetDenominator() || yFact
.GetNumerator()!=yFact
.GetDenominator()) {
595 bool bXMirr
=(xFact
.GetNumerator()<0) != (xFact
.GetDenominator()<0);
596 bool bYMirr
=(yFact
.GetNumerator()<0) != (yFact
.GetDenominator()<0);
597 if (bXMirr
|| bYMirr
) {
598 Point
aRef1(GetSnapRect().Center());
602 NbcMirrorGluePoints(aRef1
,aRef2
);
607 NbcMirrorGluePoints(aRef1
,aRef2
);
610 Rectangle aBoundRect0
; if (pUserCall
!=NULL
) aBoundRect0
=GetLastBoundRect();
611 ResizePoint(aRefPoint
,rRef
,xFact
,yFact
);
612 if (pSub
->GetObjCount()!=0) {
613 // move the connectors first, everything else afterwards
614 SdrObjList
* pOL
=pSub
;
615 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
617 for (i
=0; i
<nObjAnz
; i
++) {
618 SdrObject
* pObj
=pOL
->GetObj(i
);
619 if (pObj
->IsEdgeObj()) pObj
->Resize(rRef
,xFact
,yFact
,bUnsetRelative
);
621 for (i
=0; i
<nObjAnz
; i
++) {
622 SdrObject
* pObj
=pOL
->GetObj(i
);
623 if (!pObj
->IsEdgeObj()) pObj
->Resize(rRef
,xFact
,yFact
,bUnsetRelative
);
626 ResizeRect(aOutRect
,rRef
,xFact
,yFact
);
631 BroadcastObjectChange();
632 SendUserCall(SDRUSERCALL_RESIZE
,aBoundRect0
);
637 void SdrObjGroup::Rotate(const Point
& rRef
, long nWink
, double sn
, double cs
)
640 SetGlueReallyAbsolute(sal_True
);
641 Rectangle aBoundRect0
; if (pUserCall
!=NULL
) aBoundRect0
=GetLastBoundRect();
642 RotatePoint(aRefPoint
,rRef
,sn
,cs
);
643 // move the connectors first, everything else afterwards
644 SdrObjList
* pOL
=pSub
;
645 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
647 for (i
=0; i
<nObjAnz
; i
++) {
648 SdrObject
* pObj
=pOL
->GetObj(i
);
649 if (pObj
->IsEdgeObj()) pObj
->Rotate(rRef
,nWink
,sn
,cs
);
651 for (i
=0; i
<nObjAnz
; i
++) {
652 SdrObject
* pObj
=pOL
->GetObj(i
);
653 if (!pObj
->IsEdgeObj()) pObj
->Rotate(rRef
,nWink
,sn
,cs
);
655 NbcRotateGluePoints(rRef
,nWink
,sn
,cs
);
656 SetGlueReallyAbsolute(sal_False
);
658 BroadcastObjectChange();
659 SendUserCall(SDRUSERCALL_RESIZE
,aBoundRect0
);
664 void SdrObjGroup::Mirror(const Point
& rRef1
, const Point
& rRef2
)
666 SetGlueReallyAbsolute(sal_True
);
667 Rectangle aBoundRect0
; if (pUserCall
!=NULL
) aBoundRect0
=GetLastBoundRect();
668 MirrorPoint(aRefPoint
,rRef1
,rRef2
); // implementation missing in SvdEtc!
669 // move the connectors first, everything else afterwards
670 SdrObjList
* pOL
=pSub
;
671 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
673 for (i
=0; i
<nObjAnz
; i
++) {
674 SdrObject
* pObj
=pOL
->GetObj(i
);
675 if (pObj
->IsEdgeObj()) pObj
->Mirror(rRef1
,rRef2
);
677 for (i
=0; i
<nObjAnz
; i
++) {
678 SdrObject
* pObj
=pOL
->GetObj(i
);
679 if (!pObj
->IsEdgeObj()) pObj
->Mirror(rRef1
,rRef2
);
681 NbcMirrorGluePoints(rRef1
,rRef2
);
682 SetGlueReallyAbsolute(sal_False
);
684 BroadcastObjectChange();
685 SendUserCall(SDRUSERCALL_RESIZE
,aBoundRect0
);
689 void SdrObjGroup::Shear(const Point
& rRef
, long nWink
, double tn
, bool bVShear
)
692 SetGlueReallyAbsolute(sal_True
);
693 Rectangle aBoundRect0
; if (pUserCall
!=NULL
) aBoundRect0
=GetLastBoundRect();
694 ShearPoint(aRefPoint
,rRef
,tn
);
695 // move the connectors first, everything else afterwards
696 SdrObjList
* pOL
=pSub
;
697 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
699 for (i
=0; i
<nObjAnz
; i
++) {
700 SdrObject
* pObj
=pOL
->GetObj(i
);
701 if (pObj
->IsEdgeObj()) pObj
->Shear(rRef
,nWink
,tn
,bVShear
);
703 for (i
=0; i
<nObjAnz
; i
++) {
704 SdrObject
* pObj
=pOL
->GetObj(i
);
705 if (!pObj
->IsEdgeObj()) pObj
->Shear(rRef
,nWink
,tn
,bVShear
);
707 NbcShearGluePoints(rRef
,nWink
,tn
,bVShear
);
708 SetGlueReallyAbsolute(sal_False
);
710 BroadcastObjectChange();
711 SendUserCall(SDRUSERCALL_RESIZE
,aBoundRect0
);
716 void SdrObjGroup::SetAnchorPos(const Point
& rPnt
)
718 Rectangle aBoundRect0
; if (pUserCall
!=NULL
) aBoundRect0
=GetLastBoundRect();
719 bool bChg
=aAnchor
!=rPnt
;
721 Size
aSiz(rPnt
.X()-aAnchor
.X(),rPnt
.Y()-aAnchor
.Y());
722 MovePoint(aRefPoint
,aSiz
);
723 // move the connectors first, everything else afterwards
724 SdrObjList
* pOL
=pSub
;
725 sal_uIntPtr nObjAnz
=pOL
->GetObjCount();
727 for (i
=0; i
<nObjAnz
; i
++) {
728 SdrObject
* pObj
=pOL
->GetObj(i
);
729 if (pObj
->IsEdgeObj()) pObj
->SetAnchorPos(rPnt
);
731 for (i
=0; i
<nObjAnz
; i
++) {
732 SdrObject
* pObj
=pOL
->GetObj(i
);
733 if (!pObj
->IsEdgeObj()) pObj
->SetAnchorPos(rPnt
);
737 BroadcastObjectChange();
738 SendUserCall(SDRUSERCALL_MOVEONLY
,aBoundRect0
);
744 void SdrObjGroup::NbcSetRelativePos(const Point
& rPnt
)
746 Point
aRelPos0(GetSnapRect().TopLeft()-aAnchor
);
747 Size
aSiz(rPnt
.X()-aRelPos0
.X(),rPnt
.Y()-aRelPos0
.Y());
748 NbcMove(aSiz
); // this also calls SetRectsDirty()
751 void SdrObjGroup::SetRelativePos(const Point
& rPnt
)
753 Point
aRelPos0(GetSnapRect().TopLeft()-aAnchor
);
754 Size
aSiz(rPnt
.X()-aRelPos0
.X(),rPnt
.Y()-aRelPos0
.Y());
755 if (aSiz
.Width()!=0 || aSiz
.Height()!=0) Move(aSiz
); // this also calls SetRectsDirty() and Broadcast, ...
758 void SdrObjGroup::NbcReformatText()
760 pSub
->NbcReformatAllTextObjects();
763 void SdrObjGroup::ReformatText()
765 pSub
->ReformatAllTextObjects();
768 SdrObject
* SdrObjGroup::DoConvertToPolyObj(sal_Bool bBezier
, bool bAddText
) const
770 SdrObject
* pGroup
= new SdrObjGroup
;
771 pGroup
->SetModel(GetModel());
773 for(sal_uInt32 a
=0;a
<pSub
->GetObjCount();a
++)
775 SdrObject
* pIterObj
= pSub
->GetObj(a
);
776 SdrObject
* pResult
= pIterObj
->DoConvertToPolyObj(bBezier
, bAddText
);
778 // pResult can be NULL e.g. for empty objects
780 pGroup
->GetSubList()->NbcInsertObject(pResult
);
786 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */