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