xref: /aoo42x/main/svx/source/svdraw/svdobj.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #define _USE_MATH_DEFINES
33*cdf0e10cSrcweir #include <math.h>
34*cdf0e10cSrcweir #include <vcl/metaact.hxx>   // fuer TakeContour
35*cdf0e10cSrcweir #include <vcl/cvtsvm.hxx>
36*cdf0e10cSrcweir #include <tools/line.hxx>
37*cdf0e10cSrcweir #include <tools/bigint.hxx>
38*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
39*cdf0e10cSrcweir #include <vector>
40*cdf0e10cSrcweir #include <svx/svdobj.hxx>
41*cdf0e10cSrcweir #include <svx/xpoly.hxx>
42*cdf0e10cSrcweir #include <svx/svdetc.hxx>
43*cdf0e10cSrcweir #include <svx/svdtrans.hxx>
44*cdf0e10cSrcweir #include <svx/svdhdl.hxx>
45*cdf0e10cSrcweir #include <svx/svddrag.hxx>
46*cdf0e10cSrcweir #include <svx/svdmodel.hxx>
47*cdf0e10cSrcweir #include <svx/svdpage.hxx>
48*cdf0e10cSrcweir #include <svx/svdovirt.hxx>  // Fuer Add/Del Ref
49*cdf0e10cSrcweir #include <svx/svdview.hxx>   // fuer Dragging (Ortho abfragen)
50*cdf0e10cSrcweir #include "svx/svdglob.hxx"   // StringCache
51*cdf0e10cSrcweir #include <svx/svdstr.hrc>    // Objektname
52*cdf0e10cSrcweir #include <svx/svdogrp.hxx>   // Factory
53*cdf0e10cSrcweir #include <svx/svdopath.hxx>  // Factory
54*cdf0e10cSrcweir #include <svx/svdoedge.hxx>  // Factory
55*cdf0e10cSrcweir #include <svx/svdorect.hxx>  // Factory
56*cdf0e10cSrcweir #include <svx/svdocirc.hxx>  // Factory
57*cdf0e10cSrcweir #include <svx/svdotext.hxx>  // Factory
58*cdf0e10cSrcweir #include <svx/svdomeas.hxx>  // Factory
59*cdf0e10cSrcweir #include <svx/svdograf.hxx>  // Factory
60*cdf0e10cSrcweir #include <svx/svdoole2.hxx>  // Factory
61*cdf0e10cSrcweir #include <svx/svdocapt.hxx>  // Factory
62*cdf0e10cSrcweir #include <svx/svdopage.hxx>  // Factory
63*cdf0e10cSrcweir #include <svx/svdouno.hxx>   // Factory
64*cdf0e10cSrcweir #include <svx/svdattrx.hxx> // NotPersistItems
65*cdf0e10cSrcweir #include <svx/svdoashp.hxx>
66*cdf0e10cSrcweir #include <svx/svdomedia.hxx>
67*cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
68*cdf0e10cSrcweir #include <svx/xlnstwit.hxx>
69*cdf0e10cSrcweir #include <svx/xlnedwit.hxx>
70*cdf0e10cSrcweir #include <svx/xlnstit.hxx>
71*cdf0e10cSrcweir #include <svx/xlnedit.hxx>
72*cdf0e10cSrcweir #include <svx/xlnstcit.hxx>
73*cdf0e10cSrcweir #include <svx/xlnedcit.hxx>
74*cdf0e10cSrcweir #include <svx/xlndsit.hxx>
75*cdf0e10cSrcweir #include <svx/xlnclit.hxx>
76*cdf0e10cSrcweir #include <svx/xflclit.hxx>
77*cdf0e10cSrcweir #include <svx/svditer.hxx>
78*cdf0e10cSrcweir #include <svx/xlntrit.hxx>
79*cdf0e10cSrcweir #include <svx/xfltrit.hxx>
80*cdf0e10cSrcweir #include <svx/xfltrit.hxx>
81*cdf0e10cSrcweir #include <svx/xflftrit.hxx>
82*cdf0e10cSrcweir #include "svx/xlinjoit.hxx"
83*cdf0e10cSrcweir #include <svx/unopage.hxx>
84*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
85*cdf0e10cSrcweir #include <svx/xenum.hxx>
86*cdf0e10cSrcweir #include <svx/xgrad.hxx>
87*cdf0e10cSrcweir #include <svx/xhatch.hxx>
88*cdf0e10cSrcweir #include <svx/xflhtit.hxx>
89*cdf0e10cSrcweir #include <svx/xbtmpit.hxx>
90*cdf0e10cSrcweir #include <svx/svdpool.hxx>
91*cdf0e10cSrcweir #include <editeng/editeng.hxx>
92*cdf0e10cSrcweir #include <vcl/salbtype.hxx>		// FRound
93*cdf0e10cSrcweir #include <svl/whiter.hxx>
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir // #97849#
96*cdf0e10cSrcweir #include <svx/fmmodel.hxx>
97*cdf0e10cSrcweir #include <sfx2/objsh.hxx>
98*cdf0e10cSrcweir #include <sfx2/objface.hxx>
99*cdf0e10cSrcweir #include "svdoimp.hxx"
100*cdf0e10cSrcweir #include <vcl/graphictools.hxx>
101*cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
102*cdf0e10cSrcweir #include <svx/sdr/properties/emptyproperties.hxx>
103*cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
104*cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofgraphic.hxx>
105*cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
106*cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
107*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
108*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
109*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
110*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
111*cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx>
112*cdf0e10cSrcweir #include <svx/unoshape.hxx>
113*cdf0e10cSrcweir #include <vcl/virdev.hxx>
114*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygoncutter.hxx>
115*cdf0e10cSrcweir #include <drawinglayer/processor2d/contourextractor2d.hxx>
116*cdf0e10cSrcweir #include <drawinglayer/processor2d/linegeometryextractor2d.hxx>
117*cdf0e10cSrcweir #include <svx/polysc3d.hxx>
118*cdf0e10cSrcweir #include "svx/svdotable.hxx"
119*cdf0e10cSrcweir #include "svx/shapepropertynotifier.hxx"
120*cdf0e10cSrcweir #include <svx/sdrhittesthelper.hxx>
121*cdf0e10cSrcweir #include <svx/svdundo.hxx>
122*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
123*cdf0e10cSrcweir #include <svx/sdrobjectfilter.hxx>
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir using namespace ::com::sun::star;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir // #104018# replace macros above with type-detecting methods
128*cdf0e10cSrcweir inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
129*cdf0e10cSrcweir inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir TYPEINIT0(SdrObjUserCall);
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir SdrObjUserCall::~SdrObjUserCall()
136*cdf0e10cSrcweir {
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir void SdrObjUserCall::Changed(const SdrObject& /*rObj*/, SdrUserCallType /*eType*/, const Rectangle& /*rOldBoundRect*/)
140*cdf0e10cSrcweir {
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir TYPEINIT0(SdrObjUserData);
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir void SdrObjUserData::operator=(const SdrObjUserData& /*rData*/)    // nicht implementiert
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir sal_Bool SdrObjUserData::operator==(const SdrObjUserData& /*rData*/) const // nicht implementiert
152*cdf0e10cSrcweir {
153*cdf0e10cSrcweir 	return sal_False;
154*cdf0e10cSrcweir }
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir sal_Bool SdrObjUserData::operator!=(const SdrObjUserData& /*rData*/) const // nicht implementiert
157*cdf0e10cSrcweir {
158*cdf0e10cSrcweir 	return sal_False;
159*cdf0e10cSrcweir }
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir SdrObjUserData::~SdrObjUserData()
162*cdf0e10cSrcweir {
163*cdf0e10cSrcweir }
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir FASTBOOL SdrObjUserData::HasMacro(const SdrObject* /*pObj*/) const
166*cdf0e10cSrcweir {
167*cdf0e10cSrcweir 	return sal_False;
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir SdrObject* SdrObjUserData::CheckMacroHit(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const
171*cdf0e10cSrcweir {
172*cdf0e10cSrcweir 	if(pObj)
173*cdf0e10cSrcweir     {
174*cdf0e10cSrcweir         if(rRec.pPageView)
175*cdf0e10cSrcweir         {
176*cdf0e10cSrcweir     	    return SdrObjectPrimitiveHit(*pObj, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
177*cdf0e10cSrcweir         }
178*cdf0e10cSrcweir     }
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	return 0;
181*cdf0e10cSrcweir }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir Pointer SdrObjUserData::GetMacroPointer(const SdrObjMacroHitRec& /*rRec*/, const SdrObject* /*pObj*/) const
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir 	return Pointer(POINTER_REFHAND);
186*cdf0e10cSrcweir }
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir void SdrObjUserData::PaintMacro(OutputDevice& rOut, const Rectangle& /*rDirtyRect*/, const SdrObjMacroHitRec& /*rRec*/, const SdrObject* pObj) const
189*cdf0e10cSrcweir {
190*cdf0e10cSrcweir 	if(!pObj)
191*cdf0e10cSrcweir         return;
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 	const RasterOp eRop(rOut.GetRasterOp());
194*cdf0e10cSrcweir 	const basegfx::B2DPolyPolygon aPolyPolygon(pObj->TakeXorPoly());
195*cdf0e10cSrcweir 	const sal_uInt32 nCount(aPolyPolygon.count());
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir     rOut.SetLineColor(COL_BLACK);
198*cdf0e10cSrcweir     rOut.SetFillColor();
199*cdf0e10cSrcweir 	rOut.SetRasterOp(ROP_INVERT);
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 	for(sal_uInt32 a(0); a < nCount; a++)
202*cdf0e10cSrcweir 	{
203*cdf0e10cSrcweir 		rOut.DrawPolyLine(aPolyPolygon.getB2DPolygon(a));
204*cdf0e10cSrcweir 	}
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir     rOut.SetRasterOp(eRop);
207*cdf0e10cSrcweir }
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir FASTBOOL SdrObjUserData::DoMacro(const SdrObjMacroHitRec& /*rRec*/, SdrObject* /*pObj*/)
210*cdf0e10cSrcweir {
211*cdf0e10cSrcweir 	return sal_False;
212*cdf0e10cSrcweir }
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir XubString SdrObjUserData::GetMacroPopupComment(const SdrObjMacroHitRec& /*rRec*/, const SdrObject* /*pObj*/) const
215*cdf0e10cSrcweir {
216*cdf0e10cSrcweir 	return String();
217*cdf0e10cSrcweir }
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir void SdrObjUserDataList::Clear()
220*cdf0e10cSrcweir {
221*cdf0e10cSrcweir 	sal_uInt16 nAnz=GetUserDataCount();
222*cdf0e10cSrcweir 	for (sal_uInt16 i=0; i<nAnz; i++) {
223*cdf0e10cSrcweir 		delete GetUserData(i);
224*cdf0e10cSrcweir 	}
225*cdf0e10cSrcweir 	aList.Clear();
226*cdf0e10cSrcweir }
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir DBG_NAME(SdrObjGeoData);
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir SdrObjGeoData::SdrObjGeoData():
233*cdf0e10cSrcweir 	pGPL(NULL),
234*cdf0e10cSrcweir 	bMovProt(sal_False),
235*cdf0e10cSrcweir 	bSizProt(sal_False),
236*cdf0e10cSrcweir 	bNoPrint(sal_False),
237*cdf0e10cSrcweir 	bClosedObj(sal_False),
238*cdf0e10cSrcweir 	mbVisible(true),
239*cdf0e10cSrcweir 	mnLayerID(0)
240*cdf0e10cSrcweir {
241*cdf0e10cSrcweir 	DBG_CTOR(SdrObjGeoData,NULL);
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir SdrObjGeoData::~SdrObjGeoData()
245*cdf0e10cSrcweir {
246*cdf0e10cSrcweir 	DBG_DTOR(SdrObjGeoData,NULL);
247*cdf0e10cSrcweir 	delete pGPL;
248*cdf0e10cSrcweir }
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir TYPEINIT0(SdrObjPlusData);
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir SdrObjPlusData::SdrObjPlusData():
255*cdf0e10cSrcweir 	pBroadcast(NULL),
256*cdf0e10cSrcweir 	pUserDataList(NULL),
257*cdf0e10cSrcweir 	pGluePoints(NULL),
258*cdf0e10cSrcweir 	pAutoTimer(NULL)
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir }
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir SdrObjPlusData::~SdrObjPlusData()
263*cdf0e10cSrcweir {
264*cdf0e10cSrcweir 	if (pBroadcast   !=NULL) delete pBroadcast;
265*cdf0e10cSrcweir 	if (pUserDataList!=NULL) delete pUserDataList;
266*cdf0e10cSrcweir 	if (pGluePoints  !=NULL) delete pGluePoints;
267*cdf0e10cSrcweir 	if (pAutoTimer   !=NULL) delete pAutoTimer;
268*cdf0e10cSrcweir }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
271*cdf0e10cSrcweir {
272*cdf0e10cSrcweir 	SdrObjPlusData* pNeuPlusData=new SdrObjPlusData;
273*cdf0e10cSrcweir 	if (pUserDataList!=NULL) {
274*cdf0e10cSrcweir 		sal_uInt16 nAnz=pUserDataList->GetUserDataCount();
275*cdf0e10cSrcweir 		if (nAnz!=0) {
276*cdf0e10cSrcweir 			pNeuPlusData->pUserDataList=new SdrObjUserDataList;
277*cdf0e10cSrcweir 			for (sal_uInt16 i=0; i<nAnz; i++) {
278*cdf0e10cSrcweir 				SdrObjUserData* pNeuUserData=pUserDataList->GetUserData(i)->Clone(pObj1);
279*cdf0e10cSrcweir 				if (pNeuUserData!=NULL) {
280*cdf0e10cSrcweir 					pNeuPlusData->pUserDataList->InsertUserData(pNeuUserData);
281*cdf0e10cSrcweir 				} else {
282*cdf0e10cSrcweir 					DBG_ERROR("SdrObjPlusData::Clone(): UserData.Clone() liefert NULL");
283*cdf0e10cSrcweir 				}
284*cdf0e10cSrcweir 			}
285*cdf0e10cSrcweir 		}
286*cdf0e10cSrcweir 	}
287*cdf0e10cSrcweir 	if (pGluePoints!=NULL) pNeuPlusData->pGluePoints=new SdrGluePointList(*pGluePoints);
288*cdf0e10cSrcweir 	// MtfAnimator wird auch nicht mitkopiert
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 	// #i68101#
291*cdf0e10cSrcweir 	// copy object name, title and description
292*cdf0e10cSrcweir 	pNeuPlusData->aObjName = aObjName;
293*cdf0e10cSrcweir 	pNeuPlusData->aObjTitle = aObjTitle;
294*cdf0e10cSrcweir 	pNeuPlusData->aObjDescription = aObjDescription;
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 	if (pAutoTimer!=NULL) {
297*cdf0e10cSrcweir 		pNeuPlusData->pAutoTimer=new AutoTimer;
298*cdf0e10cSrcweir 		// Handler, etc. nicht mitkopieren!
299*cdf0e10cSrcweir 	}
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 	// For HTMLName: Do not clone, leave uninitialized (empty string)
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 	return pNeuPlusData;
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
307*cdf0e10cSrcweir //
308*cdf0e10cSrcweir //   @@@@  @@@@@  @@@@@@ @@@@@  @@@@  @@@@@@
309*cdf0e10cSrcweir //  @@  @@ @@  @@     @@ @@    @@  @@   @@
310*cdf0e10cSrcweir //  @@  @@ @@  @@     @@ @@    @@       @@
311*cdf0e10cSrcweir //  @@  @@ @@@@@      @@ @@@@  @@       @@
312*cdf0e10cSrcweir //  @@  @@ @@  @@     @@ @@    @@       @@
313*cdf0e10cSrcweir //  @@  @@ @@  @@ @@  @@ @@    @@  @@   @@
314*cdf0e10cSrcweir //   @@@@  @@@@@   @@@@  @@@@@  @@@@    @@
315*cdf0e10cSrcweir //
316*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
319*cdf0e10cSrcweir // BaseProperties section
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir sdr::properties::BaseProperties* SdrObject::CreateObjectSpecificProperties()
322*cdf0e10cSrcweir {
323*cdf0e10cSrcweir 	return new sdr::properties::EmptyProperties(*this);
324*cdf0e10cSrcweir }
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir sdr::properties::BaseProperties& SdrObject::GetProperties() const
327*cdf0e10cSrcweir {
328*cdf0e10cSrcweir 	if(!mpProperties)
329*cdf0e10cSrcweir 	{
330*cdf0e10cSrcweir 		const_cast< SdrObject* >(this)->mpProperties =
331*cdf0e10cSrcweir             const_cast< SdrObject* >(this)->CreateObjectSpecificProperties();
332*cdf0e10cSrcweir 	}
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 	return *mpProperties;
335*cdf0e10cSrcweir }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
338*cdf0e10cSrcweir // ObjectUser section
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir void SdrObject::AddObjectUser(sdr::ObjectUser& rNewUser)
341*cdf0e10cSrcweir {
342*cdf0e10cSrcweir 	maObjectUsers.push_back(&rNewUser);
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir void SdrObject::RemoveObjectUser(sdr::ObjectUser& rOldUser)
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir 	const ::sdr::ObjectUserVector::iterator aFindResult = ::std::find(maObjectUsers.begin(), maObjectUsers.end(), &rOldUser);
348*cdf0e10cSrcweir 	if(aFindResult != maObjectUsers.end())
349*cdf0e10cSrcweir 	{
350*cdf0e10cSrcweir 		maObjectUsers.erase(aFindResult);
351*cdf0e10cSrcweir 	}
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
355*cdf0e10cSrcweir // #110094# DrawContact section
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir sdr::contact::ViewContact* SdrObject::CreateObjectSpecificViewContact()
358*cdf0e10cSrcweir {
359*cdf0e10cSrcweir 	return new sdr::contact::ViewContactOfSdrObj(*this);
360*cdf0e10cSrcweir }
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir sdr::contact::ViewContact& SdrObject::GetViewContact() const
363*cdf0e10cSrcweir {
364*cdf0e10cSrcweir 	if(!mpViewContact)
365*cdf0e10cSrcweir 	{
366*cdf0e10cSrcweir 		const_cast< SdrObject* >(this)->mpViewContact =
367*cdf0e10cSrcweir             const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact();
368*cdf0e10cSrcweir 	}
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 	return *mpViewContact;
371*cdf0e10cSrcweir }
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir // DrawContact support: Methods for handling Object changes
374*cdf0e10cSrcweir void SdrObject::ActionChanged() const
375*cdf0e10cSrcweir {
376*cdf0e10cSrcweir     // Do necessary ViewContact actions
377*cdf0e10cSrcweir 	GetViewContact().ActionChanged();
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir void SdrObject::SetBoundRectDirty()
383*cdf0e10cSrcweir {
384*cdf0e10cSrcweir 	aOutRect = Rectangle();
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir DBG_NAME(SdrObject);
390*cdf0e10cSrcweir TYPEINIT1(SdrObject,SfxListener);
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir SdrObject::SdrObject()
393*cdf0e10cSrcweir     :mpProperties(0L)
394*cdf0e10cSrcweir     ,mpViewContact(0L)
395*cdf0e10cSrcweir     ,pObjList(NULL)
396*cdf0e10cSrcweir     ,pPage(NULL)
397*cdf0e10cSrcweir     ,pModel(NULL)
398*cdf0e10cSrcweir     ,pUserCall(NULL)
399*cdf0e10cSrcweir     ,pPlusData(NULL)
400*cdf0e10cSrcweir     ,nOrdNum(0)
401*cdf0e10cSrcweir     ,mnNavigationPosition(SAL_MAX_UINT32)
402*cdf0e10cSrcweir     ,mnLayerID(0)
403*cdf0e10cSrcweir     ,mpSvxShape( NULL )
404*cdf0e10cSrcweir     ,maWeakUnoShape()
405*cdf0e10cSrcweir {
406*cdf0e10cSrcweir 	DBG_CTOR(SdrObject,NULL);
407*cdf0e10cSrcweir 	bVirtObj         =sal_False;
408*cdf0e10cSrcweir 	bSnapRectDirty   =sal_True;
409*cdf0e10cSrcweir 	bNetLock         =sal_False;
410*cdf0e10cSrcweir 	bInserted        =sal_False;
411*cdf0e10cSrcweir 	bGrouped         =sal_False;
412*cdf0e10cSrcweir 	bMovProt         =sal_False;
413*cdf0e10cSrcweir 	bSizProt         =sal_False;
414*cdf0e10cSrcweir 	bNoPrint         =sal_False;
415*cdf0e10cSrcweir 	bEmptyPresObj    =sal_False;
416*cdf0e10cSrcweir 	bNotVisibleAsMaster=sal_False;
417*cdf0e10cSrcweir 	bClosedObj       =sal_False;
418*cdf0e10cSrcweir 	mbVisible		 = true;
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir 	// #i25616#
421*cdf0e10cSrcweir 	mbLineIsOutsideGeometry = sal_False;
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir 	// #i25616#
424*cdf0e10cSrcweir 	mbSupportTextIndentingOnLineWidthChange = sal_False;
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 	//#110094#-1
427*cdf0e10cSrcweir 	//bWriterFlyFrame  =sal_False;
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 	bNotMasterCachable=sal_False;
430*cdf0e10cSrcweir 	bIsEdge=sal_False;
431*cdf0e10cSrcweir 	bIs3DObj=sal_False;
432*cdf0e10cSrcweir 	bMarkProt=sal_False;
433*cdf0e10cSrcweir 	bIsUnoObj=sal_False;
434*cdf0e10cSrcweir }
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir SdrObject::~SdrObject()
437*cdf0e10cSrcweir {
438*cdf0e10cSrcweir 	// tell all the registered ObjectUsers that the page is in destruction
439*cdf0e10cSrcweir 	::sdr::ObjectUserVector aListCopy(maObjectUsers.begin(), maObjectUsers.end());
440*cdf0e10cSrcweir 	for(::sdr::ObjectUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); aIterator++)
441*cdf0e10cSrcweir 	{
442*cdf0e10cSrcweir 		sdr::ObjectUser* pObjectUser = *aIterator;
443*cdf0e10cSrcweir 		DBG_ASSERT(pObjectUser, "SdrObject::~SdrObject: corrupt ObjectUser list (!)");
444*cdf0e10cSrcweir 		pObjectUser->ObjectInDestruction(*this);
445*cdf0e10cSrcweir 	}
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir 	// Clear the vector. This means that user do not need to call RemoveObjectUser()
448*cdf0e10cSrcweir 	// when they get called from ObjectInDestruction().
449*cdf0e10cSrcweir 	maObjectUsers.clear();
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir     try
452*cdf0e10cSrcweir     {
453*cdf0e10cSrcweir         SvxShape* pSvxShape = getSvxShape();
454*cdf0e10cSrcweir         if ( pSvxShape )
455*cdf0e10cSrcweir         {
456*cdf0e10cSrcweir             OSL_ENSURE(!pSvxShape->HasSdrObjectOwnership(),"Please check where this call come from and replace it with SdrObject::Free");
457*cdf0e10cSrcweir             pSvxShape->InvalidateSdrObject();
458*cdf0e10cSrcweir 	        uno::Reference< lang::XComponent > xShapeComp( getWeakUnoShape(), uno::UNO_QUERY_THROW );
459*cdf0e10cSrcweir 		    xShapeComp->dispose();
460*cdf0e10cSrcweir         }
461*cdf0e10cSrcweir     }
462*cdf0e10cSrcweir     catch( const uno::Exception& )
463*cdf0e10cSrcweir     {
464*cdf0e10cSrcweir     	DBG_UNHANDLED_EXCEPTION();
465*cdf0e10cSrcweir     }
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 	DBG_DTOR(SdrObject,NULL);
468*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_DELETE, GetLastBoundRect());
469*cdf0e10cSrcweir 	if (pPlusData!=NULL) delete pPlusData;
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir 	if(mpProperties)
472*cdf0e10cSrcweir 	{
473*cdf0e10cSrcweir 		delete mpProperties;
474*cdf0e10cSrcweir 		mpProperties = 0L;
475*cdf0e10cSrcweir 	}
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir 	// #110094#
478*cdf0e10cSrcweir 	if(mpViewContact)
479*cdf0e10cSrcweir 	{
480*cdf0e10cSrcweir 		delete mpViewContact;
481*cdf0e10cSrcweir 		mpViewContact = 0L;
482*cdf0e10cSrcweir 	}
483*cdf0e10cSrcweir }
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir void SdrObject::Free( SdrObject*& _rpObject )
486*cdf0e10cSrcweir {
487*cdf0e10cSrcweir     SdrObject* pObject = _rpObject; _rpObject = NULL;
488*cdf0e10cSrcweir     if ( pObject == NULL )
489*cdf0e10cSrcweir         // nothing to do
490*cdf0e10cSrcweir         return;
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir 	SvxShape* pShape = pObject->getSvxShape();
493*cdf0e10cSrcweir     if ( pShape && pShape->HasSdrObjectOwnership() )
494*cdf0e10cSrcweir         // only the shape is allowed to delete me, and will reset the ownership before doing so
495*cdf0e10cSrcweir         return;
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir     delete pObject;
498*cdf0e10cSrcweir }
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir SdrObjPlusData* SdrObject::NewPlusData() const
501*cdf0e10cSrcweir {
502*cdf0e10cSrcweir 	return new SdrObjPlusData;
503*cdf0e10cSrcweir }
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir void SdrObject::SetRectsDirty(sal_Bool bNotMyself)
506*cdf0e10cSrcweir {
507*cdf0e10cSrcweir 	if (!bNotMyself) {
508*cdf0e10cSrcweir 		SetBoundRectDirty();
509*cdf0e10cSrcweir 		bSnapRectDirty=sal_True;
510*cdf0e10cSrcweir 	}
511*cdf0e10cSrcweir 	if (pObjList!=NULL) {
512*cdf0e10cSrcweir 		pObjList->SetRectsDirty();
513*cdf0e10cSrcweir 	}
514*cdf0e10cSrcweir }
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir void SdrObject::SetModel(SdrModel* pNewModel)
517*cdf0e10cSrcweir {
518*cdf0e10cSrcweir 	if(pNewModel && pPage)
519*cdf0e10cSrcweir 	{
520*cdf0e10cSrcweir 		if(pPage->GetModel() != pNewModel)
521*cdf0e10cSrcweir 		{
522*cdf0e10cSrcweir 			pPage = NULL;
523*cdf0e10cSrcweir 		}
524*cdf0e10cSrcweir 	}
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir 	// update listeners at possible api wrapper object
527*cdf0e10cSrcweir 	if( pModel != pNewModel )
528*cdf0e10cSrcweir 	{
529*cdf0e10cSrcweir 		SvxShape* pShape = getSvxShape();
530*cdf0e10cSrcweir 		if( pShape )
531*cdf0e10cSrcweir 			pShape->ChangeModel( pNewModel );
532*cdf0e10cSrcweir 	}
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir 	pModel = pNewModel;
535*cdf0e10cSrcweir }
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir void SdrObject::SetObjList(SdrObjList* pNewObjList)
538*cdf0e10cSrcweir {
539*cdf0e10cSrcweir 	pObjList=pNewObjList;
540*cdf0e10cSrcweir }
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir void SdrObject::SetPage(SdrPage* pNewPage)
543*cdf0e10cSrcweir {
544*cdf0e10cSrcweir 	pPage=pNewPage;
545*cdf0e10cSrcweir 	if (pPage!=NULL) {
546*cdf0e10cSrcweir 		SdrModel* pMod=pPage->GetModel();
547*cdf0e10cSrcweir 		if (pMod!=pModel && pMod!=NULL) {
548*cdf0e10cSrcweir 			SetModel(pMod);
549*cdf0e10cSrcweir 		}}
550*cdf0e10cSrcweir }
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir // init global static itempool
553*cdf0e10cSrcweir SdrItemPool* SdrObject::mpGlobalItemPool = NULL;
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir SdrItemPool& SdrObject::GetGlobalDrawObjectItemPool()
556*cdf0e10cSrcweir {
557*cdf0e10cSrcweir 	if(!mpGlobalItemPool)
558*cdf0e10cSrcweir 	{
559*cdf0e10cSrcweir 		mpGlobalItemPool = new SdrItemPool();
560*cdf0e10cSrcweir 		SfxItemPool* pGlobalOutlPool = EditEngine::CreatePool();
561*cdf0e10cSrcweir 		mpGlobalItemPool->SetSecondaryPool(pGlobalOutlPool);
562*cdf0e10cSrcweir 		mpGlobalItemPool->SetDefaultMetric((SfxMapUnit)SdrEngineDefaults::GetMapUnit());
563*cdf0e10cSrcweir 		mpGlobalItemPool->FreezeIdRanges();
564*cdf0e10cSrcweir 	}
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir 	return *mpGlobalItemPool;
567*cdf0e10cSrcweir }
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir void SdrObject::FreeGlobalDrawObjectItemPool()
570*cdf0e10cSrcweir {
571*cdf0e10cSrcweir 	// code for deletion of GlobalItemPool
572*cdf0e10cSrcweir 	if(mpGlobalItemPool)
573*cdf0e10cSrcweir 	{
574*cdf0e10cSrcweir 		SfxItemPool* pGlobalOutlPool = mpGlobalItemPool->GetSecondaryPool();
575*cdf0e10cSrcweir         SfxItemPool::Free(mpGlobalItemPool);
576*cdf0e10cSrcweir         SfxItemPool::Free(pGlobalOutlPool);
577*cdf0e10cSrcweir 	}
578*cdf0e10cSrcweir }
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir SdrItemPool* SdrObject::GetObjectItemPool() const
581*cdf0e10cSrcweir {
582*cdf0e10cSrcweir 	if(pModel)
583*cdf0e10cSrcweir 		return (SdrItemPool*)(&pModel->GetItemPool());
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir 	// use a static global default pool
586*cdf0e10cSrcweir 	return &SdrObject::GetGlobalDrawObjectItemPool();
587*cdf0e10cSrcweir }
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir sal_uInt32 SdrObject::GetObjInventor()   const
590*cdf0e10cSrcweir {
591*cdf0e10cSrcweir 	return SdrInventor;
592*cdf0e10cSrcweir }
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir sal_uInt16 SdrObject::GetObjIdentifier() const
595*cdf0e10cSrcweir {
596*cdf0e10cSrcweir 	return sal_uInt16(OBJ_NONE);
597*cdf0e10cSrcweir }
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir void SdrObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
600*cdf0e10cSrcweir {
601*cdf0e10cSrcweir 	rInfo.bRotateFreeAllowed=sal_False;
602*cdf0e10cSrcweir 	rInfo.bMirrorFreeAllowed=sal_False;
603*cdf0e10cSrcweir 	rInfo.bTransparenceAllowed = sal_False;
604*cdf0e10cSrcweir 	rInfo.bGradientAllowed = sal_False;
605*cdf0e10cSrcweir 	rInfo.bShearAllowed     =sal_False;
606*cdf0e10cSrcweir 	rInfo.bEdgeRadiusAllowed=sal_False;
607*cdf0e10cSrcweir 	rInfo.bCanConvToPath    =sal_False;
608*cdf0e10cSrcweir 	rInfo.bCanConvToPoly    =sal_False;
609*cdf0e10cSrcweir 	rInfo.bCanConvToContour = sal_False;
610*cdf0e10cSrcweir 	rInfo.bCanConvToPathLineToArea=sal_False;
611*cdf0e10cSrcweir 	rInfo.bCanConvToPolyLineToArea=sal_False;
612*cdf0e10cSrcweir }
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir SdrLayerID SdrObject::GetLayer() const
615*cdf0e10cSrcweir {
616*cdf0e10cSrcweir 	return mnLayerID;
617*cdf0e10cSrcweir }
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir void SdrObject::getMergedHierarchyLayerSet(SetOfByte& rSet) const
620*cdf0e10cSrcweir {
621*cdf0e10cSrcweir 	rSet.Set(GetLayer());
622*cdf0e10cSrcweir 	SdrObjList* pOL=GetSubList();
623*cdf0e10cSrcweir 	if (pOL!=NULL) {
624*cdf0e10cSrcweir 		sal_uIntPtr nObjAnz=pOL->GetObjCount();
625*cdf0e10cSrcweir 		for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
626*cdf0e10cSrcweir 			pOL->GetObj(nObjNum)->getMergedHierarchyLayerSet(rSet);
627*cdf0e10cSrcweir 		}
628*cdf0e10cSrcweir 	}
629*cdf0e10cSrcweir }
630*cdf0e10cSrcweir 
631*cdf0e10cSrcweir void SdrObject::NbcSetLayer(SdrLayerID nLayer)
632*cdf0e10cSrcweir {
633*cdf0e10cSrcweir 	if(GetLayer() != nLayer)
634*cdf0e10cSrcweir 	{
635*cdf0e10cSrcweir 		mnLayerID = nLayer;
636*cdf0e10cSrcweir 	}
637*cdf0e10cSrcweir }
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir void SdrObject::SetLayer(SdrLayerID nLayer)
640*cdf0e10cSrcweir {
641*cdf0e10cSrcweir 	NbcSetLayer(nLayer);
642*cdf0e10cSrcweir 	SetChanged();
643*cdf0e10cSrcweir 	BroadcastObjectChange();
644*cdf0e10cSrcweir }
645*cdf0e10cSrcweir 
646*cdf0e10cSrcweir void SdrObject::AddListener(SfxListener& rListener)
647*cdf0e10cSrcweir {
648*cdf0e10cSrcweir 	ImpForcePlusData();
649*cdf0e10cSrcweir 	if (pPlusData->pBroadcast==NULL) pPlusData->pBroadcast=new SfxBroadcaster;
650*cdf0e10cSrcweir 	rListener.StartListening(*pPlusData->pBroadcast);
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir void SdrObject::RemoveListener(SfxListener& rListener)
654*cdf0e10cSrcweir {
655*cdf0e10cSrcweir 	if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {
656*cdf0e10cSrcweir 		rListener.EndListening(*pPlusData->pBroadcast);
657*cdf0e10cSrcweir 		if (!pPlusData->pBroadcast->HasListeners()) {
658*cdf0e10cSrcweir 			delete pPlusData->pBroadcast;
659*cdf0e10cSrcweir 			pPlusData->pBroadcast=NULL;
660*cdf0e10cSrcweir 		}
661*cdf0e10cSrcweir 	}
662*cdf0e10cSrcweir }
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir void SdrObject::AddReference(SdrVirtObj& rVrtObj)
665*cdf0e10cSrcweir {
666*cdf0e10cSrcweir 	AddListener(rVrtObj);
667*cdf0e10cSrcweir }
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir void SdrObject::DelReference(SdrVirtObj& rVrtObj)
670*cdf0e10cSrcweir {
671*cdf0e10cSrcweir 	RemoveListener(rVrtObj);
672*cdf0e10cSrcweir }
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir AutoTimer* SdrObject::ForceAutoTimer()
675*cdf0e10cSrcweir {
676*cdf0e10cSrcweir 	ImpForcePlusData();
677*cdf0e10cSrcweir 	if (pPlusData->pAutoTimer==NULL) pPlusData->pAutoTimer=new AutoTimer;
678*cdf0e10cSrcweir 	return pPlusData->pAutoTimer;
679*cdf0e10cSrcweir }
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir FASTBOOL SdrObject::HasRefPoint() const
682*cdf0e10cSrcweir {
683*cdf0e10cSrcweir 	return sal_False;
684*cdf0e10cSrcweir }
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir Point SdrObject::GetRefPoint() const
687*cdf0e10cSrcweir {
688*cdf0e10cSrcweir 	return GetCurrentBoundRect().Center();
689*cdf0e10cSrcweir }
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir void SdrObject::SetRefPoint(const Point& /*rPnt*/)
692*cdf0e10cSrcweir {
693*cdf0e10cSrcweir }
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir SdrObjList* SdrObject::GetSubList() const
696*cdf0e10cSrcweir {
697*cdf0e10cSrcweir 	return NULL;
698*cdf0e10cSrcweir }
699*cdf0e10cSrcweir 
700*cdf0e10cSrcweir SdrObject* SdrObject::GetUpGroup() const
701*cdf0e10cSrcweir {
702*cdf0e10cSrcweir 	return pObjList!=NULL ? pObjList->GetOwnerObj() : NULL;
703*cdf0e10cSrcweir }
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir void SdrObject::SetName(const String& rStr)
706*cdf0e10cSrcweir {
707*cdf0e10cSrcweir 	if(rStr.Len() && !pPlusData)
708*cdf0e10cSrcweir 	{
709*cdf0e10cSrcweir 		ImpForcePlusData();
710*cdf0e10cSrcweir 	}
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir 	if(pPlusData && pPlusData->aObjName != rStr)
713*cdf0e10cSrcweir 	{
714*cdf0e10cSrcweir         // --> OD 2009-07-09 #i73249#
715*cdf0e10cSrcweir         // Undo/Redo for setting object's name
716*cdf0e10cSrcweir         bool bUndo( false );
717*cdf0e10cSrcweir         if ( GetModel() && GetModel()->IsUndoEnabled() )
718*cdf0e10cSrcweir         {
719*cdf0e10cSrcweir             bUndo = true;
720*cdf0e10cSrcweir             SdrUndoAction* pUndoAction =
721*cdf0e10cSrcweir                     GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
722*cdf0e10cSrcweir                                                     *this,
723*cdf0e10cSrcweir                                                     SdrUndoObjStrAttr::OBJ_NAME,
724*cdf0e10cSrcweir                                                     GetName(),
725*cdf0e10cSrcweir                                                     rStr );
726*cdf0e10cSrcweir             GetModel()->BegUndo( pUndoAction->GetComment() );
727*cdf0e10cSrcweir             GetModel()->AddUndo( pUndoAction );
728*cdf0e10cSrcweir         }
729*cdf0e10cSrcweir         // <--
730*cdf0e10cSrcweir         pPlusData->aObjName = rStr;
731*cdf0e10cSrcweir         // --> OD 2009-07-09 #i73249#
732*cdf0e10cSrcweir         if ( bUndo )
733*cdf0e10cSrcweir         {
734*cdf0e10cSrcweir             GetModel()->EndUndo();
735*cdf0e10cSrcweir         }
736*cdf0e10cSrcweir         // <--
737*cdf0e10cSrcweir 		SetChanged();
738*cdf0e10cSrcweir         BroadcastObjectChange();
739*cdf0e10cSrcweir 	}
740*cdf0e10cSrcweir }
741*cdf0e10cSrcweir 
742*cdf0e10cSrcweir String SdrObject::GetName() const
743*cdf0e10cSrcweir {
744*cdf0e10cSrcweir 	if(pPlusData)
745*cdf0e10cSrcweir 	{
746*cdf0e10cSrcweir 		return pPlusData->aObjName;
747*cdf0e10cSrcweir 	}
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir 	return String();
750*cdf0e10cSrcweir }
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir void SdrObject::SetTitle(const String& rStr)
753*cdf0e10cSrcweir {
754*cdf0e10cSrcweir 	if(rStr.Len() && !pPlusData)
755*cdf0e10cSrcweir 	{
756*cdf0e10cSrcweir 		ImpForcePlusData();
757*cdf0e10cSrcweir 	}
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir 	if(pPlusData && pPlusData->aObjTitle != rStr)
760*cdf0e10cSrcweir 	{
761*cdf0e10cSrcweir         // --> OD 2009-07-13 #i73249#
762*cdf0e10cSrcweir         // Undo/Redo for setting object's title
763*cdf0e10cSrcweir         bool bUndo( false );
764*cdf0e10cSrcweir         if ( GetModel() && GetModel()->IsUndoEnabled() )
765*cdf0e10cSrcweir         {
766*cdf0e10cSrcweir             bUndo = true;
767*cdf0e10cSrcweir             SdrUndoAction* pUndoAction =
768*cdf0e10cSrcweir                     GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
769*cdf0e10cSrcweir                                                     *this,
770*cdf0e10cSrcweir                                                     SdrUndoObjStrAttr::OBJ_TITLE,
771*cdf0e10cSrcweir                                                     GetTitle(),
772*cdf0e10cSrcweir                                                     rStr );
773*cdf0e10cSrcweir             GetModel()->BegUndo( pUndoAction->GetComment() );
774*cdf0e10cSrcweir             GetModel()->AddUndo( pUndoAction );
775*cdf0e10cSrcweir         }
776*cdf0e10cSrcweir         // <--
777*cdf0e10cSrcweir 		pPlusData->aObjTitle = rStr;
778*cdf0e10cSrcweir         // --> OD 2009-07-13 #i73249#
779*cdf0e10cSrcweir         if ( bUndo )
780*cdf0e10cSrcweir         {
781*cdf0e10cSrcweir             GetModel()->EndUndo();
782*cdf0e10cSrcweir         }
783*cdf0e10cSrcweir         // <--
784*cdf0e10cSrcweir 		SetChanged();
785*cdf0e10cSrcweir         BroadcastObjectChange();
786*cdf0e10cSrcweir 	}
787*cdf0e10cSrcweir }
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir String SdrObject::GetTitle() const
790*cdf0e10cSrcweir {
791*cdf0e10cSrcweir 	if(pPlusData)
792*cdf0e10cSrcweir 	{
793*cdf0e10cSrcweir 		return pPlusData->aObjTitle;
794*cdf0e10cSrcweir 	}
795*cdf0e10cSrcweir 
796*cdf0e10cSrcweir 	return String();
797*cdf0e10cSrcweir }
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir void SdrObject::SetDescription(const String& rStr)
800*cdf0e10cSrcweir {
801*cdf0e10cSrcweir 	if(rStr.Len() && !pPlusData)
802*cdf0e10cSrcweir 	{
803*cdf0e10cSrcweir 		ImpForcePlusData();
804*cdf0e10cSrcweir 	}
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 	if(pPlusData && pPlusData->aObjDescription != rStr)
807*cdf0e10cSrcweir 	{
808*cdf0e10cSrcweir         // --> OD 2009-07-13 #i73249#
809*cdf0e10cSrcweir         // Undo/Redo for setting object's description
810*cdf0e10cSrcweir         bool bUndo( false );
811*cdf0e10cSrcweir         if ( GetModel() && GetModel()->IsUndoEnabled() )
812*cdf0e10cSrcweir         {
813*cdf0e10cSrcweir             bUndo = true;
814*cdf0e10cSrcweir             SdrUndoAction* pUndoAction =
815*cdf0e10cSrcweir                     GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
816*cdf0e10cSrcweir                                                     *this,
817*cdf0e10cSrcweir                                                     SdrUndoObjStrAttr::OBJ_DESCRIPTION,
818*cdf0e10cSrcweir                                                     GetDescription(),
819*cdf0e10cSrcweir                                                     rStr );
820*cdf0e10cSrcweir             GetModel()->BegUndo( pUndoAction->GetComment() );
821*cdf0e10cSrcweir             GetModel()->AddUndo( pUndoAction );
822*cdf0e10cSrcweir         }
823*cdf0e10cSrcweir         // <--
824*cdf0e10cSrcweir 		pPlusData->aObjDescription = rStr;
825*cdf0e10cSrcweir         // --> OD 2009-07-13 #i73249#
826*cdf0e10cSrcweir         if ( bUndo )
827*cdf0e10cSrcweir         {
828*cdf0e10cSrcweir             GetModel()->EndUndo();
829*cdf0e10cSrcweir         }
830*cdf0e10cSrcweir         // <--
831*cdf0e10cSrcweir 		SetChanged();
832*cdf0e10cSrcweir         BroadcastObjectChange();
833*cdf0e10cSrcweir 	}
834*cdf0e10cSrcweir }
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir String SdrObject::GetDescription() const
837*cdf0e10cSrcweir {
838*cdf0e10cSrcweir 	if(pPlusData)
839*cdf0e10cSrcweir 	{
840*cdf0e10cSrcweir 		return pPlusData->aObjDescription;
841*cdf0e10cSrcweir 	}
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir 	return String();
844*cdf0e10cSrcweir }
845*cdf0e10cSrcweir 
846*cdf0e10cSrcweir void SdrObject::SetHTMLName(const String& rStr)
847*cdf0e10cSrcweir {
848*cdf0e10cSrcweir 	if(rStr.Len() && !pPlusData)
849*cdf0e10cSrcweir 	{
850*cdf0e10cSrcweir 		ImpForcePlusData();
851*cdf0e10cSrcweir 	}
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir 	if(pPlusData && pPlusData->aObjName != rStr)
854*cdf0e10cSrcweir 	{
855*cdf0e10cSrcweir 		pPlusData->aHTMLName = rStr;
856*cdf0e10cSrcweir 		SetChanged();
857*cdf0e10cSrcweir 	}
858*cdf0e10cSrcweir }
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir String SdrObject::GetHTMLName() const
861*cdf0e10cSrcweir {
862*cdf0e10cSrcweir 	if(pPlusData)
863*cdf0e10cSrcweir 	{
864*cdf0e10cSrcweir 		return pPlusData->aHTMLName;
865*cdf0e10cSrcweir 	}
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 	return String();
868*cdf0e10cSrcweir }
869*cdf0e10cSrcweir 
870*cdf0e10cSrcweir sal_uInt32 SdrObject::GetOrdNum() const
871*cdf0e10cSrcweir {
872*cdf0e10cSrcweir 	if (pObjList!=NULL) {
873*cdf0e10cSrcweir 		if (pObjList->IsObjOrdNumsDirty()) {
874*cdf0e10cSrcweir 			pObjList->RecalcObjOrdNums();
875*cdf0e10cSrcweir 		}
876*cdf0e10cSrcweir 	} else ((SdrObject*)this)->nOrdNum=0;
877*cdf0e10cSrcweir 	return nOrdNum;
878*cdf0e10cSrcweir }
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir 
881*cdf0e10cSrcweir 
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir sal_uInt32 SdrObject::GetNavigationPosition (void)
884*cdf0e10cSrcweir {
885*cdf0e10cSrcweir     if (pObjList!=NULL && pObjList->RecalcNavigationPositions())
886*cdf0e10cSrcweir     {
887*cdf0e10cSrcweir         return mnNavigationPosition;
888*cdf0e10cSrcweir     }
889*cdf0e10cSrcweir     else
890*cdf0e10cSrcweir         return GetOrdNum();
891*cdf0e10cSrcweir }
892*cdf0e10cSrcweir 
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir 
896*cdf0e10cSrcweir void SdrObject::SetNavigationPosition (const sal_uInt32 nNewPosition)
897*cdf0e10cSrcweir {
898*cdf0e10cSrcweir     mnNavigationPosition = nNewPosition;
899*cdf0e10cSrcweir }
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir 
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir // #111111#
905*cdf0e10cSrcweir // To make clearer that this method may trigger RecalcBoundRect and thus may be
906*cdf0e10cSrcweir // expensive and somtimes problematic (inside a bigger object change You will get
907*cdf0e10cSrcweir // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
908*cdf0e10cSrcweir // GetCurrentBoundRect().
909*cdf0e10cSrcweir const Rectangle& SdrObject::GetCurrentBoundRect() const
910*cdf0e10cSrcweir {
911*cdf0e10cSrcweir 	if(aOutRect.IsEmpty())
912*cdf0e10cSrcweir 	{
913*cdf0e10cSrcweir 		const_cast< SdrObject* >(this)->RecalcBoundRect();
914*cdf0e10cSrcweir 	}
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir 	return aOutRect;
917*cdf0e10cSrcweir }
918*cdf0e10cSrcweir 
919*cdf0e10cSrcweir // #111111#
920*cdf0e10cSrcweir // To have a possibility to get the last calculated BoundRect e.g for producing
921*cdf0e10cSrcweir // the first rectangle for repaints (old and new need to be used) without forcing
922*cdf0e10cSrcweir // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
923*cdf0e10cSrcweir // a new method for accessing the last BoundRect.
924*cdf0e10cSrcweir const Rectangle& SdrObject::GetLastBoundRect() const
925*cdf0e10cSrcweir {
926*cdf0e10cSrcweir 	return aOutRect;
927*cdf0e10cSrcweir }
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir void SdrObject::RecalcBoundRect()
930*cdf0e10cSrcweir {
931*cdf0e10cSrcweir 	// #i101680# suppress BoundRect calculations on import(s)
932*cdf0e10cSrcweir 	if(pModel && pModel->isLocked())
933*cdf0e10cSrcweir 		return;
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir 	// central new method which will calculate the BoundRect using primitive geometry
936*cdf0e10cSrcweir 	if(aOutRect.IsEmpty())
937*cdf0e10cSrcweir 	{
938*cdf0e10cSrcweir     	const drawinglayer::primitive2d::Primitive2DSequence xPrimitives(GetViewContact().getViewIndependentPrimitive2DSequence());
939*cdf0e10cSrcweir 
940*cdf0e10cSrcweir 	    if(xPrimitives.hasElements())
941*cdf0e10cSrcweir 	    {
942*cdf0e10cSrcweir 		    // use neutral ViewInformation and get the range of the primitives
943*cdf0e10cSrcweir 		    const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
944*cdf0e10cSrcweir     		const basegfx::B2DRange aRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xPrimitives, aViewInformation2D));
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir 		    if(!aRange.isEmpty())
947*cdf0e10cSrcweir 		    {
948*cdf0e10cSrcweir 			    aOutRect = Rectangle(
949*cdf0e10cSrcweir 					    (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()),
950*cdf0e10cSrcweir 					    (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY()));
951*cdf0e10cSrcweir                 return;
952*cdf0e10cSrcweir 		    }
953*cdf0e10cSrcweir         }
954*cdf0e10cSrcweir 	}
955*cdf0e10cSrcweir }
956*cdf0e10cSrcweir 
957*cdf0e10cSrcweir void SdrObject::BroadcastObjectChange() const
958*cdf0e10cSrcweir {
959*cdf0e10cSrcweir 	if( pModel && pModel->isLocked() )
960*cdf0e10cSrcweir 		return;
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir 	sal_Bool bPlusDataBroadcast(pPlusData && pPlusData->pBroadcast);
963*cdf0e10cSrcweir 	sal_Bool bObjectChange(IsInserted() && pModel);
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 	if(bPlusDataBroadcast || bObjectChange)
966*cdf0e10cSrcweir 	{
967*cdf0e10cSrcweir 		SdrHint aHint(*this);
968*cdf0e10cSrcweir 
969*cdf0e10cSrcweir 		if(bPlusDataBroadcast)
970*cdf0e10cSrcweir 		{
971*cdf0e10cSrcweir 			pPlusData->pBroadcast->Broadcast(aHint);
972*cdf0e10cSrcweir 		}
973*cdf0e10cSrcweir 
974*cdf0e10cSrcweir 		if(bObjectChange)
975*cdf0e10cSrcweir 		{
976*cdf0e10cSrcweir 			pModel->Broadcast(aHint);
977*cdf0e10cSrcweir 		}
978*cdf0e10cSrcweir 	}
979*cdf0e10cSrcweir }
980*cdf0e10cSrcweir 
981*cdf0e10cSrcweir void SdrObject::SetChanged()
982*cdf0e10cSrcweir {
983*cdf0e10cSrcweir 	// #110094#-11
984*cdf0e10cSrcweir 	// For test purposes, use the new ViewContact for change
985*cdf0e10cSrcweir 	// notification now.
986*cdf0e10cSrcweir 	ActionChanged();
987*cdf0e10cSrcweir 
988*cdf0e10cSrcweir 	if(IsInserted() && pModel)
989*cdf0e10cSrcweir 	{
990*cdf0e10cSrcweir 		pModel->SetChanged();
991*cdf0e10cSrcweir 	}
992*cdf0e10cSrcweir }
993*cdf0e10cSrcweir 
994*cdf0e10cSrcweir // Tooling for painting a single object to a OutputDevice.
995*cdf0e10cSrcweir sal_Bool SdrObject::SingleObjectPainter(OutputDevice& rOut) const
996*cdf0e10cSrcweir {
997*cdf0e10cSrcweir 	sdr::contact::SdrObjectVector aObjectVector;
998*cdf0e10cSrcweir 	aObjectVector.push_back(const_cast< SdrObject* >(this));
999*cdf0e10cSrcweir 
1000*cdf0e10cSrcweir 	sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aObjectVector, GetPage());
1001*cdf0e10cSrcweir 	sdr::contact::DisplayInfo aDisplayInfo;
1002*cdf0e10cSrcweir 
1003*cdf0e10cSrcweir 	// do processing
1004*cdf0e10cSrcweir 	aPainter.ProcessDisplay(aDisplayInfo);
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir 	return sal_True;
1007*cdf0e10cSrcweir }
1008*cdf0e10cSrcweir 
1009*cdf0e10cSrcweir sal_Bool SdrObject::LineGeometryUsageIsNecessary() const
1010*cdf0e10cSrcweir {
1011*cdf0e10cSrcweir 	XLineStyle eXLS = (XLineStyle)((const XLineStyleItem&)GetMergedItem(XATTR_LINESTYLE)).GetValue();
1012*cdf0e10cSrcweir 	return (eXLS != XLINE_NONE);
1013*cdf0e10cSrcweir }
1014*cdf0e10cSrcweir 
1015*cdf0e10cSrcweir SdrObject* SdrObject::Clone() const
1016*cdf0e10cSrcweir {
1017*cdf0e10cSrcweir 	SdrObject* pObj=SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL);
1018*cdf0e10cSrcweir 	if (pObj!=NULL) {
1019*cdf0e10cSrcweir 		pObj->pModel=pModel;
1020*cdf0e10cSrcweir 		pObj->pPage=pPage;
1021*cdf0e10cSrcweir 		*pObj=*this;
1022*cdf0e10cSrcweir 	}
1023*cdf0e10cSrcweir 	return pObj;
1024*cdf0e10cSrcweir }
1025*cdf0e10cSrcweir 
1026*cdf0e10cSrcweir void SdrObject::operator=(const SdrObject& rObj)
1027*cdf0e10cSrcweir {
1028*cdf0e10cSrcweir 	if(mpProperties)
1029*cdf0e10cSrcweir 	{
1030*cdf0e10cSrcweir 		delete mpProperties;
1031*cdf0e10cSrcweir 		mpProperties = 0L;
1032*cdf0e10cSrcweir 	}
1033*cdf0e10cSrcweir 
1034*cdf0e10cSrcweir 	// #110094#
1035*cdf0e10cSrcweir 	if(mpViewContact)
1036*cdf0e10cSrcweir 	{
1037*cdf0e10cSrcweir 		delete mpViewContact;
1038*cdf0e10cSrcweir 		mpViewContact = 0L;
1039*cdf0e10cSrcweir 	}
1040*cdf0e10cSrcweir 
1041*cdf0e10cSrcweir 	// The Clone() method uses the local copy constructor from the individual
1042*cdf0e10cSrcweir 	// sdr::properties::BaseProperties class. Since the target class maybe for another
1043*cdf0e10cSrcweir 	// draw object a SdrObject needs to be provided, as in the nromal constructor.
1044*cdf0e10cSrcweir 	mpProperties = &rObj.GetProperties().Clone(*this);
1045*cdf0e10cSrcweir 
1046*cdf0e10cSrcweir 	pModel  =rObj.pModel;
1047*cdf0e10cSrcweir 	aOutRect=rObj.aOutRect;
1048*cdf0e10cSrcweir 	mnLayerID = rObj.mnLayerID;
1049*cdf0e10cSrcweir 	aAnchor =rObj.aAnchor;
1050*cdf0e10cSrcweir 	bVirtObj=rObj.bVirtObj;
1051*cdf0e10cSrcweir 	bSizProt=rObj.bSizProt;
1052*cdf0e10cSrcweir 	bMovProt=rObj.bMovProt;
1053*cdf0e10cSrcweir 	bNoPrint=rObj.bNoPrint;
1054*cdf0e10cSrcweir 	mbVisible=rObj.mbVisible;
1055*cdf0e10cSrcweir 	bMarkProt=rObj.bMarkProt;
1056*cdf0e10cSrcweir 	//EmptyPresObj wird nicht kopiert: nun doch! (25-07-1995, Joe)
1057*cdf0e10cSrcweir 	bEmptyPresObj =rObj.bEmptyPresObj;
1058*cdf0e10cSrcweir 	//NotVisibleAsMaster wird nicht kopiert: nun doch! (25-07-1995, Joe)
1059*cdf0e10cSrcweir 	bNotVisibleAsMaster=rObj.bNotVisibleAsMaster;
1060*cdf0e10cSrcweir 	bSnapRectDirty=sal_True; //rObj.bSnapRectDirty;
1061*cdf0e10cSrcweir 	bNotMasterCachable=rObj.bNotMasterCachable;
1062*cdf0e10cSrcweir 	if (pPlusData!=NULL) { delete pPlusData; pPlusData=NULL; }
1063*cdf0e10cSrcweir 	if (rObj.pPlusData!=NULL) {
1064*cdf0e10cSrcweir 		pPlusData=rObj.pPlusData->Clone(this);
1065*cdf0e10cSrcweir 	}
1066*cdf0e10cSrcweir 	if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {
1067*cdf0e10cSrcweir 		delete pPlusData->pBroadcast; // der Broadcaster wird nicht mitkopiert
1068*cdf0e10cSrcweir 		pPlusData->pBroadcast=NULL;
1069*cdf0e10cSrcweir 	}
1070*cdf0e10cSrcweir }
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir void SdrObject::TakeObjNameSingul(XubString& rName) const
1073*cdf0e10cSrcweir {
1074*cdf0e10cSrcweir 	rName=ImpGetResStr(STR_ObjNameSingulNONE);
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir 	String aName( GetName() );
1077*cdf0e10cSrcweir 	if(aName.Len())
1078*cdf0e10cSrcweir 	{
1079*cdf0e10cSrcweir 		rName += sal_Unicode(' ');
1080*cdf0e10cSrcweir 		rName += sal_Unicode('\'');
1081*cdf0e10cSrcweir 		rName += aName;
1082*cdf0e10cSrcweir 		rName += sal_Unicode('\'');
1083*cdf0e10cSrcweir 	}
1084*cdf0e10cSrcweir }
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir void SdrObject::TakeObjNamePlural(XubString& rName) const
1087*cdf0e10cSrcweir {
1088*cdf0e10cSrcweir 	rName=ImpGetResStr(STR_ObjNamePluralNONE);
1089*cdf0e10cSrcweir }
1090*cdf0e10cSrcweir 
1091*cdf0e10cSrcweir void SdrObject::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal) const
1092*cdf0e10cSrcweir {
1093*cdf0e10cSrcweir 	rStr = ImpGetResStr(nStrCacheID);
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir 	sal_Char aSearchText1[] = "%1";
1096*cdf0e10cSrcweir 	sal_Char aSearchText2[] = "%2";
1097*cdf0e10cSrcweir 	xub_StrLen nPos = rStr.SearchAscii(aSearchText1);
1098*cdf0e10cSrcweir 
1099*cdf0e10cSrcweir 	if(nPos != STRING_NOTFOUND)
1100*cdf0e10cSrcweir 	{
1101*cdf0e10cSrcweir 		rStr.Erase(nPos, 2);
1102*cdf0e10cSrcweir 
1103*cdf0e10cSrcweir 		XubString aObjName;
1104*cdf0e10cSrcweir 
1105*cdf0e10cSrcweir 		TakeObjNameSingul(aObjName);
1106*cdf0e10cSrcweir 		rStr.Insert(aObjName, nPos);
1107*cdf0e10cSrcweir 	}
1108*cdf0e10cSrcweir 
1109*cdf0e10cSrcweir 	nPos = rStr.SearchAscii(aSearchText2);
1110*cdf0e10cSrcweir 
1111*cdf0e10cSrcweir 	if(nPos != STRING_NOTFOUND)
1112*cdf0e10cSrcweir 	{
1113*cdf0e10cSrcweir 		rStr.Erase(nPos, 2);
1114*cdf0e10cSrcweir 		rStr.Insert(UniString::CreateFromInt32(nVal), nPos);
1115*cdf0e10cSrcweir 	}
1116*cdf0e10cSrcweir }
1117*cdf0e10cSrcweir 
1118*cdf0e10cSrcweir XubString SdrObject::GetWinkStr(long nWink, FASTBOOL bNoDegChar) const
1119*cdf0e10cSrcweir {
1120*cdf0e10cSrcweir 	XubString aStr;
1121*cdf0e10cSrcweir 	if (pModel!=NULL) {
1122*cdf0e10cSrcweir 		pModel->TakeWinkStr(nWink,aStr,bNoDegChar);
1123*cdf0e10cSrcweir 	}
1124*cdf0e10cSrcweir 	return aStr;
1125*cdf0e10cSrcweir }
1126*cdf0e10cSrcweir 
1127*cdf0e10cSrcweir XubString SdrObject::GetMetrStr(long nVal, MapUnit /*eWantMap*/, FASTBOOL bNoUnitChars) const
1128*cdf0e10cSrcweir {
1129*cdf0e10cSrcweir 	XubString aStr;
1130*cdf0e10cSrcweir 	if (pModel!=NULL) {
1131*cdf0e10cSrcweir 		pModel->TakeMetricStr(nVal,aStr,bNoUnitChars);
1132*cdf0e10cSrcweir 	}
1133*cdf0e10cSrcweir 	return aStr;
1134*cdf0e10cSrcweir }
1135*cdf0e10cSrcweir 
1136*cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrObject::TakeXorPoly() const
1137*cdf0e10cSrcweir {
1138*cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aRetval;
1139*cdf0e10cSrcweir 	const Rectangle aR(GetCurrentBoundRect());
1140*cdf0e10cSrcweir 	const basegfx::B2DRange aRange(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
1141*cdf0e10cSrcweir 	aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
1142*cdf0e10cSrcweir 
1143*cdf0e10cSrcweir 	return aRetval;
1144*cdf0e10cSrcweir }
1145*cdf0e10cSrcweir 
1146*cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrObject::TakeContour() const
1147*cdf0e10cSrcweir {
1148*cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aRetval;
1149*cdf0e10cSrcweir 
1150*cdf0e10cSrcweir     // create cloned object without text, but with XLINE_SOLID,
1151*cdf0e10cSrcweir     // COL_BLACK as line color and XFILL_NONE
1152*cdf0e10cSrcweir 	SdrObject* pClone = Clone();
1153*cdf0e10cSrcweir 
1154*cdf0e10cSrcweir     if(pClone)
1155*cdf0e10cSrcweir     {
1156*cdf0e10cSrcweir         const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(this);
1157*cdf0e10cSrcweir 
1158*cdf0e10cSrcweir         if(pTextObj)
1159*cdf0e10cSrcweir 	    {
1160*cdf0e10cSrcweir             // no text and no text animation
1161*cdf0e10cSrcweir 		    pClone->SetMergedItem(SdrTextAniKindItem(SDRTEXTANI_NONE));
1162*cdf0e10cSrcweir             pClone->SetOutlinerParaObject(0);
1163*cdf0e10cSrcweir 	    }
1164*cdf0e10cSrcweir 
1165*cdf0e10cSrcweir         const SdrEdgeObj* pEdgeObj = dynamic_cast< const SdrEdgeObj* >(this);
1166*cdf0e10cSrcweir 
1167*cdf0e10cSrcweir         if(pEdgeObj)
1168*cdf0e10cSrcweir 	    {
1169*cdf0e10cSrcweir             // create connections if connector, will be cleaned up when
1170*cdf0e10cSrcweir             // deleting the connector again
1171*cdf0e10cSrcweir 		    SdrObject* pLeft = pEdgeObj->GetConnectedNode(sal_True);
1172*cdf0e10cSrcweir 		    SdrObject* pRight = pEdgeObj->GetConnectedNode(sal_False);
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir 		    if(pLeft)
1175*cdf0e10cSrcweir 		    {
1176*cdf0e10cSrcweir 			    pClone->ConnectToNode(sal_True, pLeft);
1177*cdf0e10cSrcweir 		    }
1178*cdf0e10cSrcweir 
1179*cdf0e10cSrcweir 		    if(pRight)
1180*cdf0e10cSrcweir 		    {
1181*cdf0e10cSrcweir 			    pClone->ConnectToNode(sal_False, pRight);
1182*cdf0e10cSrcweir 		    }
1183*cdf0e10cSrcweir 	    }
1184*cdf0e10cSrcweir 
1185*cdf0e10cSrcweir 	    SfxItemSet aNewSet(*GetObjectItemPool());
1186*cdf0e10cSrcweir 
1187*cdf0e10cSrcweir         // #i101980# ignore LineWidth; that's what the old implementation
1188*cdf0e10cSrcweir         // did. With linewidth, the result may be huge due to fat/thick
1189*cdf0e10cSrcweir         // line decompositions
1190*cdf0e10cSrcweir     	aNewSet.Put(XLineWidthItem(0));
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir         // solid black lines and no fill
1193*cdf0e10cSrcweir         aNewSet.Put(XLineStyleItem(XLINE_SOLID));
1194*cdf0e10cSrcweir 	    aNewSet.Put(XLineColorItem(String(), Color(COL_BLACK)));
1195*cdf0e10cSrcweir 	    aNewSet.Put(XFillStyleItem(XFILL_NONE));
1196*cdf0e10cSrcweir 	    pClone->SetMergedItemSet(aNewSet);
1197*cdf0e10cSrcweir 
1198*cdf0e10cSrcweir         // get sequence from clone
1199*cdf0e10cSrcweir 	    const sdr::contact::ViewContact& rVC(pClone->GetViewContact());
1200*cdf0e10cSrcweir 	    const drawinglayer::primitive2d::Primitive2DSequence xSequence(rVC.getViewIndependentPrimitive2DSequence());
1201*cdf0e10cSrcweir 
1202*cdf0e10cSrcweir 	    if(xSequence.hasElements())
1203*cdf0e10cSrcweir 	    {
1204*cdf0e10cSrcweir 		    // use neutral ViewInformation
1205*cdf0e10cSrcweir 		    const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
1206*cdf0e10cSrcweir 
1207*cdf0e10cSrcweir 		    // create extractor, process and get result
1208*cdf0e10cSrcweir 		    drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D);
1209*cdf0e10cSrcweir 		    aExtractor.process(xSequence);
1210*cdf0e10cSrcweir             const std::vector< basegfx::B2DPolyPolygon >& rResult(aExtractor.getExtractedContour());
1211*cdf0e10cSrcweir             const sal_uInt32 nSize(rResult.size());
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir             // when count is one, it is implied that the object has only it's normal
1214*cdf0e10cSrcweir             // contour anyways and TakeCountour() is to return an empty PolyPolygon
1215*cdf0e10cSrcweir             // (see old implementation for historical reasons)
1216*cdf0e10cSrcweir             if(nSize > 1)
1217*cdf0e10cSrcweir             {
1218*cdf0e10cSrcweir                 // the topology for contour is correctly a vector of PolyPolygons; for
1219*cdf0e10cSrcweir                 // historical reasons cut it back to a single PolyPolygon here
1220*cdf0e10cSrcweir                 for(sal_uInt32 a(0); a < nSize; a++)
1221*cdf0e10cSrcweir                 {
1222*cdf0e10cSrcweir                     aRetval.append(rResult[a]);
1223*cdf0e10cSrcweir                 }
1224*cdf0e10cSrcweir             }
1225*cdf0e10cSrcweir         }
1226*cdf0e10cSrcweir 
1227*cdf0e10cSrcweir     	delete pClone;
1228*cdf0e10cSrcweir     }
1229*cdf0e10cSrcweir 
1230*cdf0e10cSrcweir 	return aRetval;
1231*cdf0e10cSrcweir }
1232*cdf0e10cSrcweir 
1233*cdf0e10cSrcweir sal_uInt32 SdrObject::GetHdlCount() const
1234*cdf0e10cSrcweir {
1235*cdf0e10cSrcweir 	return 8L;
1236*cdf0e10cSrcweir }
1237*cdf0e10cSrcweir 
1238*cdf0e10cSrcweir SdrHdl* SdrObject::GetHdl(sal_uInt32 nHdlNum) const
1239*cdf0e10cSrcweir {
1240*cdf0e10cSrcweir 	SdrHdl* pH=NULL;
1241*cdf0e10cSrcweir 	const Rectangle& rR=GetSnapRect();
1242*cdf0e10cSrcweir 	switch (nHdlNum) {
1243*cdf0e10cSrcweir 		case 0: pH=new SdrHdl(rR.TopLeft(),     HDL_UPLFT); break; // Oben links
1244*cdf0e10cSrcweir 		case 1: pH=new SdrHdl(rR.TopCenter(),   HDL_UPPER); break; // Oben
1245*cdf0e10cSrcweir 		case 2: pH=new SdrHdl(rR.TopRight(),    HDL_UPRGT); break; // Oben rechts
1246*cdf0e10cSrcweir 		case 3: pH=new SdrHdl(rR.LeftCenter(),  HDL_LEFT ); break; // Links
1247*cdf0e10cSrcweir 		case 4: pH=new SdrHdl(rR.RightCenter(), HDL_RIGHT); break; // Rechts
1248*cdf0e10cSrcweir 		case 5: pH=new SdrHdl(rR.BottomLeft(),  HDL_LWLFT); break; // Unten links
1249*cdf0e10cSrcweir 		case 6: pH=new SdrHdl(rR.BottomCenter(),HDL_LOWER); break; // Unten
1250*cdf0e10cSrcweir 		case 7: pH=new SdrHdl(rR.BottomRight(), HDL_LWRGT); break; // Unten rechts
1251*cdf0e10cSrcweir 	}
1252*cdf0e10cSrcweir 	return pH;
1253*cdf0e10cSrcweir }
1254*cdf0e10cSrcweir 
1255*cdf0e10cSrcweir sal_uInt32 SdrObject::GetPlusHdlCount(const SdrHdl& /*rHdl*/) const
1256*cdf0e10cSrcweir {
1257*cdf0e10cSrcweir 	return 0L;
1258*cdf0e10cSrcweir }
1259*cdf0e10cSrcweir 
1260*cdf0e10cSrcweir SdrHdl* SdrObject::GetPlusHdl(const SdrHdl& /*rHdl*/, sal_uInt32 /*nPlNum*/) const
1261*cdf0e10cSrcweir {
1262*cdf0e10cSrcweir 	return 0L;
1263*cdf0e10cSrcweir }
1264*cdf0e10cSrcweir 
1265*cdf0e10cSrcweir void SdrObject::AddToHdlList(SdrHdlList& rHdlList) const
1266*cdf0e10cSrcweir {
1267*cdf0e10cSrcweir 	sal_uInt32 nAnz=GetHdlCount();
1268*cdf0e10cSrcweir 	for (sal_uInt32 i=0L; i<nAnz; i++) {
1269*cdf0e10cSrcweir 		SdrHdl* pHdl=GetHdl(i);
1270*cdf0e10cSrcweir 		if (pHdl!=NULL) {
1271*cdf0e10cSrcweir 			rHdlList.AddHdl(pHdl);
1272*cdf0e10cSrcweir 		}
1273*cdf0e10cSrcweir 	}
1274*cdf0e10cSrcweir }
1275*cdf0e10cSrcweir 
1276*cdf0e10cSrcweir Rectangle SdrObject::ImpDragCalcRect(const SdrDragStat& rDrag) const
1277*cdf0e10cSrcweir {
1278*cdf0e10cSrcweir 	Rectangle aTmpRect(GetSnapRect());
1279*cdf0e10cSrcweir 	Rectangle aRect(aTmpRect);
1280*cdf0e10cSrcweir 	const SdrHdl* pHdl=rDrag.GetHdl();
1281*cdf0e10cSrcweir 	SdrHdlKind eHdl=pHdl==NULL ? HDL_MOVE : pHdl->GetKind();
1282*cdf0e10cSrcweir 	FASTBOOL bEcke=(eHdl==HDL_UPLFT || eHdl==HDL_UPRGT || eHdl==HDL_LWLFT || eHdl==HDL_LWRGT);
1283*cdf0e10cSrcweir 	FASTBOOL bOrtho=rDrag.GetView()!=NULL && rDrag.GetView()->IsOrtho();
1284*cdf0e10cSrcweir 	FASTBOOL bBigOrtho=bEcke && bOrtho && rDrag.GetView()->IsBigOrtho();
1285*cdf0e10cSrcweir 	Point aPos(rDrag.GetNow());
1286*cdf0e10cSrcweir 	FASTBOOL bLft=(eHdl==HDL_UPLFT || eHdl==HDL_LEFT  || eHdl==HDL_LWLFT);
1287*cdf0e10cSrcweir 	FASTBOOL bRgt=(eHdl==HDL_UPRGT || eHdl==HDL_RIGHT || eHdl==HDL_LWRGT);
1288*cdf0e10cSrcweir 	FASTBOOL bTop=(eHdl==HDL_UPRGT || eHdl==HDL_UPPER || eHdl==HDL_UPLFT);
1289*cdf0e10cSrcweir 	FASTBOOL bBtm=(eHdl==HDL_LWRGT || eHdl==HDL_LOWER || eHdl==HDL_LWLFT);
1290*cdf0e10cSrcweir 	if (bLft) aTmpRect.Left()  =aPos.X();
1291*cdf0e10cSrcweir 	if (bRgt) aTmpRect.Right() =aPos.X();
1292*cdf0e10cSrcweir 	if (bTop) aTmpRect.Top()   =aPos.Y();
1293*cdf0e10cSrcweir 	if (bBtm) aTmpRect.Bottom()=aPos.Y();
1294*cdf0e10cSrcweir 	if (bOrtho) { // Ortho
1295*cdf0e10cSrcweir 		long nWdt0=aRect.Right() -aRect.Left();
1296*cdf0e10cSrcweir 		long nHgt0=aRect.Bottom()-aRect.Top();
1297*cdf0e10cSrcweir 		long nXMul=aTmpRect.Right() -aTmpRect.Left();
1298*cdf0e10cSrcweir 		long nYMul=aTmpRect.Bottom()-aTmpRect.Top();
1299*cdf0e10cSrcweir 		long nXDiv=nWdt0;
1300*cdf0e10cSrcweir 		long nYDiv=nHgt0;
1301*cdf0e10cSrcweir 		FASTBOOL bXNeg=(nXMul<0)!=(nXDiv<0);
1302*cdf0e10cSrcweir 		FASTBOOL bYNeg=(nYMul<0)!=(nYDiv<0);
1303*cdf0e10cSrcweir 		nXMul=Abs(nXMul);
1304*cdf0e10cSrcweir 		nYMul=Abs(nYMul);
1305*cdf0e10cSrcweir 		nXDiv=Abs(nXDiv);
1306*cdf0e10cSrcweir 		nYDiv=Abs(nYDiv);
1307*cdf0e10cSrcweir 		Fraction aXFact(nXMul,nXDiv); // Fractions zum kuerzen
1308*cdf0e10cSrcweir 		Fraction aYFact(nYMul,nYDiv); // und zum vergleichen
1309*cdf0e10cSrcweir 		nXMul=aXFact.GetNumerator();
1310*cdf0e10cSrcweir 		nYMul=aYFact.GetNumerator();
1311*cdf0e10cSrcweir 		nXDiv=aXFact.GetDenominator();
1312*cdf0e10cSrcweir 		nYDiv=aYFact.GetDenominator();
1313*cdf0e10cSrcweir 		if (bEcke) { // Eckpunkthandles
1314*cdf0e10cSrcweir 			FASTBOOL bUseX=(aXFact<aYFact) != bBigOrtho;
1315*cdf0e10cSrcweir 			if (bUseX) {
1316*cdf0e10cSrcweir 				long nNeed=long(BigInt(nHgt0)*BigInt(nXMul)/BigInt(nXDiv));
1317*cdf0e10cSrcweir 				if (bYNeg) nNeed=-nNeed;
1318*cdf0e10cSrcweir 				if (bTop) aTmpRect.Top()=aTmpRect.Bottom()-nNeed;
1319*cdf0e10cSrcweir 				if (bBtm) aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
1320*cdf0e10cSrcweir 			} else {
1321*cdf0e10cSrcweir 				long nNeed=long(BigInt(nWdt0)*BigInt(nYMul)/BigInt(nYDiv));
1322*cdf0e10cSrcweir 				if (bXNeg) nNeed=-nNeed;
1323*cdf0e10cSrcweir 				if (bLft) aTmpRect.Left()=aTmpRect.Right()-nNeed;
1324*cdf0e10cSrcweir 				if (bRgt) aTmpRect.Right()=aTmpRect.Left()+nNeed;
1325*cdf0e10cSrcweir 			}
1326*cdf0e10cSrcweir 		} else { // Scheitelpunkthandles
1327*cdf0e10cSrcweir 			if ((bLft || bRgt) && nXDiv!=0) {
1328*cdf0e10cSrcweir 				long nHgt0b=aRect.Bottom()-aRect.Top();
1329*cdf0e10cSrcweir 				long nNeed=long(BigInt(nHgt0b)*BigInt(nXMul)/BigInt(nXDiv));
1330*cdf0e10cSrcweir 				aTmpRect.Top()-=(nNeed-nHgt0b)/2;
1331*cdf0e10cSrcweir 				aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
1332*cdf0e10cSrcweir 			}
1333*cdf0e10cSrcweir 			if ((bTop || bBtm) && nYDiv!=0) {
1334*cdf0e10cSrcweir 				long nWdt0b=aRect.Right()-aRect.Left();
1335*cdf0e10cSrcweir 				long nNeed=long(BigInt(nWdt0b)*BigInt(nYMul)/BigInt(nYDiv));
1336*cdf0e10cSrcweir 				aTmpRect.Left()-=(nNeed-nWdt0b)/2;
1337*cdf0e10cSrcweir 				aTmpRect.Right()=aTmpRect.Left()+nNeed;
1338*cdf0e10cSrcweir 			}
1339*cdf0e10cSrcweir 		}
1340*cdf0e10cSrcweir 	}
1341*cdf0e10cSrcweir 	aTmpRect.Justify();
1342*cdf0e10cSrcweir 	return aTmpRect;
1343*cdf0e10cSrcweir }
1344*cdf0e10cSrcweir 
1345*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1346*cdf0e10cSrcweir 
1347*cdf0e10cSrcweir bool SdrObject::hasSpecialDrag() const
1348*cdf0e10cSrcweir {
1349*cdf0e10cSrcweir 	return false;
1350*cdf0e10cSrcweir }
1351*cdf0e10cSrcweir 
1352*cdf0e10cSrcweir bool SdrObject::supportsFullDrag() const
1353*cdf0e10cSrcweir {
1354*cdf0e10cSrcweir     return true;
1355*cdf0e10cSrcweir }
1356*cdf0e10cSrcweir 
1357*cdf0e10cSrcweir SdrObject* SdrObject::getFullDragClone() const
1358*cdf0e10cSrcweir {
1359*cdf0e10cSrcweir 	// default uses simple clone
1360*cdf0e10cSrcweir 	return Clone();
1361*cdf0e10cSrcweir }
1362*cdf0e10cSrcweir 
1363*cdf0e10cSrcweir bool SdrObject::beginSpecialDrag(SdrDragStat& rDrag) const
1364*cdf0e10cSrcweir {
1365*cdf0e10cSrcweir     const SdrHdl* pHdl = rDrag.GetHdl();
1366*cdf0e10cSrcweir 
1367*cdf0e10cSrcweir     SdrHdlKind eHdl = (pHdl == NULL) ? HDL_MOVE : pHdl->GetKind();
1368*cdf0e10cSrcweir 
1369*cdf0e10cSrcweir     if(eHdl==HDL_UPLFT || eHdl==HDL_UPPER || eHdl==HDL_UPRGT ||
1370*cdf0e10cSrcweir 	    eHdl==HDL_LEFT || eHdl==HDL_RIGHT || eHdl==HDL_LWLFT ||
1371*cdf0e10cSrcweir         eHdl==HDL_LOWER || eHdl==HDL_LWRGT)
1372*cdf0e10cSrcweir     {
1373*cdf0e10cSrcweir         return true;
1374*cdf0e10cSrcweir     }
1375*cdf0e10cSrcweir 
1376*cdf0e10cSrcweir     return false;
1377*cdf0e10cSrcweir }
1378*cdf0e10cSrcweir 
1379*cdf0e10cSrcweir bool SdrObject::applySpecialDrag(SdrDragStat& rDrag)
1380*cdf0e10cSrcweir {
1381*cdf0e10cSrcweir 	Rectangle aNewRect(ImpDragCalcRect(rDrag));
1382*cdf0e10cSrcweir 
1383*cdf0e10cSrcweir     if(aNewRect != GetSnapRect())
1384*cdf0e10cSrcweir     {
1385*cdf0e10cSrcweir    		NbcSetSnapRect(aNewRect);
1386*cdf0e10cSrcweir 	}
1387*cdf0e10cSrcweir 
1388*cdf0e10cSrcweir     return true;
1389*cdf0e10cSrcweir }
1390*cdf0e10cSrcweir 
1391*cdf0e10cSrcweir String SdrObject::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const
1392*cdf0e10cSrcweir {
1393*cdf0e10cSrcweir 	return String();
1394*cdf0e10cSrcweir }
1395*cdf0e10cSrcweir 
1396*cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrObject::getSpecialDragPoly(const SdrDragStat& /*rDrag*/) const
1397*cdf0e10cSrcweir {
1398*cdf0e10cSrcweir     // default has nothing to add
1399*cdf0e10cSrcweir     return basegfx::B2DPolyPolygon();
1400*cdf0e10cSrcweir }
1401*cdf0e10cSrcweir 
1402*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1403*cdf0e10cSrcweir // Create
1404*cdf0e10cSrcweir FASTBOOL SdrObject::BegCreate(SdrDragStat& rStat)
1405*cdf0e10cSrcweir {
1406*cdf0e10cSrcweir 	rStat.SetOrtho4Possible();
1407*cdf0e10cSrcweir 	Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
1408*cdf0e10cSrcweir 	aRect1.Justify();
1409*cdf0e10cSrcweir 	rStat.SetActionRect(aRect1);
1410*cdf0e10cSrcweir 	aOutRect = aRect1;
1411*cdf0e10cSrcweir 	return sal_True;
1412*cdf0e10cSrcweir }
1413*cdf0e10cSrcweir 
1414*cdf0e10cSrcweir FASTBOOL SdrObject::MovCreate(SdrDragStat& rStat)
1415*cdf0e10cSrcweir {
1416*cdf0e10cSrcweir 	rStat.TakeCreateRect(aOutRect);
1417*cdf0e10cSrcweir 	rStat.SetActionRect(aOutRect);
1418*cdf0e10cSrcweir 	aOutRect.Justify();
1419*cdf0e10cSrcweir 
1420*cdf0e10cSrcweir 	// #i101648# for naked (non-derived) SdrObjects, do not invalidate aOutRect
1421*cdf0e10cSrcweir 	// by calling SetBoundRectDirty(); aOutRect IS the geometry for such objects.
1422*cdf0e10cSrcweir 	// No derivation implementation calls the parent implementation, so this will
1423*cdf0e10cSrcweir 	// cause no further prolems
1424*cdf0e10cSrcweir 	//
1425*cdf0e10cSrcweir 	// SetBoundRectDirty();
1426*cdf0e10cSrcweir 	// bSnapRectDirty=sal_True;
1427*cdf0e10cSrcweir 
1428*cdf0e10cSrcweir 	return sal_True;
1429*cdf0e10cSrcweir }
1430*cdf0e10cSrcweir 
1431*cdf0e10cSrcweir FASTBOOL SdrObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
1432*cdf0e10cSrcweir {
1433*cdf0e10cSrcweir 	rStat.TakeCreateRect(aOutRect);
1434*cdf0e10cSrcweir 	aOutRect.Justify();
1435*cdf0e10cSrcweir 
1436*cdf0e10cSrcweir 	// #i101648# see description at MovCreate
1437*cdf0e10cSrcweir 	//
1438*cdf0e10cSrcweir 	// SetRectsDirty();
1439*cdf0e10cSrcweir 
1440*cdf0e10cSrcweir 	return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
1441*cdf0e10cSrcweir }
1442*cdf0e10cSrcweir 
1443*cdf0e10cSrcweir void SdrObject::BrkCreate(SdrDragStat& /*rStat*/)
1444*cdf0e10cSrcweir {
1445*cdf0e10cSrcweir }
1446*cdf0e10cSrcweir 
1447*cdf0e10cSrcweir FASTBOOL SdrObject::BckCreate(SdrDragStat& /*rStat*/)
1448*cdf0e10cSrcweir {
1449*cdf0e10cSrcweir 	return sal_False;
1450*cdf0e10cSrcweir }
1451*cdf0e10cSrcweir 
1452*cdf0e10cSrcweir basegfx::B2DPolyPolygon SdrObject::TakeCreatePoly(const SdrDragStat& rDrag) const
1453*cdf0e10cSrcweir {
1454*cdf0e10cSrcweir 	Rectangle aRect1;
1455*cdf0e10cSrcweir 	rDrag.TakeCreateRect(aRect1);
1456*cdf0e10cSrcweir 	aRect1.Justify();
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir 	basegfx::B2DPolyPolygon aRetval;
1459*cdf0e10cSrcweir 	const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
1460*cdf0e10cSrcweir 	aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
1461*cdf0e10cSrcweir 	return aRetval;
1462*cdf0e10cSrcweir }
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir Pointer SdrObject::GetCreatePointer() const
1465*cdf0e10cSrcweir {
1466*cdf0e10cSrcweir 	return Pointer(POINTER_CROSS);
1467*cdf0e10cSrcweir }
1468*cdf0e10cSrcweir 
1469*cdf0e10cSrcweir // Transformationen
1470*cdf0e10cSrcweir void SdrObject::NbcMove(const Size& rSiz)
1471*cdf0e10cSrcweir {
1472*cdf0e10cSrcweir 	MoveRect(aOutRect,rSiz);
1473*cdf0e10cSrcweir 	SetRectsDirty();
1474*cdf0e10cSrcweir }
1475*cdf0e10cSrcweir 
1476*cdf0e10cSrcweir void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
1477*cdf0e10cSrcweir {
1478*cdf0e10cSrcweir 	FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
1479*cdf0e10cSrcweir 	FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
1480*cdf0e10cSrcweir 	if (bXMirr || bYMirr) {
1481*cdf0e10cSrcweir 		Point aRef1(GetSnapRect().Center());
1482*cdf0e10cSrcweir 		if (bXMirr) {
1483*cdf0e10cSrcweir 			Point aRef2(aRef1);
1484*cdf0e10cSrcweir 			aRef2.Y()++;
1485*cdf0e10cSrcweir 			NbcMirrorGluePoints(aRef1,aRef2);
1486*cdf0e10cSrcweir 		}
1487*cdf0e10cSrcweir 		if (bYMirr) {
1488*cdf0e10cSrcweir 			Point aRef2(aRef1);
1489*cdf0e10cSrcweir 			aRef2.X()++;
1490*cdf0e10cSrcweir 			NbcMirrorGluePoints(aRef1,aRef2);
1491*cdf0e10cSrcweir 		}
1492*cdf0e10cSrcweir 	}
1493*cdf0e10cSrcweir 	ResizeRect(aOutRect,rRef,xFact,yFact);
1494*cdf0e10cSrcweir 	SetRectsDirty();
1495*cdf0e10cSrcweir }
1496*cdf0e10cSrcweir 
1497*cdf0e10cSrcweir void SdrObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
1498*cdf0e10cSrcweir {
1499*cdf0e10cSrcweir 	SetGlueReallyAbsolute(sal_True);
1500*cdf0e10cSrcweir 	aOutRect.Move(-rRef.X(),-rRef.Y());
1501*cdf0e10cSrcweir 	Rectangle R(aOutRect);
1502*cdf0e10cSrcweir     if (sn==1.0 && cs==0.0) { // 90deg
1503*cdf0e10cSrcweir 		aOutRect.Left()  =-R.Bottom();
1504*cdf0e10cSrcweir 		aOutRect.Right() =-R.Top();
1505*cdf0e10cSrcweir 		aOutRect.Top()   =R.Left();
1506*cdf0e10cSrcweir 		aOutRect.Bottom()=R.Right();
1507*cdf0e10cSrcweir     } else if (sn==0.0 && cs==-1.0) { // 180deg
1508*cdf0e10cSrcweir 		aOutRect.Left()  =-R.Right();
1509*cdf0e10cSrcweir 		aOutRect.Right() =-R.Left();
1510*cdf0e10cSrcweir 		aOutRect.Top()   =-R.Bottom();
1511*cdf0e10cSrcweir 		aOutRect.Bottom()=-R.Top();
1512*cdf0e10cSrcweir     } else if (sn==-1.0 && cs==0.0) { // 270deg
1513*cdf0e10cSrcweir 		aOutRect.Left()  =R.Top();
1514*cdf0e10cSrcweir 		aOutRect.Right() =R.Bottom();
1515*cdf0e10cSrcweir 		aOutRect.Top()   =-R.Right();
1516*cdf0e10cSrcweir 		aOutRect.Bottom()=-R.Left();
1517*cdf0e10cSrcweir 	}
1518*cdf0e10cSrcweir 	aOutRect.Move(rRef.X(),rRef.Y());
1519*cdf0e10cSrcweir 	aOutRect.Justify(); // Sicherheitshalber
1520*cdf0e10cSrcweir 	SetRectsDirty();
1521*cdf0e10cSrcweir 	NbcRotateGluePoints(rRef,nWink,sn,cs);
1522*cdf0e10cSrcweir 	SetGlueReallyAbsolute(sal_False);
1523*cdf0e10cSrcweir }
1524*cdf0e10cSrcweir 
1525*cdf0e10cSrcweir void SdrObject::NbcMirror(const Point& rRef1, const Point& rRef2)
1526*cdf0e10cSrcweir {
1527*cdf0e10cSrcweir 	SetGlueReallyAbsolute(sal_True);
1528*cdf0e10cSrcweir 	aOutRect.Move(-rRef1.X(),-rRef1.Y());
1529*cdf0e10cSrcweir 	Rectangle R(aOutRect);
1530*cdf0e10cSrcweir 	long dx=rRef2.X()-rRef1.X();
1531*cdf0e10cSrcweir 	long dy=rRef2.Y()-rRef1.Y();
1532*cdf0e10cSrcweir 	if (dx==0) {          // Vertikale Achse
1533*cdf0e10cSrcweir 		aOutRect.Left() =-R.Right();
1534*cdf0e10cSrcweir 		aOutRect.Right()=-R.Left();
1535*cdf0e10cSrcweir 	} else if (dy==0) {   // Horizontale Achse
1536*cdf0e10cSrcweir 		aOutRect.Top()   =-R.Bottom();
1537*cdf0e10cSrcweir 		aOutRect.Bottom()=-R.Top();
1538*cdf0e10cSrcweir 	} else if (dx==dy) {  /* 45 Grad Achse \ */
1539*cdf0e10cSrcweir 		aOutRect.Left()  =R.Top();
1540*cdf0e10cSrcweir 		aOutRect.Right() =R.Bottom();
1541*cdf0e10cSrcweir 		aOutRect.Top()   =R.Left();
1542*cdf0e10cSrcweir 		aOutRect.Bottom()=R.Right();
1543*cdf0e10cSrcweir 	} else if (dx==-dy) { // 45 Grad Achse /
1544*cdf0e10cSrcweir 		aOutRect.Left()  =-R.Bottom();
1545*cdf0e10cSrcweir 		aOutRect.Right() =-R.Top();
1546*cdf0e10cSrcweir 		aOutRect.Top()   =-R.Right();
1547*cdf0e10cSrcweir 		aOutRect.Bottom()=-R.Left();
1548*cdf0e10cSrcweir 	}
1549*cdf0e10cSrcweir 	aOutRect.Move(rRef1.X(),rRef1.Y());
1550*cdf0e10cSrcweir 	aOutRect.Justify(); // Sicherheitshalber
1551*cdf0e10cSrcweir 	SetRectsDirty();
1552*cdf0e10cSrcweir 	NbcMirrorGluePoints(rRef1,rRef2);
1553*cdf0e10cSrcweir 	SetGlueReallyAbsolute(sal_False);
1554*cdf0e10cSrcweir }
1555*cdf0e10cSrcweir 
1556*cdf0e10cSrcweir void SdrObject::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
1557*cdf0e10cSrcweir {
1558*cdf0e10cSrcweir 	SetGlueReallyAbsolute(sal_True);
1559*cdf0e10cSrcweir 	NbcShearGluePoints(rRef,nWink,tn,bVShear);
1560*cdf0e10cSrcweir 	SetGlueReallyAbsolute(sal_False);
1561*cdf0e10cSrcweir }
1562*cdf0e10cSrcweir 
1563*cdf0e10cSrcweir void SdrObject::Move(const Size& rSiz)
1564*cdf0e10cSrcweir {
1565*cdf0e10cSrcweir 	if (rSiz.Width()!=0 || rSiz.Height()!=0) {
1566*cdf0e10cSrcweir 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1567*cdf0e10cSrcweir 		// #110094#-14 SendRepaintBroadcast();
1568*cdf0e10cSrcweir 		NbcMove(rSiz);
1569*cdf0e10cSrcweir 		SetChanged();
1570*cdf0e10cSrcweir 		BroadcastObjectChange();
1571*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
1572*cdf0e10cSrcweir 	}
1573*cdf0e10cSrcweir }
1574*cdf0e10cSrcweir 
1575*cdf0e10cSrcweir void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
1576*cdf0e10cSrcweir {
1577*cdf0e10cSrcweir 	if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
1578*cdf0e10cSrcweir 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1579*cdf0e10cSrcweir 		// #110094#-14 SendRepaintBroadcast();
1580*cdf0e10cSrcweir 		NbcResize(rRef,xFact,yFact);
1581*cdf0e10cSrcweir 		SetChanged();
1582*cdf0e10cSrcweir 		BroadcastObjectChange();
1583*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1584*cdf0e10cSrcweir 	}
1585*cdf0e10cSrcweir }
1586*cdf0e10cSrcweir 
1587*cdf0e10cSrcweir void SdrObject::Rotate(const Point& rRef, long nWink, double sn, double cs)
1588*cdf0e10cSrcweir {
1589*cdf0e10cSrcweir 	if (nWink!=0) {
1590*cdf0e10cSrcweir 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1591*cdf0e10cSrcweir 		// #110094#-14 SendRepaintBroadcast();
1592*cdf0e10cSrcweir 		NbcRotate(rRef,nWink,sn,cs);
1593*cdf0e10cSrcweir 		SetChanged();
1594*cdf0e10cSrcweir 		BroadcastObjectChange();
1595*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1596*cdf0e10cSrcweir 	}
1597*cdf0e10cSrcweir }
1598*cdf0e10cSrcweir 
1599*cdf0e10cSrcweir void SdrObject::Mirror(const Point& rRef1, const Point& rRef2)
1600*cdf0e10cSrcweir {
1601*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1602*cdf0e10cSrcweir 	// #110094#-14 SendRepaintBroadcast();
1603*cdf0e10cSrcweir 	NbcMirror(rRef1,rRef2);
1604*cdf0e10cSrcweir 	SetChanged();
1605*cdf0e10cSrcweir 	BroadcastObjectChange();
1606*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1607*cdf0e10cSrcweir }
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir void SdrObject::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
1610*cdf0e10cSrcweir {
1611*cdf0e10cSrcweir 	if (nWink!=0) {
1612*cdf0e10cSrcweir 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1613*cdf0e10cSrcweir 		// #110094#-14 SendRepaintBroadcast();
1614*cdf0e10cSrcweir 		NbcShear(rRef,nWink,tn,bVShear);
1615*cdf0e10cSrcweir 		SetChanged();
1616*cdf0e10cSrcweir 		BroadcastObjectChange();
1617*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1618*cdf0e10cSrcweir 	}
1619*cdf0e10cSrcweir }
1620*cdf0e10cSrcweir 
1621*cdf0e10cSrcweir void SdrObject::NbcSetRelativePos(const Point& rPnt)
1622*cdf0e10cSrcweir {
1623*cdf0e10cSrcweir 	Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
1624*cdf0e10cSrcweir 	Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
1625*cdf0e10cSrcweir 	NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
1626*cdf0e10cSrcweir }
1627*cdf0e10cSrcweir 
1628*cdf0e10cSrcweir void SdrObject::SetRelativePos(const Point& rPnt)
1629*cdf0e10cSrcweir {
1630*cdf0e10cSrcweir 	if (rPnt!=GetRelativePos()) {
1631*cdf0e10cSrcweir 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1632*cdf0e10cSrcweir 		// #110094#-14 SendRepaintBroadcast();
1633*cdf0e10cSrcweir 		NbcSetRelativePos(rPnt);
1634*cdf0e10cSrcweir 		SetChanged();
1635*cdf0e10cSrcweir 		BroadcastObjectChange();
1636*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
1637*cdf0e10cSrcweir 	}
1638*cdf0e10cSrcweir }
1639*cdf0e10cSrcweir 
1640*cdf0e10cSrcweir Point SdrObject::GetRelativePos() const
1641*cdf0e10cSrcweir {
1642*cdf0e10cSrcweir 	return GetSnapRect().TopLeft()-aAnchor;
1643*cdf0e10cSrcweir }
1644*cdf0e10cSrcweir 
1645*cdf0e10cSrcweir void SdrObject::NbcSetAnchorPos(const Point& rPnt)
1646*cdf0e10cSrcweir {
1647*cdf0e10cSrcweir 	Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
1648*cdf0e10cSrcweir 	aAnchor=rPnt;
1649*cdf0e10cSrcweir 	NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
1650*cdf0e10cSrcweir }
1651*cdf0e10cSrcweir 
1652*cdf0e10cSrcweir void SdrObject::SetAnchorPos(const Point& rPnt)
1653*cdf0e10cSrcweir {
1654*cdf0e10cSrcweir 	if (rPnt!=aAnchor) {
1655*cdf0e10cSrcweir 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1656*cdf0e10cSrcweir 		// #110094#-14 SendRepaintBroadcast();
1657*cdf0e10cSrcweir 		NbcSetAnchorPos(rPnt);
1658*cdf0e10cSrcweir 		SetChanged();
1659*cdf0e10cSrcweir 		BroadcastObjectChange();
1660*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
1661*cdf0e10cSrcweir 	}
1662*cdf0e10cSrcweir }
1663*cdf0e10cSrcweir 
1664*cdf0e10cSrcweir const Point& SdrObject::GetAnchorPos() const
1665*cdf0e10cSrcweir {
1666*cdf0e10cSrcweir 	return aAnchor;
1667*cdf0e10cSrcweir }
1668*cdf0e10cSrcweir 
1669*cdf0e10cSrcweir void SdrObject::RecalcSnapRect()
1670*cdf0e10cSrcweir {
1671*cdf0e10cSrcweir }
1672*cdf0e10cSrcweir 
1673*cdf0e10cSrcweir const Rectangle& SdrObject::GetSnapRect() const
1674*cdf0e10cSrcweir {
1675*cdf0e10cSrcweir 	return aOutRect;
1676*cdf0e10cSrcweir }
1677*cdf0e10cSrcweir 
1678*cdf0e10cSrcweir void SdrObject::NbcSetSnapRect(const Rectangle& rRect)
1679*cdf0e10cSrcweir {
1680*cdf0e10cSrcweir 	aOutRect=rRect;
1681*cdf0e10cSrcweir }
1682*cdf0e10cSrcweir 
1683*cdf0e10cSrcweir const Rectangle& SdrObject::GetLogicRect() const
1684*cdf0e10cSrcweir {
1685*cdf0e10cSrcweir 	return GetSnapRect();
1686*cdf0e10cSrcweir }
1687*cdf0e10cSrcweir 
1688*cdf0e10cSrcweir void SdrObject::NbcSetLogicRect(const Rectangle& rRect)
1689*cdf0e10cSrcweir {
1690*cdf0e10cSrcweir 	NbcSetSnapRect(rRect);
1691*cdf0e10cSrcweir }
1692*cdf0e10cSrcweir 
1693*cdf0e10cSrcweir void SdrObject::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ )
1694*cdf0e10cSrcweir {
1695*cdf0e10cSrcweir 	SetLogicRect( rMaxRect );
1696*cdf0e10cSrcweir }
1697*cdf0e10cSrcweir 
1698*cdf0e10cSrcweir void SdrObject::SetSnapRect(const Rectangle& rRect)
1699*cdf0e10cSrcweir {
1700*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1701*cdf0e10cSrcweir 	// #110094#-14 SendRepaintBroadcast();
1702*cdf0e10cSrcweir 	NbcSetSnapRect(rRect);
1703*cdf0e10cSrcweir 	SetChanged();
1704*cdf0e10cSrcweir 	BroadcastObjectChange();
1705*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1706*cdf0e10cSrcweir }
1707*cdf0e10cSrcweir 
1708*cdf0e10cSrcweir void SdrObject::SetLogicRect(const Rectangle& rRect)
1709*cdf0e10cSrcweir {
1710*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1711*cdf0e10cSrcweir 	// #110094#-14 SendRepaintBroadcast();
1712*cdf0e10cSrcweir 	NbcSetLogicRect(rRect);
1713*cdf0e10cSrcweir 	SetChanged();
1714*cdf0e10cSrcweir 	BroadcastObjectChange();
1715*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1716*cdf0e10cSrcweir }
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir long SdrObject::GetRotateAngle() const
1719*cdf0e10cSrcweir {
1720*cdf0e10cSrcweir 	return 0;
1721*cdf0e10cSrcweir }
1722*cdf0e10cSrcweir 
1723*cdf0e10cSrcweir long SdrObject::GetShearAngle(FASTBOOL /*bVertical*/) const
1724*cdf0e10cSrcweir {
1725*cdf0e10cSrcweir 	return 0;
1726*cdf0e10cSrcweir }
1727*cdf0e10cSrcweir 
1728*cdf0e10cSrcweir sal_uInt32 SdrObject::GetSnapPointCount() const
1729*cdf0e10cSrcweir {
1730*cdf0e10cSrcweir 	return GetPointCount();
1731*cdf0e10cSrcweir }
1732*cdf0e10cSrcweir 
1733*cdf0e10cSrcweir Point SdrObject::GetSnapPoint(sal_uInt32 i) const
1734*cdf0e10cSrcweir {
1735*cdf0e10cSrcweir 	return GetPoint(i);
1736*cdf0e10cSrcweir }
1737*cdf0e10cSrcweir 
1738*cdf0e10cSrcweir sal_Bool SdrObject::IsPolyObj() const
1739*cdf0e10cSrcweir {
1740*cdf0e10cSrcweir 	return sal_False;
1741*cdf0e10cSrcweir }
1742*cdf0e10cSrcweir 
1743*cdf0e10cSrcweir sal_uInt32 SdrObject::GetPointCount() const
1744*cdf0e10cSrcweir {
1745*cdf0e10cSrcweir 	return 0L;
1746*cdf0e10cSrcweir }
1747*cdf0e10cSrcweir 
1748*cdf0e10cSrcweir Point SdrObject::GetPoint(sal_uInt32 /*i*/) const
1749*cdf0e10cSrcweir {
1750*cdf0e10cSrcweir 	return Point();
1751*cdf0e10cSrcweir }
1752*cdf0e10cSrcweir 
1753*cdf0e10cSrcweir void SdrObject::SetPoint(const Point& rPnt, sal_uInt32 i)
1754*cdf0e10cSrcweir {
1755*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1756*cdf0e10cSrcweir 	// #110094#-14 SendRepaintBroadcast();
1757*cdf0e10cSrcweir 	NbcSetPoint(rPnt, i);
1758*cdf0e10cSrcweir 	SetChanged();
1759*cdf0e10cSrcweir 	BroadcastObjectChange();
1760*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1761*cdf0e10cSrcweir }
1762*cdf0e10cSrcweir 
1763*cdf0e10cSrcweir void SdrObject::NbcSetPoint(const Point& /*rPnt*/, sal_uInt32 /*i*/)
1764*cdf0e10cSrcweir {
1765*cdf0e10cSrcweir }
1766*cdf0e10cSrcweir 
1767*cdf0e10cSrcweir FASTBOOL SdrObject::HasTextEdit() const
1768*cdf0e10cSrcweir {
1769*cdf0e10cSrcweir 	return sal_False;
1770*cdf0e10cSrcweir }
1771*cdf0e10cSrcweir 
1772*cdf0e10cSrcweir sal_Bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/)
1773*cdf0e10cSrcweir {
1774*cdf0e10cSrcweir 	return sal_False;
1775*cdf0e10cSrcweir }
1776*cdf0e10cSrcweir 
1777*cdf0e10cSrcweir void SdrObject::EndTextEdit(SdrOutliner& /*rOutl*/)
1778*cdf0e10cSrcweir {
1779*cdf0e10cSrcweir }
1780*cdf0e10cSrcweir 
1781*cdf0e10cSrcweir void SdrObject::SetOutlinerParaObject(OutlinerParaObject* pTextObject)
1782*cdf0e10cSrcweir {
1783*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1784*cdf0e10cSrcweir 	// #110094#-14 SendRepaintBroadcast();
1785*cdf0e10cSrcweir 	NbcSetOutlinerParaObject(pTextObject);
1786*cdf0e10cSrcweir 	SetChanged();
1787*cdf0e10cSrcweir 	BroadcastObjectChange();
1788*cdf0e10cSrcweir 	if (GetCurrentBoundRect()!=aBoundRect0) {
1789*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1790*cdf0e10cSrcweir 	}
1791*cdf0e10cSrcweir }
1792*cdf0e10cSrcweir 
1793*cdf0e10cSrcweir void SdrObject::NbcSetOutlinerParaObject(OutlinerParaObject* /*pTextObject*/)
1794*cdf0e10cSrcweir {
1795*cdf0e10cSrcweir }
1796*cdf0e10cSrcweir 
1797*cdf0e10cSrcweir OutlinerParaObject* SdrObject::GetOutlinerParaObject() const
1798*cdf0e10cSrcweir {
1799*cdf0e10cSrcweir 	return NULL;
1800*cdf0e10cSrcweir }
1801*cdf0e10cSrcweir 
1802*cdf0e10cSrcweir void SdrObject::NbcReformatText()
1803*cdf0e10cSrcweir {
1804*cdf0e10cSrcweir }
1805*cdf0e10cSrcweir 
1806*cdf0e10cSrcweir void SdrObject::ReformatText()
1807*cdf0e10cSrcweir {
1808*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1809*cdf0e10cSrcweir 	NbcReformatText();
1810*cdf0e10cSrcweir 	SetChanged();
1811*cdf0e10cSrcweir 	BroadcastObjectChange();
1812*cdf0e10cSrcweir 	if (GetCurrentBoundRect()!=aBoundRect0) {
1813*cdf0e10cSrcweir 		SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1814*cdf0e10cSrcweir 	}
1815*cdf0e10cSrcweir }
1816*cdf0e10cSrcweir 
1817*cdf0e10cSrcweir void SdrObject::BurnInStyleSheetAttributes()
1818*cdf0e10cSrcweir {
1819*cdf0e10cSrcweir 	GetProperties().ForceStyleToHardAttributes();
1820*cdf0e10cSrcweir }
1821*cdf0e10cSrcweir 
1822*cdf0e10cSrcweir #define Imp2ndKennung (0x434F4D43)
1823*cdf0e10cSrcweir SdrObjUserData* SdrObject::ImpGetMacroUserData() const
1824*cdf0e10cSrcweir {
1825*cdf0e10cSrcweir 	SdrObjUserData* pData=NULL;
1826*cdf0e10cSrcweir 	sal_uInt16 nAnz=GetUserDataCount();
1827*cdf0e10cSrcweir 	for (sal_uInt16 nNum=nAnz; nNum>0 && pData==NULL;) {
1828*cdf0e10cSrcweir 		nNum--;
1829*cdf0e10cSrcweir 		pData=GetUserData(nNum);
1830*cdf0e10cSrcweir 		if (!pData->HasMacro(this)) pData=NULL;
1831*cdf0e10cSrcweir 	}
1832*cdf0e10cSrcweir 	return pData;
1833*cdf0e10cSrcweir }
1834*cdf0e10cSrcweir 
1835*cdf0e10cSrcweir FASTBOOL SdrObject::HasMacro() const
1836*cdf0e10cSrcweir {
1837*cdf0e10cSrcweir 	SdrObjUserData* pData=ImpGetMacroUserData();
1838*cdf0e10cSrcweir 	return pData!=NULL ? pData->HasMacro(this) : sal_False;
1839*cdf0e10cSrcweir }
1840*cdf0e10cSrcweir 
1841*cdf0e10cSrcweir SdrObject* SdrObject::CheckMacroHit(const SdrObjMacroHitRec& rRec) const
1842*cdf0e10cSrcweir {
1843*cdf0e10cSrcweir 	SdrObjUserData* pData = ImpGetMacroUserData();
1844*cdf0e10cSrcweir 
1845*cdf0e10cSrcweir     if(pData)
1846*cdf0e10cSrcweir     {
1847*cdf0e10cSrcweir 		return pData->CheckMacroHit(rRec, this);
1848*cdf0e10cSrcweir 	}
1849*cdf0e10cSrcweir 
1850*cdf0e10cSrcweir     if(rRec.pPageView)
1851*cdf0e10cSrcweir     {
1852*cdf0e10cSrcweir 	    return SdrObjectPrimitiveHit(*this, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
1853*cdf0e10cSrcweir     }
1854*cdf0e10cSrcweir 
1855*cdf0e10cSrcweir 	return 0;
1856*cdf0e10cSrcweir }
1857*cdf0e10cSrcweir 
1858*cdf0e10cSrcweir Pointer SdrObject::GetMacroPointer(const SdrObjMacroHitRec& rRec) const
1859*cdf0e10cSrcweir {
1860*cdf0e10cSrcweir 	SdrObjUserData* pData=ImpGetMacroUserData();
1861*cdf0e10cSrcweir 	if (pData!=NULL) {
1862*cdf0e10cSrcweir 		return pData->GetMacroPointer(rRec,this);
1863*cdf0e10cSrcweir 	}
1864*cdf0e10cSrcweir 	return Pointer(POINTER_REFHAND);
1865*cdf0e10cSrcweir }
1866*cdf0e10cSrcweir 
1867*cdf0e10cSrcweir void SdrObject::PaintMacro(OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const
1868*cdf0e10cSrcweir {
1869*cdf0e10cSrcweir 	SdrObjUserData* pData=ImpGetMacroUserData();
1870*cdf0e10cSrcweir 
1871*cdf0e10cSrcweir     if(pData)
1872*cdf0e10cSrcweir     {
1873*cdf0e10cSrcweir 		pData->PaintMacro(rOut,rDirtyRect,rRec,this);
1874*cdf0e10cSrcweir 	}
1875*cdf0e10cSrcweir     else
1876*cdf0e10cSrcweir     {
1877*cdf0e10cSrcweir 	    const RasterOp eRop(rOut.GetRasterOp());
1878*cdf0e10cSrcweir 	    const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
1879*cdf0e10cSrcweir 	    const sal_uInt32 nCount(aPolyPolygon.count());
1880*cdf0e10cSrcweir 
1881*cdf0e10cSrcweir         rOut.SetLineColor(COL_BLACK);
1882*cdf0e10cSrcweir         rOut.SetFillColor();
1883*cdf0e10cSrcweir 	    rOut.SetRasterOp(ROP_INVERT);
1884*cdf0e10cSrcweir 
1885*cdf0e10cSrcweir 	    for(sal_uInt32 a(0); a < nCount; a++)
1886*cdf0e10cSrcweir 	    {
1887*cdf0e10cSrcweir 		    rOut.DrawPolyLine(aPolyPolygon.getB2DPolygon(a));
1888*cdf0e10cSrcweir 	    }
1889*cdf0e10cSrcweir 
1890*cdf0e10cSrcweir         rOut.SetRasterOp(eRop);
1891*cdf0e10cSrcweir 	}
1892*cdf0e10cSrcweir }
1893*cdf0e10cSrcweir 
1894*cdf0e10cSrcweir FASTBOOL SdrObject::DoMacro(const SdrObjMacroHitRec& rRec)
1895*cdf0e10cSrcweir {
1896*cdf0e10cSrcweir 	SdrObjUserData* pData=ImpGetMacroUserData();
1897*cdf0e10cSrcweir 	if (pData!=NULL) {
1898*cdf0e10cSrcweir 		return pData->DoMacro(rRec,this);
1899*cdf0e10cSrcweir 	}
1900*cdf0e10cSrcweir 	return sal_False;
1901*cdf0e10cSrcweir }
1902*cdf0e10cSrcweir 
1903*cdf0e10cSrcweir XubString SdrObject::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
1904*cdf0e10cSrcweir {
1905*cdf0e10cSrcweir 	SdrObjUserData* pData=ImpGetMacroUserData();
1906*cdf0e10cSrcweir 	if (pData!=NULL) {
1907*cdf0e10cSrcweir 		return pData->GetMacroPopupComment(rRec,this);
1908*cdf0e10cSrcweir 	}
1909*cdf0e10cSrcweir 	return String();
1910*cdf0e10cSrcweir }
1911*cdf0e10cSrcweir 
1912*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1913*cdf0e10cSrcweir 
1914*cdf0e10cSrcweir SdrObjGeoData* SdrObject::NewGeoData() const
1915*cdf0e10cSrcweir {
1916*cdf0e10cSrcweir 	return new SdrObjGeoData;
1917*cdf0e10cSrcweir }
1918*cdf0e10cSrcweir 
1919*cdf0e10cSrcweir void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const
1920*cdf0e10cSrcweir {
1921*cdf0e10cSrcweir 	rGeo.aBoundRect    =GetCurrentBoundRect();
1922*cdf0e10cSrcweir 	rGeo.aAnchor       =aAnchor       ;
1923*cdf0e10cSrcweir 	rGeo.bMovProt      =bMovProt      ;
1924*cdf0e10cSrcweir 	rGeo.bSizProt      =bSizProt      ;
1925*cdf0e10cSrcweir 	rGeo.bNoPrint      =bNoPrint      ;
1926*cdf0e10cSrcweir 	rGeo.mbVisible	   =mbVisible     ;
1927*cdf0e10cSrcweir 	rGeo.bClosedObj    =bClosedObj    ;
1928*cdf0e10cSrcweir 	rGeo.mnLayerID = mnLayerID;
1929*cdf0e10cSrcweir 
1930*cdf0e10cSrcweir 	// Benutzerdefinierte Klebepunkte
1931*cdf0e10cSrcweir 	if (pPlusData!=NULL && pPlusData->pGluePoints!=NULL) {
1932*cdf0e10cSrcweir 		if (rGeo.pGPL!=NULL) {
1933*cdf0e10cSrcweir 			*rGeo.pGPL=*pPlusData->pGluePoints;
1934*cdf0e10cSrcweir 		} else {
1935*cdf0e10cSrcweir 			rGeo.pGPL=new SdrGluePointList(*pPlusData->pGluePoints);
1936*cdf0e10cSrcweir 		}
1937*cdf0e10cSrcweir 	} else {
1938*cdf0e10cSrcweir 		if (rGeo.pGPL!=NULL) {
1939*cdf0e10cSrcweir 			delete rGeo.pGPL;
1940*cdf0e10cSrcweir 			rGeo.pGPL=NULL;
1941*cdf0e10cSrcweir 		}
1942*cdf0e10cSrcweir 	}
1943*cdf0e10cSrcweir }
1944*cdf0e10cSrcweir 
1945*cdf0e10cSrcweir void SdrObject::RestGeoData(const SdrObjGeoData& rGeo)
1946*cdf0e10cSrcweir {
1947*cdf0e10cSrcweir 	SetRectsDirty();
1948*cdf0e10cSrcweir 	aOutRect      =rGeo.aBoundRect    ;
1949*cdf0e10cSrcweir 	aAnchor       =rGeo.aAnchor       ;
1950*cdf0e10cSrcweir 	bMovProt      =rGeo.bMovProt      ;
1951*cdf0e10cSrcweir 	bSizProt      =rGeo.bSizProt      ;
1952*cdf0e10cSrcweir 	bNoPrint      =rGeo.bNoPrint      ;
1953*cdf0e10cSrcweir 	mbVisible     =rGeo.mbVisible     ;
1954*cdf0e10cSrcweir 	bClosedObj    =rGeo.bClosedObj    ;
1955*cdf0e10cSrcweir 	mnLayerID = rGeo.mnLayerID;
1956*cdf0e10cSrcweir 
1957*cdf0e10cSrcweir 	// Benutzerdefinierte Klebepunkte
1958*cdf0e10cSrcweir 	if (rGeo.pGPL!=NULL) {
1959*cdf0e10cSrcweir 		ImpForcePlusData();
1960*cdf0e10cSrcweir 		if (pPlusData->pGluePoints!=NULL) {
1961*cdf0e10cSrcweir 			*pPlusData->pGluePoints=*rGeo.pGPL;
1962*cdf0e10cSrcweir 		} else {
1963*cdf0e10cSrcweir 			pPlusData->pGluePoints=new SdrGluePointList(*rGeo.pGPL);
1964*cdf0e10cSrcweir 		}
1965*cdf0e10cSrcweir 	} else {
1966*cdf0e10cSrcweir 		if (pPlusData!=NULL && pPlusData->pGluePoints!=NULL) {
1967*cdf0e10cSrcweir 			delete pPlusData->pGluePoints;
1968*cdf0e10cSrcweir 			pPlusData->pGluePoints=NULL;
1969*cdf0e10cSrcweir 		}
1970*cdf0e10cSrcweir 	}
1971*cdf0e10cSrcweir }
1972*cdf0e10cSrcweir 
1973*cdf0e10cSrcweir SdrObjGeoData* SdrObject::GetGeoData() const
1974*cdf0e10cSrcweir {
1975*cdf0e10cSrcweir 	SdrObjGeoData* pGeo=NewGeoData();
1976*cdf0e10cSrcweir 	SaveGeoData(*pGeo);
1977*cdf0e10cSrcweir 	return pGeo;
1978*cdf0e10cSrcweir }
1979*cdf0e10cSrcweir 
1980*cdf0e10cSrcweir void SdrObject::SetGeoData(const SdrObjGeoData& rGeo)
1981*cdf0e10cSrcweir {
1982*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
1983*cdf0e10cSrcweir 	RestGeoData(rGeo);
1984*cdf0e10cSrcweir 	SetChanged();
1985*cdf0e10cSrcweir 	BroadcastObjectChange();
1986*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
1987*cdf0e10cSrcweir }
1988*cdf0e10cSrcweir 
1989*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1990*cdf0e10cSrcweir // ItemSet access
1991*cdf0e10cSrcweir 
1992*cdf0e10cSrcweir const SfxItemSet& SdrObject::GetObjectItemSet() const
1993*cdf0e10cSrcweir {
1994*cdf0e10cSrcweir 	return GetProperties().GetObjectItemSet();
1995*cdf0e10cSrcweir }
1996*cdf0e10cSrcweir 
1997*cdf0e10cSrcweir const SfxItemSet& SdrObject::GetMergedItemSet() const
1998*cdf0e10cSrcweir {
1999*cdf0e10cSrcweir 	return GetProperties().GetMergedItemSet();
2000*cdf0e10cSrcweir }
2001*cdf0e10cSrcweir 
2002*cdf0e10cSrcweir void SdrObject::SetObjectItem(const SfxPoolItem& rItem)
2003*cdf0e10cSrcweir {
2004*cdf0e10cSrcweir 	GetProperties().SetObjectItem(rItem);
2005*cdf0e10cSrcweir }
2006*cdf0e10cSrcweir 
2007*cdf0e10cSrcweir void SdrObject::SetMergedItem(const SfxPoolItem& rItem)
2008*cdf0e10cSrcweir {
2009*cdf0e10cSrcweir 	GetProperties().SetMergedItem(rItem);
2010*cdf0e10cSrcweir }
2011*cdf0e10cSrcweir 
2012*cdf0e10cSrcweir void SdrObject::ClearObjectItem(const sal_uInt16 nWhich)
2013*cdf0e10cSrcweir {
2014*cdf0e10cSrcweir 	GetProperties().ClearObjectItem(nWhich);
2015*cdf0e10cSrcweir }
2016*cdf0e10cSrcweir 
2017*cdf0e10cSrcweir void SdrObject::ClearMergedItem(const sal_uInt16 nWhich)
2018*cdf0e10cSrcweir {
2019*cdf0e10cSrcweir 	GetProperties().ClearMergedItem(nWhich);
2020*cdf0e10cSrcweir }
2021*cdf0e10cSrcweir 
2022*cdf0e10cSrcweir void SdrObject::SetObjectItemSet(const SfxItemSet& rSet)
2023*cdf0e10cSrcweir {
2024*cdf0e10cSrcweir 	GetProperties().SetObjectItemSet(rSet);
2025*cdf0e10cSrcweir }
2026*cdf0e10cSrcweir 
2027*cdf0e10cSrcweir void SdrObject::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
2028*cdf0e10cSrcweir {
2029*cdf0e10cSrcweir 	GetProperties().SetMergedItemSet(rSet, bClearAllItems);
2030*cdf0e10cSrcweir }
2031*cdf0e10cSrcweir 
2032*cdf0e10cSrcweir const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const
2033*cdf0e10cSrcweir {
2034*cdf0e10cSrcweir 	return GetObjectItemSet().Get(nWhich);
2035*cdf0e10cSrcweir }
2036*cdf0e10cSrcweir 
2037*cdf0e10cSrcweir const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const
2038*cdf0e10cSrcweir {
2039*cdf0e10cSrcweir 	return GetMergedItemSet().Get(nWhich);
2040*cdf0e10cSrcweir }
2041*cdf0e10cSrcweir 
2042*cdf0e10cSrcweir void SdrObject::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems)
2043*cdf0e10cSrcweir {
2044*cdf0e10cSrcweir 	GetProperties().SetMergedItemSetAndBroadcast(rSet, bClearAllItems);
2045*cdf0e10cSrcweir }
2046*cdf0e10cSrcweir 
2047*cdf0e10cSrcweir void SdrObject::ApplyNotPersistAttr(const SfxItemSet& rAttr)
2048*cdf0e10cSrcweir {
2049*cdf0e10cSrcweir 	Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
2050*cdf0e10cSrcweir 	NbcApplyNotPersistAttr(rAttr);
2051*cdf0e10cSrcweir 	SetChanged();
2052*cdf0e10cSrcweir 	BroadcastObjectChange();
2053*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
2054*cdf0e10cSrcweir }
2055*cdf0e10cSrcweir 
2056*cdf0e10cSrcweir void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
2057*cdf0e10cSrcweir {
2058*cdf0e10cSrcweir 	const Rectangle& rSnap=GetSnapRect();
2059*cdf0e10cSrcweir 	const Rectangle& rLogic=GetLogicRect();
2060*cdf0e10cSrcweir 	Point aRef1(rSnap.Center());
2061*cdf0e10cSrcweir 	Point aRef2(aRef1); aRef2.Y()++;
2062*cdf0e10cSrcweir 	const SfxPoolItem *pPoolItem=NULL;
2063*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2064*cdf0e10cSrcweir 		aRef1.X()=((const SdrTransformRef1XItem*)pPoolItem)->GetValue();
2065*cdf0e10cSrcweir 	}
2066*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2067*cdf0e10cSrcweir 		aRef1.Y()=((const SdrTransformRef1YItem*)pPoolItem)->GetValue();
2068*cdf0e10cSrcweir 	}
2069*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2070*cdf0e10cSrcweir 		aRef2.X()=((const SdrTransformRef2XItem*)pPoolItem)->GetValue();
2071*cdf0e10cSrcweir 	}
2072*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2073*cdf0e10cSrcweir 		aRef2.Y()=((const SdrTransformRef2YItem*)pPoolItem)->GetValue();
2074*cdf0e10cSrcweir 	}
2075*cdf0e10cSrcweir 
2076*cdf0e10cSrcweir 	Rectangle aNewSnap(rSnap);
2077*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_MOVEX,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2078*cdf0e10cSrcweir 		long n=((const SdrMoveXItem*)pPoolItem)->GetValue();
2079*cdf0e10cSrcweir 		aNewSnap.Move(n,0);
2080*cdf0e10cSrcweir 	}
2081*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_MOVEY,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2082*cdf0e10cSrcweir 		long n=((const SdrMoveYItem*)pPoolItem)->GetValue();
2083*cdf0e10cSrcweir 		aNewSnap.Move(0,n);
2084*cdf0e10cSrcweir 	}
2085*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ONEPOSITIONX,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2086*cdf0e10cSrcweir 		long n=((const SdrOnePositionXItem*)pPoolItem)->GetValue();
2087*cdf0e10cSrcweir 		aNewSnap.Move(n-aNewSnap.Left(),0);
2088*cdf0e10cSrcweir 	}
2089*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ONEPOSITIONY,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2090*cdf0e10cSrcweir 		long n=((const SdrOnePositionYItem*)pPoolItem)->GetValue();
2091*cdf0e10cSrcweir 		aNewSnap.Move(0,n-aNewSnap.Top());
2092*cdf0e10cSrcweir 	}
2093*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ONESIZEWIDTH,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2094*cdf0e10cSrcweir 		long n=((const SdrOneSizeWidthItem*)pPoolItem)->GetValue();
2095*cdf0e10cSrcweir 		aNewSnap.Right()=aNewSnap.Left()+n;
2096*cdf0e10cSrcweir 	}
2097*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ONESIZEHEIGHT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2098*cdf0e10cSrcweir 		long n=((const SdrOneSizeHeightItem*)pPoolItem)->GetValue();
2099*cdf0e10cSrcweir 		aNewSnap.Bottom()=aNewSnap.Top()+n;
2100*cdf0e10cSrcweir 	}
2101*cdf0e10cSrcweir 	if (aNewSnap!=rSnap) {
2102*cdf0e10cSrcweir 		if (aNewSnap.GetSize()==rSnap.GetSize()) {
2103*cdf0e10cSrcweir 			NbcMove(Size(aNewSnap.Left()-rSnap.Left(),aNewSnap.Top()-rSnap.Top()));
2104*cdf0e10cSrcweir 		} else {
2105*cdf0e10cSrcweir 			NbcSetSnapRect(aNewSnap);
2106*cdf0e10cSrcweir 		}
2107*cdf0e10cSrcweir 	}
2108*cdf0e10cSrcweir 
2109*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_SHEARANGLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2110*cdf0e10cSrcweir 		long n=((const SdrShearAngleItem*)pPoolItem)->GetValue();
2111*cdf0e10cSrcweir 		n-=GetShearAngle();
2112*cdf0e10cSrcweir 		if (n!=0) {
2113*cdf0e10cSrcweir 			double nTan=tan(n*nPi180);
2114*cdf0e10cSrcweir 			NbcShear(aRef1,n,nTan,sal_False);
2115*cdf0e10cSrcweir 		}
2116*cdf0e10cSrcweir 	}
2117*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ROTATEANGLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2118*cdf0e10cSrcweir 		long n=((const SdrRotateAngleItem*)pPoolItem)->GetValue();
2119*cdf0e10cSrcweir 		n-=GetRotateAngle();
2120*cdf0e10cSrcweir 		if (n!=0) {
2121*cdf0e10cSrcweir 			double nSin=sin(n*nPi180);
2122*cdf0e10cSrcweir 			double nCos=cos(n*nPi180);
2123*cdf0e10cSrcweir 			NbcRotate(aRef1,n,nSin,nCos);
2124*cdf0e10cSrcweir 		}
2125*cdf0e10cSrcweir 	}
2126*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ROTATEONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2127*cdf0e10cSrcweir 		long n=((const SdrRotateOneItem*)pPoolItem)->GetValue();
2128*cdf0e10cSrcweir 		double nSin=sin(n*nPi180);
2129*cdf0e10cSrcweir 		double nCos=cos(n*nPi180);
2130*cdf0e10cSrcweir 		NbcRotate(aRef1,n,nSin,nCos);
2131*cdf0e10cSrcweir 	}
2132*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_HORZSHEARONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2133*cdf0e10cSrcweir 		long n=((const SdrHorzShearOneItem*)pPoolItem)->GetValue();
2134*cdf0e10cSrcweir 		double nTan=tan(n*nPi180);
2135*cdf0e10cSrcweir 		NbcShear(aRef1,n,nTan,sal_False);
2136*cdf0e10cSrcweir 	}
2137*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_VERTSHEARONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2138*cdf0e10cSrcweir 		long n=((const SdrVertShearOneItem*)pPoolItem)->GetValue();
2139*cdf0e10cSrcweir 		double nTan=tan(n*nPi180);
2140*cdf0e10cSrcweir 		NbcShear(aRef1,n,nTan,sal_True);
2141*cdf0e10cSrcweir 	}
2142*cdf0e10cSrcweir 
2143*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_OBJMOVEPROTECT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2144*cdf0e10cSrcweir 		bool b=((const SdrObjMoveProtectItem*)pPoolItem)->GetValue();
2145*cdf0e10cSrcweir 		SetMoveProtect(b);
2146*cdf0e10cSrcweir 	}
2147*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_OBJSIZEPROTECT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2148*cdf0e10cSrcweir 		bool b=((const SdrObjSizeProtectItem*)pPoolItem)->GetValue();
2149*cdf0e10cSrcweir 		SetResizeProtect(b);
2150*cdf0e10cSrcweir 	}
2151*cdf0e10cSrcweir 
2152*cdf0e10cSrcweir 	/* #67368# move protect always sets size protect */
2153*cdf0e10cSrcweir 	if( IsMoveProtect() )
2154*cdf0e10cSrcweir 		SetResizeProtect( true );
2155*cdf0e10cSrcweir 
2156*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_OBJPRINTABLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2157*cdf0e10cSrcweir 		bool b=((const SdrObjPrintableItem*)pPoolItem)->GetValue();
2158*cdf0e10cSrcweir 		SetPrintable(b);
2159*cdf0e10cSrcweir 	}
2160*cdf0e10cSrcweir 
2161*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_OBJVISIBLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2162*cdf0e10cSrcweir 		bool b=((const SdrObjVisibleItem*)pPoolItem)->GetValue();
2163*cdf0e10cSrcweir 		SetVisible(b);
2164*cdf0e10cSrcweir 	}
2165*cdf0e10cSrcweir 
2166*cdf0e10cSrcweir 	SdrLayerID nLayer=SDRLAYER_NOTFOUND;
2167*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LAYERID,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2168*cdf0e10cSrcweir 		nLayer=((const SdrLayerIdItem*)pPoolItem)->GetValue();
2169*cdf0e10cSrcweir 	}
2170*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LAYERNAME,sal_True,&pPoolItem)==SFX_ITEM_SET && pModel!=NULL) {
2171*cdf0e10cSrcweir 		XubString aLayerName=((const SdrLayerNameItem*)pPoolItem)->GetValue();
2172*cdf0e10cSrcweir 		const SdrLayerAdmin* pLayAd=pPage!=NULL ? &pPage->GetLayerAdmin() : pModel!=NULL ? &pModel->GetLayerAdmin() : NULL;
2173*cdf0e10cSrcweir 		if (pLayAd!=NULL) {
2174*cdf0e10cSrcweir 			const SdrLayer* pLayer=pLayAd->GetLayer(aLayerName, sal_True);
2175*cdf0e10cSrcweir 			if (pLayer!=NULL) {
2176*cdf0e10cSrcweir 				nLayer=pLayer->GetID();
2177*cdf0e10cSrcweir 			}
2178*cdf0e10cSrcweir 		}
2179*cdf0e10cSrcweir 
2180*cdf0e10cSrcweir 	}
2181*cdf0e10cSrcweir 	if (nLayer!=SDRLAYER_NOTFOUND) {
2182*cdf0e10cSrcweir 		NbcSetLayer(nLayer);
2183*cdf0e10cSrcweir 	}
2184*cdf0e10cSrcweir 
2185*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_OBJECTNAME,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2186*cdf0e10cSrcweir 		XubString aName=((const SdrObjectNameItem*)pPoolItem)->GetValue();
2187*cdf0e10cSrcweir 		SetName(aName);
2188*cdf0e10cSrcweir 	}
2189*cdf0e10cSrcweir 	Rectangle aNewLogic(rLogic);
2190*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LOGICSIZEWIDTH,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2191*cdf0e10cSrcweir 		long n=((const SdrLogicSizeWidthItem*)pPoolItem)->GetValue();
2192*cdf0e10cSrcweir 		aNewLogic.Right()=aNewLogic.Left()+n;
2193*cdf0e10cSrcweir 	}
2194*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LOGICSIZEHEIGHT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2195*cdf0e10cSrcweir 		long n=((const SdrLogicSizeHeightItem*)pPoolItem)->GetValue();
2196*cdf0e10cSrcweir 		aNewLogic.Bottom()=aNewLogic.Top()+n;
2197*cdf0e10cSrcweir 	}
2198*cdf0e10cSrcweir 	if (aNewLogic!=rLogic) {
2199*cdf0e10cSrcweir 		NbcSetLogicRect(aNewLogic);
2200*cdf0e10cSrcweir 	}
2201*cdf0e10cSrcweir 	Fraction aResizeX(1,1);
2202*cdf0e10cSrcweir 	Fraction aResizeY(1,1);
2203*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_RESIZEXONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2204*cdf0e10cSrcweir 		aResizeX*=((const SdrResizeXOneItem*)pPoolItem)->GetValue();
2205*cdf0e10cSrcweir 	}
2206*cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_RESIZEYONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
2207*cdf0e10cSrcweir 		aResizeY*=((const SdrResizeYOneItem*)pPoolItem)->GetValue();
2208*cdf0e10cSrcweir 	}
2209*cdf0e10cSrcweir 	if (aResizeX!=Fraction(1,1) || aResizeY!=Fraction(1,1)) {
2210*cdf0e10cSrcweir 		NbcResize(aRef1,aResizeX,aResizeY);
2211*cdf0e10cSrcweir 	}
2212*cdf0e10cSrcweir }
2213*cdf0e10cSrcweir 
2214*cdf0e10cSrcweir void lcl_SetItem(SfxItemSet& rAttr, FASTBOOL bMerge, const SfxPoolItem& rItem)
2215*cdf0e10cSrcweir {
2216*cdf0e10cSrcweir 	if (bMerge) rAttr.MergeValue(rItem,sal_True);
2217*cdf0e10cSrcweir 	else rAttr.Put(rItem);
2218*cdf0e10cSrcweir }
2219*cdf0e10cSrcweir 
2220*cdf0e10cSrcweir void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const
2221*cdf0e10cSrcweir {
2222*cdf0e10cSrcweir 	const Rectangle& rSnap=GetSnapRect();
2223*cdf0e10cSrcweir 	const Rectangle& rLogic=GetLogicRect();
2224*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrObjMoveProtectItem(IsMoveProtect()));
2225*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrObjSizeProtectItem(IsResizeProtect()));
2226*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrObjPrintableItem(IsPrintable()));
2227*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrObjVisibleItem(IsVisible()));
2228*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrRotateAngleItem(GetRotateAngle()));
2229*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrShearAngleItem(GetShearAngle()));
2230*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrOneSizeWidthItem(rSnap.GetWidth()-1));
2231*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrOneSizeHeightItem(rSnap.GetHeight()-1));
2232*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrOnePositionXItem(rSnap.Left()));
2233*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrOnePositionYItem(rSnap.Top()));
2234*cdf0e10cSrcweir 	if (rLogic.GetWidth()!=rSnap.GetWidth()) {
2235*cdf0e10cSrcweir 		lcl_SetItem(rAttr,bMerge,SdrLogicSizeWidthItem(rLogic.GetWidth()-1));
2236*cdf0e10cSrcweir 	}
2237*cdf0e10cSrcweir 	if (rLogic.GetHeight()!=rSnap.GetHeight()) {
2238*cdf0e10cSrcweir 		lcl_SetItem(rAttr,bMerge,SdrLogicSizeHeightItem(rLogic.GetHeight()-1));
2239*cdf0e10cSrcweir 	}
2240*cdf0e10cSrcweir 	XubString aName(GetName());
2241*cdf0e10cSrcweir 
2242*cdf0e10cSrcweir 	if(aName.Len())
2243*cdf0e10cSrcweir 	{
2244*cdf0e10cSrcweir 		lcl_SetItem(rAttr, bMerge, SdrObjectNameItem(aName));
2245*cdf0e10cSrcweir 	}
2246*cdf0e10cSrcweir 
2247*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrLayerIdItem(GetLayer()));
2248*cdf0e10cSrcweir 	const SdrLayerAdmin* pLayAd=pPage!=NULL ? &pPage->GetLayerAdmin() : pModel!=NULL ? &pModel->GetLayerAdmin() : NULL;
2249*cdf0e10cSrcweir 	if (pLayAd!=NULL) {
2250*cdf0e10cSrcweir 		const SdrLayer* pLayer=pLayAd->GetLayerPerID(GetLayer());
2251*cdf0e10cSrcweir 		if (pLayer!=NULL) {
2252*cdf0e10cSrcweir 			lcl_SetItem(rAttr,bMerge,SdrLayerNameItem(pLayer->GetName()));
2253*cdf0e10cSrcweir 		}
2254*cdf0e10cSrcweir 	}
2255*cdf0e10cSrcweir 	Point aRef1(rSnap.Center());
2256*cdf0e10cSrcweir 	Point aRef2(aRef1); aRef2.Y()++;
2257*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrTransformRef1XItem(aRef1.X()));
2258*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrTransformRef1YItem(aRef1.Y()));
2259*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrTransformRef2XItem(aRef2.X()));
2260*cdf0e10cSrcweir 	lcl_SetItem(rAttr,bMerge,SdrTransformRef2YItem(aRef2.Y()));
2261*cdf0e10cSrcweir }
2262*cdf0e10cSrcweir 
2263*cdf0e10cSrcweir SfxStyleSheet* SdrObject::GetStyleSheet() const
2264*cdf0e10cSrcweir {
2265*cdf0e10cSrcweir 	return GetProperties().GetStyleSheet();
2266*cdf0e10cSrcweir }
2267*cdf0e10cSrcweir 
2268*cdf0e10cSrcweir void SdrObject::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
2269*cdf0e10cSrcweir {
2270*cdf0e10cSrcweir 	Rectangle aBoundRect0;
2271*cdf0e10cSrcweir 
2272*cdf0e10cSrcweir 	if(pUserCall)
2273*cdf0e10cSrcweir 		aBoundRect0 = GetLastBoundRect();
2274*cdf0e10cSrcweir 
2275*cdf0e10cSrcweir 	// #110094#-14 SendRepaintBroadcast();
2276*cdf0e10cSrcweir 	NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
2277*cdf0e10cSrcweir 	SetChanged();
2278*cdf0e10cSrcweir 	BroadcastObjectChange();
2279*cdf0e10cSrcweir 	SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0);
2280*cdf0e10cSrcweir }
2281*cdf0e10cSrcweir 
2282*cdf0e10cSrcweir void SdrObject::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
2283*cdf0e10cSrcweir {
2284*cdf0e10cSrcweir 	// only allow graphic and presentation styles for shapes
2285*cdf0e10cSrcweir 	if( pNewStyleSheet && (pNewStyleSheet->GetFamily() == SFX_STYLE_FAMILY_PARA) && (pNewStyleSheet->GetFamily() == SFX_STYLE_FAMILY_PAGE) )
2286*cdf0e10cSrcweir 		return;
2287*cdf0e10cSrcweir 
2288*cdf0e10cSrcweir 	GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
2289*cdf0e10cSrcweir }
2290*cdf0e10cSrcweir 
2291*cdf0e10cSrcweir // Das Broadcasting beim Setzen der Attribute wird vom AttrObj gemanagt
2292*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2293*cdf0e10cSrcweir 
2294*cdf0e10cSrcweir FASTBOOL SdrObject::IsNode() const
2295*cdf0e10cSrcweir {
2296*cdf0e10cSrcweir 	return sal_True;
2297*cdf0e10cSrcweir }
2298*cdf0e10cSrcweir 
2299*cdf0e10cSrcweir SdrGluePoint SdrObject::GetVertexGluePoint(sal_uInt16 nPosNum) const
2300*cdf0e10cSrcweir {
2301*cdf0e10cSrcweir 	// #i41936# Use SnapRect for default GluePoints
2302*cdf0e10cSrcweir 	const Rectangle aR(GetSnapRect());
2303*cdf0e10cSrcweir 	Point aPt;
2304*cdf0e10cSrcweir 
2305*cdf0e10cSrcweir 	switch(nPosNum)
2306*cdf0e10cSrcweir 	{
2307*cdf0e10cSrcweir 		case 0 : aPt = aR.TopCenter();    break;
2308*cdf0e10cSrcweir 		case 1 : aPt = aR.RightCenter();  break;
2309*cdf0e10cSrcweir 		case 2 : aPt = aR.BottomCenter(); break;
2310*cdf0e10cSrcweir 		case 3 : aPt = aR.LeftCenter();   break;
2311*cdf0e10cSrcweir 	}
2312*cdf0e10cSrcweir 
2313*cdf0e10cSrcweir 	aPt -= aR.Center();
2314*cdf0e10cSrcweir 	SdrGluePoint aGP(aPt);
2315*cdf0e10cSrcweir 	aGP.SetPercent(sal_False);
2316*cdf0e10cSrcweir 
2317*cdf0e10cSrcweir 	return aGP;
2318*cdf0e10cSrcweir }
2319*cdf0e10cSrcweir 
2320*cdf0e10cSrcweir SdrGluePoint SdrObject::GetCornerGluePoint(sal_uInt16 nPosNum) const
2321*cdf0e10cSrcweir {
2322*cdf0e10cSrcweir 	Rectangle aR(GetCurrentBoundRect());
2323*cdf0e10cSrcweir 	Point aPt;
2324*cdf0e10cSrcweir 	switch (nPosNum) {
2325*cdf0e10cSrcweir 		case 0 : aPt=aR.TopLeft();     break;
2326*cdf0e10cSrcweir 		case 1 : aPt=aR.TopRight();    break;
2327*cdf0e10cSrcweir 		case 2 : aPt=aR.BottomRight(); break;
2328*cdf0e10cSrcweir 		case 3 : aPt=aR.BottomLeft();  break;
2329*cdf0e10cSrcweir 	}
2330*cdf0e10cSrcweir 	aPt-=GetSnapRect().Center();
2331*cdf0e10cSrcweir 	SdrGluePoint aGP(aPt);
2332*cdf0e10cSrcweir 	aGP.SetPercent(sal_False);
2333*cdf0e10cSrcweir 	return aGP;
2334*cdf0e10cSrcweir }
2335*cdf0e10cSrcweir 
2336*cdf0e10cSrcweir const SdrGluePointList* SdrObject::GetGluePointList() const
2337*cdf0e10cSrcweir {
2338*cdf0e10cSrcweir 	if (pPlusData!=NULL) return pPlusData->pGluePoints;
2339*cdf0e10cSrcweir 	return NULL;
2340*cdf0e10cSrcweir }
2341*cdf0e10cSrcweir 
2342*cdf0e10cSrcweir //SdrGluePointList* SdrObject::GetGluePointList()
2343*cdf0e10cSrcweir //{
2344*cdf0e10cSrcweir //	if (pPlusData!=NULL) return pPlusData->pGluePoints;
2345*cdf0e10cSrcweir //	return NULL;
2346*cdf0e10cSrcweir //}
2347*cdf0e10cSrcweir 
2348*cdf0e10cSrcweir SdrGluePointList* SdrObject::ForceGluePointList()
2349*cdf0e10cSrcweir {
2350*cdf0e10cSrcweir 	ImpForcePlusData();
2351*cdf0e10cSrcweir 	if (pPlusData->pGluePoints==NULL) {
2352*cdf0e10cSrcweir 		pPlusData->pGluePoints=new SdrGluePointList;
2353*cdf0e10cSrcweir 	}
2354*cdf0e10cSrcweir 	return pPlusData->pGluePoints;
2355*cdf0e10cSrcweir }
2356*cdf0e10cSrcweir 
2357*cdf0e10cSrcweir void SdrObject::SetGlueReallyAbsolute(FASTBOOL bOn)
2358*cdf0e10cSrcweir {
2359*cdf0e10cSrcweir 	// erst Const-Aufruf um zu sehen, ob
2360*cdf0e10cSrcweir 	// ueberhaupt Klebepunkte da sind
2361*cdf0e10cSrcweir 	// const-Aufruf erzwingen!
2362*cdf0e10cSrcweir 	if (GetGluePointList()!=NULL) {
2363*cdf0e10cSrcweir 		SdrGluePointList* pGPL=ForceGluePointList();
2364*cdf0e10cSrcweir 		pGPL->SetReallyAbsolute(bOn,*this);
2365*cdf0e10cSrcweir 	}
2366*cdf0e10cSrcweir }
2367*cdf0e10cSrcweir 
2368*cdf0e10cSrcweir void SdrObject::NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs)
2369*cdf0e10cSrcweir {
2370*cdf0e10cSrcweir 	// erst Const-Aufruf um zu sehen, ob
2371*cdf0e10cSrcweir 	// ueberhaupt Klebepunkte da sind
2372*cdf0e10cSrcweir 	// const-Aufruf erzwingen!
2373*cdf0e10cSrcweir 	if (GetGluePointList()!=NULL) {
2374*cdf0e10cSrcweir 		SdrGluePointList* pGPL=ForceGluePointList();
2375*cdf0e10cSrcweir 		pGPL->Rotate(rRef,nWink,sn,cs,this);
2376*cdf0e10cSrcweir 	}
2377*cdf0e10cSrcweir }
2378*cdf0e10cSrcweir 
2379*cdf0e10cSrcweir void SdrObject::NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2)
2380*cdf0e10cSrcweir {
2381*cdf0e10cSrcweir 	// erst Const-Aufruf um zu sehen, ob
2382*cdf0e10cSrcweir 	// ueberhaupt Klebepunkte da sind
2383*cdf0e10cSrcweir 	// const-Aufruf erzwingen!
2384*cdf0e10cSrcweir 	if (GetGluePointList()!=NULL) {
2385*cdf0e10cSrcweir 		SdrGluePointList* pGPL=ForceGluePointList();
2386*cdf0e10cSrcweir 		pGPL->Mirror(rRef1,rRef2,this);
2387*cdf0e10cSrcweir 	}
2388*cdf0e10cSrcweir }
2389*cdf0e10cSrcweir 
2390*cdf0e10cSrcweir void SdrObject::NbcShearGluePoints(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
2391*cdf0e10cSrcweir {
2392*cdf0e10cSrcweir 	// erst Const-Aufruf um zu sehen, ob
2393*cdf0e10cSrcweir 	// ueberhaupt Klebepunkte da sind
2394*cdf0e10cSrcweir 	// const-Aufruf erzwingen!
2395*cdf0e10cSrcweir 	if (GetGluePointList()!=NULL) {
2396*cdf0e10cSrcweir 		SdrGluePointList* pGPL=ForceGluePointList();
2397*cdf0e10cSrcweir 		pGPL->Shear(rRef,nWink,tn,bVShear,this);
2398*cdf0e10cSrcweir 	}
2399*cdf0e10cSrcweir }
2400*cdf0e10cSrcweir 
2401*cdf0e10cSrcweir FASTBOOL SdrObject::IsEdge() const
2402*cdf0e10cSrcweir {
2403*cdf0e10cSrcweir 	return sal_False;
2404*cdf0e10cSrcweir }
2405*cdf0e10cSrcweir 
2406*cdf0e10cSrcweir void SdrObject::ConnectToNode(FASTBOOL /*bTail1*/, SdrObject* /*pObj*/)
2407*cdf0e10cSrcweir {
2408*cdf0e10cSrcweir }
2409*cdf0e10cSrcweir 
2410*cdf0e10cSrcweir void SdrObject::DisconnectFromNode(FASTBOOL /*bTail1*/)
2411*cdf0e10cSrcweir {
2412*cdf0e10cSrcweir }
2413*cdf0e10cSrcweir 
2414*cdf0e10cSrcweir SdrObject* SdrObject::GetConnectedNode(FASTBOOL /*bTail1*/) const
2415*cdf0e10cSrcweir {
2416*cdf0e10cSrcweir 	return NULL;
2417*cdf0e10cSrcweir }
2418*cdf0e10cSrcweir 
2419*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2420*cdf0e10cSrcweir 
2421*cdf0e10cSrcweir SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash) const
2422*cdf0e10cSrcweir {
2423*cdf0e10cSrcweir 	bool bNoChange(true);
2424*cdf0e10cSrcweir 
2425*cdf0e10cSrcweir 	if(pRet->LineGeometryUsageIsNecessary())
2426*cdf0e10cSrcweir 	{
2427*cdf0e10cSrcweir 		basegfx::B2DPolyPolygon aMergedLineFillPolyPolygon;
2428*cdf0e10cSrcweir 		basegfx::B2DPolyPolygon aMergedHairlinePolyPolygon;
2429*cdf0e10cSrcweir 		const drawinglayer::primitive2d::Primitive2DSequence xSequence(pRet->GetViewContact().getViewIndependentPrimitive2DSequence());
2430*cdf0e10cSrcweir 
2431*cdf0e10cSrcweir 		if(xSequence.hasElements())
2432*cdf0e10cSrcweir 		{
2433*cdf0e10cSrcweir 			// use neutral ViewInformation
2434*cdf0e10cSrcweir 			const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
2435*cdf0e10cSrcweir 
2436*cdf0e10cSrcweir 			// create extractor, process and get result
2437*cdf0e10cSrcweir 			drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D);
2438*cdf0e10cSrcweir 			aExtractor.process(xSequence);
2439*cdf0e10cSrcweir 
2440*cdf0e10cSrcweir 			// #i102241# check for line results
2441*cdf0e10cSrcweir 			const std::vector< basegfx::B2DPolygon >& rHairlineVector = aExtractor.getExtractedHairlines();
2442*cdf0e10cSrcweir 
2443*cdf0e10cSrcweir 			if(!rHairlineVector.empty())
2444*cdf0e10cSrcweir 			{
2445*cdf0e10cSrcweir 				// for SdrObject creation, just copy all to a single Hairline-PolyPolygon
2446*cdf0e10cSrcweir 				for(sal_uInt32 a(0); a < rHairlineVector.size(); a++)
2447*cdf0e10cSrcweir 				{
2448*cdf0e10cSrcweir 					aMergedHairlinePolyPolygon.append(rHairlineVector[a]);
2449*cdf0e10cSrcweir 				}
2450*cdf0e10cSrcweir 			}
2451*cdf0e10cSrcweir 
2452*cdf0e10cSrcweir 			// #i102241# check for fill rsults
2453*cdf0e10cSrcweir 			const std::vector< basegfx::B2DPolyPolygon >& rLineFillVector(aExtractor.getExtractedLineFills());
2454*cdf0e10cSrcweir 
2455*cdf0e10cSrcweir 			if(!rLineFillVector.empty())
2456*cdf0e10cSrcweir 			{
2457*cdf0e10cSrcweir 				// merge to a single PolyPolygon (OR)
2458*cdf0e10cSrcweir 				aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rLineFillVector);
2459*cdf0e10cSrcweir 			}
2460*cdf0e10cSrcweir 		}
2461*cdf0e10cSrcweir 
2462*cdf0e10cSrcweir 		//  || aMergedHairlinePolyPolygon.Count() removed; the conversion is ONLY
2463*cdf0e10cSrcweir 		// useful when new closed filled polygons are created
2464*cdf0e10cSrcweir 		if(aMergedLineFillPolyPolygon.count() || (bForceLineDash && aMergedHairlinePolyPolygon.count()))
2465*cdf0e10cSrcweir 		{
2466*cdf0e10cSrcweir 			SfxItemSet aSet(pRet->GetMergedItemSet());
2467*cdf0e10cSrcweir 			XFillStyle eOldFillStyle = ((const XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
2468*cdf0e10cSrcweir 			SdrPathObj* aLinePolygonPart = NULL;
2469*cdf0e10cSrcweir 			SdrPathObj* aLineHairlinePart = NULL;
2470*cdf0e10cSrcweir 			bool bBuildGroup(false);
2471*cdf0e10cSrcweir 
2472*cdf0e10cSrcweir 			if(aMergedLineFillPolyPolygon.count())
2473*cdf0e10cSrcweir 			{
2474*cdf0e10cSrcweir                 // create SdrObject for filled line geometry
2475*cdf0e10cSrcweir 				aLinePolygonPart = new SdrPathObj(OBJ_PATHFILL, aMergedLineFillPolyPolygon);
2476*cdf0e10cSrcweir 				aLinePolygonPart->SetModel(pRet->GetModel());
2477*cdf0e10cSrcweir 
2478*cdf0e10cSrcweir                 // correct item properties
2479*cdf0e10cSrcweir 				aSet.Put(XLineWidthItem(0L));
2480*cdf0e10cSrcweir 				aSet.Put(XLineStyleItem(XLINE_NONE));
2481*cdf0e10cSrcweir 				Color aColorLine = ((const XLineColorItem&)(aSet.Get(XATTR_LINECOLOR))).GetColorValue();
2482*cdf0e10cSrcweir 				sal_uInt16 nTransLine = ((const XLineTransparenceItem&)(aSet.Get(XATTR_LINETRANSPARENCE))).GetValue();
2483*cdf0e10cSrcweir 				aSet.Put(XFillColorItem(XubString(), aColorLine));
2484*cdf0e10cSrcweir 				aSet.Put(XFillStyleItem(XFILL_SOLID));
2485*cdf0e10cSrcweir 				aSet.Put(XFillTransparenceItem(nTransLine));
2486*cdf0e10cSrcweir 
2487*cdf0e10cSrcweir 				aLinePolygonPart->SetMergedItemSet(aSet);
2488*cdf0e10cSrcweir 			}
2489*cdf0e10cSrcweir 
2490*cdf0e10cSrcweir 			if(aMergedHairlinePolyPolygon.count())
2491*cdf0e10cSrcweir 			{
2492*cdf0e10cSrcweir                 // create SdrObject for hairline geometry
2493*cdf0e10cSrcweir 				// OBJ_PATHLINE is necessary here, not OBJ_PATHFILL. This is intended
2494*cdf0e10cSrcweir 				// to get a non-filled object. If the poly is closed, the PathObj takes care for
2495*cdf0e10cSrcweir 				// the correct closed state.
2496*cdf0e10cSrcweir 				aLineHairlinePart = new SdrPathObj(OBJ_PATHLINE, aMergedHairlinePolyPolygon);
2497*cdf0e10cSrcweir 				aLineHairlinePart->SetModel(pRet->GetModel());
2498*cdf0e10cSrcweir 
2499*cdf0e10cSrcweir 				aSet.Put(XLineWidthItem(0L));
2500*cdf0e10cSrcweir 				aSet.Put(XFillStyleItem(XFILL_NONE));
2501*cdf0e10cSrcweir 				aSet.Put(XLineStyleItem(XLINE_SOLID));
2502*cdf0e10cSrcweir 
2503*cdf0e10cSrcweir 				// it is also necessary to switch off line start and ends here
2504*cdf0e10cSrcweir 				aSet.Put(XLineStartWidthItem(0));
2505*cdf0e10cSrcweir 				aSet.Put(XLineEndWidthItem(0));
2506*cdf0e10cSrcweir 
2507*cdf0e10cSrcweir 				aLineHairlinePart->SetMergedItemSet(aSet);
2508*cdf0e10cSrcweir 
2509*cdf0e10cSrcweir 				if(aLinePolygonPart)
2510*cdf0e10cSrcweir                 {
2511*cdf0e10cSrcweir 					bBuildGroup = true;
2512*cdf0e10cSrcweir                 }
2513*cdf0e10cSrcweir 			}
2514*cdf0e10cSrcweir 
2515*cdf0e10cSrcweir 			// check if original geometry should be added (e.g. filled and closed)
2516*cdf0e10cSrcweir 			bool bAddOriginalGeometry(false);
2517*cdf0e10cSrcweir 			SdrPathObj* pPath = PTR_CAST(SdrPathObj, pRet);
2518*cdf0e10cSrcweir 
2519*cdf0e10cSrcweir             if(pPath && pPath->IsClosed())
2520*cdf0e10cSrcweir 			{
2521*cdf0e10cSrcweir 				if(eOldFillStyle != XFILL_NONE)
2522*cdf0e10cSrcweir 				{
2523*cdf0e10cSrcweir 					// #107600# use new boolean here
2524*cdf0e10cSrcweir 					bAddOriginalGeometry = true;
2525*cdf0e10cSrcweir 				}
2526*cdf0e10cSrcweir 			}
2527*cdf0e10cSrcweir 
2528*cdf0e10cSrcweir 			// do we need a group?
2529*cdf0e10cSrcweir 			if(bBuildGroup || bAddOriginalGeometry)
2530*cdf0e10cSrcweir 			{
2531*cdf0e10cSrcweir 				SdrObject* pGroup = new SdrObjGroup;
2532*cdf0e10cSrcweir 				pGroup->SetModel(pRet->GetModel());
2533*cdf0e10cSrcweir 
2534*cdf0e10cSrcweir 				if(bAddOriginalGeometry)
2535*cdf0e10cSrcweir 				{
2536*cdf0e10cSrcweir 					// Add a clone of the original geometry.
2537*cdf0e10cSrcweir 					aSet.ClearItem();
2538*cdf0e10cSrcweir 					aSet.Put(pRet->GetMergedItemSet());
2539*cdf0e10cSrcweir 					aSet.Put(XLineStyleItem(XLINE_NONE));
2540*cdf0e10cSrcweir 					aSet.Put(XLineWidthItem(0L));
2541*cdf0e10cSrcweir 
2542*cdf0e10cSrcweir 					SdrObject* pClone = pRet->Clone();
2543*cdf0e10cSrcweir 
2544*cdf0e10cSrcweir 					pClone->SetModel(pRet->GetModel());
2545*cdf0e10cSrcweir 					pClone->SetMergedItemSet(aSet);
2546*cdf0e10cSrcweir 
2547*cdf0e10cSrcweir 					pGroup->GetSubList()->NbcInsertObject(pClone);
2548*cdf0e10cSrcweir 				}
2549*cdf0e10cSrcweir 
2550*cdf0e10cSrcweir 				if(aLinePolygonPart)
2551*cdf0e10cSrcweir 				{
2552*cdf0e10cSrcweir 					pGroup->GetSubList()->NbcInsertObject(aLinePolygonPart);
2553*cdf0e10cSrcweir 				}
2554*cdf0e10cSrcweir 
2555*cdf0e10cSrcweir 				if(aLineHairlinePart)
2556*cdf0e10cSrcweir 				{
2557*cdf0e10cSrcweir 					pGroup->GetSubList()->NbcInsertObject(aLineHairlinePart);
2558*cdf0e10cSrcweir 				}
2559*cdf0e10cSrcweir 
2560*cdf0e10cSrcweir 				pRet = pGroup;
2561*cdf0e10cSrcweir 
2562*cdf0e10cSrcweir 				// be more careful with the state describing bool
2563*cdf0e10cSrcweir 				bNoChange = false;
2564*cdf0e10cSrcweir 			}
2565*cdf0e10cSrcweir 			else
2566*cdf0e10cSrcweir 			{
2567*cdf0e10cSrcweir 				if(aLinePolygonPart)
2568*cdf0e10cSrcweir 				{
2569*cdf0e10cSrcweir 					pRet = aLinePolygonPart;
2570*cdf0e10cSrcweir 					// be more careful with the state describing bool
2571*cdf0e10cSrcweir 					bNoChange = false;
2572*cdf0e10cSrcweir 				}
2573*cdf0e10cSrcweir 				else if(aLineHairlinePart)
2574*cdf0e10cSrcweir 				{
2575*cdf0e10cSrcweir 					pRet = aLineHairlinePart;
2576*cdf0e10cSrcweir 					// be more careful with the state describing bool
2577*cdf0e10cSrcweir 					bNoChange = false;
2578*cdf0e10cSrcweir 				}
2579*cdf0e10cSrcweir 			}
2580*cdf0e10cSrcweir 		}
2581*cdf0e10cSrcweir 	}
2582*cdf0e10cSrcweir 
2583*cdf0e10cSrcweir 	if(bNoChange)
2584*cdf0e10cSrcweir 	{
2585*cdf0e10cSrcweir         // due to current method usage, create and return a clone when nothing has changed
2586*cdf0e10cSrcweir 		SdrObject* pClone = pRet->Clone();
2587*cdf0e10cSrcweir 		pClone->SetModel(pRet->GetModel());
2588*cdf0e10cSrcweir 		pRet = pClone;
2589*cdf0e10cSrcweir 	}
2590*cdf0e10cSrcweir 
2591*cdf0e10cSrcweir 	return pRet;
2592*cdf0e10cSrcweir }
2593*cdf0e10cSrcweir 
2594*cdf0e10cSrcweir // convert this path object to contour object, even when it is a group
2595*cdf0e10cSrcweir SdrObject* SdrObject::ConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash) const
2596*cdf0e10cSrcweir {
2597*cdf0e10cSrcweir 	if(pRet->ISA(SdrObjGroup))
2598*cdf0e10cSrcweir 	{
2599*cdf0e10cSrcweir 		SdrObjList* pObjList2 = pRet->GetSubList();
2600*cdf0e10cSrcweir 		SdrObject* pGroup = new SdrObjGroup;
2601*cdf0e10cSrcweir 		pGroup->SetModel(pRet->GetModel());
2602*cdf0e10cSrcweir 
2603*cdf0e10cSrcweir 		for(sal_uInt32 a=0;a<pObjList2->GetObjCount();a++)
2604*cdf0e10cSrcweir 		{
2605*cdf0e10cSrcweir 			SdrObject* pIterObj = pObjList2->GetObj(a);
2606*cdf0e10cSrcweir 			pGroup->GetSubList()->NbcInsertObject(ConvertToContourObj(pIterObj, bForceLineDash));
2607*cdf0e10cSrcweir 		}
2608*cdf0e10cSrcweir 
2609*cdf0e10cSrcweir 		pRet = pGroup;
2610*cdf0e10cSrcweir 	}
2611*cdf0e10cSrcweir 	else
2612*cdf0e10cSrcweir 	{
2613*cdf0e10cSrcweir         if(pRet && pRet->ISA(SdrPathObj))
2614*cdf0e10cSrcweir         {
2615*cdf0e10cSrcweir             SdrPathObj* pPathObj = (SdrPathObj*)pRet;
2616*cdf0e10cSrcweir 
2617*cdf0e10cSrcweir             // bezier geometry got created, even for straight edges since the given
2618*cdf0e10cSrcweir             // object is a result of DoConvertToPolyObj. For conversion to contour
2619*cdf0e10cSrcweir             // this is not really needed and can be reduced again AFAP
2620*cdf0e10cSrcweir             pPathObj->SetPathPoly(basegfx::tools::simplifyCurveSegments(pPathObj->GetPathPoly()));
2621*cdf0e10cSrcweir         }
2622*cdf0e10cSrcweir 
2623*cdf0e10cSrcweir 		pRet = ImpConvertToContourObj(pRet, bForceLineDash);
2624*cdf0e10cSrcweir 	}
2625*cdf0e10cSrcweir 
2626*cdf0e10cSrcweir 	// #i73441# preserve LayerID
2627*cdf0e10cSrcweir 	if(pRet && pRet->GetLayer() != GetLayer())
2628*cdf0e10cSrcweir 	{
2629*cdf0e10cSrcweir 		pRet->SetLayer(GetLayer());
2630*cdf0e10cSrcweir 	}
2631*cdf0e10cSrcweir 
2632*cdf0e10cSrcweir 	return pRet;
2633*cdf0e10cSrcweir }
2634*cdf0e10cSrcweir 
2635*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2636*cdf0e10cSrcweir 
2637*cdf0e10cSrcweir SdrObject* SdrObject::ConvertToPolyObj(sal_Bool bBezier, sal_Bool bLineToArea) const
2638*cdf0e10cSrcweir {
2639*cdf0e10cSrcweir 	SdrObject* pRet = DoConvertToPolyObj(bBezier);
2640*cdf0e10cSrcweir 
2641*cdf0e10cSrcweir 	if(pRet && bLineToArea)
2642*cdf0e10cSrcweir 	{
2643*cdf0e10cSrcweir 		SdrObject* pNewRet = ConvertToContourObj(pRet);
2644*cdf0e10cSrcweir 		delete pRet;
2645*cdf0e10cSrcweir 		pRet = pNewRet;
2646*cdf0e10cSrcweir 	}
2647*cdf0e10cSrcweir 
2648*cdf0e10cSrcweir 	// #i73441# preserve LayerID
2649*cdf0e10cSrcweir 	if(pRet && pRet->GetLayer() != GetLayer())
2650*cdf0e10cSrcweir 	{
2651*cdf0e10cSrcweir 		pRet->SetLayer(GetLayer());
2652*cdf0e10cSrcweir 	}
2653*cdf0e10cSrcweir 
2654*cdf0e10cSrcweir 	return pRet;
2655*cdf0e10cSrcweir }
2656*cdf0e10cSrcweir 
2657*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2658*cdf0e10cSrcweir 
2659*cdf0e10cSrcweir SdrObject* SdrObject::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
2660*cdf0e10cSrcweir {
2661*cdf0e10cSrcweir 	return NULL;
2662*cdf0e10cSrcweir }
2663*cdf0e10cSrcweir 
2664*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2665*cdf0e10cSrcweir 
2666*cdf0e10cSrcweir void SdrObject::SetInserted(sal_Bool bIns)
2667*cdf0e10cSrcweir {
2668*cdf0e10cSrcweir 	if (bIns!=IsInserted()) {
2669*cdf0e10cSrcweir 		bInserted=bIns;
2670*cdf0e10cSrcweir 		Rectangle aBoundRect0(GetLastBoundRect());
2671*cdf0e10cSrcweir 		if (bIns) SendUserCall(SDRUSERCALL_INSERTED,aBoundRect0);
2672*cdf0e10cSrcweir 		else SendUserCall(SDRUSERCALL_REMOVED,aBoundRect0);
2673*cdf0e10cSrcweir 
2674*cdf0e10cSrcweir 		if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) { // #42522#
2675*cdf0e10cSrcweir 			SdrHint aHint(*this);
2676*cdf0e10cSrcweir 			aHint.SetKind(bIns?HINT_OBJINSERTED:HINT_OBJREMOVED);
2677*cdf0e10cSrcweir 			pPlusData->pBroadcast->Broadcast(aHint);
2678*cdf0e10cSrcweir 		}
2679*cdf0e10cSrcweir 	}
2680*cdf0e10cSrcweir }
2681*cdf0e10cSrcweir 
2682*cdf0e10cSrcweir void SdrObject::SetMoveProtect(sal_Bool bProt)
2683*cdf0e10cSrcweir {
2684*cdf0e10cSrcweir 	if(IsMoveProtect() != bProt)
2685*cdf0e10cSrcweir 	{
2686*cdf0e10cSrcweir 		// #i77187# secured and simplified
2687*cdf0e10cSrcweir 		bMovProt = bProt;
2688*cdf0e10cSrcweir 		SetChanged();
2689*cdf0e10cSrcweir 		BroadcastObjectChange();
2690*cdf0e10cSrcweir 	}
2691*cdf0e10cSrcweir }
2692*cdf0e10cSrcweir 
2693*cdf0e10cSrcweir void SdrObject::SetResizeProtect(sal_Bool bProt)
2694*cdf0e10cSrcweir {
2695*cdf0e10cSrcweir 	if(IsResizeProtect() != bProt)
2696*cdf0e10cSrcweir 	{
2697*cdf0e10cSrcweir 		// #i77187# secured and simplified
2698*cdf0e10cSrcweir 		bSizProt = bProt;
2699*cdf0e10cSrcweir 		SetChanged();
2700*cdf0e10cSrcweir 		BroadcastObjectChange();
2701*cdf0e10cSrcweir 	}
2702*cdf0e10cSrcweir }
2703*cdf0e10cSrcweir 
2704*cdf0e10cSrcweir void SdrObject::SetPrintable(sal_Bool bPrn)
2705*cdf0e10cSrcweir {
2706*cdf0e10cSrcweir 	if( bPrn == bNoPrint )
2707*cdf0e10cSrcweir 	{
2708*cdf0e10cSrcweir 		bNoPrint=!bPrn;
2709*cdf0e10cSrcweir 		SetChanged();
2710*cdf0e10cSrcweir 		if (IsInserted() && pModel!=NULL)
2711*cdf0e10cSrcweir 		{
2712*cdf0e10cSrcweir 			SdrHint aHint(*this);
2713*cdf0e10cSrcweir 			pModel->Broadcast(aHint);
2714*cdf0e10cSrcweir 		}
2715*cdf0e10cSrcweir 	}
2716*cdf0e10cSrcweir }
2717*cdf0e10cSrcweir 
2718*cdf0e10cSrcweir void SdrObject::SetVisible(sal_Bool bVisible)
2719*cdf0e10cSrcweir {
2720*cdf0e10cSrcweir 	if( bVisible != mbVisible )
2721*cdf0e10cSrcweir 	{
2722*cdf0e10cSrcweir 		mbVisible = bVisible;
2723*cdf0e10cSrcweir 		SetChanged();
2724*cdf0e10cSrcweir 		if (IsInserted() && pModel!=NULL)
2725*cdf0e10cSrcweir 		{
2726*cdf0e10cSrcweir 			SdrHint aHint(*this);
2727*cdf0e10cSrcweir 			pModel->Broadcast(aHint);
2728*cdf0e10cSrcweir 		}
2729*cdf0e10cSrcweir 	}
2730*cdf0e10cSrcweir }
2731*cdf0e10cSrcweir 
2732*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2733*cdf0e10cSrcweir 
2734*cdf0e10cSrcweir sal_uInt16 SdrObject::GetUserDataCount() const
2735*cdf0e10cSrcweir {
2736*cdf0e10cSrcweir 	if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return 0;
2737*cdf0e10cSrcweir 	return pPlusData->pUserDataList->GetUserDataCount();
2738*cdf0e10cSrcweir }
2739*cdf0e10cSrcweir 
2740*cdf0e10cSrcweir SdrObjUserData* SdrObject::GetUserData(sal_uInt16 nNum) const
2741*cdf0e10cSrcweir {
2742*cdf0e10cSrcweir 	if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return NULL;
2743*cdf0e10cSrcweir 	return pPlusData->pUserDataList->GetUserData(nNum);
2744*cdf0e10cSrcweir }
2745*cdf0e10cSrcweir 
2746*cdf0e10cSrcweir void SdrObject::InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos)
2747*cdf0e10cSrcweir {
2748*cdf0e10cSrcweir 	if (pData!=NULL) {
2749*cdf0e10cSrcweir 		ImpForcePlusData();
2750*cdf0e10cSrcweir 		if (pPlusData->pUserDataList==NULL) pPlusData->pUserDataList=new SdrObjUserDataList;
2751*cdf0e10cSrcweir 		pPlusData->pUserDataList->InsertUserData(pData,nPos);
2752*cdf0e10cSrcweir 	} else {
2753*cdf0e10cSrcweir 		DBG_ERROR("SdrObject::InsertUserData(): pData ist NULL-Pointer");
2754*cdf0e10cSrcweir 	}
2755*cdf0e10cSrcweir }
2756*cdf0e10cSrcweir 
2757*cdf0e10cSrcweir void SdrObject::DeleteUserData(sal_uInt16 nNum)
2758*cdf0e10cSrcweir {
2759*cdf0e10cSrcweir 	sal_uInt16 nAnz=GetUserDataCount();
2760*cdf0e10cSrcweir 	if (nNum<nAnz) {
2761*cdf0e10cSrcweir 		pPlusData->pUserDataList->DeleteUserData(nNum);
2762*cdf0e10cSrcweir 		if (nAnz==1)  {
2763*cdf0e10cSrcweir 			delete pPlusData->pUserDataList;
2764*cdf0e10cSrcweir 			pPlusData->pUserDataList=NULL;
2765*cdf0e10cSrcweir 		}
2766*cdf0e10cSrcweir 	} else {
2767*cdf0e10cSrcweir 		DBG_ERROR("SdrObject::DeleteUserData(): ungueltiger Index");
2768*cdf0e10cSrcweir 	}
2769*cdf0e10cSrcweir }
2770*cdf0e10cSrcweir 
2771*cdf0e10cSrcweir void SdrObject::SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const
2772*cdf0e10cSrcweir {
2773*cdf0e10cSrcweir 	SdrObjGroup* pGroup = NULL;
2774*cdf0e10cSrcweir 
2775*cdf0e10cSrcweir 	if( pObjList && pObjList->GetListKind() == SDROBJLIST_GROUPOBJ )
2776*cdf0e10cSrcweir 		pGroup = (SdrObjGroup*) pObjList->GetOwnerObj();
2777*cdf0e10cSrcweir 
2778*cdf0e10cSrcweir 	if ( pUserCall )
2779*cdf0e10cSrcweir 	{
2780*cdf0e10cSrcweir 		// UserCall ausfuehren
2781*cdf0e10cSrcweir 		pUserCall->Changed( *this, eUserCall, rBoundRect );
2782*cdf0e10cSrcweir 	}
2783*cdf0e10cSrcweir 
2784*cdf0e10cSrcweir 	while( pGroup )
2785*cdf0e10cSrcweir 	{
2786*cdf0e10cSrcweir 		// Gruppe benachrichtigen
2787*cdf0e10cSrcweir 		if( pGroup->GetUserCall() )
2788*cdf0e10cSrcweir 		{
2789*cdf0e10cSrcweir 			SdrUserCallType eChildUserType = SDRUSERCALL_CHILD_CHGATTR;
2790*cdf0e10cSrcweir 
2791*cdf0e10cSrcweir 			switch( eUserCall )
2792*cdf0e10cSrcweir 			{
2793*cdf0e10cSrcweir 				case SDRUSERCALL_MOVEONLY:
2794*cdf0e10cSrcweir 					eChildUserType = SDRUSERCALL_CHILD_MOVEONLY;
2795*cdf0e10cSrcweir 				break;
2796*cdf0e10cSrcweir 
2797*cdf0e10cSrcweir 				case SDRUSERCALL_RESIZE:
2798*cdf0e10cSrcweir 					eChildUserType = SDRUSERCALL_CHILD_RESIZE;
2799*cdf0e10cSrcweir 				break;
2800*cdf0e10cSrcweir 
2801*cdf0e10cSrcweir 				case SDRUSERCALL_CHGATTR:
2802*cdf0e10cSrcweir 					eChildUserType = SDRUSERCALL_CHILD_CHGATTR;
2803*cdf0e10cSrcweir 				break;
2804*cdf0e10cSrcweir 
2805*cdf0e10cSrcweir 				case SDRUSERCALL_DELETE:
2806*cdf0e10cSrcweir 					eChildUserType = SDRUSERCALL_CHILD_DELETE;
2807*cdf0e10cSrcweir 				break;
2808*cdf0e10cSrcweir 
2809*cdf0e10cSrcweir 				case SDRUSERCALL_COPY:
2810*cdf0e10cSrcweir 					eChildUserType = SDRUSERCALL_CHILD_COPY;
2811*cdf0e10cSrcweir 				break;
2812*cdf0e10cSrcweir 
2813*cdf0e10cSrcweir 				case SDRUSERCALL_INSERTED:
2814*cdf0e10cSrcweir 					eChildUserType = SDRUSERCALL_CHILD_INSERTED;
2815*cdf0e10cSrcweir 				break;
2816*cdf0e10cSrcweir 
2817*cdf0e10cSrcweir 				case SDRUSERCALL_REMOVED:
2818*cdf0e10cSrcweir 					eChildUserType = SDRUSERCALL_CHILD_REMOVED;
2819*cdf0e10cSrcweir 				break;
2820*cdf0e10cSrcweir 
2821*cdf0e10cSrcweir 				default: break;
2822*cdf0e10cSrcweir 			}
2823*cdf0e10cSrcweir 
2824*cdf0e10cSrcweir 			pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect );
2825*cdf0e10cSrcweir 		}
2826*cdf0e10cSrcweir 
2827*cdf0e10cSrcweir 		if( pGroup->GetObjList()                                       &&
2828*cdf0e10cSrcweir 			pGroup->GetObjList()->GetListKind() == SDROBJLIST_GROUPOBJ &&
2829*cdf0e10cSrcweir 			pGroup != (SdrObjGroup*) pObjList->GetOwnerObj() )
2830*cdf0e10cSrcweir 			pGroup = (SdrObjGroup*) pObjList->GetOwnerObj();
2831*cdf0e10cSrcweir 		else
2832*cdf0e10cSrcweir 			pGroup = NULL;
2833*cdf0e10cSrcweir 	}
2834*cdf0e10cSrcweir 
2835*cdf0e10cSrcweir     // notify our UNO shape listeners
2836*cdf0e10cSrcweir     switch ( eUserCall )
2837*cdf0e10cSrcweir     {
2838*cdf0e10cSrcweir     case SDRUSERCALL_RESIZE:
2839*cdf0e10cSrcweir         notifyShapePropertyChange( ::svx::eShapeSize );
2840*cdf0e10cSrcweir         // fall through - RESIZE might also imply a change of the position
2841*cdf0e10cSrcweir     case SDRUSERCALL_MOVEONLY:
2842*cdf0e10cSrcweir         notifyShapePropertyChange( ::svx::eShapePosition );
2843*cdf0e10cSrcweir         break;
2844*cdf0e10cSrcweir     default:
2845*cdf0e10cSrcweir         // not interested in
2846*cdf0e10cSrcweir         break;
2847*cdf0e10cSrcweir     }
2848*cdf0e10cSrcweir }
2849*cdf0e10cSrcweir 
2850*cdf0e10cSrcweir // ItemPool fuer dieses Objekt wechseln
2851*cdf0e10cSrcweir void SdrObject::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
2852*cdf0e10cSrcweir {
2853*cdf0e10cSrcweir 	if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
2854*cdf0e10cSrcweir 	{
2855*cdf0e10cSrcweir 		GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel);
2856*cdf0e10cSrcweir 	}
2857*cdf0e10cSrcweir }
2858*cdf0e10cSrcweir 
2859*cdf0e10cSrcweir sal_Bool SdrObject::IsTransparent( sal_Bool /*bCheckForAlphaChannel*/) const
2860*cdf0e10cSrcweir {
2861*cdf0e10cSrcweir 	bool bRet = false;
2862*cdf0e10cSrcweir 
2863*cdf0e10cSrcweir 	if( IsGroupObject() )
2864*cdf0e10cSrcweir 	{
2865*cdf0e10cSrcweir 		SdrObjListIter aIter( *GetSubList(), IM_DEEPNOGROUPS );
2866*cdf0e10cSrcweir 
2867*cdf0e10cSrcweir 		for( SdrObject*	pO = aIter.Next(); pO && !bRet; pO = aIter.Next() )
2868*cdf0e10cSrcweir 		{
2869*cdf0e10cSrcweir 			const SfxItemSet& rAttr = pO->GetMergedItemSet();
2870*cdf0e10cSrcweir 
2871*cdf0e10cSrcweir 			if( ( ( (const XFillTransparenceItem&) rAttr.Get( XATTR_FILLTRANSPARENCE ) ).GetValue() ||
2872*cdf0e10cSrcweir 				  ( (const XLineTransparenceItem&) rAttr.Get( XATTR_LINETRANSPARENCE ) ).GetValue()	) ||
2873*cdf0e10cSrcweir 				( ( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET ) &&
2874*cdf0e10cSrcweir 				  ( (const XFillFloatTransparenceItem&) rAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled() ) )
2875*cdf0e10cSrcweir 			{
2876*cdf0e10cSrcweir 				bRet = sal_True;
2877*cdf0e10cSrcweir 			}
2878*cdf0e10cSrcweir 			else if( pO->ISA( SdrGrafObj ) )
2879*cdf0e10cSrcweir 			{
2880*cdf0e10cSrcweir 				SdrGrafObj* pGrafObj = (SdrGrafObj*) pO;
2881*cdf0e10cSrcweir 				if( ( (const SdrGrafTransparenceItem&) rAttr.Get( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ||
2882*cdf0e10cSrcweir                     ( pGrafObj->GetGraphicType() == GRAPHIC_BITMAP && pGrafObj->GetGraphic().GetBitmapEx().IsAlpha() ) )
2883*cdf0e10cSrcweir 				{
2884*cdf0e10cSrcweir 					bRet = sal_True;
2885*cdf0e10cSrcweir 				}
2886*cdf0e10cSrcweir 			}
2887*cdf0e10cSrcweir 		}
2888*cdf0e10cSrcweir 	}
2889*cdf0e10cSrcweir 	else
2890*cdf0e10cSrcweir 	{
2891*cdf0e10cSrcweir 		const SfxItemSet& rAttr = GetMergedItemSet();
2892*cdf0e10cSrcweir 
2893*cdf0e10cSrcweir 		if( ( ( (const XFillTransparenceItem&) rAttr.Get( XATTR_FILLTRANSPARENCE ) ).GetValue() ||
2894*cdf0e10cSrcweir 			  ( (const XLineTransparenceItem&) rAttr.Get( XATTR_LINETRANSPARENCE ) ).GetValue()	) ||
2895*cdf0e10cSrcweir 			( ( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET ) &&
2896*cdf0e10cSrcweir 			  ( (const XFillFloatTransparenceItem&) rAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled() ) )
2897*cdf0e10cSrcweir 		{
2898*cdf0e10cSrcweir 			bRet = sal_True;
2899*cdf0e10cSrcweir 		}
2900*cdf0e10cSrcweir 		else if( ISA( SdrGrafObj ) )
2901*cdf0e10cSrcweir 		{
2902*cdf0e10cSrcweir 			SdrGrafObj* pGrafObj = (SdrGrafObj*) this;
2903*cdf0e10cSrcweir 
2904*cdf0e10cSrcweir 			// #i25616#
2905*cdf0e10cSrcweir 			bRet = pGrafObj->IsObjectTransparent();
2906*cdf0e10cSrcweir 		}
2907*cdf0e10cSrcweir 	}
2908*cdf0e10cSrcweir 
2909*cdf0e10cSrcweir 	return bRet;
2910*cdf0e10cSrcweir }
2911*cdf0e10cSrcweir 
2912*cdf0e10cSrcweir void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUnoShape )
2913*cdf0e10cSrcweir {
2914*cdf0e10cSrcweir 	maWeakUnoShape = _rxUnoShape;
2915*cdf0e10cSrcweir 	mpSvxShape = SvxShape::getImplementation( _rxUnoShape );
2916*cdf0e10cSrcweir //    OSL_ENSURE( mpSvxShape || !_rxUnoShape.is(),
2917*cdf0e10cSrcweir //        "SdrObject::setUnoShape: not sure it's a good idea to have an XShape which is not implemented by SvxShape ..." );
2918*cdf0e10cSrcweir }
2919*cdf0e10cSrcweir 
2920*cdf0e10cSrcweir /** only for internal use! */
2921*cdf0e10cSrcweir SvxShape* SdrObject::getSvxShape() const
2922*cdf0e10cSrcweir {
2923*cdf0e10cSrcweir     DBG_TESTSOLARMUTEX();
2924*cdf0e10cSrcweir         // retrieving the impl pointer and subsequently using it is not thread-safe, of course, so it needs to be
2925*cdf0e10cSrcweir         // guarded by the SolarMutex
2926*cdf0e10cSrcweir 
2927*cdf0e10cSrcweir #if OSL_DEBUG_LEVE > 0
2928*cdf0e10cSrcweir     uno::Reference< uno::XInterface > xShape( maWeakUnoShape );
2929*cdf0e10cSrcweir     OSL_ENSURE( !( !xShapeGuard.is() && mpSvxShape ),
2930*cdf0e10cSrcweir         "SdrObject::getSvxShape: still having IMPL-Pointer to dead object!" );
2931*cdf0e10cSrcweir #endif
2932*cdf0e10cSrcweir 
2933*cdf0e10cSrcweir 	return mpSvxShape;
2934*cdf0e10cSrcweir }
2935*cdf0e10cSrcweir 
2936*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SdrObject::getUnoShape()
2937*cdf0e10cSrcweir {
2938*cdf0e10cSrcweir 	// try weak reference first
2939*cdf0e10cSrcweir 	uno::Reference< uno::XInterface > xShape( getWeakUnoShape() );
2940*cdf0e10cSrcweir 	if( !xShape.is() )
2941*cdf0e10cSrcweir 	{
2942*cdf0e10cSrcweir         OSL_ENSURE( mpSvxShape == NULL, "SdrObject::getUnoShape: XShape already dead, but still an IMPL pointer!" );
2943*cdf0e10cSrcweir 		if ( pPage )
2944*cdf0e10cSrcweir 		{
2945*cdf0e10cSrcweir 			uno::Reference< uno::XInterface > xPage( pPage->getUnoPage() );
2946*cdf0e10cSrcweir 			if( xPage.is() )
2947*cdf0e10cSrcweir 			{
2948*cdf0e10cSrcweir 				SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation(xPage);
2949*cdf0e10cSrcweir 				if( pDrawPage )
2950*cdf0e10cSrcweir 				{
2951*cdf0e10cSrcweir 					// create one
2952*cdf0e10cSrcweir                     xShape = pDrawPage->_CreateShape( this );
2953*cdf0e10cSrcweir                     impl_setUnoShape( xShape );
2954*cdf0e10cSrcweir 				}
2955*cdf0e10cSrcweir 			}
2956*cdf0e10cSrcweir 		}
2957*cdf0e10cSrcweir 		else
2958*cdf0e10cSrcweir 		{
2959*cdf0e10cSrcweir 			mpSvxShape = SvxDrawPage::CreateShapeByTypeAndInventor( GetObjIdentifier(), GetObjInventor(), this, NULL );
2960*cdf0e10cSrcweir 			maWeakUnoShape = xShape = static_cast< ::cppu::OWeakObject* >( mpSvxShape );
2961*cdf0e10cSrcweir 		}
2962*cdf0e10cSrcweir 	}
2963*cdf0e10cSrcweir 
2964*cdf0e10cSrcweir 	return xShape;
2965*cdf0e10cSrcweir }
2966*cdf0e10cSrcweir 
2967*cdf0e10cSrcweir ::svx::PropertyChangeNotifier& SdrObject::getShapePropertyChangeNotifier()
2968*cdf0e10cSrcweir {
2969*cdf0e10cSrcweir     DBG_TESTSOLARMUTEX();
2970*cdf0e10cSrcweir 
2971*cdf0e10cSrcweir     SvxShape* pSvxShape = getSvxShape();
2972*cdf0e10cSrcweir     ENSURE_OR_THROW( pSvxShape, "no SvxShape, yet!" );
2973*cdf0e10cSrcweir     return pSvxShape->getShapePropertyChangeNotifier();
2974*cdf0e10cSrcweir }
2975*cdf0e10cSrcweir 
2976*cdf0e10cSrcweir void SdrObject::notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const
2977*cdf0e10cSrcweir {
2978*cdf0e10cSrcweir     DBG_TESTSOLARMUTEX();
2979*cdf0e10cSrcweir 
2980*cdf0e10cSrcweir     SvxShape* pSvxShape = const_cast< SdrObject* >( this )->getSvxShape();
2981*cdf0e10cSrcweir     if ( pSvxShape )
2982*cdf0e10cSrcweir         return pSvxShape->getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty );
2983*cdf0e10cSrcweir }
2984*cdf0e10cSrcweir 
2985*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2986*cdf0e10cSrcweir //
2987*cdf0e10cSrcweir // transformation interface for StarOfficeAPI. This implements support for
2988*cdf0e10cSrcweir // homogen 3x3 matrices containing the transformation of the SdrObject. At the
2989*cdf0e10cSrcweir // moment it contains a shearX, rotation and translation, but for setting all linear
2990*cdf0e10cSrcweir // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
2991*cdf0e10cSrcweir //
2992*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
2993*cdf0e10cSrcweir // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
2994*cdf0e10cSrcweir // with the base geometry and returns TRUE. Otherwise it returns FALSE.
2995*cdf0e10cSrcweir sal_Bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
2996*cdf0e10cSrcweir {
2997*cdf0e10cSrcweir 	// any kind of SdrObject, just use SnapRect
2998*cdf0e10cSrcweir 	Rectangle aRectangle(GetSnapRect());
2999*cdf0e10cSrcweir 
3000*cdf0e10cSrcweir 	// convert to transformation values
3001*cdf0e10cSrcweir 	basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
3002*cdf0e10cSrcweir 	basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
3003*cdf0e10cSrcweir 
3004*cdf0e10cSrcweir 	// position maybe relative to anchorpos, convert
3005*cdf0e10cSrcweir 	if( pModel && pModel->IsWriter() )
3006*cdf0e10cSrcweir 	{
3007*cdf0e10cSrcweir 		if(GetAnchorPos().X() || GetAnchorPos().Y())
3008*cdf0e10cSrcweir 		{
3009*cdf0e10cSrcweir 			aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
3010*cdf0e10cSrcweir 		}
3011*cdf0e10cSrcweir 	}
3012*cdf0e10cSrcweir 
3013*cdf0e10cSrcweir 	// force MapUnit to 100th mm
3014*cdf0e10cSrcweir 	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
3015*cdf0e10cSrcweir 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
3016*cdf0e10cSrcweir 	{
3017*cdf0e10cSrcweir 		switch(eMapUnit)
3018*cdf0e10cSrcweir 		{
3019*cdf0e10cSrcweir 			case SFX_MAPUNIT_TWIP :
3020*cdf0e10cSrcweir 			{
3021*cdf0e10cSrcweir 				// postion
3022*cdf0e10cSrcweir 				aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
3023*cdf0e10cSrcweir 				aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
3024*cdf0e10cSrcweir 
3025*cdf0e10cSrcweir 				// size
3026*cdf0e10cSrcweir 				aScale.setX(ImplTwipsToMM(aScale.getX()));
3027*cdf0e10cSrcweir 				aScale.setY(ImplTwipsToMM(aScale.getY()));
3028*cdf0e10cSrcweir 
3029*cdf0e10cSrcweir 				break;
3030*cdf0e10cSrcweir 			}
3031*cdf0e10cSrcweir 			default:
3032*cdf0e10cSrcweir 			{
3033*cdf0e10cSrcweir 				DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!");
3034*cdf0e10cSrcweir 			}
3035*cdf0e10cSrcweir 		}
3036*cdf0e10cSrcweir 	}
3037*cdf0e10cSrcweir 
3038*cdf0e10cSrcweir 	// build matrix
3039*cdf0e10cSrcweir 	rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate);
3040*cdf0e10cSrcweir 
3041*cdf0e10cSrcweir 	return sal_False;
3042*cdf0e10cSrcweir }
3043*cdf0e10cSrcweir 
3044*cdf0e10cSrcweir // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
3045*cdf0e10cSrcweir // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
3046*cdf0e10cSrcweir // to use (0,0) as upper left and will be scaled to the given size in the matrix.
3047*cdf0e10cSrcweir void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
3048*cdf0e10cSrcweir {
3049*cdf0e10cSrcweir 	// break up matrix
3050*cdf0e10cSrcweir 	basegfx::B2DTuple aScale;
3051*cdf0e10cSrcweir 	basegfx::B2DTuple aTranslate;
3052*cdf0e10cSrcweir 	double fRotate, fShearX;
3053*cdf0e10cSrcweir 	rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
3054*cdf0e10cSrcweir 
3055*cdf0e10cSrcweir 	// #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
3056*cdf0e10cSrcweir 	// in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
3057*cdf0e10cSrcweir 	if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
3058*cdf0e10cSrcweir 	{
3059*cdf0e10cSrcweir 		aScale.setX(fabs(aScale.getX()));
3060*cdf0e10cSrcweir 		aScale.setY(fabs(aScale.getY()));
3061*cdf0e10cSrcweir 		fRotate = fmod(fRotate + F_PI, F_2PI);
3062*cdf0e10cSrcweir 	}
3063*cdf0e10cSrcweir 
3064*cdf0e10cSrcweir 	// force metric to pool metric
3065*cdf0e10cSrcweir 	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
3066*cdf0e10cSrcweir 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
3067*cdf0e10cSrcweir 	{
3068*cdf0e10cSrcweir 		switch(eMapUnit)
3069*cdf0e10cSrcweir 		{
3070*cdf0e10cSrcweir 			case SFX_MAPUNIT_TWIP :
3071*cdf0e10cSrcweir 			{
3072*cdf0e10cSrcweir 				// position
3073*cdf0e10cSrcweir 				aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
3074*cdf0e10cSrcweir 				aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
3075*cdf0e10cSrcweir 
3076*cdf0e10cSrcweir 				// size
3077*cdf0e10cSrcweir 				aScale.setX(ImplMMToTwips(aScale.getX()));
3078*cdf0e10cSrcweir 				aScale.setY(ImplMMToTwips(aScale.getY()));
3079*cdf0e10cSrcweir 
3080*cdf0e10cSrcweir 				break;
3081*cdf0e10cSrcweir 			}
3082*cdf0e10cSrcweir 			default:
3083*cdf0e10cSrcweir 			{
3084*cdf0e10cSrcweir 				DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
3085*cdf0e10cSrcweir 			}
3086*cdf0e10cSrcweir 		}
3087*cdf0e10cSrcweir 	}
3088*cdf0e10cSrcweir 
3089*cdf0e10cSrcweir 	// if anchor is used, make position relative to it
3090*cdf0e10cSrcweir 	if( pModel && pModel->IsWriter() )
3091*cdf0e10cSrcweir 	{
3092*cdf0e10cSrcweir 		if(GetAnchorPos().X() || GetAnchorPos().Y())
3093*cdf0e10cSrcweir 		{
3094*cdf0e10cSrcweir 			aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
3095*cdf0e10cSrcweir 		}
3096*cdf0e10cSrcweir 	}
3097*cdf0e10cSrcweir 
3098*cdf0e10cSrcweir 	// build BaseRect
3099*cdf0e10cSrcweir 	Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
3100*cdf0e10cSrcweir 	Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
3101*cdf0e10cSrcweir 
3102*cdf0e10cSrcweir 	// set BaseRect
3103*cdf0e10cSrcweir 	SetSnapRect(aBaseRect);
3104*cdf0e10cSrcweir }
3105*cdf0e10cSrcweir 
3106*cdf0e10cSrcweir // #116168#
3107*cdf0e10cSrcweir // Give info if object is in destruction
3108*cdf0e10cSrcweir sal_Bool SdrObject::IsInDestruction() const
3109*cdf0e10cSrcweir {
3110*cdf0e10cSrcweir 	if(pModel)
3111*cdf0e10cSrcweir 		return pModel->IsInDestruction();
3112*cdf0e10cSrcweir 	return sal_False;
3113*cdf0e10cSrcweir }
3114*cdf0e10cSrcweir 
3115*cdf0e10cSrcweir // return if fill is != XFILL_NONE
3116*cdf0e10cSrcweir bool SdrObject::HasFillStyle() const
3117*cdf0e10cSrcweir {
3118*cdf0e10cSrcweir 	return (((const XFillStyleItem&)GetObjectItem(XATTR_FILLSTYLE)).GetValue() != XFILL_NONE);
3119*cdf0e10cSrcweir }
3120*cdf0e10cSrcweir 
3121*cdf0e10cSrcweir bool SdrObject::HasLineStyle() const
3122*cdf0e10cSrcweir {
3123*cdf0e10cSrcweir 	return (((const XLineStyleItem&)GetObjectItem(XATTR_LINESTYLE)).GetValue() != XLINE_NONE);
3124*cdf0e10cSrcweir }
3125*cdf0e10cSrcweir 
3126*cdf0e10cSrcweir 
3127*cdf0e10cSrcweir // #i52224#
3128*cdf0e10cSrcweir // on import of OLE object from MS documents the BLIP size might be retrieved,
3129*cdf0e10cSrcweir // the following four methods are used to control it;
3130*cdf0e10cSrcweir // usually this data makes no sence after the import is finished, since the object
3131*cdf0e10cSrcweir // might be resized
3132*cdf0e10cSrcweir 
3133*cdf0e10cSrcweir Rectangle SdrObject::GetBLIPSizeRectangle() const
3134*cdf0e10cSrcweir {
3135*cdf0e10cSrcweir 	return maBLIPSizeRectangle;
3136*cdf0e10cSrcweir }
3137*cdf0e10cSrcweir 
3138*cdf0e10cSrcweir void SdrObject::SetBLIPSizeRectangle( const Rectangle& aRect )
3139*cdf0e10cSrcweir {
3140*cdf0e10cSrcweir 	maBLIPSizeRectangle = aRect;
3141*cdf0e10cSrcweir }
3142*cdf0e10cSrcweir 
3143*cdf0e10cSrcweir void SdrObject::SetContextWritingMode( const sal_Int16 /*_nContextWritingMode*/ )
3144*cdf0e10cSrcweir {
3145*cdf0e10cSrcweir     // this base class does not support different writing modes, so ignore the call
3146*cdf0e10cSrcweir }
3147*cdf0e10cSrcweir 
3148*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
3149*cdf0e10cSrcweir //
3150*cdf0e10cSrcweir //   @@@@  @@@@@  @@@@@@  @@@@@  @@@@   @@@@  @@@@@@  @@@@  @@@@@  @@  @@
3151*cdf0e10cSrcweir //  @@  @@ @@  @@     @@  @@    @@  @@ @@  @@   @@   @@  @@ @@  @@ @@  @@
3152*cdf0e10cSrcweir //  @@  @@ @@  @@     @@  @@    @@  @@ @@       @@   @@  @@ @@  @@ @@  @@
3153*cdf0e10cSrcweir //  @@  @@ @@@@@      @@  @@@@  @@@@@@ @@       @@   @@  @@ @@@@@   @@@@
3154*cdf0e10cSrcweir //  @@  @@ @@  @@     @@  @@    @@  @@ @@       @@   @@  @@ @@  @@   @@
3155*cdf0e10cSrcweir //  @@  @@ @@  @@ @@  @@  @@    @@  @@ @@  @@   @@   @@  @@ @@  @@   @@
3156*cdf0e10cSrcweir //   @@@@  @@@@@   @@@@   @@    @@  @@  @@@@    @@    @@@@  @@  @@   @@
3157*cdf0e10cSrcweir //
3158*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
3159*cdf0e10cSrcweir 
3160*cdf0e10cSrcweir SdrObjFactory::SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel)
3161*cdf0e10cSrcweir {
3162*cdf0e10cSrcweir 	nInventor=nInvent;
3163*cdf0e10cSrcweir 	nIdentifier=nIdent;
3164*cdf0e10cSrcweir 	pNewObj=NULL;
3165*cdf0e10cSrcweir 	pPage=pNewPage;
3166*cdf0e10cSrcweir 	pModel=pNewModel;
3167*cdf0e10cSrcweir 	pObj=NULL;
3168*cdf0e10cSrcweir 	pNewData=NULL;
3169*cdf0e10cSrcweir }
3170*cdf0e10cSrcweir 
3171*cdf0e10cSrcweir SdrObjFactory::SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1)
3172*cdf0e10cSrcweir {
3173*cdf0e10cSrcweir 	nInventor=nInvent;
3174*cdf0e10cSrcweir 	nIdentifier=nIdent;
3175*cdf0e10cSrcweir 	pNewObj=NULL;
3176*cdf0e10cSrcweir 	pPage=NULL;
3177*cdf0e10cSrcweir 	pModel=NULL;
3178*cdf0e10cSrcweir 	pObj=pObj1;
3179*cdf0e10cSrcweir 	pNewData=NULL;
3180*cdf0e10cSrcweir }
3181*cdf0e10cSrcweir 
3182*cdf0e10cSrcweir SdrObject* SdrObjFactory::MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel)
3183*cdf0e10cSrcweir {
3184*cdf0e10cSrcweir 	if(pModel == NULL && pPage != NULL)
3185*cdf0e10cSrcweir 		pModel = pPage->GetModel();
3186*cdf0e10cSrcweir 	SdrObject* pObj = NULL;
3187*cdf0e10cSrcweir 
3188*cdf0e10cSrcweir 	if(nInvent == SdrInventor)
3189*cdf0e10cSrcweir 	{
3190*cdf0e10cSrcweir 		switch (nIdent)
3191*cdf0e10cSrcweir 		{
3192*cdf0e10cSrcweir 			case sal_uInt16(OBJ_NONE       ): pObj=new SdrObject;                   break;
3193*cdf0e10cSrcweir 			case sal_uInt16(OBJ_GRUP       ): pObj=new SdrObjGroup;                 break;
3194*cdf0e10cSrcweir 			case sal_uInt16(OBJ_LINE       ): pObj=new SdrPathObj(OBJ_LINE       ); break;
3195*cdf0e10cSrcweir 			case sal_uInt16(OBJ_POLY       ): pObj=new SdrPathObj(OBJ_POLY       ); break;
3196*cdf0e10cSrcweir 			case sal_uInt16(OBJ_PLIN       ): pObj=new SdrPathObj(OBJ_PLIN       ); break;
3197*cdf0e10cSrcweir 			case sal_uInt16(OBJ_PATHLINE   ): pObj=new SdrPathObj(OBJ_PATHLINE   ); break;
3198*cdf0e10cSrcweir 			case sal_uInt16(OBJ_PATHFILL   ): pObj=new SdrPathObj(OBJ_PATHFILL   ); break;
3199*cdf0e10cSrcweir 			case sal_uInt16(OBJ_FREELINE   ): pObj=new SdrPathObj(OBJ_FREELINE   ); break;
3200*cdf0e10cSrcweir 			case sal_uInt16(OBJ_FREEFILL   ): pObj=new SdrPathObj(OBJ_FREEFILL   ); break;
3201*cdf0e10cSrcweir 			case sal_uInt16(OBJ_PATHPOLY   ): pObj=new SdrPathObj(OBJ_POLY       ); break;
3202*cdf0e10cSrcweir 			case sal_uInt16(OBJ_PATHPLIN   ): pObj=new SdrPathObj(OBJ_PLIN       ); break;
3203*cdf0e10cSrcweir 			case sal_uInt16(OBJ_EDGE       ): pObj=new SdrEdgeObj;                  break;
3204*cdf0e10cSrcweir 			case sal_uInt16(OBJ_RECT       ): pObj=new SdrRectObj;                  break;
3205*cdf0e10cSrcweir 			case sal_uInt16(OBJ_CIRC       ): pObj=new SdrCircObj(OBJ_CIRC       ); break;
3206*cdf0e10cSrcweir 			case sal_uInt16(OBJ_SECT       ): pObj=new SdrCircObj(OBJ_SECT       ); break;
3207*cdf0e10cSrcweir 			case sal_uInt16(OBJ_CARC       ): pObj=new SdrCircObj(OBJ_CARC       ); break;
3208*cdf0e10cSrcweir 			case sal_uInt16(OBJ_CCUT       ): pObj=new SdrCircObj(OBJ_CCUT       ); break;
3209*cdf0e10cSrcweir 			case sal_uInt16(OBJ_TEXT       ): pObj=new SdrRectObj(OBJ_TEXT       ); break;
3210*cdf0e10cSrcweir 			case sal_uInt16(OBJ_TEXTEXT    ): pObj=new SdrRectObj(OBJ_TEXTEXT    ); break;
3211*cdf0e10cSrcweir 			case sal_uInt16(OBJ_TITLETEXT  ): pObj=new SdrRectObj(OBJ_TITLETEXT  ); break;
3212*cdf0e10cSrcweir 			case sal_uInt16(OBJ_OUTLINETEXT): pObj=new SdrRectObj(OBJ_OUTLINETEXT); break;
3213*cdf0e10cSrcweir 			case sal_uInt16(OBJ_MEASURE    ): pObj=new SdrMeasureObj;               break;
3214*cdf0e10cSrcweir 			case sal_uInt16(OBJ_GRAF       ): pObj=new SdrGrafObj;                  break;
3215*cdf0e10cSrcweir 			case sal_uInt16(OBJ_OLE2       ): pObj=new SdrOle2Obj;                  break;
3216*cdf0e10cSrcweir 			case sal_uInt16(OBJ_FRAME      ): pObj=new SdrOle2Obj(sal_True);            break;
3217*cdf0e10cSrcweir 			case sal_uInt16(OBJ_CAPTION    ): pObj=new SdrCaptionObj;               break;
3218*cdf0e10cSrcweir 			case sal_uInt16(OBJ_PAGE       ): pObj=new SdrPageObj;                  break;
3219*cdf0e10cSrcweir 			case sal_uInt16(OBJ_UNO        ): pObj=new SdrUnoObj(String());			break;
3220*cdf0e10cSrcweir 			case sal_uInt16(OBJ_CUSTOMSHAPE  ): pObj=new SdrObjCustomShape();       break;
3221*cdf0e10cSrcweir 			case sal_uInt16(OBJ_MEDIA 	   ): pObj=new SdrMediaObj();           	break;
3222*cdf0e10cSrcweir 			case sal_uInt16(OBJ_TABLE	   ): pObj=new ::sdr::table::SdrTableObj(pModel);	break;
3223*cdf0e10cSrcweir 		}
3224*cdf0e10cSrcweir 	}
3225*cdf0e10cSrcweir 
3226*cdf0e10cSrcweir 	if(pObj == NULL)
3227*cdf0e10cSrcweir 	{
3228*cdf0e10cSrcweir 		SdrObjFactory* pFact=new SdrObjFactory(nInvent,nIdent,pPage,pModel);
3229*cdf0e10cSrcweir 		SdrLinkList& rLL=ImpGetUserMakeObjHdl();
3230*cdf0e10cSrcweir 		unsigned nAnz=rLL.GetLinkCount();
3231*cdf0e10cSrcweir 		unsigned i=0;
3232*cdf0e10cSrcweir 		while (i<nAnz && pObj==NULL) {
3233*cdf0e10cSrcweir 			rLL.GetLink(i).Call((void*)pFact);
3234*cdf0e10cSrcweir 			pObj=pFact->pNewObj;
3235*cdf0e10cSrcweir 			i++;
3236*cdf0e10cSrcweir 		}
3237*cdf0e10cSrcweir 		delete pFact;
3238*cdf0e10cSrcweir 	}
3239*cdf0e10cSrcweir 
3240*cdf0e10cSrcweir 	if(pObj == NULL)
3241*cdf0e10cSrcweir 	{
3242*cdf0e10cSrcweir 		// Na wenn's denn keiner will ...
3243*cdf0e10cSrcweir 	}
3244*cdf0e10cSrcweir 
3245*cdf0e10cSrcweir 	if(pObj != NULL)
3246*cdf0e10cSrcweir 	{
3247*cdf0e10cSrcweir 		if(pPage != NULL)
3248*cdf0e10cSrcweir 			pObj->SetPage(pPage);
3249*cdf0e10cSrcweir 		else if(pModel != NULL)
3250*cdf0e10cSrcweir 			pObj->SetModel(pModel);
3251*cdf0e10cSrcweir 	}
3252*cdf0e10cSrcweir 
3253*cdf0e10cSrcweir 	return pObj;
3254*cdf0e10cSrcweir }
3255*cdf0e10cSrcweir 
3256*cdf0e10cSrcweir SdrObjUserData* SdrObjFactory::MakeNewObjUserData(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1)
3257*cdf0e10cSrcweir {
3258*cdf0e10cSrcweir 	SdrObjUserData* pData=NULL;
3259*cdf0e10cSrcweir 	if (nInvent==SdrInventor) {
3260*cdf0e10cSrcweir 		switch (nIdent)
3261*cdf0e10cSrcweir 		{
3262*cdf0e10cSrcweir 			case sal_uInt16(SDRUSERDATA_OBJTEXTLINK) : pData=new ImpSdrObjTextLinkUserData((SdrTextObj*)pObj1); break;
3263*cdf0e10cSrcweir 		}
3264*cdf0e10cSrcweir 	}
3265*cdf0e10cSrcweir 	if (pData==NULL) {
3266*cdf0e10cSrcweir 		SdrObjFactory aFact(nInvent,nIdent,pObj1);
3267*cdf0e10cSrcweir 		SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
3268*cdf0e10cSrcweir 		unsigned nAnz=rLL.GetLinkCount();
3269*cdf0e10cSrcweir 		unsigned i=0;
3270*cdf0e10cSrcweir 		while (i<nAnz && pData==NULL) {
3271*cdf0e10cSrcweir 			rLL.GetLink(i).Call((void*)&aFact);
3272*cdf0e10cSrcweir 			pData=aFact.pNewData;
3273*cdf0e10cSrcweir 			i++;
3274*cdf0e10cSrcweir 		}
3275*cdf0e10cSrcweir 	}
3276*cdf0e10cSrcweir 	return pData;
3277*cdf0e10cSrcweir }
3278*cdf0e10cSrcweir 
3279*cdf0e10cSrcweir void SdrObjFactory::InsertMakeObjectHdl(const Link& rLink)
3280*cdf0e10cSrcweir {
3281*cdf0e10cSrcweir 	SdrLinkList& rLL=ImpGetUserMakeObjHdl();
3282*cdf0e10cSrcweir 	rLL.InsertLink(rLink);
3283*cdf0e10cSrcweir }
3284*cdf0e10cSrcweir 
3285*cdf0e10cSrcweir void SdrObjFactory::RemoveMakeObjectHdl(const Link& rLink)
3286*cdf0e10cSrcweir {
3287*cdf0e10cSrcweir 	SdrLinkList& rLL=ImpGetUserMakeObjHdl();
3288*cdf0e10cSrcweir 	rLL.RemoveLink(rLink);
3289*cdf0e10cSrcweir }
3290*cdf0e10cSrcweir 
3291*cdf0e10cSrcweir void SdrObjFactory::InsertMakeUserDataHdl(const Link& rLink)
3292*cdf0e10cSrcweir {
3293*cdf0e10cSrcweir 	SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
3294*cdf0e10cSrcweir 	rLL.InsertLink(rLink);
3295*cdf0e10cSrcweir }
3296*cdf0e10cSrcweir 
3297*cdf0e10cSrcweir void SdrObjFactory::RemoveMakeUserDataHdl(const Link& rLink)
3298*cdf0e10cSrcweir {
3299*cdf0e10cSrcweir 	SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
3300*cdf0e10cSrcweir 	rLL.RemoveLink(rLink);
3301*cdf0e10cSrcweir }
3302*cdf0e10cSrcweir 
3303*cdf0e10cSrcweir namespace svx
3304*cdf0e10cSrcweir {
3305*cdf0e10cSrcweir     ISdrObjectFilter::~ISdrObjectFilter()
3306*cdf0e10cSrcweir     {
3307*cdf0e10cSrcweir     }
3308*cdf0e10cSrcweir }
3309*cdf0e10cSrcweir 
3310*cdf0e10cSrcweir // eof
3311