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