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 <cppuhelper/typeprovider.hxx>
30 : : #include <com/sun/star/awt/XBitmap.hpp>
31 : : #include <com/sun/star/awt/Rectangle.hpp>
32 : : #include <com/sun/star/drawing/CircleKind.hpp>
33 : : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
34 : : #include <vcl/svapp.hxx>
35 : : #include <svl/itemprop.hxx>
36 : : #include <svtools/fltcall.hxx>
37 : : #include <osl/mutex.hxx>
38 : : #include <editeng/unotext.hxx>
39 : : #include <svx/svdobj.hxx>
40 : : #include <svx/svdoole2.hxx>
41 : : #include "svx/shapepropertynotifier.hxx"
42 : : #include <comphelper/extract.hxx>
43 : : #include <comphelper/scopeguard.hxx>
44 : : #include <comphelper/servicehelper.hxx>
45 : : #include <comphelper/serviceinfohelper.hxx>
46 : : #include <toolkit/unohlp.hxx>
47 : : #include <rtl/memory.h>
48 : : #include <vcl/gfxlink.hxx>
49 : : #include <vcl/virdev.hxx>
50 : : #include <sfx2/objsh.hxx>
51 : : #include <sfx2/viewsh.hxx>
52 : : #include "svx/svdopage.hxx"
53 : : #include "svx/xflbstit.hxx"
54 : : #include "svx/xflbmtit.hxx"
55 : : #include "svx/xlnstit.hxx"
56 : : #include "svx/xlnedit.hxx"
57 : : #include "svx/svdogrp.hxx"
58 : : #include "svx/scene3d.hxx"
59 : : #include "svx/svdmodel.hxx"
60 : : #include "svx/globl3d.hxx"
61 : : #include "svx/fmglob.hxx"
62 : : #include "svx/unopage.hxx"
63 : : #include "svx/view3d.hxx"
64 : : #include "svx/unoshape.hxx"
65 : : #include "svx/svxids.hrc"
66 : : #include "svx/unoshtxt.hxx"
67 : : #include "svx/svdpage.hxx"
68 : : #include "svx/unoshprp.hxx"
69 : : #include "svx/sxciaitm.hxx" // todo: remove
70 : : #include "svx/svdograf.hxx"
71 : : #include "svx/unoapi.hxx"
72 : : #include "svx/svdomeas.hxx"
73 : : #include "svx/svdpagv.hxx"
74 : : #include "svx/svdpool.hxx"
75 : : #include <tools/shl.hxx> //
76 : : #include "svx/dialmgr.hxx" // not nice, we need our own resources some day
77 : : #include "svx/dialogs.hrc" //
78 : : #include "svx/svdocapt.hxx"
79 : : #include <svx/obj3d.hxx>
80 : : #include <tools/diagnose_ex.h>
81 : : #include "svx/xflftrit.hxx"
82 : : #include "svx/xtable.hxx"
83 : : #include "svx/xbtmpit.hxx"
84 : : #include "svx/xflgrit.hxx"
85 : : #include "svx/xflhtit.hxx"
86 : : #include "svx/xlndsit.hxx"
87 : : #include "svx/svdglob.hxx"
88 : : #include "svx/svdstr.hrc"
89 : : #include "svx/unomaster.hxx"
90 : : #include <editeng/outlobj.hxx>
91 : : #include <basegfx/matrix/b2dhommatrix.hxx>
92 : : #include <basegfx/matrix/b2dhommatrixtools.hxx>
93 : : #include <basegfx/tools/unotools.hxx>
94 : : #include "shapeimpl.hxx"
95 : : #include <sal/log.hxx>
96 : :
97 : : #include <vector>
98 : :
99 : : // #i68523#
100 : : #include "svx/lathe3d.hxx"
101 : : #include "svx/extrud3d.hxx"
102 : :
103 : : #include <boost/bind.hpp>
104 : : #include <svtools/wmf.hxx>
105 : :
106 : : using ::rtl::OUString;
107 : : using namespace ::osl;
108 : : using namespace ::cppu;
109 : : using namespace ::com::sun::star;
110 : : using namespace ::com::sun::star::uno;
111 : : using namespace ::com::sun::star::lang;
112 : : using namespace ::com::sun::star::container;
113 : : using ::svx::PropertyValueProvider;
114 : : using ::svx::IPropertyValueProvider;
115 : :
116 : : class GDIMetaFile;
117 : :
118 : : uno::Reference< uno::XInterface > SAL_CALL SvxUnoGluePointAccess_createInstance( SdrObject* pObject );
119 : :
120 : : /***********************************************************************
121 : : * class SvxShapeImpl *
122 : : ***********************************************************************/
123 : :
124 [ + - ][ + - ]: 155276 : struct SvxShapeImpl
125 : : {
126 : : SvxShape& mrAntiImpl;
127 : : SfxItemSet* mpItemSet;
128 : : sal_uInt32 mnObjId;
129 : : SvxShapeMaster* mpMaster;
130 : : bool mbHasSdrObjectOwnership;
131 : : bool mbDisposing;
132 : :
133 : : /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
134 : : * a SvxShape::Create() call is executed. It is then set to the created
135 : : * SdrObject so a multiple call to SvxShape::Create() with same SdrObject
136 : : * is prohibited.
137 : : */
138 : : ::tools::WeakReference< SdrObject > mpCreatedObj;
139 : :
140 : : // for xComponent
141 : : ::cppu::OInterfaceContainerHelper maDisposeListeners;
142 : : ::svx::PropertyChangeNotifier maPropertyNotifier;
143 : :
144 : 155276 : SvxShapeImpl( SvxShape& _rAntiImpl, ::osl::Mutex& _rMutex )
145 : : :mrAntiImpl( _rAntiImpl )
146 : : ,mpItemSet( NULL )
147 : : ,mnObjId( 0 )
148 : : ,mpMaster( NULL )
149 : : ,mbHasSdrObjectOwnership( false )
150 : : ,mbDisposing( false )
151 : : ,mpCreatedObj()
152 : : ,maDisposeListeners( _rMutex )
153 [ + - ][ + - ]: 155276 : ,maPropertyNotifier( _rAntiImpl, _rMutex )
154 : : {
155 : 155276 : }
156 : : };
157 : :
158 : : /**********************************************************************/
159 [ - + ]: 310552 : class ShapePositionProvider : public PropertyValueProvider
160 : : {
161 : : public:
162 : 155276 : ShapePositionProvider( const SvxShapeImpl& _shapeImpl )
163 : 155276 : :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Position" )
164 : : {
165 : 155276 : }
166 : :
167 : : protected:
168 : 0 : virtual void getCurrentValue( Any& _out_rCurrentValue ) const
169 : : {
170 [ # # ]: 0 : _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getPosition();
171 : 0 : }
172 : : };
173 : :
174 : : //----------------------------------------------------------------------
175 [ - + ]: 310552 : class ShapeSizeProvider : public PropertyValueProvider
176 : : {
177 : : public:
178 : 155276 : ShapeSizeProvider( const SvxShapeImpl& _shapeImpl )
179 : 155276 : :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Size" )
180 : : {
181 : 155276 : }
182 : :
183 : : protected:
184 : 0 : virtual void getCurrentValue( Any& _out_rCurrentValue ) const
185 : : {
186 [ # # ]: 0 : _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getSize();
187 : 0 : }
188 : : };
189 : :
190 : : /***********************************************************************
191 : : * class SvxShape *
192 : : ***********************************************************************/
193 : :
194 : : DBG_NAME(SvxShape)
195 : :
196 : 0 : SvxShape::SvxShape( SdrObject* pObject ) throw()
197 : : : maSize(100,100)
198 [ # # ]: 0 : , mpImpl( new SvxShapeImpl( *this, maMutex ) )
199 : : , mbIsMultiPropertyCall(false)
200 [ # # ][ # # ]: 0 : , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
[ # # ]
201 [ # # ][ # # ]: 0 : , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
202 : : , mpObj(pObject)
203 : : , mpModel(NULL)
204 [ # # ][ # # ]: 0 : , mnLockCount(0)
[ # # ][ # # ]
[ # # ]
205 : : {
206 : : DBG_CTOR(SvxShape,NULL);
207 [ # # ]: 0 : impl_construct();
208 : 0 : }
209 : :
210 : : //----------------------------------------------------------------------
211 : 155276 : SvxShape::SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet ) throw()
212 : : : maSize(100,100)
213 [ + - ]: 155276 : , mpImpl( new SvxShapeImpl( *this, maMutex ) )
214 : : , mbIsMultiPropertyCall(false)
215 : : , mpPropSet(pPropertySet)
216 : : , maPropMapEntries(pEntries)
217 : : , mpObj(pObject)
218 : : , mpModel(NULL)
219 [ + - ][ + - ]: 310552 : , mnLockCount(0)
[ + - ][ + - ]
[ + - ]
220 : : {
221 : : DBG_CTOR(SvxShape,NULL);
222 [ + - ]: 155276 : impl_construct();
223 : 155276 : }
224 : :
225 : : //----------------------------------------------------------------------
226 : 0 : SvxShape::SvxShape() throw()
227 : : : maSize(100,100)
228 [ # # ]: 0 : , mpImpl( new SvxShapeImpl( *this, maMutex ) )
229 : : , mbIsMultiPropertyCall(false)
230 [ # # ][ # # ]: 0 : , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
[ # # ]
231 [ # # ][ # # ]: 0 : , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
232 : : , mpObj(NULL)
233 : : , mpModel(NULL)
234 [ # # ][ # # ]: 0 : , mnLockCount(0)
[ # # ][ # # ]
[ # # ]
235 : : {
236 : : DBG_CTOR(SvxShape,NULL);
237 [ # # ]: 0 : impl_construct();
238 : 0 : }
239 : :
240 : : //----------------------------------------------------------------------
241 [ + - ][ + - ]: 155276 : SvxShape::~SvxShape() throw()
[ + - ][ + - ]
242 : : {
243 [ + - ]: 155276 : ::SolarMutexGuard aGuard;
244 : :
245 : : DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
246 : :
247 [ + + ]: 155276 : if ( mpModel )
248 [ + - ]: 132952 : EndListening( *mpModel );
249 : :
250 [ + + ]: 155276 : if ( mpImpl->mpMaster )
251 [ + - ]: 6252 : mpImpl->mpMaster->dispose();
252 : :
253 [ + + ]: 155276 : if ( mpObj.is() )
254 [ + - ][ + - ]: 132956 : mpObj->setUnoShape(NULL);
255 : :
256 [ + - ][ - + ]: 155276 : if( HasSdrObjectOwnership() && mpObj.is() )
[ # # ][ - + ]
257 : : {
258 : 0 : mpImpl->mbHasSdrObjectOwnership = false;
259 : 0 : SdrObject* pObject = mpObj.get();
260 [ # # ]: 0 : SdrObject::Free( pObject );
261 : : }
262 : :
263 [ + - ][ + - ]: 155276 : delete mpImpl, mpImpl = NULL;
264 : :
265 [ + - ]: 155276 : DBG_DTOR(SvxShape,NULL);
266 [ - + ]: 156176 : }
267 : :
268 : : //----------------------------------------------------------------------
269 : :
270 : 0 : void SvxShape::TakeSdrObjectOwnership()
271 : : {
272 : 0 : mpImpl->mbHasSdrObjectOwnership = true;
273 : 0 : }
274 : :
275 : : //----------------------------------------------------------------------
276 : :
277 : 178458 : bool SvxShape::HasSdrObjectOwnership() const
278 : : {
279 [ + - ]: 178458 : if ( !mpImpl->mbHasSdrObjectOwnership )
280 : 178458 : return false;
281 : :
282 : : OSL_ENSURE( mpObj.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
283 : 178458 : return mpObj.is();
284 : : }
285 : :
286 : : //----------------------------------------------------------------------
287 : :
288 : 154925 : void SvxShape::setShapeKind( sal_uInt32 nKind )
289 : : {
290 : 154925 : mpImpl->mnObjId = nKind;
291 : 154925 : }
292 : :
293 : : //----------------------------------------------------------------------
294 : :
295 : 12504 : sal_uInt32 SvxShape::getShapeKind() const
296 : : {
297 : 12504 : return mpImpl->mnObjId;
298 : : }
299 : :
300 : : //----------------------------------------------------------------------
301 : :
302 : 12504 : void SvxShape::setMaster( SvxShapeMaster* pMaster )
303 : : {
304 : 12504 : mpImpl->mpMaster = pMaster;
305 : 12504 : }
306 : :
307 : : //----------------------------------------------------------------------
308 : :
309 : 1180128 : uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType ) throw (uno::RuntimeException)
310 : : {
311 [ + + ]: 1180128 : if( mpImpl->mpMaster )
312 : : {
313 : 32467 : uno::Any aAny;
314 [ + + ][ + - ]: 32467 : if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
315 [ + + ]: 32467 : return aAny;
316 : : }
317 : :
318 : 1180128 : return SvxShape_UnoImplHelper::queryAggregation(rType);
319 : : }
320 : :
321 : : namespace
322 : : {
323 : : class theSvxShapeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxShapeUnoTunnelId > {};
324 : : }
325 : :
326 : 684378 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() throw()
327 : : {
328 : 684378 : return theSvxShapeUnoTunnelId::get().getSeq();
329 : : }
330 : :
331 : : //----------------------------------------------------------------------
332 : 471387 : SvxShape* SvxShape::getImplementation( const uno::Reference< uno::XInterface >& xInt )
333 : : {
334 [ + - ]: 471387 : uno::Reference< lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
335 [ + + ]: 471387 : if( xUT.is() )
336 [ + - ][ + - ]: 338414 : return reinterpret_cast<SvxShape*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxShape::getUnoTunnelId())));
337 : : else
338 : 471387 : return NULL;
339 : : }
340 : :
341 : : //----------------------------------------------------------------------
342 : 343077 : sal_Int64 SAL_CALL SvxShape::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
343 : : {
344 [ + - ][ + + ]: 343077 : if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
[ + + ]
345 : : {
346 : 341133 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
347 : : }
348 : : else
349 : : {
350 : 343077 : return 0;
351 : : }
352 : : }
353 : :
354 : : //----------------------------------------------------------------------
355 : 476196 : ::svx::PropertyChangeNotifier& SvxShape::getShapePropertyChangeNotifier()
356 : : {
357 : 476196 : return mpImpl->maPropertyNotifier;
358 : : }
359 : :
360 : : //----------------------------------------------------------------------
361 : 155276 : void SvxShape::impl_construct()
362 : : {
363 : : mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapePosition,
364 [ + - ][ + - ]: 155276 : ::svx::PPropertyValueProvider( new ShapePositionProvider( *mpImpl ) ) );
365 : : mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapeSize,
366 [ + - ][ + - ]: 155276 : ::svx::PPropertyValueProvider( new ShapeSizeProvider( *mpImpl ) ) );
367 : :
368 [ + + ]: 155276 : if ( mpObj.is() )
369 : 65878 : impl_initFromSdrObject();
370 : 155276 : }
371 : :
372 : : //----------------------------------------------------------------------
373 : 155704 : void SvxShape::impl_initFromSdrObject()
374 : : {
375 : : DBG_TESTSOLARMUTEX();
376 : : OSL_PRECOND( mpObj.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
377 [ - + ]: 155704 : if ( !mpObj.is() )
378 : 155704 : return;
379 : :
380 : 155704 : osl_incrementInterlockedCount( &m_refCount );
381 : : {
382 [ + - ]: 155704 : mpObj->setUnoShape(*this);
383 : : }
384 : 155704 : osl_decrementInterlockedCount( &m_refCount );
385 : :
386 : 155704 : mpModel = mpObj->GetModel();
387 : :
388 : : // #i40944#
389 : : // Do not simply return when no model but do the type corrections
390 : : // following below.
391 [ + + ]: 155704 : if(mpModel)
392 : : {
393 : 155170 : StartListening( *mpModel );
394 : : }
395 : :
396 : 155704 : const sal_uInt32 nInventor = mpObj->GetObjInventor();
397 : :
398 : : // is it one of ours (svx) ?
399 [ + + ][ + - ]: 155704 : if( nInventor == SdrInventor || nInventor == E3dInventor || nInventor == FmFormInventor )
[ + + ]
400 : : {
401 [ + + ]: 155704 : if(nInventor == FmFormInventor)
402 : : {
403 : 1042 : mpImpl->mnObjId = OBJ_UNO;
404 : : }
405 : : else
406 : : {
407 : 154662 : mpImpl->mnObjId = mpObj->GetObjIdentifier();
408 [ + + ]: 154662 : if( nInventor == E3dInventor )
409 : 2689 : mpImpl->mnObjId |= E3D_INVENTOR_FLAG;
410 : : }
411 : :
412 [ - - + ]: 155704 : switch(mpImpl->mnObjId)
413 : : {
414 : : case OBJ_CCUT: // Kreisabschnitt
415 : : case OBJ_CARC: // Kreisbogen
416 : : case OBJ_SECT: // Kreissektor
417 : 0 : mpImpl->mnObjId = OBJ_CIRC;
418 : 0 : break;
419 : :
420 : : case E3D_SCENE_ID | E3D_INVENTOR_FLAG:
421 : 0 : mpImpl->mnObjId = E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG;
422 : 0 : break;
423 : : }
424 : : }
425 : : }
426 : :
427 : : //----------------------------------------------------------------------
428 : 89826 : void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
429 : : {
430 : : DBG_TESTSOLARMUTEX();
431 : :
432 : : OSL_PRECOND( pNewObj, "SvxShape::Create: invalid new object!" );
433 [ - + ]: 89826 : if ( !pNewObj )
434 : 89826 : return;
435 : :
436 : 89826 : SdrObject* pCreatedObj = mpImpl->mpCreatedObj.get();
437 : : OSL_ENSURE( ( pCreatedObj == NULL ) || ( pCreatedObj == pNewObj ),
438 : : "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
439 : :
440 : : // Correct condition (#i52126#)
441 [ + - ]: 89826 : if ( pCreatedObj != pNewObj )
442 : : {
443 : : DBG_ASSERT( pNewObj->GetModel(), "no model for SdrObject?" );
444 : : // Correct condition (#i52126#)
445 [ + - ]: 89826 : mpImpl->mpCreatedObj = pNewObj;
446 : :
447 [ + - ][ + + ]: 89826 : if( mpObj.is() && mpObj->GetModel() )
[ + + ]
448 : : {
449 : 500 : EndListening( *mpObj->GetModel() );
450 : : }
451 : :
452 : 89826 : mpObj.reset( pNewObj );
453 : :
454 : : OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
455 : : // this was previously set in impl_initFromSdrObject, but I think it was superfluous
456 : : // (it definitely was in the other context where it was called, but I strongly suppose
457 : : // it was also superfluous when called from here)
458 : 89826 : impl_initFromSdrObject();
459 : :
460 : 89826 : ObtainSettingsFromPropertySet( *mpPropSet );
461 : :
462 : : // save user call
463 : 89826 : SdrObjUserCall* pUser = mpObj->GetUserCall();
464 : 89826 : mpObj->SetUserCall(NULL);
465 : :
466 : 89826 : setPosition( maPosition );
467 : 89826 : setSize( maSize );
468 : :
469 : : // restore user call after we set the initial size
470 : 89826 : mpObj->SetUserCall( pUser );
471 : :
472 : : // if this shape was already named, use this name
473 [ + + ]: 89826 : if( !maShapeName.isEmpty() )
474 : : {
475 : 71 : mpObj->SetName( maShapeName );
476 : 71 : maShapeName = OUString();
477 : : }
478 : : }
479 : : }
480 : :
481 : : //----------------------------------------------------------------------
482 : :
483 : 526 : void SvxShape::ChangeModel( SdrModel* pNewModel )
484 : : {
485 : : DBG_TESTSOLARMUTEX();
486 [ + - ][ - + ]: 526 : if( mpObj.is() && mpObj->GetModel() )
[ - + ]
487 : : {
488 [ # # ]: 0 : if( mpObj->GetModel() != pNewModel )
489 : : {
490 : 0 : EndListening( *mpObj->GetModel() );
491 : : }
492 : : }
493 : :
494 : : // Always listen to new model (#i52126#)
495 [ + - ]: 526 : if( pNewModel )
496 : : {
497 : 526 : StartListening( *pNewModel );
498 : : }
499 : :
500 : : // HACK #i53696# ChangeModel should be virtual, but it isn't. can't change that for 2.0.1
501 [ - + ]: 526 : SvxShapeText* pShapeText = dynamic_cast< SvxShapeText* >( this );
502 [ + - ]: 526 : if( pShapeText )
503 : : {
504 [ + - ]: 526 : SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( pShapeText->GetEditSource() );
505 [ - + ]: 526 : if( pTextEditSource )
506 : 0 : pTextEditSource->ChangeModel( pNewModel );
507 : : }
508 : :
509 : 526 : mpModel = pNewModel;
510 : :
511 [ + + ]: 526 : if( mpImpl->mpMaster )
512 : 6 : mpImpl->mpMaster->modelChanged( pNewModel );
513 : 526 : }
514 : :
515 : : //----------------------------------------------------------------------
516 : :
517 : 266942 : void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
518 : : {
519 : : DBG_TESTSOLARMUTEX();
520 [ + - ]: 266942 : if(mpModel)
521 : : {
522 : 266942 : SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
523 [ + + ]: 266942 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
524 : : {
525 [ + - ]: 1866 : switch(eMapUnit)
526 : : {
527 : : case SFX_MAPUNIT_TWIP :
528 : : {
529 : 1866 : rPoint.A() = MM_TO_TWIPS(rPoint.A());
530 : 1866 : rPoint.B() = MM_TO_TWIPS(rPoint.B());
531 : 1866 : break;
532 : : }
533 : : default:
534 : : {
535 : : OSL_FAIL("AW: Missing unit translation to PoolMetric!");
536 : : }
537 : : }
538 : : }
539 : : }
540 : 266942 : }
541 : :
542 : : // Reintroduction of fix for issue i59051 (#i108851#)
543 : 0 : void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
544 : : {
545 : : DBG_TESTSOLARMUTEX();
546 [ # # ]: 0 : if(mpModel)
547 : : {
548 : 0 : SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
549 [ # # ]: 0 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
550 : : {
551 [ # # ]: 0 : switch(eMapUnit)
552 : : {
553 : : case SFX_MAPUNIT_TWIP :
554 : : {
555 [ # # ]: 0 : basegfx::B2DHomMatrix aTransform;
556 : 0 : const double fMMToTWIPS(72.0 / 127.0);
557 : :
558 [ # # ]: 0 : aTransform.scale(fMMToTWIPS, fMMToTWIPS);
559 [ # # ]: 0 : rPolyPolygon.transform(aTransform);
560 [ # # ]: 0 : break;
561 : : }
562 : : default:
563 : : {
564 : : OSL_FAIL("Missing unit translation to PoolMetric!");
565 : : }
566 : : }
567 : : }
568 : : }
569 : 0 : }
570 : :
571 : : //----------------------------------------------------------------------
572 : 132324 : void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
573 : : {
574 : : DBG_TESTSOLARMUTEX();
575 : 132324 : SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
576 [ + - ]: 132324 : if(mpModel)
577 : : {
578 : 132324 : eMapUnit = mpModel->GetItemPool().GetMetric(0);
579 [ + + ]: 132324 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
580 : : {
581 [ + - ]: 661 : switch(eMapUnit)
582 : : {
583 : : case SFX_MAPUNIT_TWIP :
584 : : {
585 : 661 : rPoint.A() = TWIPS_TO_MM(rPoint.A());
586 : 661 : rPoint.B() = TWIPS_TO_MM(rPoint.B());
587 : 661 : break;
588 : : }
589 : : default:
590 : : {
591 : : OSL_FAIL("AW: Missing unit translation to 100th mm!");
592 : : }
593 : : }
594 : : }
595 : : }
596 : 132324 : }
597 : :
598 : : // Reintroduction of fix for issue i59051 (#i108851#)
599 : 0 : void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
600 : : {
601 : : DBG_TESTSOLARMUTEX();
602 : 0 : SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
603 [ # # ]: 0 : if(mpModel)
604 : : {
605 : 0 : eMapUnit = mpModel->GetItemPool().GetMetric(0);
606 [ # # ]: 0 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
607 : : {
608 [ # # ]: 0 : switch(eMapUnit)
609 : : {
610 : : case SFX_MAPUNIT_TWIP :
611 : : {
612 [ # # ]: 0 : basegfx::B2DHomMatrix aTransform;
613 : 0 : const double fTWIPSToMM(127.0 / 72.0);
614 [ # # ]: 0 : aTransform.scale(fTWIPSToMM, fTWIPSToMM);
615 [ # # ]: 0 : rPolyPolygon.transform(aTransform);
616 [ # # ]: 0 : break;
617 : : }
618 : : default:
619 : : {
620 : : OSL_FAIL("Missing unit translation to 100th mm!");
621 : : }
622 : : }
623 : : }
624 : : }
625 : 0 : }
626 : :
627 : : //----------------------------------------------------------------------
628 : 71 : void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
629 : : SfxItemSet& rSet, uno::Reference< beans::XPropertySet > xSet, const SfxItemPropertyMap* pMap )
630 : : {
631 [ + - ]: 71 : if(rPropSet.AreThereOwnUsrAnys())
632 : : {
633 : 71 : const SfxItemPropertyMap* pSrc = rPropSet.getPropertyMap();
634 [ + - ]: 71 : PropertyEntryVector_t aSrcPropVector = pSrc->getPropertyEntries();
635 [ + - ]: 71 : PropertyEntryVector_t::const_iterator aSrcIt = aSrcPropVector.begin();
636 [ + - ][ + + ]: 11052 : while(aSrcIt != aSrcPropVector.end())
637 : : {
638 [ + - ]: 10981 : if(aSrcIt->nWID)
639 : : {
640 [ + - ]: 10981 : uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(aSrcIt->nWID);
641 [ + + ]: 10981 : if(pUsrAny)
642 : : {
643 : : // Aequivalenten Eintrag in pDst suchen
644 [ + - ]: 158 : const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aSrcIt->sName );
645 [ + - ]: 158 : if(pEntry)
646 : : {
647 : : // entry found
648 [ + + ][ + - ]: 158 : if(pEntry->nWID >= OWN_ATTR_VALUE_START && pEntry->nWID <= OWN_ATTR_VALUE_END)
649 : : {
650 : : // Special ID im PropertySet, kann nur direkt am
651 : : // Objekt gesetzt werden+
652 [ + - ][ + - ]: 24 : xSet->setPropertyValue( aSrcIt->sName, *pUsrAny);
653 : : }
654 : : else
655 : : {
656 [ + - ]: 134 : if(rSet.GetPool()->IsWhich(pEntry->nWID))
657 [ + - ][ + - ]: 134 : rSet.Put(rSet.GetPool()->GetDefaultItem(pEntry->nWID));
658 : : // setzen
659 [ + - ]: 158 : SvxItemPropertySet_setPropertyValue(rPropSet, pEntry, *pUsrAny, rSet);
660 : : }
661 : : }
662 : : }
663 : : }
664 : :
665 : : // next entry
666 : 10981 : ++aSrcIt;
667 : : }
668 [ + - ]: 71 : const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny();
669 : : }
670 : 71 : }
671 : :
672 : :
673 : 89826 : void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
674 : : {
675 : : DBG_TESTSOLARMUTEX();
676 [ + - ][ + + ]: 89826 : if(mpObj.is() && rPropSet.AreThereOwnUsrAnys() && mpModel)
[ + - ][ + + ]
677 : : {
678 [ + - ]: 71 : SfxItemSet aSet( mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END);
679 [ + - ]: 71 : Reference< beans::XPropertySet > xShape( (OWeakObject*)this, UNO_QUERY );
680 [ + - ]: 71 : SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, mpPropSet->getPropertyMap() );
681 : :
682 [ + - ]: 71 : mpObj->SetMergedItemSetAndBroadcast(aSet);
683 : :
684 [ + - ][ + - ]: 71 : mpObj->ApplyNotPersistAttr( aSet );
685 : : }
686 : 89826 : }
687 : :
688 : : //----------------------------------------------------------------------
689 : :
690 : 21 : uno::Any SvxShape::GetBitmap( sal_Bool bMetaFile /* = sal_False */ ) const throw()
691 : : {
692 : : DBG_TESTSOLARMUTEX();
693 : 21 : uno::Any aAny;
694 : :
695 [ + - ][ + - ]: 21 : if( !mpObj.is() || mpModel == NULL || !mpObj->IsInserted() || NULL == mpObj->GetPage() )
[ + - ][ + - ]
[ - + ][ + - ]
[ + - ]
696 : : return aAny;
697 : :
698 [ + - ]: 21 : VirtualDevice aVDev;
699 [ + - ][ + - ]: 21 : aVDev.SetMapMode(MapMode(MAP_100TH_MM));
[ + - ]
700 : :
701 [ + - ]: 21 : SdrModel* pModel = mpObj->GetModel();
702 [ + - ]: 21 : SdrPage* pPage = mpObj->GetPage();
703 : :
704 [ + - ][ + - ]: 21 : E3dView* pView = new E3dView( pModel, &aVDev );
705 [ + - ]: 21 : pView->hideMarkHandles();
706 [ + - ]: 21 : SdrPageView* pPageView = pView->ShowSdrPage(pPage);
707 : :
708 : 21 : SdrObject *pTempObj = mpObj.get();
709 [ + - ]: 21 : pView->MarkObj(pTempObj,pPageView);
710 : :
711 [ + - ]: 21 : Rectangle aRect(pTempObj->GetCurrentBoundRect());
712 [ + - ]: 21 : aRect.Justify();
713 [ + - ]: 21 : Size aSize(aRect.GetSize());
714 : :
715 [ + - ]: 21 : GDIMetaFile aMtf( pView->GetAllMarkedMetaFile() );
716 [ - + ]: 21 : if( bMetaFile )
717 : : {
718 [ # # ]: 0 : SvMemoryStream aDestStrm( 65535, 65535 );
719 [ # # ]: 0 : ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
720 : : const uno::Sequence<sal_Int8> aSeq(
721 [ # # ]: 0 : static_cast< const sal_Int8* >(aDestStrm.GetData()),
722 [ # # ]: 0 : aDestStrm.GetEndOfData());
723 [ # # ][ # # ]: 0 : aAny.setValue( &aSeq, ::getCppuType((const uno::Sequence< sal_Int8 >*)0) );
[ # # ]
724 : : }
725 : : else
726 : : {
727 [ + - ]: 21 : Graphic aGraph(aMtf);
728 [ + - ]: 21 : aGraph.SetPrefSize(aSize);
729 [ + - ][ + - ]: 21 : aGraph.SetPrefMapMode(MAP_100TH_MM);
[ + - ]
730 : :
731 [ + - ][ + - ]: 21 : Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
732 [ + - ][ + - ]: 21 : aAny <<= xBmp;
733 : : }
734 : :
735 [ + - ]: 21 : pView->UnmarkAll();
736 [ + - ][ + - ]: 21 : delete pView;
737 : :
738 [ + - ][ + - ]: 21 : return aAny;
739 : : }
740 : :
741 : : //----------------------------------------------------------------------
742 : :
743 : 0 : uno::Sequence< uno::Type > SAL_CALL SvxShape::getTypes()
744 : : throw (uno::RuntimeException)
745 : : {
746 [ # # ]: 0 : if( mpImpl->mpMaster )
747 : : {
748 : 0 : return mpImpl->mpMaster->getTypes();
749 : : }
750 : : else
751 : : {
752 : 0 : return _getTypes();
753 : : }
754 : : }
755 : :
756 : : //----------------------------------------------------------------------
757 : :
758 : 0 : uno::Sequence< uno::Type > SAL_CALL SvxShape::_getTypes()
759 : : throw(uno::RuntimeException)
760 : : {
761 [ # # # # : 0 : switch( mpImpl->mnObjId )
# # # ]
762 : : {
763 : : // shapes without text
764 : : case OBJ_OLE2:
765 : : case OBJ_PAGE:
766 : : case OBJ_FRAME:
767 : : case OBJ_OLE2_PLUGIN:
768 : : case OBJ_OLE2_APPLET:
769 : : case E3D_CUBEOBJ_ID|E3D_INVENTOR_FLAG:
770 : : case E3D_SPHEREOBJ_ID|E3D_INVENTOR_FLAG:
771 : : case E3D_LATHEOBJ_ID|E3D_INVENTOR_FLAG:
772 : : case E3D_EXTRUDEOBJ_ID|E3D_INVENTOR_FLAG:
773 : : case E3D_POLYGONOBJ_ID|E3D_INVENTOR_FLAG:
774 : : case OBJ_MEDIA:
775 : : {
776 [ # # ][ # # ]: 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
[ # # ][ # # ]
777 : :
778 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
779 : : {
780 : : // Ready for multithreading; get global mutex for first call of this method only! see before
781 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
782 : :
783 : : // Control these pointer again ... it can be, that another instance will be faster then these!
784 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
785 : : {
786 [ # # ]: 0 : aTypeSequence.realloc( 12 );
787 [ # # ]: 0 : uno::Type* pTypes = aTypeSequence.getArray();
788 : :
789 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
790 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
791 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
792 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
793 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
794 [ # # ]: 0 : *pTypes++ = beans::XMultiPropertyStates::static_type();
795 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
796 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
797 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
798 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
799 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
800 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
801 [ # # ]: 0 : }
802 : : }
803 : 0 : return aTypeSequence;
804 : : }
805 : : // group shape
806 : : case OBJ_GRUP:
807 : : {
808 [ # # ][ # # ]: 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
[ # # ][ # # ]
809 : :
810 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
811 : : {
812 : : // Ready for multithreading; get global mutex for first call of this method only! see before
813 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
814 : :
815 : : // Control these pointer again ... it can be, that another instance will be faster then these!
816 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
817 : : {
818 [ # # ]: 0 : aTypeSequence.realloc( 14 );
819 [ # # ]: 0 : uno::Type* pTypes = aTypeSequence.getArray();
820 : :
821 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
822 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
823 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
824 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
825 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
826 [ # # ]: 0 : *pTypes++ = beans::XMultiPropertyStates::static_type();
827 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
828 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
829 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
830 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
831 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
832 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
833 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShapes>*)0);
834 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShapeGroup>*)0);
835 [ # # ]: 0 : }
836 : : }
837 : 0 : return aTypeSequence;
838 : : }
839 : : // connector shape
840 : : case OBJ_EDGE:
841 : : {
842 [ # # ][ # # ]: 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
[ # # ][ # # ]
843 : :
844 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
845 : : {
846 : : // Ready for multithreading; get global mutex for first call of this method only! see before
847 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
848 : :
849 : : // Control these pointer again ... it can be, that another instance will be faster then these!
850 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
851 : : {
852 [ # # ]: 0 : aTypeSequence.realloc( 17 );
853 [ # # ]: 0 : uno::Type* pTypes = aTypeSequence.getArray();
854 : :
855 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
856 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
857 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
858 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
859 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
860 [ # # ]: 0 : *pTypes++ = beans::XMultiPropertyStates::static_type();
861 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
862 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
863 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
864 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
865 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
866 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
867 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XConnectorShape>*)0);
868 : : // from SvxUnoTextBase::getTypes()
869 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0);
870 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0);
871 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
872 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0);
873 [ # # ]: 0 : }
874 : : }
875 : 0 : return aTypeSequence;
876 : : }
877 : : // control shape
878 : : case OBJ_UNO:
879 : : {
880 [ # # ][ # # ]: 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
[ # # ][ # # ]
881 : :
882 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
883 : : {
884 : : // Ready for multithreading; get global mutex for first call of this method only! see before
885 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
886 : :
887 : : // Control these pointer again ... it can be, that another instance will be faster then these!
888 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
889 : : {
890 [ # # ]: 0 : aTypeSequence.realloc( 13 );
891 [ # # ]: 0 : uno::Type* pTypes = aTypeSequence.getArray();
892 : :
893 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
894 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
895 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
896 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
897 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
898 [ # # ]: 0 : *pTypes++ = beans::XMultiPropertyStates::static_type();
899 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
900 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
901 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
902 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
903 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
904 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
905 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XControlShape>*)0);
906 [ # # ]: 0 : }
907 : : }
908 : 0 : return aTypeSequence;
909 : : }
910 : : // 3d scene shape
911 : : case E3D_POLYSCENE_ID|E3D_INVENTOR_FLAG:
912 : : {
913 [ # # ][ # # ]: 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
[ # # ][ # # ]
914 : :
915 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
916 : : {
917 : : // Ready for multithreading; get global mutex for first call of this method only! see before
918 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
919 : :
920 : : // Control these pointer again ... it can be, that another instance will be faster then these!
921 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
922 : : {
923 [ # # ]: 0 : aTypeSequence.realloc( 13 );
924 [ # # ]: 0 : uno::Type* pTypes = aTypeSequence.getArray();
925 : :
926 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
927 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
928 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
929 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
930 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
931 [ # # ]: 0 : *pTypes++ = beans::XMultiPropertyStates::static_type();
932 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
933 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
934 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
935 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
936 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
937 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
938 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShapes>*)0);
939 [ # # ]: 0 : }
940 : : }
941 : 0 : return aTypeSequence;
942 : : }
943 : : case OBJ_CUSTOMSHAPE:
944 : : {
945 [ # # ][ # # ]: 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
[ # # ][ # # ]
946 : :
947 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
948 : : {
949 : : // Ready for multithreading; get global mutex for first call of this method only! see before
950 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
951 : :
952 : : // Control these pointer again ... it can be, that another instance will be faster then these!
953 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
954 : : {
955 [ # # ]: 0 : aTypeSequence.realloc( 16 );
956 [ # # ]: 0 : uno::Type* pTypes = aTypeSequence.getArray();
957 : :
958 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
959 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
960 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
961 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
962 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
963 [ # # ]: 0 : *pTypes++ = beans::XMultiPropertyStates::static_type();
964 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
965 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
966 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
967 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
968 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
969 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
970 : : // from SvxUnoTextBase::getTypes()
971 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XText >*)0);
972 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
973 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0);
974 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< drawing::XEnhancedCustomShapeDefaulter >*)0);
975 [ # # ]: 0 : }
976 : : }
977 : 0 : return aTypeSequence;
978 : : }
979 : : // shapes with text
980 : : case OBJ_RECT:
981 : : case OBJ_CIRC:
982 : : case OBJ_MEASURE:
983 : : case OBJ_LINE:
984 : : case OBJ_POLY:
985 : : case OBJ_PLIN:
986 : : case OBJ_PATHLINE:
987 : : case OBJ_PATHFILL:
988 : : case OBJ_FREELINE:
989 : : case OBJ_FREEFILL:
990 : : case OBJ_PATHPOLY:
991 : : case OBJ_PATHPLIN:
992 : : case OBJ_GRAF:
993 : : case OBJ_TEXT:
994 : : case OBJ_CAPTION:
995 : : case OBJ_TABLE:
996 : : default:
997 : : {
998 [ # # ][ # # ]: 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
[ # # ][ # # ]
999 : :
1000 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
1001 : : {
1002 : : // Ready for multithreading; get global mutex for first call of this method only! see before
1003 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
1004 : :
1005 : : // Control these pointer again ... it can be, that another instance will be faster then these!
1006 [ # # ]: 0 : if( aTypeSequence.getLength() == 0 )
1007 : : {
1008 [ # # ]: 0 : aTypeSequence.realloc( 16 );
1009 [ # # ]: 0 : uno::Type* pTypes = aTypeSequence.getArray();
1010 : :
1011 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
1012 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
1013 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
1014 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
1015 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
1016 [ # # ]: 0 : *pTypes++ = beans::XMultiPropertyStates::static_type();
1017 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
1018 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
1019 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
1020 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
1021 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
1022 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
1023 : : // from SvxUnoTextBase::getTypes()
1024 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0);
1025 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0);
1026 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
1027 [ # # ]: 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0);
1028 [ # # ]: 0 : }
1029 : : }
1030 : 0 : return aTypeSequence;
1031 : : }
1032 : : }
1033 : : }
1034 : :
1035 : : //----------------------------------------------------------------------
1036 : :
1037 : 0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
1038 : : throw (uno::RuntimeException)
1039 : : {
1040 : : static ::cppu::OImplementationId* pID = NULL ;
1041 : :
1042 [ # # ]: 0 : if ( pID == NULL )
1043 : : {
1044 : : // Ready for multithreading; get global mutex for first call of this method only! see before
1045 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
1046 : :
1047 : : // Control these pointer again ... it can be, that another instance will be faster then these!
1048 [ # # ]: 0 : if ( pID == NULL )
1049 : : {
1050 : : // Create a new static ID ...
1051 [ # # ][ # # ]: 0 : static ::cppu::OImplementationId aID( sal_False ) ;
1052 : : // ... and set his address to static pointer!
1053 : 0 : pID = &aID ;
1054 [ # # ]: 0 : }
1055 : : }
1056 : :
1057 : 0 : return pID->getImplementationId() ;
1058 : : }
1059 : :
1060 : : //----------------------------------------------------------------------
1061 : :
1062 : 0 : Reference< uno::XInterface > SvxShape_NewInstance()
1063 : : {
1064 : 0 : return uno::Reference< uno::XInterface >(static_cast< OWeakObject* >( new SvxShape() ) );
1065 : : }
1066 : :
1067 : : //----------------------------------------------------------------------
1068 : : // SfxListener
1069 : : //----------------------------------------------------------------------
1070 : :
1071 : 2155037 : void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
1072 : : {
1073 : : DBG_TESTSOLARMUTEX();
1074 [ + + ]: 2155037 : if( !mpObj.is() )
1075 : : return;
1076 : :
1077 : : // #i55919# HINT_OBJCHG is only interesting if it's for this object
1078 : :
1079 [ + - ][ + - ]: 2152605 : const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
[ + - ][ + + ]
1080 [ + + ][ + + ]: 6744481 : if (!pSdrHint || ( /* (pSdrHint->GetKind() != HINT_OBJREMOVED) && */
[ + + + + ]
[ + + ]
1081 [ + - ]: 2152601 : (pSdrHint->GetKind() != HINT_MODELCLEARED) &&
1082 : : // #110094#-9 (pSdrHint->GetKind() != HINT_OBJLISTCLEAR) &&
1083 [ + - ][ + - ]: 2439275 : ((pSdrHint->GetKind() != HINT_OBJCHG || pSdrHint->GetObject() != mpObj.get() ))))
1084 : : return;
1085 : :
1086 [ + - ][ + - ]: 14564 : uno::Reference< uno::XInterface > xSelf( mpObj->getWeakUnoShape() );
[ + - ]
1087 [ - + ]: 14564 : if( !xSelf.is() )
1088 : : {
1089 [ # # ]: 0 : mpObj.reset( NULL );
1090 : : return;
1091 : : }
1092 : :
1093 : 14564 : sal_Bool bClearMe = sal_False;
1094 : :
1095 [ + - ]: 14564 : switch( pSdrHint->GetKind() )
[ + + - ]
1096 : : {
1097 : : case HINT_OBJCHG:
1098 : : {
1099 [ + - ]: 13626 : updateShapeKind();
1100 : 13626 : break;
1101 : : }
1102 : : case HINT_MODELCLEARED:
1103 : : {
1104 : 938 : bClearMe = sal_True;
1105 : 938 : mpModel = NULL;
1106 : 938 : break;
1107 : : }
1108 : : default:
1109 : 0 : break;
1110 : : };
1111 : :
1112 [ + + ]: 14564 : if( bClearMe )
1113 : : {
1114 [ + - ][ + - ]: 938 : if( !HasSdrObjectOwnership() )
1115 [ + - ]: 938 : mpObj.reset( NULL );
1116 [ + - ]: 938 : if ( !mpImpl->mbDisposing )
1117 [ + - ]: 14564 : dispose();
1118 [ + - ]: 2155037 : }
1119 : : }
1120 : :
1121 : : // XShape
1122 : :
1123 : : //----------------------------------------------------------------------
1124 : : // The "*LogicRectHack" functions also existed in sch, and those
1125 : : // duplicate symbols cause Bad Things To Happen (TM) #i9462#.
1126 : : // Prefixing with 'svx' and marking static to make sure name collisions
1127 : : // do not occur.
1128 : :
1129 : 533962 : static sal_Bool svx_needLogicRectHack( SdrObject* pObj )
1130 : : {
1131 [ + + ]: 533962 : if( pObj->GetObjInventor() == SdrInventor)
1132 : : {
1133 [ + + ]: 523760 : switch(pObj->GetObjIdentifier())
1134 : : {
1135 : : case OBJ_GRUP:
1136 : : case OBJ_LINE:
1137 : : case OBJ_POLY:
1138 : : case OBJ_PLIN:
1139 : : case OBJ_PATHLINE:
1140 : : case OBJ_PATHFILL:
1141 : : case OBJ_FREELINE:
1142 : : case OBJ_FREEFILL:
1143 : : case OBJ_SPLNLINE:
1144 : : case OBJ_SPLNFILL:
1145 : : case OBJ_EDGE:
1146 : : case OBJ_PATHPOLY:
1147 : : case OBJ_PATHPLIN:
1148 : : case OBJ_MEASURE:
1149 : 229813 : return sal_True;
1150 : : }
1151 : : }
1152 : 533962 : return sal_False;
1153 : : }
1154 : :
1155 : : //----------------------------------------------------------------------
1156 : :
1157 : 398078 : static Rectangle svx_getLogicRectHack( SdrObject* pObj )
1158 : : {
1159 [ + + ]: 398078 : if(svx_needLogicRectHack(pObj))
1160 : : {
1161 : 146336 : return pObj->GetSnapRect();
1162 : : }
1163 : : else
1164 : : {
1165 : 398078 : return pObj->GetLogicRect();
1166 : : }
1167 : : }
1168 : :
1169 : : //----------------------------------------------------------------------
1170 : :
1171 : 135884 : static void svx_setLogicRectHack( SdrObject* pObj, const Rectangle& rRect )
1172 : : {
1173 [ + + ]: 135884 : if(svx_needLogicRectHack(pObj))
1174 : : {
1175 : 83477 : pObj->SetSnapRect( rRect );
1176 : : }
1177 : : else
1178 : : {
1179 : 52407 : pObj->SetLogicRect( rRect );
1180 : : }
1181 : 135884 : }
1182 : :
1183 : : //----------------------------------------------------------------------
1184 : :
1185 : 145518 : awt::Point SAL_CALL SvxShape::getPosition() throw(uno::RuntimeException)
1186 : : {
1187 [ + - ]: 145518 : ::SolarMutexGuard aGuard;
1188 : :
1189 [ + + ][ + - ]: 145518 : if( mpObj.is() && mpModel)
[ + + ]
1190 : : {
1191 [ + - ]: 56536 : Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
1192 : 56536 : Point aPt( aRect.Left(), aRect.Top() );
1193 : :
1194 : : // Position is relativ to anchor, so recalc to absolut position
1195 [ + + ]: 56536 : if( mpModel->IsWriter() )
1196 [ + - ]: 538 : aPt -= mpObj->GetAnchorPos();
1197 : :
1198 : 56536 : ForceMetricTo100th_mm(aPt);
1199 : 56536 : return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
1200 : : }
1201 : : else
1202 : : {
1203 : 88982 : return maPosition;
1204 [ + - ]: 145518 : }
1205 : : }
1206 : :
1207 : : //----------------------------------------------------------------------
1208 : 133841 : void SAL_CALL SvxShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
1209 : : {
1210 [ + - ]: 133841 : ::SolarMutexGuard aGuard;
1211 : :
1212 [ + + ][ + + ]: 133841 : if( mpObj.is() && mpModel )
[ + + ]
1213 : : {
1214 : : // do NOT move 3D objects, this would change the homogen
1215 : : // transformation matrix
1216 [ + - ][ + - ]: 132989 : if(!mpObj->ISA(E3dCompoundObject))
[ + + ]
1217 : : {
1218 [ + - ]: 131050 : Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
1219 : 131050 : Point aLocalPos( Position.X, Position.Y );
1220 : 131050 : ForceMetricToItemPoolMetric(aLocalPos);
1221 : :
1222 : : // Position ist absolut, relativ zum Anker stellen
1223 [ + + ]: 131050 : if( mpModel->IsWriter() )
1224 [ + - ]: 1217 : aLocalPos += mpObj->GetAnchorPos();
1225 : :
1226 : 131050 : long nDX = aLocalPos.X() - aRect.Left();
1227 : 131050 : long nDY = aLocalPos.Y() - aRect.Top();
1228 : :
1229 [ + - ]: 131050 : mpObj->Move( Size( nDX, nDY ) );
1230 [ + - ]: 131050 : mpModel->SetChanged();
1231 : : }
1232 : : }
1233 : :
1234 [ + - ]: 133841 : maPosition = Position;
1235 : 133841 : }
1236 : :
1237 : : //----------------------------------------------------------------------
1238 : 163706 : awt::Size SAL_CALL SvxShape::getSize() throw(uno::RuntimeException)
1239 : : {
1240 [ + - ]: 163706 : ::SolarMutexGuard aGuard;
1241 : :
1242 [ + + ][ + - ]: 163706 : if( mpObj.is() && mpModel)
[ + + ]
1243 : : {
1244 [ + - ]: 74608 : Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
1245 : 74608 : Size aObjSize( aRect.getWidth(), aRect.getHeight() );
1246 : 74608 : ForceMetricTo100th_mm(aObjSize);
1247 : 74608 : return ::com::sun::star::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
1248 : : }
1249 : : else
1250 [ + - ]: 163706 : return maSize;
1251 : : }
1252 : :
1253 : : //----------------------------------------------------------------------
1254 : 136749 : void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
1255 : : throw(beans::PropertyVetoException, uno::RuntimeException)
1256 : : {
1257 [ + - ]: 136749 : ::SolarMutexGuard aGuard;
1258 : :
1259 [ + + ][ + + ]: 136749 : if( mpObj.is() && mpModel)
[ + + ]
1260 : : {
1261 [ + - ]: 135884 : Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
1262 : 135884 : Size aLocalSize( rSize.Width, rSize.Height );
1263 : 135884 : ForceMetricToItemPoolMetric(aLocalSize);
1264 : :
1265 [ + + ][ + - ]: 135884 : if(mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_MEASURE )
[ - + ][ - + ]
[ + - ]
1266 : : {
1267 [ # # ]: 0 : Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
1268 [ # # ]: 0 : Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
1269 [ # # ]: 0 : Point aPt = mpObj->GetSnapRect().TopLeft();
1270 [ # # ]: 0 : mpObj->Resize(aPt,aWdt,aHgt);
1271 : : }
1272 : : else
1273 : : {
1274 : : //aRect.SetSize(aLocalSize); // this call substract 1 // http://www.openoffice.org/issues/show_bug.cgi?id=83193
1275 [ + + ]: 135884 : if ( !aLocalSize.Width() )
1276 : : {
1277 : 32831 : aRect.Right() = RECT_EMPTY;
1278 : : }
1279 : : else
1280 : 103053 : aRect.setWidth(aLocalSize.Width());
1281 [ + + ]: 135884 : if ( !aLocalSize.Height() )
1282 : : {
1283 : 33219 : aRect.Bottom() = RECT_EMPTY;
1284 : : }
1285 : : else
1286 : 102665 : aRect.setHeight(aLocalSize.Height());
1287 : :
1288 [ + - ]: 135884 : svx_setLogicRectHack( mpObj.get(), aRect );
1289 : : }
1290 : :
1291 [ + - ]: 135884 : mpModel->SetChanged();
1292 : : }
1293 [ + - ]: 136749 : maSize = rSize;
1294 : 136749 : }
1295 : :
1296 : : //----------------------------------------------------------------------
1297 : :
1298 : : // XNamed
1299 : 100 : OUString SAL_CALL SvxShape::getName( ) throw(::com::sun::star::uno::RuntimeException)
1300 : : {
1301 [ + - ]: 100 : ::SolarMutexGuard aGuard;
1302 [ + - ]: 100 : if( mpObj.is() )
1303 : : {
1304 [ + - ]: 100 : return mpObj->GetName();
1305 : : }
1306 : : else
1307 : : {
1308 : 0 : return maShapeName;
1309 [ + - ]: 100 : }
1310 : : }
1311 : :
1312 : : //----------------------------------------------------------------------
1313 : :
1314 : 71 : void SAL_CALL SvxShape::setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException)
1315 : : {
1316 [ + - ]: 71 : ::SolarMutexGuard aGuard;
1317 [ - + ]: 71 : if( mpObj.is() )
1318 : : {
1319 [ # # ]: 0 : mpObj->SetName( aName );
1320 : : }
1321 : : else
1322 : : {
1323 : 71 : maShapeName = aName;
1324 [ + - ]: 71 : }
1325 : 71 : }
1326 : :
1327 : : // XShapeDescriptor
1328 : :
1329 : : //----------------------------------------------------------------------
1330 : 179300 : OUString SAL_CALL SvxShape::getShapeType() throw(uno::RuntimeException)
1331 : : {
1332 [ + + ]: 179300 : if( !maShapeType.getLength() )
1333 : 178895 : return UHashMap::getNameFromId( mpImpl->mnObjId );
1334 : : else
1335 : 179300 : return maShapeType;
1336 : : }
1337 : :
1338 : : // XComponent
1339 : :
1340 : : //----------------------------------------------------------------------
1341 : 23190 : void SAL_CALL SvxShape::dispose() throw(uno::RuntimeException)
1342 : : {
1343 [ + - ]: 23190 : ::SolarMutexGuard aGuard;
1344 : :
1345 [ + + ]: 23190 : if( mpImpl->mbDisposing )
1346 : 23190 : return; // caught a recursion
1347 : :
1348 : 22244 : mpImpl->mbDisposing = true;
1349 : :
1350 [ + - ]: 22244 : lang::EventObject aEvt;
1351 [ + - ][ + - ]: 22244 : aEvt.Source = *(OWeakAggObject*) this;
1352 [ + - ]: 22244 : mpImpl->maDisposeListeners.disposeAndClear(aEvt);
1353 [ + - ]: 22244 : mpImpl->maPropertyNotifier.disposing();
1354 : :
1355 [ + + ]: 22244 : if ( mpObj.is() )
1356 : : {
1357 : 2 : bool bFreeSdrObject = false;
1358 : :
1359 [ + - ][ - + ]: 2 : if ( mpObj->IsInserted() && mpObj->GetPage() )
[ # # ][ # # ]
[ - + ]
1360 : : {
1361 : : OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
1362 : : // normally, we are allowed to free the SdrObject only if we have its ownership.
1363 : : // Why isn't this checked here?
1364 : :
1365 [ # # ]: 0 : SdrPage* pPage = mpObj->GetPage();
1366 : : // SdrObject aus der Page loeschen
1367 [ # # ]: 0 : sal_uInt32 nCount = pPage->GetObjCount();
1368 [ # # ]: 0 : for ( sal_uInt32 nNum = 0; nNum < nCount; ++nNum )
1369 : : {
1370 [ # # ][ # # ]: 0 : if ( pPage->GetObj( nNum ) == mpObj.get() )
1371 : : {
1372 [ # # ]: 0 : OSL_VERIFY( pPage->RemoveObject( nNum ) == mpObj.get() );
1373 : 0 : bFreeSdrObject = true;
1374 : 0 : break;
1375 : : }
1376 : : }
1377 : : }
1378 : :
1379 [ + - ][ + - ]: 2 : mpObj->setUnoShape(NULL);
1380 : :
1381 [ - + ]: 2 : if ( bFreeSdrObject )
1382 : : {
1383 : : // in case we have the ownership of the SdrObject, a Free
1384 : : // would do nothing. So ensure the ownership is reset.
1385 : 0 : mpImpl->mbHasSdrObjectOwnership = false;
1386 : 0 : SdrObject* pObject = mpObj.get();
1387 [ # # ]: 0 : SdrObject::Free( pObject );
1388 : : }
1389 : : }
1390 : :
1391 [ + + ]: 22244 : if( mpModel )
1392 : : {
1393 [ + - ]: 21306 : EndListening( *mpModel );
1394 : 21306 : mpModel = NULL;
1395 [ + - ][ + - ]: 23190 : }
[ + + ]
1396 : : }
1397 : :
1398 : : //----------------------------------------------------------------------
1399 : :
1400 : 10 : void SAL_CALL SvxShape::addEventListener( const Reference< lang::XEventListener >& xListener )
1401 : : throw(uno::RuntimeException)
1402 : : {
1403 : 10 : mpImpl->maDisposeListeners.addInterface(xListener);
1404 : 10 : }
1405 : :
1406 : : //----------------------------------------------------------------------
1407 : :
1408 : 8 : void SAL_CALL SvxShape::removeEventListener( const Reference< lang::XEventListener >& aListener ) throw(uno::RuntimeException)
1409 : : {
1410 : 8 : mpImpl->maDisposeListeners.removeInterface(aListener);
1411 : 8 : }
1412 : :
1413 : : // XPropertySet
1414 : :
1415 : : //----------------------------------------------------------------------
1416 : :
1417 : : Reference< beans::XPropertySetInfo > SAL_CALL
1418 : 3818 : SvxShape::getPropertySetInfo() throw(uno::RuntimeException)
1419 : : {
1420 [ + + ]: 3818 : if( mpImpl->mpMaster )
1421 : : {
1422 : 3536 : return mpImpl->mpMaster->getPropertySetInfo();
1423 : : }
1424 : : else
1425 : : {
1426 : 3818 : return _getPropertySetInfo();
1427 : : }
1428 : : }
1429 : :
1430 : : Reference< beans::XPropertySetInfo > SAL_CALL
1431 : 322 : SvxShape::_getPropertySetInfo() throw(uno::RuntimeException)
1432 : : {
1433 : 322 : return mpPropSet->getPropertySetInfo();
1434 : : }
1435 : :
1436 : : //----------------------------------------------------------------------
1437 : :
1438 : 0 : void SAL_CALL SvxShape::addPropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1439 : : {
1440 [ # # ]: 0 : ::osl::MutexGuard aGuard( maMutex );
1441 [ # # ][ # # ]: 0 : mpImpl->maPropertyNotifier.addPropertyChangeListener( _propertyName, _listener );
1442 : 0 : }
1443 : :
1444 : : //----------------------------------------------------------------------
1445 : :
1446 : 0 : void SAL_CALL SvxShape::removePropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1447 : : {
1448 [ # # ]: 0 : ::osl::MutexGuard aGuard( maMutex );
1449 [ # # ][ # # ]: 0 : mpImpl->maPropertyNotifier.removePropertyChangeListener( _propertyName, _listener );
1450 : 0 : }
1451 : :
1452 : : //----------------------------------------------------------------------
1453 : :
1454 : 0 : void SAL_CALL SvxShape::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1455 : : {
1456 : : OSL_FAIL( "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1457 : 0 : }
1458 : :
1459 : : //----------------------------------------------------------------------
1460 : :
1461 : 0 : void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1462 : : {
1463 : : OSL_FAIL( "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1464 : 0 : }
1465 : :
1466 : : //----------------------------------------------------------------------
1467 : :
1468 : 11104 : sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName )
1469 : : {
1470 [ + - ]: 11104 : SfxItemSet aSet( mpModel->GetItemPool(), (sal_uInt16)nWID, (sal_uInt16)nWID );
1471 : :
1472 [ + - ][ + - ]: 11104 : if( SetFillAttribute( nWID, rName, aSet, mpModel ) )
1473 : : {
1474 : : //mpObj->SetItemSetAndBroadcast(aSet);
1475 [ + - ]: 11104 : mpObj->SetMergedItemSetAndBroadcast(aSet);
1476 : :
1477 : 11104 : return sal_True;
1478 : : }
1479 : : else
1480 : : {
1481 : 0 : return sal_False;
1482 [ + - ]: 11104 : }
1483 : : }
1484 : :
1485 : : //----------------------------------------------------------------------
1486 : :
1487 : 11104 : sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName, SfxItemSet& rSet, SdrModel* pModel )
1488 : : {
1489 : : // check if an item with the given name and which id is inside the models
1490 : : // pool or the stylesheet pool, if found its puttet in the itemse
1491 [ - + ]: 11104 : if( !SetFillAttribute( nWID, rName, rSet ) )
1492 : : {
1493 : : // we did not find such item in one of the pools, so we check
1494 : : // the property lists that are loaded for the model for items
1495 : : // that support such.
1496 [ # # ]: 0 : String aStrName;
1497 : 0 : SvxUnogetInternalNameForItem( (sal_Int16)nWID, rName, aStrName );
1498 : :
1499 [ # # # # : 0 : switch( nWID )
# # ]
1500 : : {
1501 : : case XATTR_FILLBITMAP:
1502 : : {
1503 [ # # ]: 0 : XBitmapListRef pBitmapList = pModel->GetBitmapList();
1504 : :
1505 [ # # ]: 0 : if( !pBitmapList.is() )
1506 : 0 : return sal_False;
1507 : :
1508 [ # # ]: 0 : long nPos = pBitmapList->Get(aStrName);
1509 [ # # ]: 0 : if( nPos == -1 )
1510 : 0 : return sal_False;
1511 : :
1512 [ # # ]: 0 : XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos );
1513 [ # # ]: 0 : XFillBitmapItem aBmpItem;
1514 : 0 : aBmpItem.SetWhich( XATTR_FILLBITMAP );
1515 [ # # ][ # # ]: 0 : aBmpItem.SetName( rName );
[ # # ]
1516 [ # # ]: 0 : aBmpItem.SetBitmapValue( pEntry->GetXBitmap() );
1517 [ # # ]: 0 : rSet.Put( aBmpItem );
1518 [ # # ][ # # ]: 0 : break;
1519 : : }
1520 : : case XATTR_FILLGRADIENT:
1521 : : {
1522 [ # # ]: 0 : XGradientListRef pGradientList = pModel->GetGradientList();
1523 : :
1524 [ # # ]: 0 : if( !pGradientList.is() )
1525 : 0 : return sal_False;
1526 : :
1527 [ # # ]: 0 : long nPos = pGradientList->Get(aStrName);
1528 [ # # ]: 0 : if( nPos == -1 )
1529 : 0 : return sal_False;
1530 : :
1531 [ # # ]: 0 : XGradientEntry* pEntry = pGradientList->GetGradient( nPos );
1532 [ # # ]: 0 : XFillGradientItem aGrdItem;
1533 : 0 : aGrdItem.SetWhich( XATTR_FILLGRADIENT );
1534 [ # # ][ # # ]: 0 : aGrdItem.SetName( rName );
[ # # ]
1535 : 0 : aGrdItem.SetGradientValue( pEntry->GetGradient() );
1536 [ # # ]: 0 : rSet.Put( aGrdItem );
1537 [ # # ][ # # ]: 0 : break;
1538 : : }
1539 : : case XATTR_FILLHATCH:
1540 : : {
1541 [ # # ]: 0 : XHatchListRef pHatchList = pModel->GetHatchList();
1542 : :
1543 [ # # ]: 0 : if( !pHatchList.is() )
1544 : 0 : return sal_False;
1545 : :
1546 [ # # ]: 0 : long nPos = pHatchList->Get(aStrName);
1547 [ # # ]: 0 : if( nPos == -1 )
1548 : 0 : return sal_False;
1549 : :
1550 [ # # ]: 0 : XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
1551 [ # # ]: 0 : XFillHatchItem aHatchItem;
1552 : 0 : aHatchItem.SetWhich( XATTR_FILLHATCH );
1553 [ # # ][ # # ]: 0 : aHatchItem.SetName( rName );
[ # # ]
1554 : 0 : aHatchItem.SetHatchValue( pEntry->GetHatch() );
1555 [ # # ]: 0 : rSet.Put( aHatchItem );
1556 [ # # ][ # # ]: 0 : break;
1557 : : }
1558 : : case XATTR_LINEEND:
1559 : : case XATTR_LINESTART:
1560 : : {
1561 [ # # ]: 0 : XLineEndListRef pLineEndList = pModel->GetLineEndList();
1562 : :
1563 [ # # ]: 0 : if( !pLineEndList.is() )
1564 : 0 : return sal_False;
1565 : :
1566 [ # # ]: 0 : long nPos = pLineEndList->Get(aStrName);
1567 [ # # ]: 0 : if( nPos == -1 )
1568 : 0 : return sal_False;
1569 : :
1570 [ # # ]: 0 : XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
1571 [ # # ]: 0 : if( XATTR_LINEEND == nWID )
1572 : : {
1573 [ # # ]: 0 : XLineEndItem aLEItem;
1574 : 0 : aLEItem.SetWhich( XATTR_LINEEND );
1575 [ # # ][ # # ]: 0 : aLEItem.SetName( rName );
[ # # ]
1576 [ # # ]: 0 : aLEItem.SetLineEndValue( pEntry->GetLineEnd() );
1577 [ # # ][ # # ]: 0 : rSet.Put( aLEItem );
1578 : : }
1579 : : else
1580 : : {
1581 [ # # ]: 0 : XLineStartItem aLSItem;
1582 : 0 : aLSItem.SetWhich( XATTR_LINESTART );
1583 [ # # ][ # # ]: 0 : aLSItem.SetName( rName );
[ # # ]
1584 [ # # ]: 0 : aLSItem.SetLineStartValue( pEntry->GetLineEnd() );
1585 [ # # ][ # # ]: 0 : rSet.Put( aLSItem );
1586 : : }
1587 : :
1588 [ # # ]: 0 : break;
1589 : : }
1590 : : case XATTR_LINEDASH:
1591 : : {
1592 [ # # ]: 0 : XDashListRef pDashList = pModel->GetDashList();
1593 : :
1594 [ # # ]: 0 : if( !pDashList.is() )
1595 : 0 : return sal_False;
1596 : :
1597 [ # # ]: 0 : long nPos = pDashList->Get(aStrName);
1598 [ # # ]: 0 : if( nPos == -1 )
1599 : 0 : return sal_False;
1600 : :
1601 [ # # ]: 0 : XDashEntry* pEntry = pDashList->GetDash( nPos );
1602 [ # # ]: 0 : XLineDashItem aDashItem;
1603 : 0 : aDashItem.SetWhich( XATTR_LINEDASH );
1604 [ # # ][ # # ]: 0 : aDashItem.SetName( rName );
[ # # ]
1605 : 0 : aDashItem.SetDashValue( pEntry->GetDash() );
1606 [ # # ]: 0 : rSet.Put( aDashItem );
1607 [ # # ][ # # ]: 0 : break;
1608 : : }
1609 : : default:
1610 : 0 : return sal_False;
1611 [ # # ][ # # ]: 0 : }
1612 : : }
1613 : :
1614 : 11104 : return sal_True;
1615 : : }
1616 : :
1617 : : //----------------------------------------------------------------------
1618 : :
1619 : 11140 : sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, SfxItemSet& rSet )
1620 : : {
1621 [ + - ]: 11140 : String aName;
1622 : 11140 : SvxUnogetInternalNameForItem( (sal_Int16)nWID, rName, aName );
1623 : :
1624 [ + + ]: 11140 : if( aName.Len() == 0 )
1625 : : {
1626 [ - + - ]: 1007 : switch( nWID )
1627 : : {
1628 : : case XATTR_LINEEND:
1629 : : case XATTR_LINESTART:
1630 : : {
1631 [ # # ]: 0 : const String aEmpty;
1632 [ # # ]: 0 : const basegfx::B2DPolyPolygon aEmptyPoly;
1633 [ # # ]: 0 : if( nWID == XATTR_LINEEND )
1634 [ # # ][ # # ]: 0 : rSet.Put( XLineEndItem( aEmpty, aEmptyPoly ) );
[ # # ]
1635 : : else
1636 [ # # ][ # # ]: 0 : rSet.Put( XLineStartItem( aEmpty, aEmptyPoly ) );
[ # # ]
1637 : :
1638 [ # # ][ # # ]: 0 : return sal_True;
1639 : : }
1640 : : case XATTR_FILLFLOATTRANSPARENCE:
1641 : : {
1642 : : // #85953# Set a disabled XFillFloatTransparenceItem
1643 [ + - ][ + - ]: 1007 : rSet.Put(XFillFloatTransparenceItem());
[ + - ]
1644 : :
1645 : 1007 : return sal_True;
1646 : : }
1647 : : }
1648 : :
1649 : 0 : return sal_False;
1650 : : }
1651 : :
1652 : 10133 : const SfxItemPool* pPool = rSet.GetPool();
1653 : :
1654 [ + - ]: 10133 : const String aSearchName( aName );
1655 [ + - ]: 10133 : const sal_uInt32 nCount = pPool->GetItemCount2((sal_uInt16)nWID);
1656 : : const NameOrIndex* pItem;
1657 : :
1658 [ + - ]: 16432 : for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
1659 : : {
1660 [ + - ]: 16432 : pItem = (NameOrIndex*)pPool->GetItem2((sal_uInt16)nWID, nSurrogate);
1661 [ + - ][ + - ]: 16432 : if( pItem && ( pItem->GetName() == aSearchName ) )
[ + - ][ + + ]
[ + - ][ + - ]
[ + + # # ]
1662 : : {
1663 [ + - ]: 10133 : rSet.Put( *pItem );
1664 : 10133 : return sal_True;
1665 : : }
1666 : : }
1667 : :
1668 [ + - ][ + - ]: 11140 : return sal_False;
1669 : : }
1670 : :
1671 : : //----------------------------------------------------------------------
1672 : :
1673 : 1559125 : void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1674 : : throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1675 : : {
1676 [ + + ]: 1559125 : if( mpImpl->mpMaster )
1677 : : {
1678 : 4243 : mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
1679 : : }
1680 : : else
1681 : : {
1682 : 1554882 : _setPropertyValue( rPropertyName, rVal );
1683 : : }
1684 : 1559080 : }
1685 : :
1686 : 1558703 : void SAL_CALL SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1687 : : throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1688 : : {
1689 [ + - ]: 1558703 : ::SolarMutexGuard aGuard;
1690 : :
1691 [ + - ]: 1558703 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1692 : :
1693 [ + + ][ + - ]: 1558703 : if( mpObj.is() && mpModel )
[ + + ]
1694 : : {
1695 [ + + ]: 1558527 : if( pMap == NULL )
1696 [ + - ]: 45 : throw beans::UnknownPropertyException();
1697 : :
1698 [ - + ]: 1558482 : if( (pMap->nFlags & beans::PropertyAttribute::READONLY ) != 0 )
1699 : : throw beans::PropertyVetoException(
1700 : : ( rtl::OUString(
1701 : : RTL_CONSTASCII_USTRINGPARAM(
1702 : : "Readonly property can't be set: " ) )
1703 : : + rPropertyName ),
1704 [ # # ][ # # ]: 0 : uno::Reference< drawing::XShape >( this ) );
[ # # ]
1705 : :
1706 [ + - ]: 1558482 : mpModel->SetChanged();
1707 : :
1708 [ + - ][ + + ]: 1558482 : if(!setPropertyValueImpl( rPropertyName, pMap, rVal ) )
1709 : : {
1710 : : DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
1711 : : DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1712 : :
1713 [ + + ][ - + ]: 1420438 : sal_Bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
[ # # ]
1714 : :
1715 [ - + ]: 1420438 : if( pMap->nWID == SDRATTR_ECKENRADIUS )
1716 : : {
1717 : 0 : sal_Int32 nCornerRadius = 0;
1718 [ # # ][ # # ]: 0 : if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
[ # # ][ # # ]
1719 [ # # ]: 0 : throw IllegalArgumentException();
1720 : : }
1721 : :
1722 : : SfxItemSet* pSet;
1723 [ + + ][ + - ]: 1420438 : if( mbIsMultiPropertyCall && !bIsNotPersist )
1724 : : {
1725 [ + + ]: 2758220 : if( mpImpl->mpItemSet == NULL )
1726 : : {
1727 [ + - ][ + - ]: 42628 : pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone();
1728 : : }
1729 : : else
1730 : : {
1731 : 1336482 : pSet = mpImpl->mpItemSet;
1732 : : }
1733 : : }
1734 : : else
1735 : : {
1736 [ + - ][ + - ]: 41328 : pSet = new SfxItemSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
1737 : : }
1738 : :
1739 [ + - ][ + + ]: 1420438 : if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
1740 [ + - ][ + - ]: 1038314 : pSet->Put(mpObj->GetMergedItem(pMap->nWID));
1741 : :
1742 [ + - ][ + - ]: 1420438 : if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, rVal, *pSet ))
1743 : : {
1744 [ + - ][ - + ]: 1420438 : if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
1745 : : {
1746 [ # # ]: 0 : if(bIsNotPersist)
1747 : : {
1748 : : // Not-Persistant Attribute, hole diese extra
1749 [ # # ]: 0 : mpObj->TakeNotPersistAttr(*pSet, sal_False);
1750 : : }
1751 : : }
1752 : :
1753 [ + - ][ - + ]: 1420438 : if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
1754 : : {
1755 : : // Default aus ItemPool holen
1756 [ # # ]: 0 : if(mpModel->GetItemPool().IsWhich(pMap->nWID))
1757 [ # # ][ # # ]: 0 : pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
1758 : : }
1759 : :
1760 [ + - ][ + - ]: 1420438 : if( pSet->GetItemState( pMap->nWID ) == SFX_ITEM_SET )
1761 : : {
1762 [ + - ]: 1420438 : SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rVal, *pSet );
1763 : : }
1764 : : }
1765 : :
1766 [ - + ]: 1420438 : if(bIsNotPersist)
1767 : : {
1768 : : // Not-Persist Attribute extra setzen
1769 [ # # ]: 0 : mpObj->ApplyNotPersistAttr( *pSet );
1770 [ # # ][ # # ]: 0 : delete pSet;
1771 : : }
1772 : : else
1773 : : {
1774 : : // if we have a XMultiProperty call then the item set
1775 : : // will be set in setPropertyValues later
1776 [ + + ]: 1420438 : if( !mbIsMultiPropertyCall )
1777 : : {
1778 [ + - ]: 41328 : mpObj->SetMergedItemSetAndBroadcast( *pSet );
1779 : :
1780 [ + - ][ + - ]: 1420438 : delete pSet;
1781 : : }
1782 : : }
1783 : 1558658 : return;
1784 : : }
1785 : : }
1786 : : else
1787 : : {
1788 : : // since we have no actual sdr object right now
1789 : : // remember all properties in a list. These
1790 : : // properties will be set when the sdr object is
1791 : : // created
1792 : :
1793 [ + - ][ + - ]: 176 : if(pMap && pMap->nWID)
1794 : : // Fixme: We should throw a UnknownPropertyException here.
1795 : : // But since this class is aggregated from classes
1796 : : // that support additional properties that we don't
1797 : : // know here we silently store *all* properties, even
1798 : : // if they may be not supported after creation
1799 [ + - ]: 138220 : mpPropSet->setPropertyValue( pMap, rVal );
1800 [ + - ][ + + ]: 1558703 : }
1801 : : }
1802 : :
1803 : : //----------------------------------------------------------------------
1804 : :
1805 : 22647 : uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
1806 : : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1807 : : {
1808 [ + + ]: 22647 : if ( mpImpl->mpMaster )
1809 : 19331 : return mpImpl->mpMaster->getPropertyValue( PropertyName );
1810 : : else
1811 : 22647 : return _getPropertyValue( PropertyName );
1812 : : }
1813 : :
1814 : : //----------------------------------------------------------------------
1815 : :
1816 : 22084 : uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
1817 : : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1818 : : {
1819 [ + - ]: 22084 : ::SolarMutexGuard aGuard;
1820 : :
1821 [ + - ]: 22084 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1822 : :
1823 : 22084 : uno::Any aAny;
1824 [ + - ][ + - ]: 22084 : if( mpObj.is() && mpModel )
[ + - ]
1825 : : {
1826 [ + + ]: 22084 : if(pMap == NULL )
1827 [ + - ]: 3 : throw beans::UnknownPropertyException();
1828 : :
1829 [ + - ][ + + ]: 22081 : if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
1830 : : {
1831 : : DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
1832 : : DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1833 : :
1834 [ + - ]: 15695 : SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
1835 [ + - ][ + - ]: 15695 : aSet.Put(mpObj->GetMergedItem(pMap->nWID));
1836 : :
1837 [ + - ][ - + ]: 15695 : if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
1838 : : return aAny;
1839 : :
1840 [ - + ]: 15695 : if(!aSet.Count())
1841 : : {
1842 [ # # ][ # # ]: 0 : if(pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST)
1843 : : {
1844 : : // Not-Persistant Attribute, hole diese extra
1845 [ # # ]: 0 : mpObj->TakeNotPersistAttr(aSet, sal_False);
1846 : : }
1847 : : }
1848 : :
1849 [ - + ]: 15695 : if(!aSet.Count())
1850 : : {
1851 : : // Default aus ItemPool holen
1852 [ # # ]: 0 : if(mpModel->GetItemPool().IsWhich(pMap->nWID))
1853 [ # # ][ # # ]: 0 : aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
1854 : : }
1855 : :
1856 [ + - ]: 15695 : if(aSet.Count())
1857 [ + - ][ + - ]: 15695 : aAny = GetAnyForItem( aSet, pMap );
[ + - ]
1858 : : }
1859 : : }
1860 : : else
1861 : : {
1862 : :
1863 : : // Fixme: we should return default values for OWN_ATTR !
1864 : :
1865 [ # # ][ # # ]: 0 : if(pMap && pMap->nWID)
1866 : : // FixMe: see setPropertyValue
1867 [ # # ]: 0 : aAny = mpPropSet->getPropertyValue( pMap );
1868 : :
1869 : : }
1870 [ + - ]: 22084 : return aAny;
1871 : : }
1872 : :
1873 : : //----------------------------------------------------------------------
1874 : :
1875 : : // XMultiPropertySet
1876 : 42713 : void SAL_CALL SvxShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1877 : : {
1878 [ + - ]: 42713 : ::SolarMutexGuard aSolarGuard;
1879 : :
1880 : 42713 : const sal_Int32 nCount = aPropertyNames.getLength();
1881 : 42713 : const OUString* pNames = aPropertyNames.getConstArray();
1882 : :
1883 : 42713 : const uno::Any* pValues = aValues.getConstArray();
1884 : :
1885 : : // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1886 : : // reseted even when an execption is thrown
1887 [ + - ]: 42758 : const ::comphelper::ScopeGuard aGuard( boost::bind( &SvxShape::endSetPropertyValues, this ) );
[ - + - ]
[ + - ]
1888 : :
1889 : 42713 : mbIsMultiPropertyCall = sal_True;
1890 : :
1891 [ + + ]: 42713 : if( mpImpl->mpMaster )
1892 : : {
1893 [ + + ]: 3212 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1894 : : {
1895 : : try
1896 : : {
1897 [ + + ]: 2543 : setPropertyValue( *pNames, *pValues );
1898 : : }
1899 [ + - ]: 45 : catch( beans::UnknownPropertyException& e )
1900 : : {
1901 : : (void)e;
1902 : : }
1903 [ # # ]: 0 : catch( uno::Exception& ex )
1904 : : {
1905 : : (void)ex;
1906 : : }
1907 : : }
1908 : : }
1909 : : else
1910 : : {
1911 : 42044 : uno::Reference< beans::XPropertySet > xSet;
1912 [ + - ][ + - ]: 42044 : queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
[ # # # ]
[ + - ]
1913 : :
1914 [ + + ]: 1452717 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1915 : : {
1916 : : try
1917 : : {
1918 [ + - ][ + - ]: 1410673 : xSet->setPropertyValue( *pNames, *pValues );
1919 : : }
1920 [ # # ]: 0 : catch( beans::UnknownPropertyException& e )
1921 : : {
1922 : : (void)e;
1923 : : }
1924 [ # # ]: 0 : catch( uno::Exception& ex )
1925 : : {
1926 : : (void)ex;
1927 : : }
1928 : 42044 : }
1929 : : }
1930 : :
1931 [ + + ][ + - ]: 42713 : if( mpImpl->mpItemSet && mpObj.is() )
[ + + ]
1932 [ + - ][ + - ]: 42713 : mpObj->SetMergedItemSetAndBroadcast( *mpImpl->mpItemSet );
[ + - ]
1933 : 42713 : }
1934 : :
1935 : : //----------------------------------------------------------------------
1936 : :
1937 : 42713 : void SvxShape::endSetPropertyValues()
1938 : : {
1939 : 42713 : mbIsMultiPropertyCall = sal_False;
1940 [ + + ]: 42713 : if( mpImpl->mpItemSet )
1941 : : {
1942 [ + - ]: 42628 : delete mpImpl->mpItemSet;
1943 : 42628 : mpImpl->mpItemSet = 0;
1944 : : }
1945 : 42713 : }
1946 : :
1947 : : //----------------------------------------------------------------------
1948 : :
1949 : 104 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL SvxShape::getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException)
1950 : : {
1951 : 104 : const sal_Int32 nCount = aPropertyNames.getLength();
1952 : 104 : const OUString* pNames = aPropertyNames.getConstArray();
1953 : :
1954 : 104 : uno::Sequence< uno::Any > aRet( nCount );
1955 [ + - ]: 104 : uno::Any* pValue = aRet.getArray();;
1956 : :
1957 [ + - ]: 104 : if( mpImpl->mpMaster )
1958 : : {
1959 [ + + ]: 716 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1960 : : {
1961 : : try
1962 : : {
1963 [ + - ]: 612 : *pValue = getPropertyValue( *pNames );
1964 : : }
1965 [ # # ]: 0 : catch( uno::Exception& )
1966 : : {
1967 : : OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1968 : : }
1969 : : }
1970 : : }
1971 : : else
1972 : : {
1973 : 0 : uno::Reference< beans::XPropertySet > xSet;
1974 [ # # ][ # # ]: 0 : queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
[ # # ][ # # ]
1975 : :
1976 [ # # ]: 0 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1977 : : {
1978 : : try
1979 : : {
1980 [ # # ][ # # ]: 0 : *pValue = xSet->getPropertyValue( *pNames );
1981 : : }
1982 [ # # ]: 0 : catch( uno::Exception& )
1983 : : {
1984 : : OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1985 : : }
1986 : 0 : }
1987 : : }
1988 : :
1989 [ # # ]: 104 : return aRet;
1990 : : }
1991 : :
1992 : 0 : void SAL_CALL SvxShape::addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException)
1993 : : {
1994 : 0 : }
1995 : :
1996 : 0 : void SAL_CALL SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException)
1997 : : {
1998 : 0 : }
1999 : :
2000 : 0 : void SAL_CALL SvxShape::firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException)
2001 : : {
2002 : 0 : }
2003 : :
2004 : : //----------------------------------------------------------------------
2005 : :
2006 : 15695 : uno::Any SvxShape::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap ) const
2007 : : {
2008 : : DBG_TESTSOLARMUTEX();
2009 : 15695 : uno::Any aAny;
2010 : :
2011 [ - - + + ]: 15695 : switch(pMap->nWID)
2012 : : {
2013 : : case SDRATTR_CIRCSTARTANGLE:
2014 : : {
2015 : 0 : const SfxPoolItem* pPoolItem=NULL;
2016 [ # # ][ # # ]: 0 : if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
2017 : : {
2018 : 0 : sal_Int32 nAngle = ((SdrCircStartAngleItem*)pPoolItem)->GetValue();
2019 [ # # ]: 0 : aAny <<= nAngle;
2020 : : }
2021 : : break;
2022 : : }
2023 : :
2024 : : case SDRATTR_CIRCENDANGLE:
2025 : : {
2026 : 0 : const SfxPoolItem* pPoolItem=NULL;
2027 [ # # ][ # # ]: 0 : if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
2028 : : {
2029 : 0 : sal_Int32 nAngle = ((SdrCircEndAngleItem*)pPoolItem)->GetValue();
2030 [ # # ]: 0 : aAny <<= nAngle;
2031 : : }
2032 : : break;
2033 : : }
2034 : :
2035 : : case SDRATTR_CIRCKIND:
2036 : : {
2037 [ + - ][ + - ]: 8 : if( mpObj->GetObjInventor() == SdrInventor)
2038 : : {
2039 : : drawing::CircleKind eKind;
2040 [ + - ][ + - : 8 : switch(mpObj->GetObjIdentifier())
- - - ]
2041 : : {
2042 : : case OBJ_CIRC: // Kreis, Ellipse
2043 : 8 : eKind = drawing::CircleKind_FULL;
2044 : 8 : break;
2045 : : case OBJ_CCUT: // Kreisabschnitt
2046 : 0 : eKind = drawing::CircleKind_CUT;
2047 : 0 : break;
2048 : : case OBJ_CARC: // Kreisbogen
2049 : 0 : eKind = drawing::CircleKind_ARC;
2050 : 0 : break;
2051 : : case OBJ_SECT: // Kreissektor
2052 : 0 : eKind = drawing::CircleKind_SECTION;
2053 : 0 : break;
2054 : : }
2055 [ + - ]: 8 : aAny <<= eKind;
2056 : : }
2057 : 8 : break;
2058 : : }
2059 : : default:
2060 : : {
2061 : : // Hole Wert aus ItemSet
2062 [ + - ]: 15687 : aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pMap, aSet );
2063 : :
2064 [ + + ]: 15687 : if( *pMap->pType != aAny.getValueType() )
2065 : : {
2066 : : // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2067 [ + - ][ + - ]: 945 : if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
[ + - ][ + - ]
[ + - ]
2068 : : {
2069 : 945 : sal_Int32 nValue = 0;
2070 : 945 : aAny >>= nValue;
2071 [ + - ]: 945 : aAny <<= (sal_Int16)nValue;
2072 : : }
2073 : : else
2074 : : {
2075 : : OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
2076 : : }
2077 : : }
2078 : :
2079 : : }
2080 : : }
2081 : :
2082 : 15695 : return aAny;
2083 : : }
2084 : :
2085 : : //----------------------------------------------------------------------
2086 : :
2087 : : // XPropertyState
2088 : 3 : beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
2089 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
2090 : : {
2091 [ - + ]: 3 : if( mpImpl->mpMaster )
2092 : : {
2093 : 0 : return mpImpl->mpMaster->getPropertyState( PropertyName );
2094 : : }
2095 : : else
2096 : : {
2097 : 3 : return _getPropertyState( PropertyName );
2098 : : }
2099 : : }
2100 : :
2101 : 7683 : beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& PropertyName )
2102 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
2103 : : {
2104 [ + - ]: 7683 : ::SolarMutexGuard aGuard;
2105 : :
2106 [ + - ]: 7683 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
2107 : :
2108 [ + - ][ - + ]: 7683 : if( !mpObj.is() || pMap == NULL )
[ - + ]
2109 [ # # ]: 0 : throw beans::UnknownPropertyException();
2110 : :
2111 : : beans::PropertyState eState;
2112 [ + - ][ + + ]: 7683 : if( !getPropertyStateImpl( pMap, eState ) )
2113 : : {
2114 [ + - ]: 7507 : const SfxItemSet& rSet = mpObj->GetMergedItemSet();
2115 : :
2116 [ + - ]: 7507 : switch( rSet.GetItemState( pMap->nWID, sal_False ) )
[ + + - ]
2117 : : {
2118 : : case SFX_ITEM_READONLY:
2119 : : case SFX_ITEM_SET:
2120 : 492 : eState = beans::PropertyState_DIRECT_VALUE;
2121 : 492 : break;
2122 : : case SFX_ITEM_DEFAULT:
2123 : 7015 : eState = beans::PropertyState_DEFAULT_VALUE;
2124 : 7015 : break;
2125 : : default:
2126 : 0 : eState = beans::PropertyState_AMBIGUOUS_VALUE;
2127 : 0 : break;
2128 : : }
2129 : :
2130 : : // if a item is set, this doesn't mean we want it :)
2131 [ + + ]: 7507 : if( ( beans::PropertyState_DIRECT_VALUE == eState ) )
2132 : : {
2133 [ - - + ]: 492 : switch( pMap->nWID )
2134 : : {
2135 : : // the following items are disabled by changing the
2136 : : // fill style or the line style. so there is no need
2137 : : // to export items without names which should be empty
2138 : : case XATTR_FILLBITMAP:
2139 : : case XATTR_FILLGRADIENT:
2140 : : case XATTR_FILLHATCH:
2141 : : case XATTR_LINEDASH:
2142 : : {
2143 [ # # ]: 0 : NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
2144 [ # # ][ # # ]: 0 : if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
2145 : 0 : eState = beans::PropertyState_DEFAULT_VALUE;
2146 : : }
2147 : 0 : break;
2148 : :
2149 : : // #i36115#
2150 : : // If e.g. the LineStart is on NONE and thus the string has length 0, it still
2151 : : // may be a hard attribute covering the set LineStart of the parent (Style).
2152 : : // #i37644#
2153 : : // same is for fill float transparency
2154 : : case XATTR_LINEEND:
2155 : : case XATTR_LINESTART:
2156 : : case XATTR_FILLFLOATTRANSPARENCE:
2157 : : {
2158 [ # # ]: 0 : NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
2159 [ # # ]: 0 : if ( pItem == NULL )
2160 : 0 : eState = beans::PropertyState_DEFAULT_VALUE;
2161 : : }
2162 : 492 : break;
2163 : : }
2164 : : }
2165 : : }
2166 [ + - ]: 7683 : return eState;
2167 : : }
2168 : :
2169 : : //----------------------------------------------------------------------
2170 : :
2171 : 1535505 : bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
2172 : : {
2173 [ + + + - : 1535505 : switch( pProperty->nWID )
+ - - + +
+ + - + +
- + - - +
+ + + ]
2174 : : {
2175 : : case OWN_ATTR_CAPTION_POINT:
2176 : : {
2177 : 8 : awt::Point aPnt;
2178 [ + - ][ + - ]: 8 : if( rValue >>= aPnt )
2179 : : {
2180 : 8 : Point aVclPoint( aPnt.X, aPnt.Y );
2181 : :
2182 : : // #90763# position is relative to top left, make it absolute
2183 [ + - ]: 8 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2184 [ + - ]: 8 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2185 [ + - ]: 8 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2186 : :
2187 [ + - ]: 8 : aVclPoint.X() += basegfx::fround(aNewHomogenMatrix.get(0, 2));
2188 [ + - ]: 8 : aVclPoint.Y() += basegfx::fround(aNewHomogenMatrix.get(1, 2));
2189 : :
2190 : : // #88657# metric of pool maybe twips (writer)
2191 : 8 : ForceMetricToItemPoolMetric(aVclPoint);
2192 : :
2193 : : // #88491# position relative to anchor
2194 [ - + ]: 8 : if( mpModel->IsWriter() )
2195 : : {
2196 [ # # ]: 0 : aVclPoint += mpObj->GetAnchorPos();
2197 : : }
2198 : :
2199 [ + - ]: 8 : ((SdrCaptionObj*)mpObj.get())->SetTailPos(aVclPoint);
2200 : :
2201 [ + - ][ + - ]: 8 : return true;
2202 : : }
2203 : : break;
2204 : : }
2205 : : case OWN_ATTR_TRANSFORMATION:
2206 : : {
2207 : 30014 : drawing::HomogenMatrix3 aMatrix;
2208 [ + - ][ + - ]: 30014 : if(rValue >>= aMatrix)
2209 : : {
2210 [ + - ]: 30014 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2211 [ + - ]: 30014 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2212 : :
2213 [ + - ]: 30014 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2214 : :
2215 [ + - ]: 30014 : aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
2216 [ + - ]: 30014 : aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
2217 [ + - ]: 30014 : aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
2218 [ + - ]: 30014 : aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
2219 [ + - ]: 30014 : aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
2220 [ + - ]: 30014 : aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
2221 [ + - ]: 30014 : aNewHomogenMatrix.set(2, 0, aMatrix.Line3.Column1);
2222 [ + - ]: 30014 : aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2);
2223 [ + - ]: 30014 : aNewHomogenMatrix.set(2, 2, aMatrix.Line3.Column3);
2224 : :
2225 [ + - ]: 30014 : mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2226 [ + - ][ + - ]: 30014 : return true;
2227 : : }
2228 : : break;
2229 : : }
2230 : :
2231 : : case OWN_ATTR_ZORDER:
2232 : : {
2233 : 10936 : sal_Int32 nNewOrdNum = 0;
2234 [ + - ]: 10936 : if(rValue >>= nNewOrdNum)
2235 : : {
2236 [ + - ]: 10936 : SdrObjList* pObjList = mpObj->GetObjList();
2237 [ + - ]: 10936 : if( pObjList )
2238 : : {
2239 : : #ifdef DBG_UTIL
2240 : : SdrObject* pCheck =
2241 : : #endif
2242 [ + - ][ + - ]: 10936 : pObjList->SetObjectOrdNum( mpObj->GetOrdNum(), (sal_uIntPtr)nNewOrdNum );
2243 : : DBG_ASSERT( pCheck == mpObj.get(), "GetOrdNum() failed!" );
2244 : : }
2245 : 10936 : return true;
2246 : : }
2247 : : break;
2248 : : }
2249 : : case OWN_ATTR_FRAMERECT:
2250 : : {
2251 : 0 : awt::Rectangle aUnoRect;
2252 [ # # ][ # # ]: 0 : if(rValue >>= aUnoRect)
2253 : : {
2254 : 0 : Point aTopLeft( aUnoRect.X, aUnoRect.Y );
2255 : 0 : Size aObjSize( aUnoRect.Width, aUnoRect.Height );
2256 : 0 : ForceMetricToItemPoolMetric(aTopLeft);
2257 : 0 : ForceMetricToItemPoolMetric(aObjSize);
2258 [ # # ]: 0 : Rectangle aRect;
2259 : 0 : aRect.SetPos(aTopLeft);
2260 [ # # ]: 0 : aRect.SetSize(aObjSize);
2261 [ # # ]: 0 : mpObj->SetSnapRect(aRect);
2262 : 0 : return true;
2263 : : }
2264 : : break;
2265 : : }
2266 : : case OWN_ATTR_MIRRORED:
2267 : : {
2268 : 8 : sal_Bool bMirror = sal_Bool();
2269 [ + - ]: 8 : if(rValue >>= bMirror )
2270 : : {
2271 [ - + ]: 8 : SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( mpObj.get() );
2272 [ + - ]: 8 : if( pObj )
2273 [ + - ]: 8 : pObj->SetMirrored(bMirror);
2274 : 8 : return true;
2275 : : }
2276 : : break;
2277 : : }
2278 : : case OWN_ATTR_EDGE_START_OBJ:
2279 : : case OWN_ATTR_EDGE_END_OBJ:
2280 : : case OWN_ATTR_GLUEID_HEAD:
2281 : : case OWN_ATTR_GLUEID_TAIL:
2282 : : case OWN_ATTR_EDGE_START_POS:
2283 : : case OWN_ATTR_EDGE_END_POS:
2284 : : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2285 : : {
2286 [ # # ]: 0 : SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(mpObj.get());
2287 [ # # ]: 0 : if(pEdgeObj)
2288 : : {
2289 [ # # # # : 0 : switch(pProperty->nWID)
# ]
2290 : : {
2291 : : case OWN_ATTR_EDGE_START_OBJ:
2292 : : case OWN_ATTR_EDGE_END_OBJ:
2293 : : {
2294 : 0 : Reference< drawing::XShape > xShape;
2295 [ # # ][ # # ]: 0 : if( rValue >>= xShape )
2296 : : {
2297 : 0 : SdrObject* pNode = GetSdrObjectFromXShape( xShape );
2298 [ # # ]: 0 : if( pNode )
2299 : : {
2300 [ # # ]: 0 : pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
2301 [ # # ]: 0 : pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, -1 );
2302 : 0 : return true;
2303 : : }
2304 : : }
2305 [ # # ]: 0 : break;
2306 : : }
2307 : :
2308 : : case OWN_ATTR_EDGE_START_POS:
2309 : : case OWN_ATTR_EDGE_END_POS:
2310 : : {
2311 : 0 : awt::Point aUnoPoint;
2312 [ # # ][ # # ]: 0 : if( rValue >>= aUnoPoint )
2313 : : {
2314 : 0 : Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2315 : :
2316 : : // Reintroduction of fix for issue i59051 (#i108851#)
2317 : : // perform metric change before applying anchor position,
2318 : : // because the anchor position is in pool metric.
2319 : 0 : ForceMetricToItemPoolMetric( aPoint );
2320 [ # # ]: 0 : if( mpModel->IsWriter() )
2321 [ # # ]: 0 : aPoint += mpObj->GetAnchorPos();
2322 : :
2323 [ # # ]: 0 : pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
2324 : 0 : return true;
2325 : : }
2326 : : break;
2327 : : }
2328 : :
2329 : : case OWN_ATTR_GLUEID_HEAD:
2330 : : case OWN_ATTR_GLUEID_TAIL:
2331 : : {
2332 : 0 : sal_Int32 nId = 0;
2333 [ # # ]: 0 : if( rValue >>= nId )
2334 : : {
2335 [ # # ]: 0 : pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
2336 : 0 : return true;
2337 : : }
2338 : : break;
2339 : : }
2340 : : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2341 : : {
2342 [ # # ]: 0 : drawing::PolyPolygonBezierCoords aPolyPoly;
2343 [ # # ][ # # ]: 0 : if ( rValue >>= aPolyPoly )
2344 : : {
2345 [ # # ]: 0 : basegfx::B2DPolyPolygon aNewPolyPolygon( basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( aPolyPoly ) );
2346 : : // Reintroduction of fix for issue i59051 (#i108851#)
2347 : 0 : ForceMetricToItemPoolMetric( aNewPolyPolygon );
2348 [ # # ]: 0 : if( mpModel->IsWriter() )
2349 : : {
2350 [ # # ]: 0 : Point aPoint( mpObj->GetAnchorPos() );
2351 [ # # ][ # # ]: 0 : aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y()));
[ # # ]
2352 : : }
2353 [ # # ]: 0 : pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
2354 [ # # ]: 0 : return true;
2355 [ # # ][ # # ]: 0 : }
2356 : : }
2357 : : }
2358 : : }
2359 : 0 : break;
2360 : : }
2361 : : case OWN_ATTR_MEASURE_START_POS:
2362 : : case OWN_ATTR_MEASURE_END_POS:
2363 : : {
2364 [ # # ]: 0 : SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(mpObj.get());
2365 : 0 : awt::Point aUnoPoint;
2366 [ # # ][ # # ]: 0 : if(pMeasureObj && ( rValue >>= aUnoPoint ) )
[ # # ][ # # ]
2367 : : {
2368 : 0 : Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2369 : :
2370 : : // Reintroduction of fix for issue #i59051# (#i108851#)
2371 : 0 : ForceMetricToItemPoolMetric( aPoint );
2372 [ # # ]: 0 : if( mpModel->IsWriter() )
2373 [ # # ]: 0 : aPoint += mpObj->GetAnchorPos();
2374 : :
2375 [ # # ]: 0 : pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0L : 1L );
2376 [ # # ]: 0 : pMeasureObj->SetChanged();
2377 [ # # ]: 0 : pMeasureObj->BroadcastObjectChange();
2378 : 0 : return true;
2379 : : }
2380 : : break;
2381 : : }
2382 : : case OWN_ATTR_FILLBMP_MODE:
2383 : : {
2384 : : drawing::BitmapMode eMode;
2385 [ + - ][ - + ]: 18277 : if(!(rValue >>= eMode) )
2386 : : {
2387 : 0 : sal_Int32 nMode = 0;
2388 [ # # ]: 0 : if(!(rValue >>= nMode))
2389 : : break;
2390 : :
2391 : 0 : eMode = (drawing::BitmapMode)nMode;
2392 : : }
2393 [ + - ][ + - ]: 18277 : mpObj->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
[ + - ]
2394 [ + - ][ + - ]: 18277 : mpObj->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
[ + - ]
2395 : 18277 : return true;
2396 : : }
2397 : :
2398 : : case SDRATTR_LAYERID:
2399 : : {
2400 : 25 : sal_Int16 nLayerId = sal_Int16();
2401 [ + - ]: 25 : if( rValue >>= nLayerId )
2402 : : {
2403 [ + - ]: 25 : SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId);
2404 [ + - ]: 25 : if( pLayer )
2405 : : {
2406 [ + - ]: 25 : mpObj->SetLayer((unsigned char)nLayerId);
2407 : 25 : return true;
2408 : : }
2409 : : }
2410 : : break;
2411 : : }
2412 : :
2413 : : case SDRATTR_LAYERNAME:
2414 : : {
2415 : 414 : OUString aLayerName;
2416 [ + - ]: 414 : if( rValue >>= aLayerName )
2417 : : {
2418 [ + - ][ + - ]: 414 : const SdrLayer* pLayer=mpModel->GetLayerAdmin().GetLayer(aLayerName, sal_True);
[ + - ]
2419 [ + - ]: 414 : if( pLayer != NULL )
2420 : : {
2421 [ + - ]: 414 : mpObj->SetLayer( pLayer->GetID() );
2422 : 414 : return true;
2423 : : }
2424 : : }
2425 [ + - ]: 414 : break;
2426 : : }
2427 : : case SDRATTR_ROTATEANGLE:
2428 : : {
2429 : 3 : sal_Int32 nAngle = 0;
2430 [ + - ]: 3 : if( rValue >>= nAngle )
2431 : : {
2432 [ + - ][ + - ]: 3 : Point aRef1(mpObj->GetSnapRect().Center());
2433 [ + - ]: 3 : nAngle -= mpObj->GetRotateAngle();
2434 [ + - ]: 3 : if (nAngle!=0)
2435 : : {
2436 : 3 : double nSin=sin(nAngle*nPi180);
2437 : 3 : double nCos=cos(nAngle*nPi180);
2438 [ + - ]: 3 : mpObj->Rotate(aRef1,nAngle,nSin,nCos);
2439 : : }
2440 : 3 : return true;
2441 : : }
2442 : :
2443 : : break;
2444 : : }
2445 : :
2446 : : case SDRATTR_SHEARANGLE:
2447 : : {
2448 : 0 : sal_Int32 nShear = 0;
2449 [ # # ]: 0 : if( rValue >>= nShear )
2450 : : {
2451 [ # # ]: 0 : nShear -= mpObj->GetShearAngle();
2452 [ # # ]: 0 : if(nShear != 0 )
2453 : : {
2454 [ # # ][ # # ]: 0 : Point aRef1(mpObj->GetSnapRect().Center());
2455 : 0 : double nTan=tan(nShear*nPi180);
2456 [ # # ]: 0 : mpObj->Shear(aRef1,nShear,nTan,sal_False);
2457 : 0 : return true;
2458 : : }
2459 : : }
2460 : :
2461 : : break;
2462 : : }
2463 : :
2464 : : case SDRATTR_OBJMOVEPROTECT:
2465 : : {
2466 : 28 : sal_Bool bMoveProtect = sal_Bool();
2467 [ + - ]: 28 : if( rValue >>= bMoveProtect )
2468 : : {
2469 [ + - ]: 28 : mpObj->SetMoveProtect(bMoveProtect);
2470 : 28 : return true;
2471 : : }
2472 : : break;
2473 : : }
2474 : : case SDRATTR_OBJECTNAME:
2475 : : {
2476 : 44130 : OUString aName;
2477 [ + - ]: 44130 : if( rValue >>= aName )
2478 : : {
2479 [ + - ]: 44130 : mpObj->SetName( aName );
2480 : 44130 : return true;
2481 : : }
2482 [ + - ]: 44130 : break;
2483 : : }
2484 : :
2485 : : // #i68101#
2486 : : case OWN_ATTR_MISC_OBJ_TITLE:
2487 : : {
2488 : 0 : OUString aTitle;
2489 [ # # ]: 0 : if( rValue >>= aTitle )
2490 : : {
2491 [ # # ]: 0 : mpObj->SetTitle( aTitle );
2492 : 0 : return true;
2493 : : }
2494 [ # # ]: 0 : break;
2495 : : }
2496 : : case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2497 : : {
2498 : 15 : OUString aDescription;
2499 [ + - ]: 15 : if( rValue >>= aDescription )
2500 : : {
2501 [ + - ]: 15 : mpObj->SetDescription( aDescription );
2502 : 15 : return true;
2503 : : }
2504 [ + - ]: 15 : break;
2505 : : }
2506 : :
2507 : : case SDRATTR_OBJPRINTABLE:
2508 : : {
2509 : 0 : sal_Bool bPrintable = sal_Bool();
2510 [ # # ]: 0 : if( rValue >>= bPrintable )
2511 : : {
2512 [ # # ]: 0 : mpObj->SetPrintable(bPrintable);
2513 : 0 : return true;
2514 : : }
2515 : : break;
2516 : : }
2517 : : case SDRATTR_OBJVISIBLE:
2518 : : {
2519 : 0 : sal_Bool bVisible = sal_Bool();
2520 [ # # ]: 0 : if( rValue >>= bVisible )
2521 : : {
2522 [ # # ]: 0 : mpObj->SetVisible(bVisible);
2523 : 0 : return true;
2524 : : }
2525 : : break;
2526 : : }
2527 : : case SDRATTR_OBJSIZEPROTECT:
2528 : : {
2529 : 28 : sal_Bool bResizeProtect = sal_Bool();
2530 [ + - ]: 28 : if( rValue >>= bResizeProtect )
2531 : : {
2532 [ + - ]: 28 : mpObj->SetResizeProtect(bResizeProtect);
2533 : 28 : return true;
2534 : : }
2535 : : break;
2536 : : }
2537 : : case OWN_ATTR_PAGE_NUMBER:
2538 : : {
2539 : 77 : sal_Int32 nPageNum = 0;
2540 [ + - ][ + - ]: 77 : if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
[ + - ][ + - ]
2541 : : {
2542 [ - + ]: 77 : SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(mpObj.get());
2543 [ + + ]: 77 : if( pPageObj )
2544 : : {
2545 [ + - ]: 70 : SdrModel* pModel = pPageObj->GetModel();
2546 : 70 : SdrPage* pNewPage = 0L;
2547 : 70 : const sal_uInt16 nDestinationPageNum((sal_uInt16)((nPageNum << 1L) - 1L));
2548 : :
2549 [ + - ]: 70 : if(pModel)
2550 : : {
2551 [ + - ][ + + ]: 70 : if(nDestinationPageNum < pModel->GetPageCount())
2552 : : {
2553 [ + - ]: 28 : pNewPage = pModel->GetPage(nDestinationPageNum);
2554 : : }
2555 : : }
2556 : :
2557 [ + - ]: 70 : pPageObj->SetReferencedPage(pNewPage);
2558 : : }
2559 : :
2560 : 77 : return true;
2561 : : }
2562 : : break;
2563 : : }
2564 : : case XATTR_FILLBITMAP:
2565 : : case XATTR_FILLGRADIENT:
2566 : : case XATTR_FILLHATCH:
2567 : : case XATTR_FILLFLOATTRANSPARENCE:
2568 : : case XATTR_LINEEND:
2569 : : case XATTR_LINESTART:
2570 : : case XATTR_LINEDASH:
2571 : : {
2572 [ + - ]: 11104 : if( pProperty->nMemberId == MID_NAME )
2573 : : {
2574 : 11104 : OUString aApiName;
2575 [ + - ]: 11104 : if( rValue >>= aApiName )
2576 : : {
2577 [ + - ][ + - ]: 11104 : if( SetFillAttribute( pProperty->nWID, aApiName ) )
2578 : 11104 : return true;
2579 : : }
2580 [ + - ]: 11104 : break;
2581 : : }
2582 : : else
2583 : : {
2584 : 0 : return false;
2585 : : }
2586 : : }
2587 : : default:
2588 : : {
2589 : 1420438 : return false;
2590 : : }
2591 : : }
2592 [ # # ]: 1535505 : throw lang::IllegalArgumentException();
2593 : : }
2594 : :
2595 : : //----------------------------------------------------------------------
2596 : :
2597 : 21843 : bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
2598 : : {
2599 [ - + + + : 21843 : switch( pProperty->nWID )
+ - + - -
- - - + +
+ - - + +
+ + + + +
+ - - -
+ ]
2600 : : {
2601 : : case OWN_ATTR_CAPTION_POINT:
2602 : : {
2603 [ # # ]: 0 : Point aVclPoint = ((SdrCaptionObj*)mpObj.get())->GetTailPos();
2604 : :
2605 : : // #88491# make pos relative to anchor
2606 [ # # ]: 0 : if( mpModel->IsWriter() )
2607 : : {
2608 [ # # ]: 0 : aVclPoint -= mpObj->GetAnchorPos();
2609 : : }
2610 : :
2611 : : // #88657# metric of pool maybe twips (writer)
2612 : 0 : ForceMetricTo100th_mm(aVclPoint);
2613 : :
2614 : : // #90763# pos is absolute, make it relative to top left
2615 [ # # ]: 0 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2616 [ # # ]: 0 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2617 [ # # ]: 0 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2618 : :
2619 [ # # ]: 0 : aVclPoint.X() -= basegfx::fround(aNewHomogenMatrix.get(0, 2));
2620 [ # # ]: 0 : aVclPoint.Y() -= basegfx::fround(aNewHomogenMatrix.get(1, 2));
2621 : :
2622 : 0 : awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
2623 [ # # ]: 0 : rValue <<= aPnt;
2624 [ # # ][ # # ]: 0 : break;
2625 : : }
2626 : :
2627 : : case OWN_ATTR_TRANSFORMATION:
2628 : : {
2629 [ + - ]: 331 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2630 [ + - ]: 331 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2631 [ + - ]: 331 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2632 : 331 : drawing::HomogenMatrix3 aMatrix;
2633 : :
2634 [ + - ]: 331 : aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
2635 [ + - ]: 331 : aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
2636 [ + - ]: 331 : aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
2637 [ + - ]: 331 : aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
2638 [ + - ]: 331 : aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
2639 [ + - ]: 331 : aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
2640 [ + - ]: 331 : aMatrix.Line3.Column1 = aNewHomogenMatrix.get(2, 0);
2641 [ + - ]: 331 : aMatrix.Line3.Column2 = aNewHomogenMatrix.get(2, 1);
2642 [ + - ]: 331 : aMatrix.Line3.Column3 = aNewHomogenMatrix.get(2, 2);
2643 : :
2644 [ + - ]: 331 : rValue <<= aMatrix;
2645 : :
2646 [ + - ][ + - ]: 331 : break;
2647 : : }
2648 : :
2649 : : case OWN_ATTR_ZORDER:
2650 : : {
2651 [ + - ]: 446 : rValue <<= (sal_Int32)mpObj->GetOrdNum();
2652 : 446 : break;
2653 : : }
2654 : :
2655 : : case OWN_ATTR_BITMAP:
2656 : : {
2657 : 21 : rValue = GetBitmap();
2658 [ - + ]: 21 : if(!rValue.hasValue())
2659 [ # # ]: 0 : throw uno::RuntimeException();
2660 : :
2661 : 21 : break;
2662 : : }
2663 : :
2664 : : case OWN_ATTR_ISFONTWORK:
2665 : : {
2666 [ + - ][ - + ]: 3 : rValue <<= (sal_Bool)(mpObj->ISA(SdrTextObj) && ((SdrTextObj*)mpObj.get())->IsFontwork());
[ + - ]
2667 : 3 : break;
2668 : : }
2669 : :
2670 : : case OWN_ATTR_FRAMERECT:
2671 : : {
2672 [ # # ]: 0 : Rectangle aRect( mpObj->GetSnapRect() );
2673 : 0 : Point aTopLeft( aRect.TopLeft() );
2674 [ # # ][ # # ]: 0 : Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2675 : 0 : ForceMetricTo100th_mm(aTopLeft);
2676 : 0 : ForceMetricTo100th_mm(aObjSize);
2677 : : ::com::sun::star::awt::Rectangle aUnoRect(
2678 : 0 : aTopLeft.X(), aTopLeft.Y(),
2679 : 0 : aObjSize.getWidth(), aObjSize.getHeight() );
2680 [ # # ]: 0 : rValue <<= aUnoRect;
2681 : : break;
2682 : : }
2683 : :
2684 : : case OWN_ATTR_BOUNDRECT:
2685 : : {
2686 [ + - ]: 476 : Rectangle aRect( mpObj->GetCurrentBoundRect() );
2687 : 476 : Point aTopLeft( aRect.TopLeft() );
2688 [ + - ][ + - ]: 476 : Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2689 : 476 : ForceMetricTo100th_mm(aTopLeft);
2690 : 476 : ForceMetricTo100th_mm(aObjSize);
2691 : : ::com::sun::star::awt::Rectangle aUnoRect(
2692 : 476 : aTopLeft.X(), aTopLeft.Y(),
2693 : 952 : aObjSize.getWidth(), aObjSize.getHeight() );
2694 [ + - ]: 476 : rValue <<= aUnoRect;
2695 : : break;
2696 : : }
2697 : :
2698 : : case OWN_ATTR_LDNAME:
2699 : : {
2700 [ # # ]: 0 : OUString aName( mpObj->GetName() );
2701 [ # # ]: 0 : rValue <<= aName;
2702 : 0 : break;
2703 : : }
2704 : :
2705 : : case OWN_ATTR_LDBITMAP:
2706 : : {
2707 : : sal_uInt16 nId;
2708 [ # # ][ # # ]: 0 : if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_OLE2 )
[ # # ][ # # ]
[ # # ]
2709 : : {
2710 : 0 : nId = RID_UNODRAW_OLE2;
2711 : : }
2712 [ # # ][ # # ]: 0 : else if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_GRAF )
[ # # ][ # # ]
[ # # ]
2713 : : {
2714 : 0 : nId = RID_UNODRAW_GRAPHICS;
2715 : : }
2716 : : else
2717 : : {
2718 : 0 : nId = RID_UNODRAW_OBJECTS;
2719 : : }
2720 : :
2721 [ # # ][ # # ]: 0 : BitmapEx aBmp( SVX_RES(nId) );
2722 [ # # ]: 0 : Reference< awt::XBitmap > xBmp( VCLUnoHelper::CreateBitmap( aBmp ) );
2723 : :
2724 [ # # ]: 0 : rValue <<= xBmp;
2725 [ # # ]: 0 : break;
2726 : : }
2727 : :
2728 : : case OWN_ATTR_MIRRORED:
2729 : : {
2730 : 0 : sal_Bool bMirror = sal_False;
2731 [ # # ][ # # ]: 0 : if( mpObj.is() && mpObj->ISA(SdrGrafObj) )
[ # # ][ # # ]
[ # # ]
2732 [ # # ]: 0 : bMirror = ((SdrGrafObj*)mpObj.get())->IsMirrored();
2733 : :
2734 [ # # ]: 0 : rValue <<= bMirror;
2735 : : }
2736 : :
2737 : : case OWN_ATTR_EDGE_START_OBJ:
2738 : : case OWN_ATTR_EDGE_START_POS:
2739 : : case OWN_ATTR_EDGE_END_POS:
2740 : : case OWN_ATTR_EDGE_END_OBJ:
2741 : : case OWN_ATTR_GLUEID_HEAD:
2742 : : case OWN_ATTR_GLUEID_TAIL:
2743 : : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2744 : : {
2745 [ # # ]: 0 : SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(mpObj.get());
2746 [ # # ]: 0 : if(pEdgeObj)
2747 : : {
2748 [ # # # # : 0 : switch(pProperty->nWID)
# ]
2749 : : {
2750 : : case OWN_ATTR_EDGE_START_OBJ:
2751 : : case OWN_ATTR_EDGE_END_OBJ:
2752 : : {
2753 : 0 : SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
2754 [ # # ]: 0 : if(pNode)
2755 : : {
2756 : 0 : Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
2757 [ # # ]: 0 : if(xShape.is())
2758 [ # # ]: 0 : rValue <<= xShape;
2759 : :
2760 : : }
2761 : 0 : break;
2762 : : }
2763 : :
2764 : : case OWN_ATTR_EDGE_START_POS:
2765 : : case OWN_ATTR_EDGE_END_POS:
2766 : : {
2767 [ # # ]: 0 : Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
2768 [ # # ]: 0 : if( mpModel->IsWriter() )
2769 [ # # ]: 0 : aPoint -= mpObj->GetAnchorPos();
2770 : :
2771 : 0 : ForceMetricTo100th_mm( aPoint );
2772 : 0 : awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2773 : :
2774 [ # # ]: 0 : rValue <<= aUnoPoint;
2775 : : break;
2776 : : }
2777 : : case OWN_ATTR_GLUEID_HEAD:
2778 : : case OWN_ATTR_GLUEID_TAIL:
2779 : : {
2780 [ # # ]: 0 : rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
2781 : 0 : break;
2782 : : }
2783 : : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2784 : : {
2785 [ # # ]: 0 : basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
2786 [ # # ]: 0 : if( mpModel->IsWriter() )
2787 : : {
2788 [ # # ]: 0 : Point aPoint( mpObj->GetAnchorPos() );
2789 [ # # ][ # # ]: 0 : aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
[ # # ]
2790 : : }
2791 : : // Reintroduction of fix for issue #i59051# (#i108851#)
2792 : 0 : ForceMetricTo100th_mm( aPolyPoly );
2793 [ # # ]: 0 : drawing::PolyPolygonBezierCoords aRetval;
2794 [ # # ]: 0 : basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
2795 [ # # ]: 0 : rValue <<= aRetval;
2796 [ # # ][ # # ]: 0 : break;
2797 : : }
2798 : : }
2799 : : }
2800 : 0 : break;
2801 : : }
2802 : :
2803 : : case OWN_ATTR_MEASURE_START_POS:
2804 : : case OWN_ATTR_MEASURE_END_POS:
2805 : : {
2806 [ # # ]: 0 : SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(mpObj.get());
2807 [ # # ]: 0 : if(pMeasureObj)
2808 : : {
2809 [ # # ]: 0 : Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
2810 [ # # ]: 0 : if( mpModel->IsWriter() )
2811 [ # # ]: 0 : aPoint -= mpObj->GetAnchorPos();
2812 : :
2813 : : // Reintroduction of fix for issue #i59051# (#i108851#)
2814 : 0 : ForceMetricTo100th_mm( aPoint );
2815 : 0 : awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2816 : :
2817 [ # # ]: 0 : rValue <<= aUnoPoint;
2818 : : break;
2819 : : }
2820 : 0 : break;
2821 : : }
2822 : :
2823 : : case OWN_ATTR_FILLBMP_MODE:
2824 : : {
2825 : 216 : const SfxItemSet& rObjItemSet = mpObj->GetMergedItemSet();
2826 : :
2827 : 216 : XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&rObjItemSet.Get(XATTR_FILLBMP_STRETCH);
2828 : 216 : XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&rObjItemSet.Get(XATTR_FILLBMP_TILE);
2829 : :
2830 [ + - ][ + - ]: 216 : if( pTileItem && pTileItem->GetValue() )
[ + - ]
2831 : : {
2832 [ + - ]: 216 : rValue <<= drawing::BitmapMode_REPEAT;
2833 : : }
2834 [ # # ][ # # ]: 0 : else if( pStretchItem && pStretchItem->GetValue() )
[ # # ]
2835 : : {
2836 [ # # ]: 0 : rValue <<= drawing::BitmapMode_STRETCH;
2837 : : }
2838 : : else
2839 : : {
2840 [ # # ]: 0 : rValue <<= drawing::BitmapMode_NO_REPEAT;
2841 : : }
2842 : 216 : break;
2843 : : }
2844 : : case SDRATTR_LAYERID:
2845 [ + - ]: 231 : rValue <<= (sal_Int16)mpObj->GetLayer();
2846 : 231 : break;
2847 : :
2848 : : case SDRATTR_LAYERNAME:
2849 : : {
2850 : 331 : SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID(mpObj->GetLayer());
2851 [ + - ]: 331 : if( pLayer )
2852 : : {
2853 [ + - ]: 331 : OUString aName( pLayer->GetName() );
2854 [ + - ]: 331 : rValue <<= aName;
2855 : : }
2856 : 331 : break;
2857 : : }
2858 : :
2859 : : case SDRATTR_ROTATEANGLE:
2860 [ # # ]: 0 : rValue <<= mpObj->GetRotateAngle();
2861 : 0 : break;
2862 : :
2863 : : case SDRATTR_SHEARANGLE:
2864 [ # # ]: 0 : rValue <<= mpObj->GetShearAngle();
2865 : 0 : break;
2866 : :
2867 : : case SDRATTR_OBJMOVEPROTECT:
2868 [ + - ]: 291 : rValue = uno::makeAny( (sal_Bool) mpObj->IsMoveProtect() );
2869 : 291 : break;
2870 : :
2871 : : case SDRATTR_OBJECTNAME:
2872 : : {
2873 [ + - ]: 2707 : OUString aName( mpObj->GetName() );
2874 [ + - ]: 2707 : rValue <<= aName;
2875 : 2707 : break;
2876 : : }
2877 : :
2878 : : // #i68101#
2879 : : case OWN_ATTR_MISC_OBJ_TITLE:
2880 : : {
2881 [ + - ]: 80 : OUString aTitle( mpObj->GetTitle() );
2882 [ + - ]: 80 : rValue <<= aTitle;
2883 : 80 : break;
2884 : : }
2885 : :
2886 : : case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2887 : : {
2888 [ + - ]: 92 : OUString aDescription( mpObj->GetDescription() );
2889 [ + - ]: 92 : rValue <<= aDescription;
2890 : 92 : break;
2891 : : }
2892 : :
2893 : : case SDRATTR_OBJPRINTABLE:
2894 [ + - ]: 302 : rValue <<= static_cast<sal_Bool>( mpObj->IsPrintable() );
2895 : 302 : break;
2896 : :
2897 : : case SDRATTR_OBJVISIBLE:
2898 [ + - ]: 302 : rValue <<= static_cast<sal_Bool>( mpObj->IsVisible() );
2899 : 302 : break;
2900 : :
2901 : : case SDRATTR_OBJSIZEPROTECT:
2902 [ + - ]: 291 : rValue <<= static_cast<sal_Bool>( mpObj->IsResizeProtect() );
2903 : 291 : break;
2904 : :
2905 : : case OWN_ATTR_PAGE_NUMBER:
2906 : : {
2907 [ - + ]: 28 : SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(mpObj.get());
2908 [ + - ]: 28 : if(pPageObj)
2909 : : {
2910 [ + - ]: 28 : SdrPage* pPage = pPageObj->GetReferencedPage();
2911 [ + + ][ + - ]: 28 : sal_Int32 nPageNumber = (pPage) ? pPage->GetPageNum() : 0L;
2912 : 28 : nPageNumber++;
2913 : 28 : nPageNumber >>= 1;
2914 [ + - ]: 28 : rValue <<= nPageNumber;
2915 : : }
2916 : 28 : break;
2917 : : }
2918 : :
2919 : : case OWN_ATTR_UINAME_SINGULAR:
2920 : : {
2921 [ # # ]: 0 : String aTmp;
2922 [ # # ]: 0 : mpObj->TakeObjNameSingul( aTmp );
2923 [ # # ][ # # ]: 0 : rValue <<= OUString( aTmp );
2924 [ # # ]: 0 : break;
2925 : : }
2926 : :
2927 : : case OWN_ATTR_UINAME_PLURAL:
2928 : : {
2929 [ # # ]: 0 : String aTmp;
2930 [ # # ]: 0 : mpObj->TakeObjNamePlural( aTmp );
2931 [ # # ][ # # ]: 0 : rValue <<= OUString( aTmp );
2932 [ # # ]: 0 : break;
2933 : : }
2934 : : case OWN_ATTR_METAFILE:
2935 : : {
2936 [ # # ]: 0 : SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
2937 [ # # ]: 0 : if( pObj )
2938 : : {
2939 : 0 : Graphic* pGraphic = pObj->GetGraphic();
2940 [ # # ]: 0 : if( pGraphic )
2941 : : {
2942 : 0 : sal_Bool bIsWMF = sal_False;
2943 [ # # ]: 0 : if ( pGraphic->IsLink() )
2944 : : {
2945 [ # # ]: 0 : GfxLink aLnk = pGraphic->GetLink();
2946 [ # # ][ # # ]: 0 : if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
2947 : : {
2948 : 0 : bIsWMF = sal_True;
2949 [ # # ][ # # ]: 0 : uno::Sequence<sal_Int8> aSeq((sal_Int8*)aLnk.GetData(), (sal_Int32) aLnk.GetDataSize());
[ # # ]
2950 [ # # ][ # # ]: 0 : rValue <<= aSeq;
2951 [ # # ]: 0 : }
2952 : : }
2953 [ # # ]: 0 : if ( !bIsWMF )
2954 : : {
2955 [ # # ]: 0 : GDIMetaFile aMtf;
2956 [ # # ][ # # ]: 0 : if ( pGraphic->GetType() != GRAPHIC_BITMAP )
2957 [ # # ][ # # ]: 0 : aMtf = pObj->GetGraphic()->GetGDIMetaFile();
[ # # ]
2958 : : else
2959 : : {
2960 [ # # ]: 0 : VirtualDevice aVirDev;
2961 [ # # ]: 0 : aMtf.Record( &aVirDev );
2962 [ # # ][ # # ]: 0 : pGraphic->Draw( &aVirDev, Point(), pGraphic->GetPrefSize() );
2963 [ # # ]: 0 : aMtf.Stop();
2964 [ # # ]: 0 : aMtf.SetPrefSize( pGraphic->GetPrefSize() );
2965 [ # # ][ # # ]: 0 : aMtf.SetPrefMapMode( pGraphic->GetPrefMapMode() );
[ # # ][ # # ]
2966 : : }
2967 [ # # ]: 0 : SvMemoryStream aDestStrm( 65535, 65535 );
2968 [ # # ]: 0 : ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
2969 : : const uno::Sequence<sal_Int8> aSeq(
2970 [ # # ]: 0 : static_cast< const sal_Int8* >(aDestStrm.GetData()),
2971 [ # # ]: 0 : aDestStrm.GetEndOfData());
2972 [ # # ][ # # ]: 0 : rValue <<= aSeq;
[ # # ][ # # ]
2973 : : }
2974 : : }
2975 : : }
2976 : : else
2977 : : {
2978 : 0 : rValue = GetBitmap( sal_True );
2979 : : }
2980 : 0 : break;
2981 : : }
2982 : :
2983 : :
2984 : : default:
2985 : 15695 : return false;
2986 : : }
2987 : 21843 : return true;
2988 : : }
2989 : :
2990 : : //----------------------------------------------------------------------
2991 : :
2992 : 7683 : bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
2993 : : {
2994 [ + + ]: 7683 : if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
2995 : : {
2996 : 56 : const SfxItemSet& rSet = mpObj->GetMergedItemSet();
2997 : :
2998 [ - + ]: 112 : if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
[ + - - + ]
2999 : 56 : rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
3000 : : {
3001 : 0 : rState = beans::PropertyState_DIRECT_VALUE;
3002 : : }
3003 : : else
3004 : : {
3005 : 56 : rState = beans::PropertyState_AMBIGUOUS_VALUE;
3006 : : }
3007 : : }
3008 [ + + ][ + - ]: 7627 : else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
[ + + ][ + + ]
[ + + ]
3009 : : ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
3010 : : {
3011 : 120 : rState = beans::PropertyState_DIRECT_VALUE;
3012 : : }
3013 : : else
3014 : : {
3015 : 7507 : return false;
3016 : : }
3017 : :
3018 : 7683 : return true;
3019 : : }
3020 : :
3021 : : //----------------------------------------------------------------------
3022 : :
3023 : 0 : bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
3024 : : {
3025 [ # # ]: 0 : if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
3026 : : {
3027 : 0 : mpObj->ClearMergedItem( XATTR_FILLBMP_STRETCH );
3028 : 0 : mpObj->ClearMergedItem( XATTR_FILLBMP_TILE );
3029 : 0 : return true;
3030 : : }
3031 [ # # ][ # # ]: 0 : else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
[ # # ][ # # ]
3032 : : ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
3033 : : {
3034 : 0 : return true;
3035 : : }
3036 : : else
3037 : : {
3038 : 0 : return false;
3039 : : }
3040 : : }
3041 : :
3042 : : //----------------------------------------------------------------------
3043 : :
3044 : 168 : uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
3045 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
3046 : : {
3047 : 168 : const sal_Int32 nCount = aPropertyName.getLength();
3048 : 168 : const OUString* pNames = aPropertyName.getConstArray();
3049 : :
3050 : 168 : uno::Sequence< beans::PropertyState > aRet( nCount );
3051 [ + - ]: 168 : beans::PropertyState* pState = aRet.getArray();
3052 : :
3053 [ + - ]: 168 : if( mpImpl->mpMaster )
3054 : : {
3055 [ + + ]: 9844 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
3056 [ + - ]: 9676 : pState[nIdx] = mpImpl->mpMaster->getPropertyState( pNames[nIdx] );
3057 : : }
3058 : : else
3059 : : {
3060 [ # # ]: 0 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
3061 [ # # ]: 0 : pState[nIdx] = _getPropertyState( pNames[nIdx] );
3062 : : }
3063 : :
3064 : 168 : return aRet;
3065 : : }
3066 : :
3067 : : //----------------------------------------------------------------------
3068 : :
3069 : 0 : void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
3070 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
3071 : : {
3072 [ # # ]: 0 : if( mpImpl->mpMaster )
3073 : : {
3074 : 0 : mpImpl->mpMaster->setPropertyToDefault( PropertyName );
3075 : : }
3076 : : else
3077 : : {
3078 : 0 : _setPropertyToDefault( PropertyName );
3079 : : }
3080 : 0 : }
3081 : :
3082 : 0 : void SAL_CALL SvxShape::_setPropertyToDefault( const OUString& PropertyName )
3083 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
3084 : : {
3085 [ # # ]: 0 : ::SolarMutexGuard aGuard;
3086 : :
3087 [ # # ]: 0 : const SfxItemPropertySimpleEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
3088 : :
3089 [ # # ][ # # ]: 0 : if( !mpObj.is() || mpModel == NULL || pProperty == NULL )
[ # # ][ # # ]
3090 [ # # ]: 0 : throw beans::UnknownPropertyException();
3091 : :
3092 [ # # ][ # # ]: 0 : if( !setPropertyToDefaultImpl( pProperty ) )
3093 : : {
3094 [ # # ]: 0 : mpObj->ClearMergedItem( pProperty->nWID );
3095 : : }
3096 : :
3097 [ # # ][ # # ]: 0 : mpModel->SetChanged();
3098 : 0 : }
3099 : :
3100 : : //----------------------------------------------------------------------
3101 : :
3102 : 0 : uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
3103 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
3104 : : {
3105 [ # # ]: 0 : if( mpImpl->mpMaster )
3106 : : {
3107 : 0 : return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
3108 : : }
3109 : : else
3110 : : {
3111 : 0 : return _getPropertyDefault( aPropertyName );
3112 : : }
3113 : : }
3114 : :
3115 : 0 : uno::Any SAL_CALL SvxShape::_getPropertyDefault( const OUString& aPropertyName )
3116 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
3117 : : {
3118 [ # # ]: 0 : ::SolarMutexGuard aGuard;
3119 : :
3120 [ # # ]: 0 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
3121 : :
3122 [ # # ][ # # ]: 0 : if( !mpObj.is() || pMap == NULL || mpModel == NULL )
[ # # ][ # # ]
3123 [ # # ]: 0 : throw beans::UnknownPropertyException();
3124 : :
3125 [ # # ][ # # ]: 0 : if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
[ # # ][ # # ]
3126 : : ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
3127 : : {
3128 [ # # ]: 0 : return getPropertyValue( aPropertyName );
3129 : : }
3130 : :
3131 : : // Default aus ItemPool holen
3132 [ # # ]: 0 : if(!mpModel->GetItemPool().IsWhich(pMap->nWID))
3133 [ # # ]: 0 : throw beans::UnknownPropertyException();
3134 : :
3135 [ # # ]: 0 : SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
3136 [ # # ][ # # ]: 0 : aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
3137 : :
3138 [ # # ][ # # ]: 0 : return GetAnyForItem( aSet, pMap );
[ # # ]
3139 : : }
3140 : :
3141 : : // XMultiPropertyStates
3142 : 372 : void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException)
3143 : : {
3144 [ + - ]: 372 : ::SolarMutexGuard aGuard;
3145 : :
3146 [ - + ]: 372 : if( !mpObj.is() )
3147 [ # # ]: 0 : throw lang::DisposedException();
3148 [ + - ]: 372 : mpObj->ClearMergedItem(); // nWhich == 0 => all
3149 : :
3150 [ + - ][ + - ]: 372 : if(mpObj->ISA(SdrGrafObj))
[ + + ]
3151 : : {
3152 : : // defaults for graphic objects have changed:
3153 [ + - ][ + - ]: 8 : mpObj->SetMergedItem( XFillStyleItem( XFILL_NONE ) );
[ + - ]
3154 [ + - ][ + - ]: 8 : mpObj->SetMergedItem( XLineStyleItem( XLINE_NONE ) );
[ + - ]
3155 : : }
3156 : :
3157 : : // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3158 : : // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3159 : : // does not load lathe or extrude objects, it is possible to set the items
3160 : : // here.
3161 : : // For other solution possibilities, see task description.
3162 [ + - ][ + - ]: 372 : if(mpObj->ISA(E3dLatheObj) || mpObj->ISA(E3dExtrudeObj))
[ + - ][ + - ]
[ + - ][ - + ]
[ - + ]
3163 : : {
3164 [ # # ][ # # ]: 0 : mpObj->SetMergedItem(Svx3DCharacterModeItem(true));
[ # # ]
3165 : : }
3166 : :
3167 [ + - ][ + - ]: 372 : mpModel->SetChanged();
3168 : 372 : }
3169 : :
3170 : 0 : void SvxShape::setPropertiesToDefault(
3171 : : const uno::Sequence<OUString>& aPropertyNames )
3172 : : throw (beans::UnknownPropertyException, uno::RuntimeException)
3173 : : {
3174 [ # # ]: 0 : for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
3175 : 0 : setPropertyToDefault( aPropertyNames[pos] );
3176 : 0 : }
3177 : :
3178 : 0 : uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
3179 : : const uno::Sequence<OUString>& aPropertyNames )
3180 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
3181 : : uno::RuntimeException)
3182 : : {
3183 [ # # ]: 0 : ::std::vector<uno::Any> ret;
3184 [ # # ]: 0 : for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
3185 [ # # ][ # # ]: 0 : ret.push_back( getPropertyDefault( aPropertyNames[pos] ) );
3186 [ # # ]: 0 : return uno::Sequence<uno::Any>( &ret[0], ret.size() );
3187 : : }
3188 : :
3189 : : //----------------------------------------------------------------------
3190 : :
3191 : : //----------------------------------------------------------------------
3192 : : // XServiceInfo
3193 : : //----------------------------------------------------------------------
3194 : 0 : OUString SAL_CALL SvxShape::getImplementationName()
3195 : : throw(uno::RuntimeException)
3196 : : {
3197 [ # # ][ # # ]: 0 : static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShape") );
[ # # ][ # # ]
3198 : 0 : return aServiceName;
3199 : : }
3200 : :
3201 : : #define STAR_NAMESPACE "com.sun.star."
3202 : :
3203 : : const char* sUNO_service_style_ParagraphProperties = STAR_NAMESPACE "style.ParagraphProperties";
3204 : : const char* sUNO_service_style_ParagraphPropertiesComplex = STAR_NAMESPACE "style.ParagraphPropertiesComplex";
3205 : : const char* sUNO_service_style_ParagraphPropertiesAsian = STAR_NAMESPACE "style.ParagraphPropertiesAsian";
3206 : : const char* sUNO_service_style_CharacterProperties = STAR_NAMESPACE "style.CharacterProperties";
3207 : : const char* sUNO_service_style_CharacterPropertiesComplex = STAR_NAMESPACE "style.CharacterPropertiesComplex";
3208 : : const char* sUNO_service_style_CharacterPropertiesAsian = STAR_NAMESPACE "style.CharacterPropertiesAsian";
3209 : :
3210 : : const char* sUNO_service_drawing_FillProperties = STAR_NAMESPACE "drawing.FillProperties";
3211 : : const char* sUNO_service_drawing_TextProperties = STAR_NAMESPACE "drawing.TextProperties";
3212 : : const char* sUNO_service_drawing_LineProperties = STAR_NAMESPACE "drawing.LineProperties";
3213 : : const char* sUNO_service_drawing_ConnectorProperties = STAR_NAMESPACE "drawing.ConnectorProperties";
3214 : : const char* sUNO_service_drawing_MeasureProperties = STAR_NAMESPACE "drawing.MeasureProperties";
3215 : : const char* sUNO_service_drawing_ShadowProperties = STAR_NAMESPACE "drawing.ShadowProperties";
3216 : :
3217 : : const char* sUNO_service_drawing_RotationDescriptor = STAR_NAMESPACE "drawing.RotationDescriptor";
3218 : :
3219 : : const char* sUNO_service_drawing_Text = STAR_NAMESPACE "drawing.Text";
3220 : : const char* sUNO_service_drawing_GroupShape = STAR_NAMESPACE "drawing.GroupShape";
3221 : :
3222 : : const char* sUNO_service_drawing_CustomShapeProperties = STAR_NAMESPACE "drawing.CustomShapeProperties";
3223 : : const char* sUNO_service_drawing_CustomShape = STAR_NAMESPACE "drawing.CustomShape";
3224 : :
3225 : : const char* sUNO_service_drawing_PolyPolygonDescriptor = STAR_NAMESPACE "drawing.PolyPolygonDescriptor";
3226 : : const char* sUNO_service_drawing_PolyPolygonBezierDescriptor= STAR_NAMESPACE "drawing.PolyPolygonBezierDescriptor";
3227 : :
3228 : : const char* sUNO_service_drawing_LineShape = STAR_NAMESPACE "drawing.LineShape";
3229 : : const char* sUNO_service_drawing_Shape = STAR_NAMESPACE "drawing.Shape";
3230 : : const char* sUNO_service_drawing_RectangleShape = STAR_NAMESPACE "drawing.RectangleShape";
3231 : : const char* sUNO_service_drawing_EllipseShape = STAR_NAMESPACE "drawing.EllipseShape";
3232 : : const char* sUNO_service_drawing_PolyPolygonShape = STAR_NAMESPACE "drawing.PolyPolygonShape";
3233 : : const char* sUNO_service_drawing_PolyLineShape = STAR_NAMESPACE "drawing.PolyLineShape";
3234 : : const char* sUNO_service_drawing_OpenBezierShape = STAR_NAMESPACE "drawing.OpenBezierShape";
3235 : : const char* sUNO_service_drawing_ClosedBezierShape = STAR_NAMESPACE "drawing.ClosedBezierShape";
3236 : : const char* sUNO_service_drawing_TextShape = STAR_NAMESPACE "drawing.TextShape";
3237 : : const char* sUNO_service_drawing_GraphicObjectShape = STAR_NAMESPACE "drawing.GraphicObjectShape";
3238 : : const char* sUNO_service_drawing_OLE2Shape = STAR_NAMESPACE "drawing.OLE2Shape";
3239 : : const char* sUNO_service_drawing_PageShape = STAR_NAMESPACE "drawing.PageShape";
3240 : : const char* sUNO_service_drawing_CaptionShape = STAR_NAMESPACE "drawing.CaptionShape";
3241 : : const char* sUNO_service_drawing_MeasureShape = STAR_NAMESPACE "drawing.MeasureShape";
3242 : : const char* sUNO_service_drawing_FrameShape = STAR_NAMESPACE "drawing.FrameShape";
3243 : : const char* sUNO_service_drawing_ControlShape = STAR_NAMESPACE "drawing.ControlShape";
3244 : : const char* sUNO_service_drawing_ConnectorShape = STAR_NAMESPACE "drawing.ConnectorShape";
3245 : : const char* sUNO_service_drawing_MediaShape = STAR_NAMESPACE "drawing.MediaShape";
3246 : :
3247 : :
3248 : 3941 : uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
3249 : : throw(uno::RuntimeException)
3250 : : {
3251 [ + + ]: 3941 : if( mpImpl->mpMaster )
3252 : : {
3253 : 3806 : return mpImpl->mpMaster->getSupportedServiceNames();
3254 : : }
3255 : : else
3256 : : {
3257 : 3941 : return _getSupportedServiceNames();
3258 : : }
3259 : : }
3260 : :
3261 : 3941 : uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames()
3262 : : throw(uno::RuntimeException)
3263 : : {
3264 [ + - ]: 3941 : ::SolarMutexGuard aGuard;
3265 : :
3266 [ + - ][ + - ]: 3941 : if( mpObj.is() && mpObj->GetObjInventor() == SdrInventor)
[ + - ][ + - ]
3267 : : {
3268 [ + - ]: 3941 : const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
3269 : :
3270 [ - + + + : 3941 : switch(nIdent)
- + + + +
+ + - - +
- - - - -
+ ]
3271 : : {
3272 : : case OBJ_GRUP:
3273 : : {
3274 : : static uno::Sequence< OUString > *pSeq = 0;
3275 [ # # ]: 0 : if( 0 == pSeq )
3276 : : {
3277 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_GroupServices;
[ # # ][ # # ]
3278 : :
3279 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices, 2,
3280 : : sUNO_service_drawing_GroupShape,
3281 : 0 : sUNO_service_drawing_Shape );
3282 : :
3283 : 0 : pSeq = &SvxShape_GroupServices;
3284 : : }
3285 : :
3286 [ # # ]: 0 : return *pSeq;
3287 : : }
3288 : : case OBJ_CUSTOMSHAPE:
3289 : : {
3290 : : static uno::Sequence< OUString > *pSeq = 0;
3291 [ + + ]: 3186 : if( 0 == pSeq )
3292 : : {
3293 [ + - ][ + - ]: 12 : static uno::Sequence< OUString > SvxShape_CustomShapeServices;
[ + - ][ # # ]
3294 : :
3295 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices, 13,
3296 : : sUNO_service_drawing_CustomShape,
3297 : : sUNO_service_drawing_Shape,
3298 : : sUNO_service_drawing_CustomShapeProperties,
3299 : : sUNO_service_drawing_FillProperties,
3300 : : sUNO_service_drawing_LineProperties,
3301 : : sUNO_service_drawing_Text,
3302 : : sUNO_service_drawing_TextProperties,
3303 : : sUNO_service_style_ParagraphProperties,
3304 : : sUNO_service_style_ParagraphPropertiesComplex,
3305 : : sUNO_service_style_ParagraphPropertiesAsian,
3306 : : sUNO_service_style_CharacterProperties,
3307 : : sUNO_service_style_CharacterPropertiesComplex,
3308 : : sUNO_service_style_CharacterPropertiesAsian,
3309 : : sUNO_service_drawing_ShadowProperties,
3310 : 12 : sUNO_service_drawing_RotationDescriptor);
3311 : 12 : pSeq = &SvxShape_CustomShapeServices;
3312 : : }
3313 [ + - ]: 3186 : return *pSeq;
3314 : : }
3315 : : case OBJ_LINE:
3316 : : {
3317 : : static uno::Sequence< OUString > *pSeq = 0;
3318 [ + + ]: 180 : if( 0 == pSeq )
3319 : : {
3320 [ + - ][ + - ]: 9 : static uno::Sequence< OUString > SvxShape_LineServices;
[ + - ][ # # ]
3321 : :
3322 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices,14,
3323 : : sUNO_service_drawing_LineShape,
3324 : :
3325 : : sUNO_service_drawing_Shape,
3326 : : sUNO_service_drawing_LineProperties,
3327 : :
3328 : : sUNO_service_drawing_Text,
3329 : : sUNO_service_drawing_TextProperties,
3330 : : sUNO_service_style_ParagraphProperties,
3331 : : sUNO_service_style_ParagraphPropertiesComplex,
3332 : : sUNO_service_style_ParagraphPropertiesAsian,
3333 : : sUNO_service_style_CharacterProperties,
3334 : : sUNO_service_style_CharacterPropertiesComplex,
3335 : : sUNO_service_style_CharacterPropertiesAsian,
3336 : :
3337 : : sUNO_service_drawing_PolyPolygonDescriptor,
3338 : : sUNO_service_drawing_ShadowProperties,
3339 : 9 : sUNO_service_drawing_RotationDescriptor);
3340 : :
3341 : 9 : pSeq = &SvxShape_LineServices;
3342 : : }
3343 [ + - ]: 180 : return *pSeq;
3344 : : }
3345 : :
3346 : : case OBJ_RECT:
3347 : : {
3348 : : static uno::Sequence< OUString > *pSeq = 0;
3349 [ + + ]: 9 : if( 0 == pSeq )
3350 : : {
3351 [ + - ][ + - ]: 3 : static uno::Sequence< OUString > SvxShape_RectServices;
[ + - ][ # # ]
3352 : :
3353 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices,14,
3354 : : sUNO_service_drawing_RectangleShape,
3355 : :
3356 : : sUNO_service_drawing_Shape,
3357 : : sUNO_service_drawing_FillProperties,
3358 : : sUNO_service_drawing_LineProperties,
3359 : : sUNO_service_drawing_Text,
3360 : : sUNO_service_drawing_TextProperties,
3361 : : sUNO_service_style_ParagraphProperties,
3362 : : sUNO_service_style_ParagraphPropertiesComplex,
3363 : : sUNO_service_style_ParagraphPropertiesAsian,
3364 : : sUNO_service_style_CharacterProperties,
3365 : : sUNO_service_style_CharacterPropertiesComplex,
3366 : : sUNO_service_style_CharacterPropertiesAsian,
3367 : :
3368 : : sUNO_service_drawing_ShadowProperties,
3369 : 3 : sUNO_service_drawing_RotationDescriptor);
3370 : 3 : pSeq = &SvxShape_RectServices;
3371 : : }
3372 [ + - ]: 9 : return *pSeq;
3373 : : }
3374 : :
3375 : : case OBJ_CIRC:
3376 : : case OBJ_SECT:
3377 : : case OBJ_CARC:
3378 : : case OBJ_CCUT:
3379 : : {
3380 : : static uno::Sequence< OUString > *pSeq = 0;
3381 [ # # ]: 0 : if( 0 == pSeq )
3382 : : {
3383 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_CircServices;
[ # # ][ # # ]
3384 : :
3385 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices,14,
3386 : : sUNO_service_drawing_EllipseShape,
3387 : :
3388 : : sUNO_service_drawing_Shape,
3389 : : sUNO_service_drawing_FillProperties,
3390 : : sUNO_service_drawing_LineProperties,
3391 : :
3392 : : sUNO_service_drawing_Text,
3393 : : sUNO_service_drawing_TextProperties,
3394 : : sUNO_service_style_ParagraphProperties,
3395 : : sUNO_service_style_ParagraphPropertiesComplex,
3396 : : sUNO_service_style_ParagraphPropertiesAsian,
3397 : : sUNO_service_style_CharacterProperties,
3398 : : sUNO_service_style_CharacterPropertiesComplex,
3399 : : sUNO_service_style_CharacterPropertiesAsian,
3400 : :
3401 : : sUNO_service_drawing_ShadowProperties,
3402 : 0 : sUNO_service_drawing_RotationDescriptor);
3403 : :
3404 : 0 : pSeq = &SvxShape_CircServices;
3405 : : }
3406 : :
3407 [ # # ]: 0 : return *pSeq;
3408 : : }
3409 : :
3410 : : case OBJ_PATHPLIN:
3411 : : case OBJ_PLIN:
3412 : : {
3413 : : static uno::Sequence< OUString > *pSeq = 0;
3414 [ + + ]: 48 : if( 0 == pSeq )
3415 : : {
3416 [ + - ][ + - ]: 3 : static uno::Sequence< OUString > SvxShape_PathServices;
[ + - ][ # # ]
3417 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices,14,
3418 : : sUNO_service_drawing_PolyLineShape,
3419 : :
3420 : : sUNO_service_drawing_Shape,
3421 : : sUNO_service_drawing_LineProperties,
3422 : :
3423 : : sUNO_service_drawing_PolyPolygonDescriptor,
3424 : :
3425 : : sUNO_service_drawing_Text,
3426 : : sUNO_service_drawing_TextProperties,
3427 : : sUNO_service_style_ParagraphProperties,
3428 : : sUNO_service_style_ParagraphPropertiesComplex,
3429 : : sUNO_service_style_ParagraphPropertiesAsian,
3430 : : sUNO_service_style_CharacterProperties,
3431 : : sUNO_service_style_CharacterPropertiesComplex,
3432 : : sUNO_service_style_CharacterPropertiesAsian,
3433 : :
3434 : : sUNO_service_drawing_ShadowProperties,
3435 : 3 : sUNO_service_drawing_RotationDescriptor);
3436 : 3 : pSeq = &SvxShape_PathServices;
3437 : : }
3438 [ + - ]: 48 : return *pSeq;
3439 : : }
3440 : :
3441 : : case OBJ_PATHPOLY:
3442 : : case OBJ_POLY:
3443 : : {
3444 : : static uno::Sequence< OUString > *pSeq = 0;
3445 [ + + ]: 144 : if( 0 == pSeq )
3446 : : {
3447 [ + - ][ + - ]: 3 : static uno::Sequence< OUString > SvxShape_PolyServices;
[ + - ][ # # ]
3448 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices,15,
3449 : : sUNO_service_drawing_PolyPolygonShape,
3450 : :
3451 : : sUNO_service_drawing_Shape,
3452 : : sUNO_service_drawing_LineProperties,
3453 : : sUNO_service_drawing_FillProperties,
3454 : :
3455 : : sUNO_service_drawing_PolyPolygonDescriptor,
3456 : :
3457 : : sUNO_service_drawing_Text,
3458 : : sUNO_service_drawing_TextProperties,
3459 : : sUNO_service_style_ParagraphProperties,
3460 : : sUNO_service_style_ParagraphPropertiesComplex,
3461 : : sUNO_service_style_ParagraphPropertiesAsian,
3462 : : sUNO_service_style_CharacterProperties,
3463 : : sUNO_service_style_CharacterPropertiesComplex,
3464 : : sUNO_service_style_CharacterPropertiesAsian,
3465 : :
3466 : : sUNO_service_drawing_ShadowProperties,
3467 : 3 : sUNO_service_drawing_RotationDescriptor);
3468 : :
3469 : 3 : pSeq = &SvxShape_PolyServices;
3470 : : }
3471 [ + - ]: 144 : return *pSeq;
3472 : : }
3473 : :
3474 : : case OBJ_FREELINE:
3475 : : case OBJ_PATHLINE:
3476 : : {
3477 : : static uno::Sequence< OUString > *pSeq = 0;
3478 [ + + ]: 96 : if( 0 == pSeq )
3479 : : {
3480 [ + - ][ + - ]: 3 : static uno::Sequence< OUString > SvxShape_FreeLineServices;
[ + - ][ # # ]
3481 : :
3482 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices,15,
3483 : : sUNO_service_drawing_OpenBezierShape,
3484 : :
3485 : : sUNO_service_drawing_Shape,
3486 : : sUNO_service_drawing_LineProperties,
3487 : : sUNO_service_drawing_FillProperties,
3488 : :
3489 : : sUNO_service_drawing_PolyPolygonBezierDescriptor,
3490 : :
3491 : : sUNO_service_drawing_Text,
3492 : : sUNO_service_drawing_TextProperties,
3493 : : sUNO_service_style_ParagraphProperties,
3494 : : sUNO_service_style_ParagraphPropertiesComplex,
3495 : : sUNO_service_style_ParagraphPropertiesAsian,
3496 : : sUNO_service_style_CharacterProperties,
3497 : : sUNO_service_style_CharacterPropertiesComplex,
3498 : : sUNO_service_style_CharacterPropertiesAsian,
3499 : :
3500 : : sUNO_service_drawing_ShadowProperties,
3501 : 3 : sUNO_service_drawing_RotationDescriptor);
3502 : :
3503 : 3 : pSeq = &SvxShape_FreeLineServices;
3504 : : }
3505 : :
3506 [ + - ]: 96 : return *pSeq;
3507 : : }
3508 : :
3509 : : case OBJ_FREEFILL:
3510 : : case OBJ_PATHFILL:
3511 : : {
3512 : : static uno::Sequence< OUString > *pSeq = 0;
3513 [ + + ]: 96 : if( 0 == pSeq )
3514 : : {
3515 [ + - ][ + - ]: 3 : static uno::Sequence< OUString > SvxShape_FreeFillServices;
[ + - ][ # # ]
3516 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices,15,
3517 : : sUNO_service_drawing_ClosedBezierShape,
3518 : :
3519 : : sUNO_service_drawing_Shape,
3520 : : sUNO_service_drawing_LineProperties,
3521 : : sUNO_service_drawing_FillProperties,
3522 : :
3523 : : sUNO_service_drawing_PolyPolygonBezierDescriptor,
3524 : :
3525 : : sUNO_service_drawing_Text,
3526 : : sUNO_service_drawing_TextProperties,
3527 : : sUNO_service_style_ParagraphProperties,
3528 : : sUNO_service_style_ParagraphPropertiesComplex,
3529 : : sUNO_service_style_ParagraphPropertiesAsian,
3530 : : sUNO_service_style_CharacterProperties,
3531 : : sUNO_service_style_CharacterPropertiesComplex,
3532 : : sUNO_service_style_CharacterPropertiesAsian,
3533 : :
3534 : : sUNO_service_drawing_ShadowProperties,
3535 : 3 : sUNO_service_drawing_RotationDescriptor);
3536 : :
3537 : 3 : pSeq = &SvxShape_FreeFillServices;
3538 : : }
3539 [ + - ]: 96 : return *pSeq;
3540 : : }
3541 : :
3542 : : case OBJ_OUTLINETEXT:
3543 : : case OBJ_TITLETEXT:
3544 : : case OBJ_TEXT:
3545 : : {
3546 : : static uno::Sequence< OUString > *pSeq = 0;
3547 [ + + ]: 12 : if( 0 == pSeq )
3548 : : {
3549 [ + - ][ + - ]: 4 : static uno::Sequence< OUString > SvxShape_TextServices;
[ + - ][ # # ]
3550 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices,14,
3551 : : sUNO_service_drawing_TextShape,
3552 : :
3553 : : sUNO_service_drawing_Shape,
3554 : : sUNO_service_drawing_FillProperties,
3555 : : sUNO_service_drawing_LineProperties,
3556 : :
3557 : : sUNO_service_drawing_Text,
3558 : : sUNO_service_drawing_TextProperties,
3559 : : sUNO_service_style_ParagraphProperties,
3560 : : sUNO_service_style_ParagraphPropertiesComplex,
3561 : : sUNO_service_style_ParagraphPropertiesAsian,
3562 : : sUNO_service_style_CharacterProperties,
3563 : : sUNO_service_style_CharacterPropertiesComplex,
3564 : : sUNO_service_style_CharacterPropertiesAsian,
3565 : :
3566 : : sUNO_service_drawing_ShadowProperties,
3567 : 4 : sUNO_service_drawing_RotationDescriptor);
3568 : :
3569 : 4 : pSeq = &SvxShape_TextServices;
3570 : : }
3571 [ + - ]: 12 : return *pSeq;
3572 : : }
3573 : :
3574 : : case OBJ_GRAF:
3575 : : {
3576 : : static uno::Sequence< OUString > *pSeq = 0;
3577 [ + + ]: 72 : if( 0 == pSeq )
3578 : : {
3579 [ + - ][ + - ]: 6 : static uno::Sequence< OUString > SvxShape_GrafServices;
[ + - ][ # # ]
3580 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices, 12,
3581 : : sUNO_service_drawing_GraphicObjectShape,
3582 : :
3583 : : sUNO_service_drawing_Shape,
3584 : :
3585 : : sUNO_service_drawing_Text,
3586 : : sUNO_service_drawing_TextProperties,
3587 : : sUNO_service_style_ParagraphProperties,
3588 : : sUNO_service_style_ParagraphPropertiesComplex,
3589 : : sUNO_service_style_ParagraphPropertiesAsian,
3590 : : sUNO_service_style_CharacterProperties,
3591 : : sUNO_service_style_CharacterPropertiesComplex,
3592 : : sUNO_service_style_CharacterPropertiesAsian,
3593 : :
3594 : : sUNO_service_drawing_ShadowProperties,
3595 : 6 : sUNO_service_drawing_RotationDescriptor);
3596 : :
3597 : 6 : pSeq = &SvxShape_GrafServices;
3598 : : }
3599 [ + - ]: 72 : return *pSeq;
3600 : : }
3601 : :
3602 : : case OBJ_OLE2:
3603 : : {
3604 : : static uno::Sequence< OUString > *pSeq = 0;
3605 [ # # ]: 0 : if( 0 == pSeq )
3606 : : {
3607 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_Ole2Services;
[ # # ][ # # ]
3608 : :
3609 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services, 2,
3610 : : sUNO_service_drawing_OLE2Shape,
3611 : 0 : sUNO_service_drawing_Shape);
3612 : :
3613 : 0 : pSeq = &SvxShape_Ole2Services;
3614 : : }
3615 [ # # ]: 0 : return *pSeq;
3616 : : }
3617 : :
3618 : : case OBJ_CAPTION:
3619 : : {
3620 : : static uno::Sequence< OUString > *pSeq = 0;
3621 [ # # ]: 0 : if( 0 == pSeq )
3622 : : {
3623 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_CaptionServices;
[ # # ][ # # ]
3624 : :
3625 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices,14,
3626 : : sUNO_service_drawing_CaptionShape,
3627 : :
3628 : : sUNO_service_drawing_Shape,
3629 : : sUNO_service_drawing_FillProperties,
3630 : : sUNO_service_drawing_LineProperties,
3631 : :
3632 : : sUNO_service_drawing_Text,
3633 : : sUNO_service_drawing_TextProperties,
3634 : : sUNO_service_style_ParagraphProperties,
3635 : : sUNO_service_style_ParagraphPropertiesComplex,
3636 : : sUNO_service_style_ParagraphPropertiesAsian,
3637 : : sUNO_service_style_CharacterProperties,
3638 : : sUNO_service_style_CharacterPropertiesComplex,
3639 : : sUNO_service_style_CharacterPropertiesAsian,
3640 : :
3641 : : sUNO_service_drawing_ShadowProperties,
3642 : 0 : sUNO_service_drawing_RotationDescriptor);
3643 : :
3644 : 0 : pSeq = &SvxShape_CaptionServices;
3645 : : }
3646 : :
3647 [ # # ]: 0 : return *pSeq;
3648 : : }
3649 : :
3650 : : case OBJ_PAGE:
3651 : : {
3652 : : static uno::Sequence< OUString > *pSeq = 0;
3653 [ + - ]: 2 : if( 0 == pSeq )
3654 : : {
3655 [ + - ][ + - ]: 2 : static uno::Sequence< OUString > SvxShape_PageServices;
[ + - ][ # # ]
3656 : :
3657 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices, 2,
3658 : : sUNO_service_drawing_PageShape,
3659 : 2 : sUNO_service_drawing_Shape );
3660 : :
3661 : 2 : pSeq = &SvxShape_PageServices;
3662 : : }
3663 : :
3664 [ + - ]: 2 : return *pSeq;
3665 : : }
3666 : :
3667 : : case OBJ_MEASURE:
3668 : : {
3669 : : static uno::Sequence< OUString > *pSeq = 0;
3670 [ # # ]: 0 : if( 0 == pSeq )
3671 : : {
3672 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_MeasureServices;
[ # # ][ # # ]
3673 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices,15,
3674 : : sUNO_service_drawing_MeasureShape,
3675 : :
3676 : : sUNO_service_drawing_MeasureProperties,
3677 : :
3678 : : sUNO_service_drawing_Shape,
3679 : : sUNO_service_drawing_LineProperties,
3680 : :
3681 : : sUNO_service_drawing_Text,
3682 : : sUNO_service_drawing_TextProperties,
3683 : : sUNO_service_style_ParagraphProperties,
3684 : : sUNO_service_style_ParagraphPropertiesComplex,
3685 : : sUNO_service_style_ParagraphPropertiesAsian,
3686 : : sUNO_service_style_CharacterProperties,
3687 : : sUNO_service_style_CharacterPropertiesComplex,
3688 : : sUNO_service_style_CharacterPropertiesAsian,
3689 : :
3690 : : sUNO_service_drawing_PolyPolygonDescriptor,
3691 : : sUNO_service_drawing_ShadowProperties,
3692 : 0 : sUNO_service_drawing_RotationDescriptor);
3693 : :
3694 : 0 : pSeq = &SvxShape_MeasureServices;
3695 : : }
3696 : :
3697 [ # # ]: 0 : return *pSeq;
3698 : : }
3699 : :
3700 : : case OBJ_FRAME:
3701 : : {
3702 : : static uno::Sequence< OUString > *pSeq = 0;
3703 [ # # ]: 0 : if( 0 == pSeq )
3704 : : {
3705 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_FrameServices;
[ # # ][ # # ]
3706 : :
3707 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices, 2,
3708 : : sUNO_service_drawing_FrameShape,
3709 : 0 : sUNO_service_drawing_Shape );
3710 : :
3711 : 0 : pSeq = &SvxShape_FrameServices;
3712 : : }
3713 : :
3714 [ # # ]: 0 : return *pSeq;
3715 : : }
3716 : :
3717 : : case OBJ_UNO:
3718 : : {
3719 : : static uno::Sequence< OUString > *pSeq = 0;
3720 [ # # ]: 0 : if( 0 == pSeq )
3721 : : {
3722 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_UnoServices;
[ # # ][ # # ]
3723 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
3724 : : sUNO_service_drawing_ControlShape,
3725 : 0 : sUNO_service_drawing_Shape );
3726 : :
3727 : 0 : pSeq = &SvxShape_UnoServices;
3728 : : }
3729 [ # # ]: 0 : return *pSeq;
3730 : : }
3731 : :
3732 : : case OBJ_EDGE:
3733 : : {
3734 : : static uno::Sequence< OUString > *pSeq = 0;
3735 [ # # ]: 0 : if( 0 == pSeq )
3736 : : {
3737 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_EdgeServices;
[ # # ][ # # ]
3738 : :
3739 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices,15,
3740 : : sUNO_service_drawing_ConnectorShape,
3741 : : sUNO_service_drawing_ConnectorProperties,
3742 : :
3743 : : sUNO_service_drawing_Shape,
3744 : : sUNO_service_drawing_LineProperties,
3745 : :
3746 : : sUNO_service_drawing_Text,
3747 : : sUNO_service_drawing_TextProperties,
3748 : : sUNO_service_style_ParagraphProperties,
3749 : : sUNO_service_style_ParagraphPropertiesComplex,
3750 : : sUNO_service_style_ParagraphPropertiesAsian,
3751 : : sUNO_service_style_CharacterProperties,
3752 : : sUNO_service_style_CharacterPropertiesComplex,
3753 : : sUNO_service_style_CharacterPropertiesAsian,
3754 : :
3755 : : sUNO_service_drawing_PolyPolygonDescriptor,
3756 : : sUNO_service_drawing_ShadowProperties,
3757 : 0 : sUNO_service_drawing_RotationDescriptor);
3758 : :
3759 : 0 : pSeq = &SvxShape_EdgeServices;
3760 : : }
3761 [ # # ]: 0 : return *pSeq;
3762 : : }
3763 : : case OBJ_MEDIA:
3764 : : {
3765 : : static uno::Sequence< OUString > *pSeq = 0;
3766 [ # # ]: 0 : if( 0 == pSeq )
3767 : : {
3768 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_MediaServices;
[ # # ][ # # ]
3769 : :
3770 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices, 2,
3771 : : sUNO_service_drawing_MediaShape,
3772 : 0 : sUNO_service_drawing_Shape);
3773 : :
3774 : 0 : pSeq = &SvxShape_MediaServices;
3775 : : }
3776 [ # # ]: 0 : return *pSeq;
3777 : : }
3778 : : }
3779 : : }
3780 [ # # ][ # # ]: 0 : else if( mpObj.is() && mpObj->GetObjInventor() == FmFormInventor)
[ # # ][ # # ]
3781 : : {
3782 : : #if OSL_DEBUG_LEVEL > 0
3783 : : const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
3784 : : OSL_ENSURE( nIdent == OBJ_UNO, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
3785 : : #endif
3786 : : static uno::Sequence< OUString > *pSeq = 0;
3787 [ # # ]: 0 : if( 0 == pSeq )
3788 : : {
3789 [ # # ][ # # ]: 0 : static uno::Sequence< OUString > SvxShape_UnoServices;
[ # # ][ # # ]
3790 : : comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
3791 : : sUNO_service_drawing_ControlShape,
3792 : 0 : sUNO_service_drawing_Shape );
3793 : :
3794 : 0 : pSeq = &SvxShape_UnoServices;
3795 : : }
3796 [ # # ]: 0 : return *pSeq;
3797 : : }
3798 : : OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3799 [ + - ]: 96 : uno::Sequence< OUString > aSeq;
3800 [ + - ][ + - ]: 3941 : return aSeq;
[ + - ]
3801 : : }
3802 : :
3803 : : //----------------------------------------------------------------------
3804 : 3704 : sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
3805 : : {
3806 [ + - ]: 3704 : Sequence< OUString > SupportedServices( getSupportedServiceNames() );
3807 : 3704 : const ::rtl::OUString * pArray = SupportedServices.getConstArray();
3808 : 3704 : const sal_Int32 nCount = SupportedServices.getLength();
3809 : : sal_Int32 i;
3810 [ + + ]: 41824 : for( i = 0; i < nCount; i++ )
3811 [ + + ]: 39551 : if( *pArray++ == ServiceName )
3812 : 1431 : return sal_True;
3813 [ + - ]: 3704 : return sal_False;
3814 : : }
3815 : :
3816 : : //----------------------------------------------------------------------
3817 : :
3818 : : // XGluePointsSupplier
3819 : 68 : uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
3820 : : throw(uno::RuntimeException)
3821 : : {
3822 [ + - ]: 68 : ::SolarMutexGuard aGuard;
3823 [ + - ]: 68 : uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
3824 : :
3825 [ + - ][ + - ]: 68 : if( mpObj.is() && !xGluePoints.is() )
[ + - ]
3826 : : {
3827 [ + - ][ + - ]: 68 : uno::Reference< container::XIndexContainer > xNew( SvxUnoGluePointAccess_createInstance( mpObj.get() ), uno::UNO_QUERY );
3828 [ + - ][ + - ]: 68 : mxGluePoints = xGluePoints = xNew;
3829 : : }
3830 : :
3831 [ + - ]: 68 : return xGluePoints;
3832 : : }
3833 : :
3834 : : //----------------------------------------------------------------------
3835 : :
3836 : : // XChild
3837 : 12 : uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent( )
3838 : : throw(uno::RuntimeException)
3839 : : {
3840 [ + - ]: 12 : ::SolarMutexGuard aGuard;
3841 : :
3842 [ + - ][ + - ]: 12 : if( mpObj.is() && mpObj->GetObjList() )
[ + - ][ + - ]
3843 : : {
3844 [ + - ]: 12 : SdrObjList* pObjList = mpObj->GetObjList();
3845 : :
3846 [ - + - ]: 12 : switch( pObjList->GetListKind() )
3847 : : {
3848 : : case SDROBJLIST_GROUPOBJ:
3849 [ # # ][ # # ]: 0 : if( pObjList->GetOwnerObj()->ISA( SdrObjGroup ) )
[ # # ]
3850 [ # # ][ # # ]: 0 : return PTR_CAST( SdrObjGroup, pObjList->GetOwnerObj())->getUnoShape();
[ # # ][ # # ]
[ # # ]
3851 [ # # ][ # # ]: 0 : else if( pObjList->GetOwnerObj()->ISA( E3dScene ) )
[ # # ]
3852 [ # # ][ # # ]: 0 : return PTR_CAST( E3dScene, pObjList->GetOwnerObj())->getUnoShape();
[ # # ][ # # ]
[ # # ]
3853 : 0 : break;
3854 : : case SDROBJLIST_DRAWPAGE:
3855 : : case SDROBJLIST_MASTERPAGE:
3856 [ + - ][ + - ]: 12 : return PTR_CAST( SdrPage, pObjList )->getUnoPage();
[ + - ][ + - ]
[ + - ]
3857 : : default:
3858 : : OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
3859 : 0 : break;
3860 : : }
3861 : : }
3862 : :
3863 : 0 : uno::Reference< uno::XInterface > xParent;
3864 [ + - ]: 12 : return xParent;
3865 : : }
3866 : :
3867 : : //----------------------------------------------------------------------
3868 : :
3869 : 0 : void SAL_CALL SvxShape::setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& )
3870 : : throw(lang::NoSupportException, uno::RuntimeException)
3871 : : {
3872 [ # # ]: 0 : throw lang::NoSupportException();
3873 : : }
3874 : :
3875 : : //----------------------------------------------------------------------
3876 : :
3877 : : /** called from the XActionLockable interface methods on initial locking */
3878 : 95 : void SvxShape::lock()
3879 : : {
3880 : 95 : }
3881 : :
3882 : : //----------------------------------------------------------------------
3883 : :
3884 : : /** called from the XActionLockable interface methods on final unlock */
3885 : 95 : void SvxShape::unlock()
3886 : : {
3887 : 95 : }
3888 : :
3889 : : //----------------------------------------------------------------------
3890 : :
3891 : : // XActionLockable
3892 : 0 : sal_Bool SAL_CALL SvxShape::isActionLocked( ) throw (::com::sun::star::uno::RuntimeException)
3893 : : {
3894 [ # # ]: 0 : ::SolarMutexGuard aGuard;
3895 : :
3896 [ # # ]: 0 : return mnLockCount != 0;
3897 : : }
3898 : :
3899 : : //----------------------------------------------------------------------
3900 : :
3901 : 590 : void SAL_CALL SvxShape::addActionLock( ) throw (::com::sun::star::uno::RuntimeException)
3902 : : {
3903 [ + - ]: 590 : ::SolarMutexGuard aGuard;
3904 : :
3905 : : DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
3906 : 590 : mnLockCount++;
3907 : :
3908 [ + - ]: 590 : if( mnLockCount == 1 )
3909 [ + - ][ + - ]: 590 : lock();
3910 : 590 : }
3911 : :
3912 : : //----------------------------------------------------------------------
3913 : :
3914 : 590 : void SAL_CALL SvxShape::removeActionLock( ) throw (::com::sun::star::uno::RuntimeException)
3915 : : {
3916 [ + - ]: 590 : ::SolarMutexGuard aGuard;
3917 : :
3918 : : DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
3919 : 590 : mnLockCount--;
3920 : :
3921 [ + - ]: 590 : if( mnLockCount == 0 )
3922 [ + - ][ + - ]: 590 : unlock();
3923 : 590 : }
3924 : :
3925 : : //----------------------------------------------------------------------
3926 : :
3927 : 0 : void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock ) throw (::com::sun::star::uno::RuntimeException )
3928 : : {
3929 [ # # ]: 0 : ::SolarMutexGuard aGuard;
3930 : :
3931 [ # # ][ # # ]: 0 : if( (mnLockCount == 0) && (nLock != 0) )
3932 [ # # ]: 0 : unlock();
3933 : :
3934 [ # # ][ # # ]: 0 : if( (mnLockCount != 0) && (nLock == 0) )
3935 [ # # ]: 0 : lock();
3936 : :
3937 [ # # ]: 0 : mnLockCount = (sal_uInt16)nLock;
3938 : 0 : }
3939 : :
3940 : : //----------------------------------------------------------------------
3941 : :
3942 : 0 : sal_Int16 SAL_CALL SvxShape::resetActionLocks( ) throw (::com::sun::star::uno::RuntimeException)
3943 : : {
3944 [ # # ]: 0 : ::SolarMutexGuard aGuard;
3945 : :
3946 [ # # ]: 0 : if( mnLockCount != 0 )
3947 [ # # ]: 0 : unlock();
3948 : :
3949 : 0 : sal_Int16 nOldLocks = (sal_Int16)mnLockCount;
3950 : 0 : mnLockCount = 0;
3951 : :
3952 [ # # ]: 0 : return nOldLocks;
3953 : : }
3954 : :
3955 : : //----------------------------------------------------------------------
3956 : :
3957 : : /** since polygon shapes can change theire kind during editing, we have
3958 : : to recheck it here.
3959 : : Circle shapes also change theire kind, but theire all treated equal
3960 : : so no update is necessary.
3961 : : */
3962 : 13626 : void SvxShape::updateShapeKind()
3963 : : {
3964 [ + + ]: 13626 : switch( mpImpl->mnObjId )
3965 : : {
3966 : : case OBJ_LINE:
3967 : : case OBJ_POLY:
3968 : : case OBJ_PLIN:
3969 : : case OBJ_PATHLINE:
3970 : : case OBJ_PATHFILL:
3971 : : case OBJ_FREELINE:
3972 : : case OBJ_FREEFILL:
3973 : : case OBJ_PATHPOLY:
3974 : : case OBJ_PATHPLIN:
3975 : : {
3976 : 8240 : const sal_uInt32 nId = mpObj->GetObjIdentifier();
3977 : :
3978 [ - + ]: 8240 : if( nId != mpImpl->mnObjId )
3979 : : {
3980 : 0 : mpImpl->mnObjId = nId;
3981 : :
3982 : : }
3983 : 8240 : break;
3984 : : }
3985 : : };
3986 : 13626 : }
3987 : :
3988 : : /***********************************************************************
3989 : : * class SvxShapeText *
3990 : : ***********************************************************************/
3991 : 32310 : SvxShapeText::SvxShapeText( SdrObject* pObject ) throw ()
3992 [ + - ]: 32310 : : SvxShape( pObject, getSvxMapProvider().GetMap(SVXMAP_TEXT), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3993 : : {
3994 [ + - ][ + - ]: 32310 : if( pObject && pObject->GetModel() )
[ + + ][ + + ]
3995 [ + - ][ + - ]: 9808 : SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< cppu::OWeakObject * >( static_cast< SvxShape * >( this ) ) ) );
3996 : 32310 : }
3997 : :
3998 : : //----------------------------------------------------------------------
3999 : 61782 : SvxShapeText::SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ()
4000 [ + - ]: 61782 : : SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
4001 : : {
4002 [ + - ][ + + ]: 61782 : if( pObject && pObject->GetModel() )
[ + + ][ + + ]
4003 [ + - ][ + - ]: 31897 : SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< cppu::OWeakObject * >( static_cast< SvxShape * >( this ) ) ) );
4004 : 61782 : }
4005 : :
4006 : : //----------------------------------------------------------------------
4007 : 94092 : SvxShapeText::~SvxShapeText() throw ()
4008 : : {
4009 : : // check if only this instance is registered at the ranges
4010 : : DBG_ASSERT( (NULL == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
4011 : : "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
4012 [ - + ]: 126402 : }
4013 : :
4014 : 52294 : void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
4015 : : {
4016 [ + - ][ + + ]: 52294 : if( pNewObj && (NULL == GetEditSource()))
[ + + ]
4017 [ + - ]: 52290 : SetEditSource( new SvxTextEditSource( pNewObj, 0, static_cast< cppu::OWeakObject * >( static_cast< SvxShape* >(this) ) ) );
4018 : :
4019 : 52294 : SvxShape::Create( pNewObj, pNewPage );
4020 : 52294 : }
4021 : :
4022 : : // XInterface
4023 : : //----------------------------------------------------------------------
4024 : 684081 : uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
4025 : : throw( uno::RuntimeException )
4026 : : {
4027 : 684081 : return SvxShape::queryInterface( rType );
4028 : : }
4029 : :
4030 : : //----------------------------------------------------------------------
4031 : :
4032 : 686887 : uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
4033 : : throw( uno::RuntimeException )
4034 : : {
4035 [ + - ]: 686887 : uno::Any aAny( SvxShape::queryAggregation( rType ) );
4036 [ + + ]: 686887 : if( aAny.hasValue() )
4037 : 617900 : return aAny;
4038 : :
4039 [ + - ]: 686887 : return SvxUnoTextBase::queryAggregation( rType );
4040 : : }
4041 : :
4042 : : //----------------------------------------------------------------------
4043 : :
4044 : 2041089 : void SAL_CALL SvxShapeText::acquire() throw()
4045 : : {
4046 : 2041089 : SvxShape::acquire();
4047 : 2041089 : }
4048 : :
4049 : : //----------------------------------------------------------------------
4050 : 2041089 : void SAL_CALL SvxShapeText::release() throw()
4051 : : {
4052 : 2041089 : SvxShape::release();
4053 : 2041089 : }
4054 : :
4055 : : // XServiceInfo
4056 : : //----------------------------------------------------------------------
4057 : 0 : OUString SAL_CALL SvxShapeText::getImplementationName() throw( uno::RuntimeException )
4058 : : {
4059 [ # # ][ # # ]: 0 : static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShapeText") );
[ # # ][ # # ]
4060 : 0 : return aServiceName;
4061 : : }
4062 : :
4063 : : //----------------------------------------------------------------------
4064 : 3834 : uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException )
4065 : : {
4066 : 3834 : return SvxShape::getSupportedServiceNames();
4067 : : }
4068 : :
4069 : : //----------------------------------------------------------------------
4070 : 3612 : sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
4071 : : {
4072 : 3612 : return SvxShape::supportsService(ServiceName);
4073 : : }
4074 : :
4075 : : // XTypeProvider
4076 : : //----------------------------------------------------------------------
4077 : 0 : uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
4078 : : throw( uno::RuntimeException )
4079 : : {
4080 : 0 : return SvxShape::getTypes();
4081 : : }
4082 : :
4083 : 164915 : sal_Int64 SAL_CALL SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
4084 : : {
4085 : 164915 : const sal_Int64 nReturn = SvxShape::getSomething( rId );
4086 [ + + ]: 164915 : if( nReturn )
4087 : 163019 : return nReturn;
4088 : :
4089 : 164915 : return SvxUnoTextBase::getSomething( rId );
4090 : : }
4091 : :
4092 : : //----------------------------------------------------------------------
4093 : 0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
4094 : : throw( uno::RuntimeException )
4095 : : {
4096 : : static ::cppu::OImplementationId* pID = NULL ;
4097 : :
4098 [ # # ]: 0 : if ( pID == NULL )
4099 : : {
4100 : : // Ready for multithreading; get global mutex for first call of this method only! see before
4101 [ # # ][ # # ]: 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
4102 : :
4103 : : // Control these pointer again ... it can be, that another instance will be faster then these!
4104 [ # # ]: 0 : if ( pID == NULL )
4105 : : {
4106 : : // Create a new static ID ...
4107 [ # # ][ # # ]: 0 : static ::cppu::OImplementationId aID( sal_False ) ;
4108 : : // ... and set his address to static pointer!
4109 : 0 : pID = &aID ;
4110 [ # # ]: 0 : }
4111 : : }
4112 : :
4113 : 0 : return pID->getImplementationId() ;
4114 : : }
4115 : :
4116 : : //----------------------------------------------------------------------
4117 : :
4118 : : /** called from the XActionLockable interface methods on initial locking */
4119 : 495 : void SvxShapeText::lock()
4120 : : {
4121 : 495 : SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
4122 [ + - ]: 495 : if( pEditSource )
4123 : 495 : pEditSource->lock();
4124 : 495 : }
4125 : :
4126 : : //----------------------------------------------------------------------
4127 : :
4128 : : /** called from the XActionLockable interface methods on final unlock */
4129 : 495 : void SvxShapeText::unlock()
4130 : : {
4131 : 495 : SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
4132 [ + - ]: 495 : if( pEditSource )
4133 : 495 : pEditSource->unlock();
4134 : 495 : }
4135 : :
4136 : : // ::com::sun::star::text::XTextRange
4137 : 2 : uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart() throw(uno::RuntimeException)
4138 : : {
4139 [ + - ]: 2 : ::SolarMutexGuard aGuard;
4140 [ + - ][ + - ]: 2 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4141 [ + - ]: 2 : if( pForwarder )
4142 : 2 : ::GetSelection( maSelection, pForwarder );
4143 [ + - ][ + - ]: 2 : return SvxUnoTextBase::getStart();
4144 : :
4145 : : }
4146 : :
4147 : 4 : uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd() throw(uno::RuntimeException)
4148 : : {
4149 [ + - ]: 4 : ::SolarMutexGuard aGuard;
4150 [ + - ][ + - ]: 4 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4151 [ + - ]: 4 : if( pForwarder )
4152 : 4 : ::GetSelection( maSelection, pForwarder );
4153 [ + - ][ + - ]: 4 : return SvxUnoTextBase::getEnd();
4154 : : }
4155 : :
4156 : 319 : OUString SAL_CALL SvxShapeText::getString() throw(uno::RuntimeException)
4157 : : {
4158 [ + - ]: 319 : ::SolarMutexGuard aGuard;
4159 [ + - ][ + - ]: 319 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4160 [ + - ]: 319 : if( pForwarder )
4161 : 319 : ::GetSelection( maSelection, pForwarder );
4162 [ + - ][ + - ]: 319 : return SvxUnoTextBase::getString();
4163 : : }
4164 : :
4165 : :
4166 : 21491 : void SAL_CALL SvxShapeText::setString( const OUString& aString ) throw(uno::RuntimeException)
4167 : : {
4168 [ + - ]: 21491 : ::SolarMutexGuard aGuard;
4169 [ + - ][ + - ]: 21491 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4170 [ + - ]: 21491 : if( pForwarder )
4171 : 21491 : ::GetSelection( maSelection, pForwarder );
4172 [ + - ][ + - ]: 21491 : SvxUnoTextBase::setString( aString );
4173 : 21491 : }
4174 : :
4175 : : // overide these for special property handling in subcasses. Return true if property is handled
4176 : 1500941 : bool SvxShapeText::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
4177 : : {
4178 : : // HACK-fix #99090#
4179 : : // since SdrTextObj::SetVerticalWriting exchanges
4180 : : // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
4181 : : // we have to set the textdirection here
4182 : :
4183 [ + + ]: 1500941 : if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4184 : : {
4185 [ - + ]: 39 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
4186 [ + - ]: 39 : if( pTextObj )
4187 : : {
4188 : : com::sun::star::text::WritingMode eMode;
4189 [ + - ][ + - ]: 39 : if( rValue >>= eMode )
4190 : : {
4191 [ + - ]: 39 : pTextObj->SetVerticalWriting( eMode == com::sun::star::text::WritingMode_TB_RL );
4192 : : }
4193 : : }
4194 : 39 : return true;
4195 : : }
4196 : 1500941 : return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
4197 : : }
4198 : :
4199 : 5028 : bool SvxShapeText::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
4200 : : {
4201 [ + + ]: 5028 : if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4202 : : {
4203 [ - + ]: 92 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
4204 [ + - ][ - + ]: 92 : if( pTextObj && pTextObj->IsVerticalWriting() )
[ - + ]
4205 [ # # ]: 0 : rValue <<= com::sun::star::text::WritingMode_TB_RL;
4206 : : else
4207 [ + - ]: 92 : rValue <<= com::sun::star::text::WritingMode_LR_TB;
4208 : 92 : return true;
4209 : : }
4210 : :
4211 : 5028 : return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
4212 : : }
4213 : :
4214 : 7675 : bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
4215 : : {
4216 : 7675 : return SvxShape::getPropertyStateImpl( pProperty, rState );
4217 : : }
4218 : :
4219 : 0 : bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
4220 : : {
4221 : 0 : return SvxShape::setPropertyToDefaultImpl( pProperty );
4222 : : }
4223 : :
4224 : : /***********************************************************************
4225 : : * class SvxShapeRect *
4226 : : ***********************************************************************/
4227 : : DBG_NAME(SvxShapeRect)
4228 : 21291 : SvxShapeRect::SvxShapeRect( SdrObject* pObj ) throw()
4229 : 21291 : : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_SHAPE), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
4230 : : {
4231 : : DBG_CTOR(SvxShapeRect,NULL);
4232 : 21291 : }
4233 : :
4234 : 21291 : SvxShapeRect::~SvxShapeRect() throw()
4235 : : {
4236 : : DBG_DTOR(SvxShapeRect,NULL);
4237 [ - + ]: 42582 : }
4238 : :
4239 : 123628 : uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
4240 : : {
4241 : 123628 : return SvxShapeText::queryInterface( rType );
4242 : : }
4243 : :
4244 : 123726 : uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
4245 : : {
4246 : 123726 : return SvxShapeText::queryAggregation( rType );
4247 : : }
4248 : :
4249 : 345323 : void SAL_CALL SvxShapeRect::acquire() throw()
4250 : : {
4251 : 345323 : SvxShapeText::acquire();
4252 : 345323 : }
4253 : :
4254 : 345323 : void SAL_CALL SvxShapeRect::release() throw()
4255 : : {
4256 : 345323 : SvxShapeText::release();
4257 : 345323 : }
4258 : : //----------------------------------------------------------------------
4259 : : // XServiceInfo
4260 : : //----------------------------------------------------------------------
4261 : 9 : uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames(void) throw( uno::RuntimeException )
4262 : : {
4263 : 9 : return SvxShape::getSupportedServiceNames();
4264 : : }
4265 : :
4266 : : /** returns a StarOffice API wrapper for the given SdrObject */
4267 : 4485 : uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw ()
4268 : : {
4269 [ + - ]: 4485 : uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
4270 : 4485 : return xShape;
4271 : : }
4272 : :
4273 : : /** returns the SdrObject from the given StarOffice API wrapper */
4274 : 44 : SdrObject* GetSdrObjectFromXShape( uno::Reference< drawing::XShape > xShape ) throw()
4275 : : {
4276 : 44 : SvxShape* pShape = SvxShape::getImplementation( xShape );
4277 [ + + ]: 44 : return pShape ? pShape->GetSdrObject() : 0;
4278 : : }
4279 : :
4280 : : //----------------------------------------------------------------------
4281 : :
4282 : 26 : SdrObject* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt )
4283 : : {
4284 : 26 : SvxShape* pSvxShape = SvxShape::getImplementation( xInt );
4285 [ + - ]: 26 : return pSvxShape ? pSvxShape->GetSdrObject() : 0;
4286 : : }
4287 : :
4288 : 18294 : uno::Any SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet )
4289 : : {
4290 [ + - ][ - + ]: 18294 : if(!pMap || !pMap->nWID)
4291 : 0 : return uno::Any();
4292 : :
4293 : : // Check is for items that store either metric values if thei are positiv or percentage if thei are negativ.
4294 [ + + ][ + + ]: 18294 : bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4295 : 18294 : return rPropSet.getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
4296 : : }
4297 : :
4298 : 1426385 : void SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
4299 : : {
4300 : 1426385 : uno::Any aVal(rVal);
4301 [ - + ][ + - ]: 1426385 : if(!pMap || !pMap->nWID)
4302 : 1426385 : return;
4303 : :
4304 [ + + ][ + + ]: 1426385 : bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4305 [ + + ]: 1426385 : if( pMap->nWID == EE_PARA_LRSPACE ) // n#757419 Don't import negative values
4306 : : {
4307 : 1988 : sal_Int32 nVal = sal_Int32();
4308 [ + - ][ + + ]: 1988 : if( (aVal >>= nVal) && nVal < 0 )
[ + + ]
4309 [ + - ]: 1988 : aVal <<= ( sal_Int32 ) 0;
4310 : : }
4311 [ + - ][ + - ]: 1426385 : rPropSet.setPropertyValue( pMap, aVal, rSet, bDontConvertNegativeValues );
4312 [ + - ][ + - ]: 450 : }
4313 : :
4314 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|