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