1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*f6e50924SAndrew Rist * distributed with this work for additional information
6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10*f6e50924SAndrew Rist *
11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist *
13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17*f6e50924SAndrew Rist * specific language governing permissions and limitations
18*f6e50924SAndrew Rist * under the License.
19*f6e50924SAndrew Rist *
20*f6e50924SAndrew Rist *************************************************************/
21*f6e50924SAndrew Rist
22*f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <svx/svdovirt.hxx>
28cdf0e10cSrcweir #include <svx/xpool.hxx>
29cdf0e10cSrcweir #include <svx/svdtrans.hxx>
30cdf0e10cSrcweir #include <svx/svdetc.hxx>
31cdf0e10cSrcweir #include <svx/svdhdl.hxx>
32cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofvirtobj.hxx>
33cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
34cdf0e10cSrcweir #include <svx/svdograf.hxx>
35cdf0e10cSrcweir #include <svx/svddrgv.hxx>
36cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
37cdf0e10cSrcweir
38cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
39cdf0e10cSrcweir
GetProperties() const40cdf0e10cSrcweir sdr::properties::BaseProperties& SdrVirtObj::GetProperties() const
41cdf0e10cSrcweir {
42cdf0e10cSrcweir return rRefObj.GetProperties();
43cdf0e10cSrcweir }
44cdf0e10cSrcweir
45cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
46cdf0e10cSrcweir // AW, OD 2004-05-03 #i27224#
CreateObjectSpecificViewContact()47cdf0e10cSrcweir sdr::contact::ViewContact* SdrVirtObj::CreateObjectSpecificViewContact()
48cdf0e10cSrcweir {
49cdf0e10cSrcweir return new sdr::contact::ViewContactOfVirtObj(*this);
50cdf0e10cSrcweir }
51cdf0e10cSrcweir
52cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
53cdf0e10cSrcweir
54cdf0e10cSrcweir TYPEINIT1(SdrVirtObj,SdrObject);
55cdf0e10cSrcweir
SdrVirtObj(SdrObject & rNewObj)56cdf0e10cSrcweir SdrVirtObj::SdrVirtObj(SdrObject& rNewObj):
57cdf0e10cSrcweir rRefObj(rNewObj)
58cdf0e10cSrcweir {
59cdf0e10cSrcweir bVirtObj=sal_True; // Ja, ich bin ein virtuelles Objekt
60cdf0e10cSrcweir rRefObj.AddReference(*this);
61cdf0e10cSrcweir bClosedObj=rRefObj.IsClosedObj();
62cdf0e10cSrcweir }
63cdf0e10cSrcweir
SdrVirtObj(SdrObject & rNewObj,const Point & rAnchorPos)64cdf0e10cSrcweir SdrVirtObj::SdrVirtObj(SdrObject& rNewObj, const Point& rAnchorPos):
65cdf0e10cSrcweir rRefObj(rNewObj)
66cdf0e10cSrcweir {
67cdf0e10cSrcweir aAnchor=rAnchorPos;
68cdf0e10cSrcweir bVirtObj=sal_True; // Ja, ich bin ein virtuelles Objekt
69cdf0e10cSrcweir rRefObj.AddReference(*this);
70cdf0e10cSrcweir bClosedObj=rRefObj.IsClosedObj();
71cdf0e10cSrcweir }
72cdf0e10cSrcweir
~SdrVirtObj()73cdf0e10cSrcweir SdrVirtObj::~SdrVirtObj()
74cdf0e10cSrcweir {
75cdf0e10cSrcweir rRefObj.DelReference(*this);
76cdf0e10cSrcweir }
77cdf0e10cSrcweir
78cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
79cdf0e10cSrcweir
GetReferencedObj() const80cdf0e10cSrcweir const SdrObject& SdrVirtObj::GetReferencedObj() const
81cdf0e10cSrcweir {
82cdf0e10cSrcweir return rRefObj;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
ReferencedObj()85cdf0e10cSrcweir SdrObject& SdrVirtObj::ReferencedObj()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir return rRefObj;
88cdf0e10cSrcweir }
89cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint &)90cdf0e10cSrcweir void __EXPORT SdrVirtObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir bClosedObj=rRefObj.IsClosedObj();
93cdf0e10cSrcweir SetRectsDirty(); // hier noch Optimieren.
94cdf0e10cSrcweir
95cdf0e10cSrcweir // Only a repaint here, rRefObj may have changed and broadcasts
96cdf0e10cSrcweir ActionChanged();
97cdf0e10cSrcweir // BroadcastObjectChange();
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
NbcSetAnchorPos(const Point & rAnchorPos)100cdf0e10cSrcweir void SdrVirtObj::NbcSetAnchorPos(const Point& rAnchorPos)
101cdf0e10cSrcweir {
102cdf0e10cSrcweir aAnchor=rAnchorPos;
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
105cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
106cdf0e10cSrcweir
SetModel(SdrModel * pNewModel)107cdf0e10cSrcweir void SdrVirtObj::SetModel(SdrModel* pNewModel)
108cdf0e10cSrcweir {
109cdf0e10cSrcweir SdrObject::SetModel(pNewModel);
110cdf0e10cSrcweir rRefObj.SetModel(pNewModel);
111cdf0e10cSrcweir }
112cdf0e10cSrcweir
TakeObjInfo(SdrObjTransformInfoRec & rInfo) const113cdf0e10cSrcweir void SdrVirtObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
114cdf0e10cSrcweir {
115cdf0e10cSrcweir rRefObj.TakeObjInfo(rInfo);
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
GetObjInventor() const118cdf0e10cSrcweir sal_uInt32 SdrVirtObj::GetObjInventor() const
119cdf0e10cSrcweir {
120cdf0e10cSrcweir return rRefObj.GetObjInventor();
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
GetObjIdentifier() const123cdf0e10cSrcweir sal_uInt16 SdrVirtObj::GetObjIdentifier() const
124cdf0e10cSrcweir {
125cdf0e10cSrcweir return rRefObj.GetObjIdentifier();
126cdf0e10cSrcweir }
127cdf0e10cSrcweir
GetSubList() const128cdf0e10cSrcweir SdrObjList* SdrVirtObj::GetSubList() const
129cdf0e10cSrcweir {
130cdf0e10cSrcweir return rRefObj.GetSubList();
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
GetCurrentBoundRect() const133cdf0e10cSrcweir const Rectangle& SdrVirtObj::GetCurrentBoundRect() const
134cdf0e10cSrcweir {
135cdf0e10cSrcweir ((SdrVirtObj*)this)->aOutRect=rRefObj.GetCurrentBoundRect(); // Hier noch optimieren
136cdf0e10cSrcweir ((SdrVirtObj*)this)->aOutRect+=aAnchor;
137cdf0e10cSrcweir return aOutRect;
138cdf0e10cSrcweir }
139cdf0e10cSrcweir
GetLastBoundRect() const140cdf0e10cSrcweir const Rectangle& SdrVirtObj::GetLastBoundRect() const
141cdf0e10cSrcweir {
142cdf0e10cSrcweir ((SdrVirtObj*)this)->aOutRect=rRefObj.GetLastBoundRect(); // Hier noch optimieren
143cdf0e10cSrcweir ((SdrVirtObj*)this)->aOutRect+=aAnchor;
144cdf0e10cSrcweir return aOutRect;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir
RecalcBoundRect()147cdf0e10cSrcweir void SdrVirtObj::RecalcBoundRect()
148cdf0e10cSrcweir {
149cdf0e10cSrcweir aOutRect=rRefObj.GetCurrentBoundRect();
150cdf0e10cSrcweir aOutRect+=aAnchor;
151cdf0e10cSrcweir }
152cdf0e10cSrcweir
SetChanged()153cdf0e10cSrcweir void SdrVirtObj::SetChanged()
154cdf0e10cSrcweir {
155cdf0e10cSrcweir SdrObject::SetChanged();
156cdf0e10cSrcweir }
157cdf0e10cSrcweir
Clone() const158cdf0e10cSrcweir SdrObject* SdrVirtObj::Clone() const
159cdf0e10cSrcweir {
160cdf0e10cSrcweir SdrObject* pObj=new SdrVirtObj(((SdrVirtObj*)this)->rRefObj); // Nur eine weitere Referenz
161cdf0e10cSrcweir return pObj;
162cdf0e10cSrcweir }
163cdf0e10cSrcweir
operator =(const SdrObject & rObj)164cdf0e10cSrcweir void SdrVirtObj::operator=(const SdrObject& rObj)
165cdf0e10cSrcweir { // ???anderes Objekt referenzieren???
166cdf0e10cSrcweir SdrObject::operator=(rObj);
167cdf0e10cSrcweir aAnchor=((SdrVirtObj&)rObj).aAnchor;
168cdf0e10cSrcweir }
169cdf0e10cSrcweir
TakeObjNameSingul(XubString & rName) const170cdf0e10cSrcweir void SdrVirtObj::TakeObjNameSingul(XubString& rName) const
171cdf0e10cSrcweir {
172cdf0e10cSrcweir rRefObj.TakeObjNameSingul(rName);
173cdf0e10cSrcweir rName.Insert(sal_Unicode('['), 0);
174cdf0e10cSrcweir rName += sal_Unicode(']');
175cdf0e10cSrcweir
176cdf0e10cSrcweir String aName( GetName() );
177cdf0e10cSrcweir if(aName.Len())
178cdf0e10cSrcweir {
179cdf0e10cSrcweir rName += sal_Unicode(' ');
180cdf0e10cSrcweir rName += sal_Unicode('\'');
181cdf0e10cSrcweir rName += aName;
182cdf0e10cSrcweir rName += sal_Unicode('\'');
183cdf0e10cSrcweir }
184cdf0e10cSrcweir }
185cdf0e10cSrcweir
TakeObjNamePlural(XubString & rName) const186cdf0e10cSrcweir void SdrVirtObj::TakeObjNamePlural(XubString& rName) const
187cdf0e10cSrcweir {
188cdf0e10cSrcweir rRefObj.TakeObjNamePlural(rName);
189cdf0e10cSrcweir rName.Insert(sal_Unicode('['), 0);
190cdf0e10cSrcweir rName += sal_Unicode(']');
191cdf0e10cSrcweir }
192cdf0e10cSrcweir
operator +=(PolyPolygon & rPoly,const Point & rOfs)193cdf0e10cSrcweir void operator +=(PolyPolygon& rPoly, const Point& rOfs)
194cdf0e10cSrcweir {
195cdf0e10cSrcweir if (rOfs.X()!=0 || rOfs.Y()!=0) {
196cdf0e10cSrcweir sal_uInt16 i,j;
197cdf0e10cSrcweir for (j=0; j<rPoly.Count(); j++) {
198cdf0e10cSrcweir Polygon aP1(rPoly.GetObject(j));
199cdf0e10cSrcweir for (i=0; i<aP1.GetSize(); i++) {
200cdf0e10cSrcweir aP1[i]+=rOfs;
201cdf0e10cSrcweir }
202cdf0e10cSrcweir rPoly.Replace(aP1,j);
203cdf0e10cSrcweir }
204cdf0e10cSrcweir }
205cdf0e10cSrcweir }
206cdf0e10cSrcweir
TakeXorPoly() const207cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const
208cdf0e10cSrcweir {
209cdf0e10cSrcweir basegfx::B2DPolyPolygon aPolyPolygon(rRefObj.TakeXorPoly());
210cdf0e10cSrcweir
211cdf0e10cSrcweir if(aAnchor.X() || aAnchor.Y())
212cdf0e10cSrcweir {
213cdf0e10cSrcweir aPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aAnchor.X(), aAnchor.Y()));
214cdf0e10cSrcweir }
215cdf0e10cSrcweir
216cdf0e10cSrcweir return aPolyPolygon;
217cdf0e10cSrcweir }
218cdf0e10cSrcweir
219cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
220cdf0e10cSrcweir
GetHdlCount() const221cdf0e10cSrcweir sal_uInt32 SdrVirtObj::GetHdlCount() const
222cdf0e10cSrcweir {
223cdf0e10cSrcweir return rRefObj.GetHdlCount();
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
GetHdl(sal_uInt32 nHdlNum) const226cdf0e10cSrcweir SdrHdl* SdrVirtObj::GetHdl(sal_uInt32 nHdlNum) const
227cdf0e10cSrcweir {
228cdf0e10cSrcweir SdrHdl* pHdl=rRefObj.GetHdl(nHdlNum);
229cdf0e10cSrcweir
230cdf0e10cSrcweir // #i73248#
231cdf0e10cSrcweir // GetHdl() at SdrObject is not guaranteed to return an object
232cdf0e10cSrcweir if(pHdl)
233cdf0e10cSrcweir {
234cdf0e10cSrcweir Point aP(pHdl->GetPos()+aAnchor);
235cdf0e10cSrcweir pHdl->SetPos(aP);
236cdf0e10cSrcweir }
237cdf0e10cSrcweir
238cdf0e10cSrcweir return pHdl;
239cdf0e10cSrcweir }
240cdf0e10cSrcweir
GetPlusHdlCount(const SdrHdl & rHdl) const241cdf0e10cSrcweir sal_uInt32 SdrVirtObj::GetPlusHdlCount(const SdrHdl& rHdl) const
242cdf0e10cSrcweir {
243cdf0e10cSrcweir return rRefObj.GetPlusHdlCount(rHdl);
244cdf0e10cSrcweir }
245cdf0e10cSrcweir
GetPlusHdl(const SdrHdl & rHdl,sal_uInt32 nPlNum) const246cdf0e10cSrcweir SdrHdl* SdrVirtObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const
247cdf0e10cSrcweir {
248cdf0e10cSrcweir SdrHdl* pHdl=rRefObj.GetPlusHdl(rHdl,nPlNum);
249cdf0e10cSrcweir pHdl->SetPos(pHdl->GetPos() + aAnchor);
250cdf0e10cSrcweir return pHdl;
251cdf0e10cSrcweir }
252cdf0e10cSrcweir
AddToHdlList(SdrHdlList & rHdlList) const253cdf0e10cSrcweir void SdrVirtObj::AddToHdlList(SdrHdlList& rHdlList) const
254cdf0e10cSrcweir {
255cdf0e10cSrcweir // #i73248#
256cdf0e10cSrcweir // SdrObject::AddToHdlList(rHdlList) is not a good thing to call
257cdf0e10cSrcweir // since at SdrPathObj, only AddToHdlList may be used and the call
258cdf0e10cSrcweir // will instead use the standard implementation which uses GetHdlCount()
259cdf0e10cSrcweir // and GetHdl instead. This is not wrong, but may be much less effective
260cdf0e10cSrcweir // and may not be prepared to GetHdl returning NULL
261cdf0e10cSrcweir
262cdf0e10cSrcweir // get handles using AddToHdlList from ref object
263cdf0e10cSrcweir SdrHdlList aLocalList(0);
264cdf0e10cSrcweir rRefObj.AddToHdlList(aLocalList);
265cdf0e10cSrcweir const sal_uInt32 nHdlCount(aLocalList.GetHdlCount());
266cdf0e10cSrcweir
267cdf0e10cSrcweir if(nHdlCount)
268cdf0e10cSrcweir {
269cdf0e10cSrcweir // translate handles and add them to dest list. They are temporarily part of
270cdf0e10cSrcweir // two lists then
271cdf0e10cSrcweir const Point aOffset(GetOffset());
272cdf0e10cSrcweir
273cdf0e10cSrcweir for(sal_uInt32 a(0L); a < nHdlCount; a++)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir SdrHdl* pCandidate = aLocalList.GetHdl(a);
276cdf0e10cSrcweir pCandidate->SetPos(pCandidate->GetPos() + aOffset);
277cdf0e10cSrcweir rHdlList.AddHdl(pCandidate);
278cdf0e10cSrcweir }
279cdf0e10cSrcweir
280cdf0e10cSrcweir // remove them from source list, else they will be deleted when
281cdf0e10cSrcweir // source list is deleted
282cdf0e10cSrcweir while(aLocalList.GetHdlCount())
283cdf0e10cSrcweir {
284cdf0e10cSrcweir aLocalList.RemoveHdl(aLocalList.GetHdlCount() - 1L);
285cdf0e10cSrcweir }
286cdf0e10cSrcweir }
287cdf0e10cSrcweir }
288cdf0e10cSrcweir
289cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
290cdf0e10cSrcweir
hasSpecialDrag() const291cdf0e10cSrcweir bool SdrVirtObj::hasSpecialDrag() const
292cdf0e10cSrcweir {
293cdf0e10cSrcweir return rRefObj.hasSpecialDrag();
294cdf0e10cSrcweir }
295cdf0e10cSrcweir
supportsFullDrag() const296cdf0e10cSrcweir bool SdrVirtObj::supportsFullDrag() const
297cdf0e10cSrcweir {
298cdf0e10cSrcweir return false;
299cdf0e10cSrcweir }
300cdf0e10cSrcweir
getFullDragClone() const301cdf0e10cSrcweir SdrObject* SdrVirtObj::getFullDragClone() const
302cdf0e10cSrcweir {
303cdf0e10cSrcweir static bool bSpecialHandling(false);
304cdf0e10cSrcweir SdrObject* pRetval = 0;
305cdf0e10cSrcweir
306cdf0e10cSrcweir if(bSpecialHandling)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir // special handling for VirtObj. Do not create another
309cdf0e10cSrcweir // reference to rRefObj, this would allow to change that
310cdf0e10cSrcweir // one on drag. Instead, create a SdrGrafObj for drag containing
311cdf0e10cSrcweir // the graphical representation
312cdf0e10cSrcweir pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), this), GetLogicRect());
313cdf0e10cSrcweir }
314cdf0e10cSrcweir else
315cdf0e10cSrcweir {
316cdf0e10cSrcweir SdrObject& rReferencedObject = ((SdrVirtObj*)this)->ReferencedObj();
317cdf0e10cSrcweir pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), &rReferencedObject), GetLogicRect());
318cdf0e10cSrcweir }
319cdf0e10cSrcweir
320cdf0e10cSrcweir return pRetval;
321cdf0e10cSrcweir }
322cdf0e10cSrcweir
beginSpecialDrag(SdrDragStat & rDrag) const323cdf0e10cSrcweir bool SdrVirtObj::beginSpecialDrag(SdrDragStat& rDrag) const
324cdf0e10cSrcweir {
325cdf0e10cSrcweir return rRefObj.beginSpecialDrag(rDrag);
326cdf0e10cSrcweir }
327cdf0e10cSrcweir
applySpecialDrag(SdrDragStat & rDrag)328cdf0e10cSrcweir bool SdrVirtObj::applySpecialDrag(SdrDragStat& rDrag)
329cdf0e10cSrcweir {
330cdf0e10cSrcweir return rRefObj.applySpecialDrag(rDrag);
331cdf0e10cSrcweir }
332cdf0e10cSrcweir
getSpecialDragPoly(const SdrDragStat & rDrag) const333cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrVirtObj::getSpecialDragPoly(const SdrDragStat& rDrag) const
334cdf0e10cSrcweir {
335cdf0e10cSrcweir return rRefObj.getSpecialDragPoly(rDrag);
336cdf0e10cSrcweir // Offset handlen !!!!!! fehlt noch !!!!!!!
337cdf0e10cSrcweir }
338cdf0e10cSrcweir
getSpecialDragComment(const SdrDragStat & rDrag) const339cdf0e10cSrcweir String SdrVirtObj::getSpecialDragComment(const SdrDragStat& rDrag) const
340cdf0e10cSrcweir {
341cdf0e10cSrcweir return rRefObj.getSpecialDragComment(rDrag);
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
344cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
345cdf0e10cSrcweir
BegCreate(SdrDragStat & rStat)346cdf0e10cSrcweir FASTBOOL SdrVirtObj::BegCreate(SdrDragStat& rStat)
347cdf0e10cSrcweir {
348cdf0e10cSrcweir return rRefObj.BegCreate(rStat);
349cdf0e10cSrcweir }
350cdf0e10cSrcweir
MovCreate(SdrDragStat & rStat)351cdf0e10cSrcweir FASTBOOL SdrVirtObj::MovCreate(SdrDragStat& rStat)
352cdf0e10cSrcweir {
353cdf0e10cSrcweir return rRefObj.MovCreate(rStat);
354cdf0e10cSrcweir }
355cdf0e10cSrcweir
EndCreate(SdrDragStat & rStat,SdrCreateCmd eCmd)356cdf0e10cSrcweir FASTBOOL SdrVirtObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
357cdf0e10cSrcweir {
358cdf0e10cSrcweir return rRefObj.EndCreate(rStat,eCmd);
359cdf0e10cSrcweir }
360cdf0e10cSrcweir
BckCreate(SdrDragStat & rStat)361cdf0e10cSrcweir FASTBOOL SdrVirtObj::BckCreate(SdrDragStat& rStat)
362cdf0e10cSrcweir {
363cdf0e10cSrcweir return rRefObj.BckCreate(rStat);
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
BrkCreate(SdrDragStat & rStat)366cdf0e10cSrcweir void SdrVirtObj::BrkCreate(SdrDragStat& rStat)
367cdf0e10cSrcweir {
368cdf0e10cSrcweir rRefObj.BrkCreate(rStat);
369cdf0e10cSrcweir }
370cdf0e10cSrcweir
TakeCreatePoly(const SdrDragStat & rDrag) const371cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrVirtObj::TakeCreatePoly(const SdrDragStat& rDrag) const
372cdf0e10cSrcweir {
373cdf0e10cSrcweir return rRefObj.TakeCreatePoly(rDrag);
374cdf0e10cSrcweir // Offset handlen !!!!!! fehlt noch !!!!!!!
375cdf0e10cSrcweir }
376cdf0e10cSrcweir
377cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
378cdf0e10cSrcweir
NbcMove(const Size & rSiz)379cdf0e10cSrcweir void SdrVirtObj::NbcMove(const Size& rSiz)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir MovePoint(aAnchor,rSiz);
382cdf0e10cSrcweir SetRectsDirty();
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
NbcResize(const Point & rRef,const Fraction & xFact,const Fraction & yFact)385cdf0e10cSrcweir void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
386cdf0e10cSrcweir {
387cdf0e10cSrcweir rRefObj.NbcResize(rRef-aAnchor,xFact,yFact);
388cdf0e10cSrcweir SetRectsDirty();
389cdf0e10cSrcweir }
390cdf0e10cSrcweir
NbcRotate(const Point & rRef,long nWink,double sn,double cs)391cdf0e10cSrcweir void SdrVirtObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
392cdf0e10cSrcweir {
393cdf0e10cSrcweir rRefObj.NbcRotate(rRef-aAnchor,nWink,sn,cs);
394cdf0e10cSrcweir SetRectsDirty();
395cdf0e10cSrcweir }
396cdf0e10cSrcweir
NbcMirror(const Point & rRef1,const Point & rRef2)397cdf0e10cSrcweir void SdrVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
398cdf0e10cSrcweir {
399cdf0e10cSrcweir rRefObj.NbcMirror(rRef1-aAnchor,rRef2-aAnchor);
400cdf0e10cSrcweir SetRectsDirty();
401cdf0e10cSrcweir }
402cdf0e10cSrcweir
NbcShear(const Point & rRef,long nWink,double tn,FASTBOOL bVShear)403cdf0e10cSrcweir void SdrVirtObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
404cdf0e10cSrcweir {
405cdf0e10cSrcweir rRefObj.NbcShear(rRef-aAnchor,nWink,tn,bVShear);
406cdf0e10cSrcweir SetRectsDirty();
407cdf0e10cSrcweir }
408cdf0e10cSrcweir
409cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
410cdf0e10cSrcweir
Move(const Size & rSiz)411cdf0e10cSrcweir void SdrVirtObj::Move(const Size& rSiz)
412cdf0e10cSrcweir {
413cdf0e10cSrcweir if (rSiz.Width()!=0 || rSiz.Height()!=0) {
414cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
415cdf0e10cSrcweir // #110094#-14 SendRepaintBroadcast();
416cdf0e10cSrcweir NbcMove(rSiz);
417cdf0e10cSrcweir SetChanged();
418cdf0e10cSrcweir BroadcastObjectChange();
419cdf0e10cSrcweir SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
420cdf0e10cSrcweir }
421cdf0e10cSrcweir }
422cdf0e10cSrcweir
Resize(const Point & rRef,const Fraction & xFact,const Fraction & yFact)423cdf0e10cSrcweir void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
424cdf0e10cSrcweir {
425cdf0e10cSrcweir if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
426cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
427cdf0e10cSrcweir rRefObj.Resize(rRef-aAnchor,xFact,yFact);
428cdf0e10cSrcweir SetRectsDirty();
429cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
430cdf0e10cSrcweir }
431cdf0e10cSrcweir }
432cdf0e10cSrcweir
Rotate(const Point & rRef,long nWink,double sn,double cs)433cdf0e10cSrcweir void SdrVirtObj::Rotate(const Point& rRef, long nWink, double sn, double cs)
434cdf0e10cSrcweir {
435cdf0e10cSrcweir if (nWink!=0) {
436cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
437cdf0e10cSrcweir rRefObj.Rotate(rRef-aAnchor,nWink,sn,cs);
438cdf0e10cSrcweir SetRectsDirty();
439cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
440cdf0e10cSrcweir }
441cdf0e10cSrcweir }
442cdf0e10cSrcweir
Mirror(const Point & rRef1,const Point & rRef2)443cdf0e10cSrcweir void SdrVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
444cdf0e10cSrcweir {
445cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
446cdf0e10cSrcweir rRefObj.Mirror(rRef1-aAnchor,rRef2-aAnchor);
447cdf0e10cSrcweir SetRectsDirty();
448cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
449cdf0e10cSrcweir }
450cdf0e10cSrcweir
Shear(const Point & rRef,long nWink,double tn,FASTBOOL bVShear)451cdf0e10cSrcweir void SdrVirtObj::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
452cdf0e10cSrcweir {
453cdf0e10cSrcweir if (nWink!=0) {
454cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
455cdf0e10cSrcweir rRefObj.Shear(rRef-aAnchor,nWink,tn,bVShear);
456cdf0e10cSrcweir SetRectsDirty();
457cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
458cdf0e10cSrcweir }
459cdf0e10cSrcweir }
460cdf0e10cSrcweir
461cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
462cdf0e10cSrcweir
RecalcSnapRect()463cdf0e10cSrcweir void SdrVirtObj::RecalcSnapRect()
464cdf0e10cSrcweir {
465cdf0e10cSrcweir aSnapRect=rRefObj.GetSnapRect();
466cdf0e10cSrcweir aSnapRect+=aAnchor;
467cdf0e10cSrcweir }
468cdf0e10cSrcweir
GetSnapRect() const469cdf0e10cSrcweir const Rectangle& SdrVirtObj::GetSnapRect() const
470cdf0e10cSrcweir {
471cdf0e10cSrcweir ((SdrVirtObj*)this)->aSnapRect=rRefObj.GetSnapRect();
472cdf0e10cSrcweir ((SdrVirtObj*)this)->aSnapRect+=aAnchor;
473cdf0e10cSrcweir return aSnapRect;
474cdf0e10cSrcweir }
475cdf0e10cSrcweir
SetSnapRect(const Rectangle & rRect)476cdf0e10cSrcweir void SdrVirtObj::SetSnapRect(const Rectangle& rRect)
477cdf0e10cSrcweir {
478cdf0e10cSrcweir {
479cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
480cdf0e10cSrcweir Rectangle aR(rRect);
481cdf0e10cSrcweir aR-=aAnchor;
482cdf0e10cSrcweir rRefObj.SetSnapRect(aR);
483cdf0e10cSrcweir SetRectsDirty();
484cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
485cdf0e10cSrcweir }
486cdf0e10cSrcweir }
487cdf0e10cSrcweir
NbcSetSnapRect(const Rectangle & rRect)488cdf0e10cSrcweir void SdrVirtObj::NbcSetSnapRect(const Rectangle& rRect)
489cdf0e10cSrcweir {
490cdf0e10cSrcweir Rectangle aR(rRect);
491cdf0e10cSrcweir aR-=aAnchor;
492cdf0e10cSrcweir SetRectsDirty();
493cdf0e10cSrcweir rRefObj.NbcSetSnapRect(aR);
494cdf0e10cSrcweir }
495cdf0e10cSrcweir
496cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
497cdf0e10cSrcweir
GetLogicRect() const498cdf0e10cSrcweir const Rectangle& SdrVirtObj::GetLogicRect() const
499cdf0e10cSrcweir {
500cdf0e10cSrcweir ((SdrVirtObj*)this)->aSnapRect=rRefObj.GetLogicRect(); // !!! Missbrauch von aSnapRect !!!
501cdf0e10cSrcweir ((SdrVirtObj*)this)->aSnapRect+=aAnchor; // Wenns mal Aerger gibt, muss ein weiteres Rectangle Member her (oder Heap)
502cdf0e10cSrcweir return aSnapRect;
503cdf0e10cSrcweir }
504cdf0e10cSrcweir
SetLogicRect(const Rectangle & rRect)505cdf0e10cSrcweir void SdrVirtObj::SetLogicRect(const Rectangle& rRect)
506cdf0e10cSrcweir {
507cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
508cdf0e10cSrcweir Rectangle aR(rRect);
509cdf0e10cSrcweir aR-=aAnchor;
510cdf0e10cSrcweir rRefObj.SetLogicRect(aR);
511cdf0e10cSrcweir SetRectsDirty();
512cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
513cdf0e10cSrcweir }
514cdf0e10cSrcweir
NbcSetLogicRect(const Rectangle & rRect)515cdf0e10cSrcweir void SdrVirtObj::NbcSetLogicRect(const Rectangle& rRect)
516cdf0e10cSrcweir {
517cdf0e10cSrcweir Rectangle aR(rRect);
518cdf0e10cSrcweir aR-=aAnchor;
519cdf0e10cSrcweir SetRectsDirty();
520cdf0e10cSrcweir rRefObj.NbcSetLogicRect(aR);
521cdf0e10cSrcweir }
522cdf0e10cSrcweir
523cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
524cdf0e10cSrcweir
GetRotateAngle() const525cdf0e10cSrcweir long SdrVirtObj::GetRotateAngle() const
526cdf0e10cSrcweir {
527cdf0e10cSrcweir return rRefObj.GetRotateAngle();
528cdf0e10cSrcweir }
529cdf0e10cSrcweir
GetShearAngle(FASTBOOL bVertical) const530cdf0e10cSrcweir long SdrVirtObj::GetShearAngle(FASTBOOL bVertical) const
531cdf0e10cSrcweir {
532cdf0e10cSrcweir return rRefObj.GetShearAngle(bVertical);
533cdf0e10cSrcweir }
534cdf0e10cSrcweir
535cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
536cdf0e10cSrcweir
GetSnapPointCount() const537cdf0e10cSrcweir sal_uInt32 SdrVirtObj::GetSnapPointCount() const
538cdf0e10cSrcweir {
539cdf0e10cSrcweir return rRefObj.GetSnapPointCount();
540cdf0e10cSrcweir }
541cdf0e10cSrcweir
GetSnapPoint(sal_uInt32 i) const542cdf0e10cSrcweir Point SdrVirtObj::GetSnapPoint(sal_uInt32 i) const
543cdf0e10cSrcweir {
544cdf0e10cSrcweir Point aP(rRefObj.GetSnapPoint(i));
545cdf0e10cSrcweir aP+=aAnchor;
546cdf0e10cSrcweir return aP;
547cdf0e10cSrcweir }
548cdf0e10cSrcweir
IsPolyObj() const549cdf0e10cSrcweir sal_Bool SdrVirtObj::IsPolyObj() const
550cdf0e10cSrcweir {
551cdf0e10cSrcweir return rRefObj.IsPolyObj();
552cdf0e10cSrcweir }
553cdf0e10cSrcweir
GetPointCount() const554cdf0e10cSrcweir sal_uInt32 SdrVirtObj::GetPointCount() const
555cdf0e10cSrcweir {
556cdf0e10cSrcweir return rRefObj.GetPointCount();
557cdf0e10cSrcweir }
558cdf0e10cSrcweir
GetPoint(sal_uInt32 i) const559cdf0e10cSrcweir Point SdrVirtObj::GetPoint(sal_uInt32 i) const
560cdf0e10cSrcweir {
561cdf0e10cSrcweir return Point(rRefObj.GetPoint(i) + aAnchor);
562cdf0e10cSrcweir }
563cdf0e10cSrcweir
NbcSetPoint(const Point & rPnt,sal_uInt32 i)564cdf0e10cSrcweir void SdrVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
565cdf0e10cSrcweir {
566cdf0e10cSrcweir Point aP(rPnt);
567cdf0e10cSrcweir aP-=aAnchor;
568cdf0e10cSrcweir rRefObj.SetPoint(aP,i);
569cdf0e10cSrcweir SetRectsDirty();
570cdf0e10cSrcweir }
571cdf0e10cSrcweir
572cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
573cdf0e10cSrcweir
NewGeoData() const574cdf0e10cSrcweir SdrObjGeoData* SdrVirtObj::NewGeoData() const
575cdf0e10cSrcweir {
576cdf0e10cSrcweir return rRefObj.NewGeoData();
577cdf0e10cSrcweir }
578cdf0e10cSrcweir
SaveGeoData(SdrObjGeoData & rGeo) const579cdf0e10cSrcweir void SdrVirtObj::SaveGeoData(SdrObjGeoData& rGeo) const
580cdf0e10cSrcweir {
581cdf0e10cSrcweir rRefObj.SaveGeoData(rGeo);
582cdf0e10cSrcweir }
583cdf0e10cSrcweir
RestGeoData(const SdrObjGeoData & rGeo)584cdf0e10cSrcweir void SdrVirtObj::RestGeoData(const SdrObjGeoData& rGeo)
585cdf0e10cSrcweir {
586cdf0e10cSrcweir rRefObj.RestGeoData(rGeo);
587cdf0e10cSrcweir SetRectsDirty();
588cdf0e10cSrcweir }
589cdf0e10cSrcweir
590cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
591cdf0e10cSrcweir
GetGeoData() const592cdf0e10cSrcweir SdrObjGeoData* SdrVirtObj::GetGeoData() const
593cdf0e10cSrcweir {
594cdf0e10cSrcweir return rRefObj.GetGeoData();
595cdf0e10cSrcweir }
596cdf0e10cSrcweir
SetGeoData(const SdrObjGeoData & rGeo)597cdf0e10cSrcweir void SdrVirtObj::SetGeoData(const SdrObjGeoData& rGeo)
598cdf0e10cSrcweir {
599cdf0e10cSrcweir Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
600cdf0e10cSrcweir rRefObj.SetGeoData(rGeo);
601cdf0e10cSrcweir SetRectsDirty();
602cdf0e10cSrcweir SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
603cdf0e10cSrcweir }
604cdf0e10cSrcweir
605cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
606cdf0e10cSrcweir
NbcReformatText()607cdf0e10cSrcweir void SdrVirtObj::NbcReformatText()
608cdf0e10cSrcweir {
609cdf0e10cSrcweir rRefObj.NbcReformatText();
610cdf0e10cSrcweir }
611cdf0e10cSrcweir
ReformatText()612cdf0e10cSrcweir void SdrVirtObj::ReformatText()
613cdf0e10cSrcweir {
614cdf0e10cSrcweir rRefObj.ReformatText();
615cdf0e10cSrcweir }
616cdf0e10cSrcweir
617cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
618cdf0e10cSrcweir
HasMacro() const619cdf0e10cSrcweir FASTBOOL SdrVirtObj::HasMacro() const
620cdf0e10cSrcweir {
621cdf0e10cSrcweir return rRefObj.HasMacro();
622cdf0e10cSrcweir }
623cdf0e10cSrcweir
CheckMacroHit(const SdrObjMacroHitRec & rRec) const624cdf0e10cSrcweir SdrObject* SdrVirtObj::CheckMacroHit(const SdrObjMacroHitRec& rRec) const
625cdf0e10cSrcweir {
626cdf0e10cSrcweir return rRefObj.CheckMacroHit(rRec); // Todo: Positionsversatz
627cdf0e10cSrcweir }
628cdf0e10cSrcweir
GetMacroPointer(const SdrObjMacroHitRec & rRec) const629cdf0e10cSrcweir Pointer SdrVirtObj::GetMacroPointer(const SdrObjMacroHitRec& rRec) const
630cdf0e10cSrcweir {
631cdf0e10cSrcweir return rRefObj.GetMacroPointer(rRec); // Todo: Positionsversatz
632cdf0e10cSrcweir }
633cdf0e10cSrcweir
PaintMacro(OutputDevice & rOut,const Rectangle & rDirtyRect,const SdrObjMacroHitRec & rRec) const634cdf0e10cSrcweir void SdrVirtObj::PaintMacro(OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const
635cdf0e10cSrcweir {
636cdf0e10cSrcweir rRefObj.PaintMacro(rOut,rDirtyRect,rRec); // Todo: Positionsversatz
637cdf0e10cSrcweir }
638cdf0e10cSrcweir
DoMacro(const SdrObjMacroHitRec & rRec)639cdf0e10cSrcweir FASTBOOL SdrVirtObj::DoMacro(const SdrObjMacroHitRec& rRec)
640cdf0e10cSrcweir {
641cdf0e10cSrcweir return rRefObj.DoMacro(rRec); // Todo: Positionsversatz
642cdf0e10cSrcweir }
643cdf0e10cSrcweir
GetMacroPopupComment(const SdrObjMacroHitRec & rRec) const644cdf0e10cSrcweir XubString SdrVirtObj::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
645cdf0e10cSrcweir {
646cdf0e10cSrcweir return rRefObj.GetMacroPopupComment(rRec); // Todo: Positionsversatz
647cdf0e10cSrcweir }
648cdf0e10cSrcweir
GetOffset() const649cdf0e10cSrcweir const Point SdrVirtObj::GetOffset() const
650cdf0e10cSrcweir {
651cdf0e10cSrcweir // #i73248# default offset of SdrVirtObj is aAnchor
652cdf0e10cSrcweir return aAnchor;
653cdf0e10cSrcweir }
654cdf0e10cSrcweir
655cdf0e10cSrcweir // eof
656