xref: /aoo41x/main/svx/source/unodraw/unoshape.cxx (revision c7be74b1)
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 			XBitmapListSharedPtr aBitmapList = pModel->GetBitmapListFromSdrModel();
1571 
1572             if( !aBitmapList.get() )
1573                 return sal_False;
1574 
1575             long nPos = aBitmapList->GetIndex(aStrName);
1576             if( nPos == -1 )
1577                 return sal_False;
1578 
1579             XBitmapEntry* pEntry = aBitmapList->GetBitmap( nPos );
1580             XFillBitmapItem aBmpItem;
1581             aBmpItem.SetWhich( XATTR_FILLBITMAP );
1582             aBmpItem.SetName( rName );
1583             aBmpItem.SetGraphicObject(pEntry->GetGraphicObject());
1584             rSet.Put( aBmpItem );
1585 			break;
1586 		}
1587 		case XATTR_FILLGRADIENT:
1588 		{
1589 			XGradientListSharedPtr aGradientList = pModel->GetGradientListFromSdrModel();
1590 
1591             if( !aGradientList.get() )
1592                 return sal_False;
1593 
1594             long nPos = aGradientList->GetIndex(aStrName);
1595             if( nPos == -1 )
1596                 return sal_False;
1597 
1598             XGradientEntry* pEntry = aGradientList->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 			XHatchListSharedPtr aHatchList = pModel->GetHatchListFromSdrModel();
1609 
1610             if( !aHatchList.get() )
1611                 return sal_False;
1612 
1613 			long nPos = aHatchList->GetIndex(aStrName);
1614 			if( nPos == -1 )
1615 				return sal_False;
1616 
1617 			XHatchEntry* pEntry = aHatchList->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 			XLineEndListSharedPtr aLineEndList = pModel->GetLineEndListFromSdrModel();
1629 
1630             if( !aLineEndList.get() )
1631                 return sal_False;
1632 
1633 			long nPos = aLineEndList->GetIndex(aStrName);
1634 			if( nPos == -1 )
1635 				return sal_False;
1636 
1637 			XLineEndEntry* pEntry = aLineEndList->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 			XDashListSharedPtr aDashList = pModel->GetDashListFromSdrModel();
1660 
1661             if( !aDashList.get() )
1662                 return sal_False;
1663 
1664 			long nPos = aDashList->GetIndex(aStrName);
1665 			if( nPos == -1 )
1666 				return sal_False;
1667 
1668 			XDashEntry* pEntry = aDashList->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 void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1741 	throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1742 {
1743 	if( mpImpl->mpMaster )
1744 	{
1745 		mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
1746 	}
1747 	else
1748 	{
1749 		_setPropertyValue( rPropertyName, rVal );
1750 	}
1751 }
1752 
1753 void SAL_CALL SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1754 	throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1755 {
1756 	OGuard aGuard( Application::GetSolarMutex() );
1757 
1758     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1759 
1760 	if( mpObj.is() && mpModel )
1761 	{
1762 		if( pMap == NULL )
1763 			throw beans::UnknownPropertyException();
1764 
1765 		if( (pMap->nFlags & beans::PropertyAttribute::READONLY ) != 0 )
1766 			throw beans::PropertyVetoException();
1767 
1768 		mpModel->SetChanged();
1769 
1770         if(!setPropertyValueImpl( rPropertyName, pMap, rVal ) )
1771 		{
1772 			DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
1773 			DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1774 
1775 			sal_Bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
1776 
1777 			if( pMap->nWID == SDRATTR_ECKENRADIUS )
1778 			{
1779 				sal_Int32 nCornerRadius = 0;
1780 				if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
1781 					throw IllegalArgumentException();
1782 			}
1783 
1784 			SfxItemSet* pSet;
1785 			if( mbIsMultiPropertyCall && !bIsNotPersist )
1786 			{
1787 				if( mpImpl->mpItemSet == NULL )
1788 				{
1789 					pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone();
1790 				}
1791 				else
1792 				{
1793 					pSet = mpImpl->mpItemSet;
1794 				}
1795 			}
1796 			else
1797 			{
1798 				pSet = new SfxItemSet( mpModel->GetItemPool(),	pMap->nWID, pMap->nWID);
1799 			}
1800 
1801 			if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
1802 				pSet->Put(mpObj->GetMergedItem(pMap->nWID));
1803 
1804 			if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, rVal, *pSet ))
1805 			{
1806 				if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
1807 				{
1808 					if(bIsNotPersist)
1809 					{
1810 						// Not-Persistant Attribute, hole diese extra
1811 						mpObj->TakeNotPersistAttr(*pSet, sal_False);
1812 					}
1813 				}
1814 
1815 				if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
1816 				{
1817 					// Default aus ItemPool holen
1818 					if(mpModel->GetItemPool().IsWhich(pMap->nWID))
1819 						pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
1820 				}
1821 
1822 				if( pSet->GetItemState( pMap->nWID ) == SFX_ITEM_SET )
1823 				{
1824 					SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rVal, *pSet );
1825 				}
1826 			}
1827 
1828 			if(bIsNotPersist)
1829 			{
1830 				// Not-Persist Attribute extra setzen
1831 				mpObj->ApplyNotPersistAttr( *pSet );
1832 				delete pSet;
1833 			}
1834 			else
1835 			{
1836 				// if we have a XMultiProperty call then the item set
1837 				// will be set in setPropertyValues later
1838 				if( !mbIsMultiPropertyCall )
1839 				{
1840 					mpObj->SetMergedItemSetAndBroadcast( *pSet );
1841 
1842 					delete pSet;
1843 				}
1844 			}
1845 			return;
1846 		}
1847 	}
1848 	else
1849 	{
1850 		// since we have no actual sdr object right now
1851 		// remember all properties in a list. These
1852 		// properties will be set when the sdr object is
1853 		// created
1854 
1855 		if(pMap && pMap->nWID)
1856 // Fixme: We should throw a UnknownPropertyException here.
1857 //		  But since this class is aggregated from classes
1858 //		  that support additional properties that we don't
1859 //		  know here we silently store *all* properties, even
1860 //		  if they may be not supported after creation
1861 			mpPropSet->setPropertyValue( pMap, rVal );
1862 	}
1863 }
1864 
1865 //----------------------------------------------------------------------
1866 
1867 uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
1868 	throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1869 {
1870 	if ( mpImpl->mpMaster )
1871 		return mpImpl->mpMaster->getPropertyValue( PropertyName );
1872 	else
1873 		return _getPropertyValue( PropertyName );
1874 }
1875 
1876 //----------------------------------------------------------------------
1877 
1878 uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
1879 	throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1880 {
1881 	OGuard aGuard( Application::GetSolarMutex() );
1882 
1883     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1884 
1885 	uno::Any aAny;
1886 	if( mpObj.is() && mpModel )
1887 	{
1888 		if(pMap == NULL )
1889 			throw beans::UnknownPropertyException();
1890 
1891         if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
1892 		{
1893 			DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
1894 			DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1895 
1896 			SfxItemSet aSet( mpModel->GetItemPool(),	pMap->nWID, pMap->nWID);
1897 			aSet.Put(mpObj->GetMergedItem(pMap->nWID));
1898 
1899 			if(SvxUnoTextRangeBase::GetPropertyValueHelper(  aSet, pMap, aAny ))
1900 				return aAny;
1901 
1902 			if(!aSet.Count())
1903 			{
1904 				if(pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST)
1905 				{
1906 					// Not-Persistant Attribute, hole diese extra
1907 					mpObj->TakeNotPersistAttr(aSet, sal_False);
1908 				}
1909 			}
1910 
1911 			if(!aSet.Count())
1912 			{
1913 				// Default aus ItemPool holen
1914 				if(mpModel->GetItemPool().IsWhich(pMap->nWID))
1915 					aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
1916 			}
1917 
1918 			if(aSet.Count())
1919 				aAny = GetAnyForItem( aSet, pMap );
1920 		}
1921 	}
1922 	else
1923 	{
1924 
1925 // Fixme: we should	return default values for OWN_ATTR !
1926 
1927 		if(pMap && pMap->nWID)
1928 //		FixMe: see setPropertyValue
1929 			aAny = mpPropSet->getPropertyValue( pMap );
1930 
1931 	}
1932 	return aAny;
1933 }
1934 
1935 //----------------------------------------------------------------------
1936 
1937 // XMultiPropertySet
1938 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)
1939 {
1940 	OGuard aSolarGuard( Application::GetSolarMutex() );
1941 
1942     const sal_Int32 nCount = aPropertyNames.getLength();
1943 	const OUString* pNames = aPropertyNames.getConstArray();
1944 
1945 	const uno::Any* pValues = aValues.getConstArray();
1946 
1947 	// make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1948 	// reseted even when an execption is thrown
1949     const ::comphelper::ScopeGuard aGuard( boost::bind( &SvxShape::endSetPropertyValues, this ) );
1950 
1951 	mbIsMultiPropertyCall = sal_True;
1952 
1953 	if( mpImpl->mpMaster )
1954 	{
1955 		for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1956 		{
1957 			try
1958 			{
1959 				setPropertyValue( *pNames, *pValues );
1960 			}
1961 			catch( beans::UnknownPropertyException& e )
1962 			{
1963 				(void)e;
1964 			}
1965             catch( uno::Exception& ex )
1966             {
1967 				(void)ex;
1968             }
1969 		}
1970 	}
1971 	else
1972 	{
1973 		uno::Reference< beans::XPropertySet > xSet;
1974 		queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
1975 
1976 		for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1977 		{
1978 			try
1979 			{
1980 				xSet->setPropertyValue( *pNames, *pValues );
1981 			}
1982 			catch( beans::UnknownPropertyException& e )
1983 			{
1984 				(void)e;
1985 			}
1986             catch( uno::Exception& ex )
1987             {
1988 				(void)ex;
1989             }
1990 		}
1991 	}
1992 
1993 	if( mpImpl->mpItemSet && mpObj.is() )
1994 		mpObj->SetMergedItemSetAndBroadcast( *mpImpl->mpItemSet );
1995 }
1996 
1997 //----------------------------------------------------------------------
1998 
1999 void SvxShape::endSetPropertyValues()
2000 {
2001 	mbIsMultiPropertyCall = sal_False;
2002 	if( mpImpl->mpItemSet )
2003 	{
2004 		delete mpImpl->mpItemSet;
2005 		mpImpl->mpItemSet = 0;
2006 	}
2007 }
2008 
2009 //----------------------------------------------------------------------
2010 
2011 ::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)
2012 {
2013 	const sal_Int32 nCount = aPropertyNames.getLength();
2014 	const OUString* pNames = aPropertyNames.getConstArray();
2015 
2016 	uno::Sequence< uno::Any > aRet( nCount );
2017 	uno::Any* pValue = aRet.getArray();;
2018 
2019 	if( mpImpl->mpMaster )
2020 	{
2021 		for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
2022 		{
2023 			try
2024 			{
2025 				*pValue = getPropertyValue( *pNames );
2026 			}
2027 			catch( uno::Exception& )
2028 			{
2029 				DBG_ERROR( "SvxShape::getPropertyValues, unknown property asked" );
2030 			}
2031 		}
2032 	}
2033 	else
2034 	{
2035 		uno::Reference< beans::XPropertySet > xSet;
2036 		queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
2037 
2038 		for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
2039 		{
2040 			try
2041 			{
2042 				*pValue = xSet->getPropertyValue( *pNames );
2043 			}
2044 			catch( uno::Exception& )
2045 			{
2046 				DBG_ERROR( "SvxShape::getPropertyValues, unknown property asked" );
2047 			}
2048 		}
2049 	}
2050 
2051 	return aRet;
2052 }
2053 
2054 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)
2055 {
2056 }
2057 
2058 void SAL_CALL SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >&  ) throw (::com::sun::star::uno::RuntimeException)
2059 {
2060 }
2061 
2062 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)
2063 {
2064 }
2065 
2066 //----------------------------------------------------------------------
2067 
2068 uno::Any SvxShape::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap ) const
2069 {
2070     DBG_TESTSOLARMUTEX();
2071 	uno::Any aAny;
2072 
2073 	switch(pMap->nWID)
2074 	{
2075 	case SDRATTR_CIRCSTARTANGLE:
2076 	{
2077 		const SfxPoolItem* pPoolItem=NULL;
2078 		if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
2079 		{
2080 			sal_Int32 nAngle = ((SdrCircStartAngleItem*)pPoolItem)->GetValue();
2081 			aAny <<= nAngle;
2082 		}
2083 		break;
2084 	}
2085 
2086 	case SDRATTR_CIRCENDANGLE:
2087 	{
2088 		const SfxPoolItem* pPoolItem=NULL;
2089 		if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
2090 		{
2091 			sal_Int32 nAngle = ((SdrCircEndAngleItem*)pPoolItem)->GetValue();
2092 			aAny <<= nAngle;
2093 		}
2094 		break;
2095 	}
2096 
2097 	case SDRATTR_CIRCKIND:
2098 	{
2099 		if( mpObj->GetObjInventor() == SdrInventor)
2100 		{
2101 			drawing::CircleKind eKind;
2102 			switch(mpObj->GetObjIdentifier())
2103 			{
2104 			case OBJ_CIRC:			// Kreis, Ellipse
2105 				eKind = drawing::CircleKind_FULL;
2106 				break;
2107 			case OBJ_CCUT:			// Kreisabschnitt
2108 				eKind = drawing::CircleKind_CUT;
2109 				break;
2110 			case OBJ_CARC:			// Kreisbogen
2111 				eKind = drawing::CircleKind_ARC;
2112 				break;
2113 			case OBJ_SECT:			// Kreissektor
2114 				eKind = drawing::CircleKind_SECTION;
2115 				break;
2116 			}
2117 			aAny <<= eKind;
2118 		}
2119 		break;
2120 	}
2121 	default:
2122 	{
2123 		// Hole Wert aus ItemSet
2124 		aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pMap, aSet );
2125 
2126 		if( *pMap->pType != aAny.getValueType() )
2127 		{
2128 			// since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2129 			if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
2130 			{
2131 				sal_Int32 nValue = 0;
2132 				aAny >>= nValue;
2133 				aAny <<= (sal_Int16)nValue;
2134 			}
2135 			else
2136 			{
2137 				DBG_ERROR("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
2138 			}
2139 		}
2140 
2141 	}
2142 	}
2143 
2144 	return aAny;
2145 }
2146 
2147 //----------------------------------------------------------------------
2148 
2149 // XPropertyState
2150 beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
2151 	throw(beans::UnknownPropertyException, uno::RuntimeException)
2152 {
2153 	if( mpImpl->mpMaster )
2154 	{
2155 		return mpImpl->mpMaster->getPropertyState( PropertyName );
2156 	}
2157 	else
2158 	{
2159 		return _getPropertyState( PropertyName );
2160 	}
2161 }
2162 
2163 beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& PropertyName )
2164 	throw(beans::UnknownPropertyException, uno::RuntimeException)
2165 {
2166 	OGuard aGuard( Application::GetSolarMutex() );
2167 
2168     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
2169 
2170 	if( !mpObj.is() || pMap == NULL )
2171 		throw beans::UnknownPropertyException();
2172 
2173 	beans::PropertyState eState;
2174 	if( !getPropertyStateImpl( pMap, eState ) )
2175 	{
2176 		const SfxItemSet& rSet = mpObj->GetMergedItemSet();
2177 
2178 		switch( rSet.GetItemState( pMap->nWID, sal_False ) )
2179 		{
2180 		case SFX_ITEM_READONLY:
2181 		case SFX_ITEM_SET:
2182 			eState = beans::PropertyState_DIRECT_VALUE;
2183 			break;
2184 		case SFX_ITEM_DEFAULT:
2185 			eState = beans::PropertyState_DEFAULT_VALUE;
2186 			break;
2187 //		case SFX_ITEM_UNKNOWN:
2188 //		case SFX_ITEM_DONTCARE:
2189 //		case SFX_ITEM_DISABLED:
2190 		default:
2191 			eState = beans::PropertyState_AMBIGUOUS_VALUE;
2192 			break;
2193 		}
2194 
2195 		// if a item is set, this doesn't mean we want it :)
2196 		if( ( beans::PropertyState_DIRECT_VALUE == eState ) )
2197 		{
2198 			switch( pMap->nWID )
2199 			{
2200 			// the following items are disabled by changing the
2201 			// fill style or the line style. so there is no need
2202 			// to export items without names which should be empty
2203 			case XATTR_FILLBITMAP:
2204 			case XATTR_FILLGRADIENT:
2205 			case XATTR_FILLHATCH:
2206 			case XATTR_LINEDASH:
2207 				{
2208 					NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
2209 					if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
2210 						eState = beans::PropertyState_DEFAULT_VALUE;
2211 				}
2212 				break;
2213 
2214 			// #i36115#
2215 			// If e.g. the LineStart is on NONE and thus the string has length 0, it still
2216 			// may be a hard attribute covering the set LineStart of the parent (Style).
2217 			// #i37644#
2218 			// same is for fill float transparency
2219 			case XATTR_LINEEND:
2220 			case XATTR_LINESTART:
2221 			case XATTR_FILLFLOATTRANSPARENCE:
2222 				{
2223 					NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
2224 					if( ( pItem == NULL ) )
2225 						eState = beans::PropertyState_DEFAULT_VALUE;
2226 				}
2227 				break;
2228 			}
2229 		}
2230 	}
2231 	return eState;
2232 }
2233 
2234 //----------------------------------------------------------------------
2235 
2236 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)
2237 {
2238 	switch( pProperty->nWID )
2239 	{
2240 	case OWN_ATTR_CAPTION_POINT:
2241 	{
2242 		awt::Point aPnt;
2243 		if( rValue >>= aPnt )
2244 		{
2245 			Point aVclPoint( aPnt.X, aPnt.Y );
2246 
2247 			// #90763# position is relative to top left, make it absolute
2248 			basegfx::B2DPolyPolygon aNewPolyPolygon;
2249 			basegfx::B2DHomMatrix aNewHomogenMatrix;
2250 			mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2251 
2252 			aVclPoint.X() += basegfx::fround(aNewHomogenMatrix.get(0, 2));
2253 			aVclPoint.Y() += basegfx::fround(aNewHomogenMatrix.get(1, 2));
2254 
2255 			// #88657# metric of pool maybe twips (writer)
2256 			ForceMetricToItemPoolMetric(aVclPoint);
2257 
2258 			// #88491# position relative to anchor
2259 			if( mpModel->IsWriter() )
2260 			{
2261 				aVclPoint += mpObj->GetAnchorPos();
2262 			}
2263 
2264 			((SdrCaptionObj*)mpObj.get())->SetTailPos(aVclPoint);
2265 
2266 			return true;
2267 		}
2268 		break;
2269 	}
2270 	case OWN_ATTR_TRANSFORMATION:
2271 	{
2272 		drawing::HomogenMatrix3 aMatrix;
2273 		if(rValue >>= aMatrix)
2274 		{
2275 			basegfx::B2DPolyPolygon aNewPolyPolygon;
2276 			basegfx::B2DHomMatrix aNewHomogenMatrix;
2277 
2278 			mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2279 
2280 			aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
2281 			aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
2282 			aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
2283 			aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
2284 			aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
2285 			aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
2286 			aNewHomogenMatrix.set(2, 0, aMatrix.Line3.Column1);
2287 			aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2);
2288 			aNewHomogenMatrix.set(2, 2, aMatrix.Line3.Column3);
2289 
2290 			mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2291 			return true;
2292 		}
2293 		break;
2294 	}
2295 
2296 	case OWN_ATTR_ZORDER:
2297 	{
2298 		sal_Int32 nNewOrdNum = 0;
2299 		if(rValue >>= nNewOrdNum)
2300 		{
2301             SdrObjList* pObjList = mpObj->GetObjList();
2302 			if( pObjList )
2303 			{
2304 #ifdef DBG_UTIL
2305 				SdrObject* pCheck =
2306 #endif
2307 							pObjList->SetObjectOrdNum( mpObj->GetOrdNum(), (sal_uIntPtr)nNewOrdNum );
2308 				DBG_ASSERT( pCheck == mpObj.get(), "GetOrdNum() failed!" );
2309 			}
2310 			return true;
2311 		}
2312 		break;
2313 	}
2314 	case OWN_ATTR_FRAMERECT:
2315 	{
2316 		awt::Rectangle aUnoRect;
2317 		if(rValue >>= aUnoRect)
2318 		{
2319 			Point aTopLeft( aUnoRect.X, aUnoRect.Y );
2320 			Size aObjSize( aUnoRect.Width, aUnoRect.Height );
2321 			ForceMetricToItemPoolMetric(aTopLeft);
2322 			ForceMetricToItemPoolMetric(aObjSize);
2323 			Rectangle aRect;
2324 			aRect.SetPos(aTopLeft);
2325 			aRect.SetSize(aObjSize);
2326 			mpObj->SetSnapRect(aRect);
2327 			return true;
2328 		}
2329 		break;
2330 	}
2331 	case OWN_ATTR_MIRRORED:
2332 	{
2333 		sal_Bool bMirror = sal_Bool();
2334 		if(rValue >>= bMirror )
2335 		{
2336 			SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( mpObj.get() );
2337 			if( pObj )
2338 				pObj->SetMirrored(bMirror);
2339 			return true;
2340 		}
2341 		break;
2342 	}
2343 	case OWN_ATTR_EDGE_START_OBJ:
2344 	case OWN_ATTR_EDGE_END_OBJ:
2345 	case OWN_ATTR_GLUEID_HEAD:
2346 	case OWN_ATTR_GLUEID_TAIL:
2347 	case OWN_ATTR_EDGE_START_POS:
2348 	case OWN_ATTR_EDGE_END_POS:
2349 	case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2350 	{
2351 		SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(mpObj.get());
2352 		if(pEdgeObj)
2353 		{
2354 			switch(pProperty->nWID)
2355 			{
2356 			case OWN_ATTR_EDGE_START_OBJ:
2357 			case OWN_ATTR_EDGE_END_OBJ:
2358 				{
2359 					Reference< drawing::XShape > xShape;
2360 					if( rValue >>= xShape )
2361 					{
2362 						SdrObject* pNode = GetSdrObjectFromXShape( xShape );
2363 						if( pNode )
2364 						{
2365 							pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
2366 							pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, -1 );
2367 							return true;
2368 						}
2369 					}
2370 					break;
2371 				}
2372 
2373 			case OWN_ATTR_EDGE_START_POS:
2374 			case OWN_ATTR_EDGE_END_POS:
2375 				{
2376 					awt::Point aUnoPoint;
2377 					if( rValue >>= aUnoPoint )
2378 					{
2379 						Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2380 
2381                         // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
2382                         // perform metric change before applying anchor position,
2383                         // because the anchor position is in pool metric.
2384                         ForceMetricToItemPoolMetric( aPoint );
2385                         // <--
2386                         if( mpModel->IsWriter() )
2387                             aPoint += mpObj->GetAnchorPos();
2388 
2389 						pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
2390 						return true;
2391 					}
2392 					break;
2393 				}
2394 
2395 			case OWN_ATTR_GLUEID_HEAD:
2396 			case OWN_ATTR_GLUEID_TAIL:
2397 				{
2398 					sal_Int32 nId = 0;
2399 					if( rValue >>= nId )
2400 					{
2401 						pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
2402 						return true;
2403 					}
2404 					break;
2405 				}
2406 			case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2407 				{
2408 					drawing::PolyPolygonBezierCoords aPolyPoly;
2409 					if ( rValue >>= aPolyPoly )
2410 					{
2411 						basegfx::B2DPolyPolygon aNewPolyPolygon( SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aPolyPoly ) );
2412                         // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
2413                         ForceMetricToItemPoolMetric( aNewPolyPolygon );
2414                         // <--
2415                         if( mpModel->IsWriter() )
2416                         {
2417                             Point aPoint( mpObj->GetAnchorPos() );
2418                             aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y()));
2419                         }
2420                         pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
2421                         return true;
2422 					}
2423 				}
2424 			}
2425 		}
2426 		break;
2427 	}
2428 	case OWN_ATTR_MEASURE_START_POS:
2429 	case OWN_ATTR_MEASURE_END_POS:
2430 	{
2431 		SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(mpObj.get());
2432 		awt::Point aUnoPoint;
2433 		if(pMeasureObj && ( rValue >>= aUnoPoint ) )
2434 		{
2435 			Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2436 
2437             // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
2438             ForceMetricToItemPoolMetric( aPoint );
2439             // <--
2440 			if( mpModel->IsWriter() )
2441 				aPoint += mpObj->GetAnchorPos();
2442 
2443 			pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0L : 1L );
2444 			pMeasureObj->SetChanged();
2445 			pMeasureObj->BroadcastObjectChange();
2446 			return true;
2447 		}
2448 		break;
2449 	}
2450 	case OWN_ATTR_FILLBMP_MODE:
2451 		{
2452 			drawing::BitmapMode eMode;
2453 			if(!(rValue >>= eMode) )
2454 			{
2455 				sal_Int32 nMode = 0;
2456 				if(!(rValue >>= nMode))
2457 					break;
2458 
2459 				eMode = (drawing::BitmapMode)nMode;
2460 			}
2461 			mpObj->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
2462 			mpObj->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
2463 			return true;
2464 		}
2465 
2466 	case SDRATTR_LAYERID:
2467 	{
2468 		sal_Int16 nLayerId = sal_Int16();
2469 		if( rValue >>= nLayerId )
2470 		{
2471 			SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId);
2472 			if( pLayer )
2473 			{
2474 				mpObj->SetLayer((unsigned char)nLayerId);
2475 				return true;
2476 			}
2477 		}
2478 		break;
2479 	}
2480 
2481 	case SDRATTR_LAYERNAME:
2482 	{
2483 		OUString aLayerName;
2484 		if( rValue >>= aLayerName )
2485 		{
2486 			const SdrLayer* pLayer=mpModel->GetLayerAdmin().GetLayer(aLayerName, sal_True);
2487 			if( pLayer != NULL )
2488 			{
2489 				mpObj->SetLayer( pLayer->GetID() );
2490 				return true;
2491 			}
2492 		}
2493 		break;
2494 	}
2495 	case SDRATTR_ROTATEANGLE:
2496 	{
2497 		sal_Int32 nAngle = 0;
2498 		if( rValue >>= nAngle )
2499 		{
2500 			Point aRef1(mpObj->GetSnapRect().Center());
2501 			nAngle -= mpObj->GetRotateAngle();
2502 			if (nAngle!=0)
2503 			{
2504 				double nSin=sin(nAngle*nPi180);
2505 				double nCos=cos(nAngle*nPi180);
2506 				mpObj->Rotate(aRef1,nAngle,nSin,nCos);
2507 			}
2508 			return true;
2509 		}
2510 
2511 		break;
2512 	}
2513 
2514 	case SDRATTR_SHEARANGLE:
2515 	{
2516 		sal_Int32 nShear = 0;
2517 		if( rValue >>= nShear )
2518 		{
2519 			nShear -= mpObj->GetShearAngle();
2520 			if(nShear != 0 )
2521 			{
2522 				Point aRef1(mpObj->GetSnapRect().Center());
2523 				double nTan=tan(nShear*nPi180);
2524 				mpObj->Shear(aRef1,nShear,nTan,sal_False);
2525 				return true;
2526 			}
2527 		}
2528 
2529 		break;
2530 	}
2531 
2532 	case SDRATTR_OBJMOVEPROTECT:
2533 	{
2534 		sal_Bool bMoveProtect = sal_Bool();
2535 		if( rValue >>= bMoveProtect )
2536 		{
2537 			mpObj->SetMoveProtect(bMoveProtect);
2538 			return true;
2539 		}
2540 		break;
2541 	}
2542 	case SDRATTR_OBJECTNAME:
2543 	{
2544 		OUString aName;
2545 		if( rValue >>= aName )
2546 		{
2547 			mpObj->SetName( aName );
2548 			return true;
2549 		}
2550 		break;
2551 	}
2552 
2553 	// #i68101#
2554 	case OWN_ATTR_MISC_OBJ_TITLE:
2555 	{
2556 		OUString aTitle;
2557 		if( rValue >>= aTitle )
2558 		{
2559 			mpObj->SetTitle( aTitle );
2560 			return true;
2561 		}
2562 		break;
2563 	}
2564 	case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2565 	{
2566 		OUString aDescription;
2567 		if( rValue >>= aDescription )
2568 		{
2569 			mpObj->SetDescription( aDescription );
2570 			return true;
2571 		}
2572 		break;
2573 	}
2574 
2575 	case SDRATTR_OBJPRINTABLE:
2576 	{
2577 		sal_Bool bPrintable = sal_Bool();
2578 		if( rValue >>= bPrintable )
2579 		{
2580 			mpObj->SetPrintable(bPrintable);
2581 			return true;
2582 		}
2583 		break;
2584 	}
2585 	case SDRATTR_OBJVISIBLE:
2586 	{
2587 		sal_Bool bVisible = sal_Bool();
2588 		if( rValue >>= bVisible )
2589 		{
2590 			mpObj->SetVisible(bVisible);
2591 			return true;
2592 		}
2593 		break;
2594 	}
2595 	case SDRATTR_OBJSIZEPROTECT:
2596 	{
2597 		sal_Bool bResizeProtect = sal_Bool();
2598 		if( rValue >>= bResizeProtect )
2599 		{
2600 			mpObj->SetResizeProtect(bResizeProtect);
2601 			return true;
2602 		}
2603 		break;
2604 	}
2605 	case OWN_ATTR_PAGE_NUMBER:
2606 	{
2607 		sal_Int32 nPageNum = 0;
2608 		if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
2609 		{
2610 			SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(mpObj.get());
2611 			if( pPageObj )
2612 			{
2613 				SdrModel* pModel = pPageObj->GetModel();
2614 				SdrPage* pNewPage = 0L;
2615 				const sal_uInt16 nDestinationPageNum((sal_uInt16)((nPageNum << 1L) - 1L));
2616 
2617 				if(pModel)
2618 				{
2619 					if(nDestinationPageNum < pModel->GetPageCount())
2620 					{
2621 						pNewPage = pModel->GetPage(nDestinationPageNum);
2622 					}
2623 				}
2624 
2625 				pPageObj->SetReferencedPage(pNewPage);
2626 			}
2627 
2628 			return true;
2629 		}
2630 		break;
2631 	}
2632 	case XATTR_FILLBITMAP:
2633 	case XATTR_FILLGRADIENT:
2634 	case XATTR_FILLHATCH:
2635 	case XATTR_FILLFLOATTRANSPARENCE:
2636 	case XATTR_LINEEND:
2637 	case XATTR_LINESTART:
2638 	case XATTR_LINEDASH:
2639 	{
2640 		if( pProperty->nMemberId == MID_NAME )
2641 		{
2642 			OUString aApiName;
2643 			if( rValue >>= aApiName )
2644 			{
2645 				if( SetFillAttribute( pProperty->nWID, aApiName ) )
2646 					return true;
2647 			}
2648 			break;
2649 		}
2650 		else
2651 		{
2652 			return false;
2653 		}
2654 	}
2655 	default:
2656 	{
2657 		return false;
2658 	}
2659 	}
2660 	throw lang::IllegalArgumentException();
2661 }
2662 
2663 //----------------------------------------------------------------------
2664 
2665 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)
2666 {
2667 	switch( pProperty->nWID )
2668 	{
2669 /*
2670     case OWN_ATTR_HASLEVELS:
2671 	{
2672 		rValue <<= SvxTextEditSource::hasLevels( mpObj.get() );
2673 		break;
2674 	}
2675 */
2676 	case OWN_ATTR_CAPTION_POINT:
2677 	{
2678 		Point aVclPoint = ((SdrCaptionObj*)mpObj.get())->GetTailPos();
2679 
2680 		// #88491# make pos relative to anchor
2681 		if( mpModel->IsWriter() )
2682 		{
2683 			aVclPoint -= mpObj->GetAnchorPos();
2684 		}
2685 
2686 		// #88657# metric of pool maybe twips (writer)
2687 		ForceMetricTo100th_mm(aVclPoint);
2688 
2689 		// #90763# pos is absolute, make it relative to top left
2690 		basegfx::B2DPolyPolygon aNewPolyPolygon;
2691 		basegfx::B2DHomMatrix aNewHomogenMatrix;
2692 		mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2693 
2694 		aVclPoint.X() -= basegfx::fround(aNewHomogenMatrix.get(0, 2));
2695 		aVclPoint.Y() -= basegfx::fround(aNewHomogenMatrix.get(1, 2));
2696 
2697 		awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
2698 		rValue <<= aPnt;
2699 		break;
2700 	}
2701 
2702 	case OWN_ATTR_TRANSFORMATION:
2703 	{
2704 		basegfx::B2DPolyPolygon aNewPolyPolygon;
2705 		basegfx::B2DHomMatrix aNewHomogenMatrix;
2706 		mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2707 		drawing::HomogenMatrix3 aMatrix;
2708 
2709 		aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
2710 		aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
2711 		aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
2712 		aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
2713 		aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
2714 		aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
2715 		aMatrix.Line3.Column1 = aNewHomogenMatrix.get(2, 0);
2716 		aMatrix.Line3.Column2 = aNewHomogenMatrix.get(2, 1);
2717 		aMatrix.Line3.Column3 = aNewHomogenMatrix.get(2, 2);
2718 
2719 		rValue <<= aMatrix;
2720 
2721 		break;
2722 	}
2723 
2724 	case OWN_ATTR_ZORDER:
2725 	{
2726 		rValue <<= (sal_Int32)mpObj->GetOrdNum();
2727 		break;
2728 	}
2729 
2730 	case OWN_ATTR_BITMAP:
2731 	{
2732 		rValue = GetBitmap();
2733 		if(!rValue.hasValue())
2734 			throw uno::RuntimeException();
2735 
2736 		break;
2737 	}
2738 
2739 	case OWN_ATTR_ISFONTWORK:
2740 	{
2741 		rValue <<= (sal_Bool)(mpObj->ISA(SdrTextObj) && ((SdrTextObj*)mpObj.get())->IsFontwork());
2742 		break;
2743 	}
2744 
2745 	case OWN_ATTR_FRAMERECT:
2746 	{
2747 		Rectangle aRect( mpObj->GetSnapRect() );
2748 		Point aTopLeft( aRect.TopLeft() );
2749 		Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2750 		ForceMetricTo100th_mm(aTopLeft);
2751 		ForceMetricTo100th_mm(aObjSize);
2752 		::com::sun::star::awt::Rectangle aUnoRect(
2753 			aTopLeft.X(), aTopLeft.Y(),
2754 			aObjSize.getWidth(), aObjSize.getHeight() );
2755 		rValue <<= aUnoRect;
2756 		break;
2757 	}
2758 
2759 	case OWN_ATTR_BOUNDRECT:
2760 	{
2761 		Rectangle aRect( mpObj->GetCurrentBoundRect() );
2762 		Point aTopLeft( aRect.TopLeft() );
2763 		Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2764 		ForceMetricTo100th_mm(aTopLeft);
2765 		ForceMetricTo100th_mm(aObjSize);
2766 		::com::sun::star::awt::Rectangle aUnoRect(
2767 			aTopLeft.X(), aTopLeft.Y(),
2768 			aObjSize.getWidth(), aObjSize.getHeight() );
2769 		rValue <<= aUnoRect;
2770 		break;
2771 	}
2772 
2773 	case OWN_ATTR_LDNAME:
2774 	{
2775 		OUString aName( mpObj->GetName() );
2776 		rValue <<= aName;
2777 		break;
2778 	}
2779 
2780 	case OWN_ATTR_LDBITMAP:
2781 	{
2782 		sal_uInt16 nId;
2783 		if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_OLE2 )
2784 		{
2785 			nId = RID_UNODRAW_OLE2;
2786 		}
2787 		else if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_GRAF )
2788 		{
2789 			nId = RID_UNODRAW_GRAPHICS;
2790 		}
2791 		else
2792 		{
2793 			nId = RID_UNODRAW_OBJECTS;
2794 		}
2795 
2796 		BitmapEx aBmp( SVX_RES(nId) );
2797 		Reference< awt::XBitmap > xBmp( VCLUnoHelper::CreateBitmap( aBmp ) );
2798 
2799 		rValue <<= xBmp;
2800 		break;
2801 	}
2802 
2803 	case OWN_ATTR_MIRRORED:
2804 	{
2805 		sal_Bool bMirror = sal_False;
2806 		if( mpObj.is() && mpObj->ISA(SdrGrafObj) )
2807 			bMirror = ((SdrGrafObj*)mpObj.get())->IsMirrored();
2808 
2809 		rValue <<= bMirror;
2810 	}
2811 
2812 	case OWN_ATTR_EDGE_START_OBJ:
2813 	case OWN_ATTR_EDGE_START_POS:
2814 	case OWN_ATTR_EDGE_END_POS:
2815 	case OWN_ATTR_EDGE_END_OBJ:
2816 	case OWN_ATTR_GLUEID_HEAD:
2817 	case OWN_ATTR_GLUEID_TAIL:
2818 	case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2819 	{
2820 		SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(mpObj.get());
2821 		if(pEdgeObj)
2822 		{
2823 			switch(pProperty->nWID)
2824 			{
2825 			case OWN_ATTR_EDGE_START_OBJ:
2826 			case OWN_ATTR_EDGE_END_OBJ:
2827 				{
2828 					SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
2829 					if(pNode)
2830 					{
2831 						Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
2832 						if(xShape.is())
2833 							rValue <<= xShape;
2834 
2835 					}
2836 					break;
2837 				}
2838 
2839 			case OWN_ATTR_EDGE_START_POS:
2840 			case OWN_ATTR_EDGE_END_POS:
2841 				{
2842 					Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
2843 					if( mpModel->IsWriter() )
2844 						aPoint -= mpObj->GetAnchorPos();
2845 
2846 					ForceMetricTo100th_mm( aPoint );
2847 					awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2848 
2849 					rValue <<= aUnoPoint;
2850 					break;
2851 				}
2852 			case OWN_ATTR_GLUEID_HEAD:
2853 			case OWN_ATTR_GLUEID_TAIL:
2854 				{
2855 					rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
2856 					break;
2857 				}
2858 			case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2859 				{
2860 					basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
2861 					if( mpModel->IsWriter() )
2862 					{
2863 						Point aPoint( mpObj->GetAnchorPos() );
2864 						aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
2865 					}
2866                     // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
2867                     ForceMetricTo100th_mm( aPolyPoly );
2868                     // <--
2869 					drawing::PolyPolygonBezierCoords aRetval;
2870 					SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
2871 					rValue <<= aRetval;
2872 					break;
2873 				}
2874 			}
2875 		}
2876 		break;
2877 	}
2878 
2879 	case OWN_ATTR_MEASURE_START_POS:
2880 	case OWN_ATTR_MEASURE_END_POS:
2881 	{
2882 		SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(mpObj.get());
2883 		if(pMeasureObj)
2884 		{
2885 			Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
2886 			if( mpModel->IsWriter() )
2887 				aPoint -= mpObj->GetAnchorPos();
2888 
2889             // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
2890             ForceMetricTo100th_mm( aPoint );
2891             // <--
2892 			awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2893 
2894 			rValue <<= aUnoPoint;
2895 			break;
2896 		}
2897 		break;
2898 	}
2899 
2900 	case OWN_ATTR_FILLBMP_MODE:
2901 	{
2902 		const SfxItemSet& rObjItemSet = mpObj->GetMergedItemSet();
2903 
2904 		XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&rObjItemSet.Get(XATTR_FILLBMP_STRETCH);
2905 		XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&rObjItemSet.Get(XATTR_FILLBMP_TILE);
2906 
2907 		if( pTileItem && pTileItem->GetValue() )
2908 		{
2909 			rValue <<= drawing::BitmapMode_REPEAT;
2910 		}
2911 		else if( pStretchItem && pStretchItem->GetValue() )
2912 		{
2913 			rValue <<= drawing::BitmapMode_STRETCH;
2914 		}
2915 		else
2916 		{
2917 			rValue <<= drawing::BitmapMode_NO_REPEAT;
2918 		}
2919 		break;
2920 	}
2921 	case SDRATTR_LAYERID:
2922 		rValue <<= (sal_Int16)mpObj->GetLayer();
2923 		break;
2924 
2925 	case SDRATTR_LAYERNAME:
2926 	{
2927 		SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID(mpObj->GetLayer());
2928 		if( pLayer )
2929 		{
2930 			OUString aName( pLayer->GetName() );
2931 			rValue <<= aName;
2932 		}
2933 		break;
2934 	}
2935 
2936 	case SDRATTR_ROTATEANGLE:
2937 		rValue <<= mpObj->GetRotateAngle();
2938 		break;
2939 
2940 	case SDRATTR_SHEARANGLE:
2941 		rValue <<= mpObj->GetShearAngle();
2942 		break;
2943 
2944 	case SDRATTR_OBJMOVEPROTECT:
2945 		rValue = uno::makeAny( (sal_Bool) mpObj->IsMoveProtect() );
2946 		break;
2947 
2948 	case SDRATTR_OBJECTNAME:
2949 	{
2950 		OUString aName( mpObj->GetName() );
2951 		rValue <<= aName;
2952 		break;
2953 	}
2954 
2955 	// #i68101#
2956 	case OWN_ATTR_MISC_OBJ_TITLE:
2957 	{
2958 		OUString aTitle( mpObj->GetTitle() );
2959 		rValue <<= aTitle;
2960 		break;
2961 	}
2962 
2963 	case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2964 	{
2965 		OUString aDescription( mpObj->GetDescription() );
2966 		rValue <<= aDescription;
2967 		break;
2968 	}
2969 
2970 	case SDRATTR_OBJPRINTABLE:
2971 		rValue <<= static_cast<sal_Bool>( mpObj->IsPrintable() );
2972 		break;
2973 
2974 	case SDRATTR_OBJVISIBLE:
2975 		rValue <<= static_cast<sal_Bool>( mpObj->IsVisible() );
2976 		break;
2977 
2978 	case SDRATTR_OBJSIZEPROTECT:
2979 		rValue <<= static_cast<sal_Bool>( mpObj->IsResizeProtect() );
2980 		break;
2981 
2982 	case OWN_ATTR_PAGE_NUMBER:
2983 	{
2984 		SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(mpObj.get());
2985 		if(pPageObj)
2986 		{
2987 			SdrPage* pPage = pPageObj->GetReferencedPage();
2988 			sal_Int32 nPageNumber = (pPage) ? pPage->GetPageNum() : 0L;
2989 			nPageNumber++;
2990 			nPageNumber >>= 1;
2991 			rValue <<= nPageNumber;
2992 		}
2993 		break;
2994 	}
2995 
2996 	case OWN_ATTR_UINAME_SINGULAR:
2997 	{
2998 		String aTmp;
2999 		mpObj->TakeObjNameSingul( aTmp );
3000 		rValue <<= OUString( aTmp );
3001 		break;
3002 	}
3003 
3004 	case OWN_ATTR_UINAME_PLURAL:
3005 	{
3006 		String aTmp;
3007 		mpObj->TakeObjNamePlural( aTmp );
3008 		rValue <<= OUString( aTmp );
3009 		break;
3010 	}
3011 	case OWN_ATTR_METAFILE:
3012 	{
3013 		SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
3014 		if( pObj )
3015 		{
3016             Graphic* pGraphic = pObj->GetGraphic();
3017             if( pGraphic )
3018 			{
3019                 sal_Bool bIsWMF = sal_False;
3020                 if ( pGraphic->IsLink() )
3021                 {
3022                     GfxLink aLnk = pGraphic->GetLink();
3023                     if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
3024                     {
3025                         bIsWMF = sal_True;
3026                         uno::Sequence<sal_Int8> aSeq((sal_Int8*)aLnk.GetData(), (sal_Int32) aLnk.GetDataSize());
3027                         rValue <<= aSeq;
3028                     }
3029                 }
3030                 if ( !bIsWMF )
3031                 {
3032                     // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
3033 					GDIMetaFile aMtf(pObj->GetGraphic()->GetGDIMetaFile());
3034                     SvMemoryStream aDestStrm( 65535, 65535 );
3035                     ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
3036                     const uno::Sequence<sal_Int8> aSeq(
3037                         static_cast< const sal_Int8* >(aDestStrm.GetData()),
3038                         aDestStrm.GetEndOfData());
3039                     rValue <<= aSeq;
3040                 }
3041 			}
3042 		}
3043 		else
3044 		{
3045 			rValue = GetBitmap( sal_True );
3046 		}
3047 		break;
3048 	}
3049 
3050 
3051 	default:
3052 		return false;
3053 	}
3054 	return true;
3055 }
3056 
3057 //----------------------------------------------------------------------
3058 
3059 bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
3060 {
3061 	if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
3062 	{
3063 		const SfxItemSet& rSet = mpObj->GetMergedItemSet();
3064 
3065 		if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
3066 			rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
3067 		{
3068 			rState = beans::PropertyState_DIRECT_VALUE;
3069 		}
3070 		else
3071 		{
3072 			rState = beans::PropertyState_AMBIGUOUS_VALUE;
3073 		}
3074 	}
3075 	else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
3076 	   ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
3077 	{
3078 		rState = beans::PropertyState_DIRECT_VALUE;
3079 	}
3080 	else
3081 	{
3082 		return false;
3083 	}
3084 
3085 	return true;
3086 }
3087 
3088 //----------------------------------------------------------------------
3089 
3090 bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
3091 {
3092 	if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
3093 	{
3094 		mpObj->ClearMergedItem( XATTR_FILLBMP_STRETCH );
3095 		mpObj->ClearMergedItem( XATTR_FILLBMP_TILE );
3096 		return true;
3097 	}
3098 	else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
3099 	   ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
3100 	{
3101 		return true;
3102 	}
3103 	else
3104 	{
3105 		return false;
3106 	}
3107 }
3108 
3109 //----------------------------------------------------------------------
3110 
3111 uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
3112 	throw(beans::UnknownPropertyException, uno::RuntimeException)
3113 {
3114 	const sal_Int32 nCount = aPropertyName.getLength();
3115 	const OUString* pNames = aPropertyName.getConstArray();
3116 
3117 	uno::Sequence< beans::PropertyState > aRet( nCount );
3118 	beans::PropertyState* pState = aRet.getArray();
3119 
3120 	if( mpImpl->mpMaster )
3121 	{
3122 		for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
3123 			pState[nIdx] = getPropertyState( pNames[nIdx] );
3124 
3125 	}
3126 	else
3127 	{
3128 		for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
3129 			pState[nIdx] = getPropertyState( pNames[nIdx] );
3130 	}
3131 
3132 	return aRet;
3133 }
3134 
3135 //----------------------------------------------------------------------
3136 
3137 void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
3138 	throw(beans::UnknownPropertyException, uno::RuntimeException)
3139 {
3140 	if( mpImpl->mpMaster )
3141 	{
3142 		mpImpl->mpMaster->setPropertyToDefault( PropertyName );
3143 	}
3144 	else
3145 	{
3146 		_setPropertyToDefault( PropertyName );
3147 	}
3148 }
3149 
3150 void SAL_CALL SvxShape::_setPropertyToDefault( const OUString& PropertyName )
3151 	throw(beans::UnknownPropertyException, uno::RuntimeException)
3152 {
3153 	OGuard aGuard( Application::GetSolarMutex() );
3154 
3155     const SfxItemPropertySimpleEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
3156 
3157 	if( !mpObj.is() || mpModel == NULL || pProperty == NULL )
3158 		throw beans::UnknownPropertyException();
3159 
3160 	if( !setPropertyToDefaultImpl( pProperty ) )
3161 	{
3162 		mpObj->ClearMergedItem( pProperty->nWID );
3163 	}
3164 
3165 	mpModel->SetChanged();
3166 }
3167 
3168 //----------------------------------------------------------------------
3169 
3170 uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
3171 	throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
3172 {
3173 	if( mpImpl->mpMaster )
3174 	{
3175 		return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
3176 	}
3177 	else
3178 	{
3179 		return _getPropertyDefault( aPropertyName );
3180 	}
3181 }
3182 
3183 uno::Any SAL_CALL SvxShape::_getPropertyDefault( const OUString& aPropertyName )
3184 	throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
3185 {
3186 	OGuard aGuard( Application::GetSolarMutex() );
3187 
3188     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
3189 
3190 	if( !mpObj.is() || pMap == NULL || mpModel == NULL )
3191 		throw beans::UnknownPropertyException();
3192 
3193 	if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
3194 	   ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
3195 	{
3196 		return getPropertyValue( aPropertyName );
3197 	}
3198 
3199 	// Default aus ItemPool holen
3200 	if(!mpModel->GetItemPool().IsWhich(pMap->nWID))
3201 		throw beans::UnknownPropertyException();
3202 
3203 	SfxItemSet aSet( mpModel->GetItemPool(),	pMap->nWID, pMap->nWID);
3204 	aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
3205 
3206 	return GetAnyForItem( aSet, pMap );
3207 }
3208 
3209 // XMultiPropertyStates
3210 void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException)
3211 {
3212 	OGuard aGuard( Application::GetSolarMutex() );
3213 
3214 	if( !mpObj.is() )
3215 		throw lang::DisposedException();
3216 	mpObj->ClearMergedItem(); // nWhich == 0 => all
3217 
3218     if(mpObj->ISA(SdrGrafObj))
3219 	{
3220         // defaults for graphic objects have changed:
3221         mpObj->SetMergedItem( XFillStyleItem( XFILL_NONE ) );
3222         mpObj->SetMergedItem( XLineStyleItem( XLINE_NONE ) );
3223 	}
3224 
3225 	// #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3226 	// but needs to be sal_True in svx, pool default (false) in sch. Since sch
3227 	// does not load lathe or extrude objects, it is possible to set the items
3228 	// here.
3229 	// For other solution possibilities, see task description.
3230     if(mpObj->ISA(E3dLatheObj) || mpObj->ISA(E3dExtrudeObj))
3231 	{
3232         mpObj->SetMergedItem(Svx3DCharacterModeItem(true));
3233 	}
3234 
3235 	mpModel->SetChanged();
3236 }
3237 
3238 void SvxShape::setPropertiesToDefault(
3239     const uno::Sequence<OUString>& aPropertyNames )
3240     throw (beans::UnknownPropertyException, uno::RuntimeException)
3241 {
3242     for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
3243         setPropertyToDefault( aPropertyNames[pos] );
3244 }
3245 
3246 uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
3247     const uno::Sequence<OUString>& aPropertyNames )
3248     throw (beans::UnknownPropertyException, lang::WrappedTargetException,
3249            uno::RuntimeException)
3250 {
3251     ::std::vector<uno::Any> ret;
3252     for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
3253         ret.push_back( getPropertyDefault( aPropertyNames[pos] ) );
3254     return uno::Sequence<uno::Any>( &ret[0], ret.size() );
3255 }
3256 
3257 //----------------------------------------------------------------------
3258 
3259 //----------------------------------------------------------------------
3260 // XServiceInfo
3261 //----------------------------------------------------------------------
3262 OUString SAL_CALL SvxShape::getImplementationName()
3263 	throw(uno::RuntimeException)
3264 {
3265 	static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShape") );
3266 	return aServiceName;
3267 }
3268 
3269 #define STAR_NAMESPACE "com.sun.star."
3270 
3271 const char* sUNO_service_style_ParagraphProperties			= STAR_NAMESPACE "style.ParagraphProperties";
3272 const char* sUNO_service_style_ParagraphPropertiesComplex	= STAR_NAMESPACE "style.ParagraphPropertiesComplex";
3273 const char* sUNO_service_style_ParagraphPropertiesAsian		= STAR_NAMESPACE "style.ParagraphPropertiesAsian";
3274 const char* sUNO_service_style_CharacterProperties			= STAR_NAMESPACE "style.CharacterProperties";
3275 const char* sUNO_service_style_CharacterPropertiesComplex	= STAR_NAMESPACE "style.CharacterPropertiesComplex";
3276 const char* sUNO_service_style_CharacterPropertiesAsian		= STAR_NAMESPACE "style.CharacterPropertiesAsian";
3277 
3278 const char* sUNO_service_drawing_FillProperties				= STAR_NAMESPACE "drawing.FillProperties";
3279 const char* sUNO_service_drawing_TextProperties				= STAR_NAMESPACE "drawing.TextProperties";
3280 const char* sUNO_service_drawing_LineProperties				= STAR_NAMESPACE "drawing.LineProperties";
3281 const char* sUNO_service_drawing_ConnectorProperties		= STAR_NAMESPACE "drawing.ConnectorProperties";
3282 const char* sUNO_service_drawing_MeasureProperties			= STAR_NAMESPACE "drawing.MeasureProperties";
3283 const char* sUNO_service_drawing_ShadowProperties			= STAR_NAMESPACE "drawing.ShadowProperties";
3284 
3285 const char* sUNO_service_drawing_RotationDescriptor			= STAR_NAMESPACE "drawing.RotationDescriptor";
3286 
3287 const char* sUNO_service_drawing_Text						= STAR_NAMESPACE "drawing.Text";
3288 const char* sUNO_service_drawing_GroupShape					= STAR_NAMESPACE "drawing.GroupShape";
3289 
3290 const char* sUNO_service_drawing_CustomShapeProperties		= STAR_NAMESPACE "drawing.CustomShapeProperties";
3291 const char* sUNO_service_drawing_CustomShape					= STAR_NAMESPACE "drawing.CustomShape";
3292 
3293 const char* sUNO_service_drawing_PolyPolygonDescriptor		= STAR_NAMESPACE "drawing.PolyPolygonDescriptor";
3294 const char* sUNO_service_drawing_PolyPolygonBezierDescriptor= STAR_NAMESPACE "drawing.PolyPolygonBezierDescriptor";
3295 
3296 const char* sUNO_service_drawing_LineShape					= STAR_NAMESPACE "drawing.LineShape";
3297 const char* sUNO_service_drawing_Shape						= STAR_NAMESPACE "drawing.Shape";
3298 const char* sUNO_service_drawing_RectangleShape				= STAR_NAMESPACE "drawing.RectangleShape";
3299 const char* sUNO_service_drawing_EllipseShape				= STAR_NAMESPACE "drawing.EllipseShape";
3300 const char* sUNO_service_drawing_PolyPolygonShape			= STAR_NAMESPACE "drawing.PolyPolygonShape";
3301 const char* sUNO_service_drawing_PolyLineShape				= STAR_NAMESPACE "drawing.PolyLineShape";
3302 const char* sUNO_service_drawing_OpenBezierShape			= STAR_NAMESPACE "drawing.OpenBezierShape";
3303 const char* sUNO_service_drawing_ClosedBezierShape			= STAR_NAMESPACE "drawing.ClosedBezierShape";
3304 const char* sUNO_service_drawing_TextShape					= STAR_NAMESPACE "drawing.TextShape";
3305 const char* sUNO_service_drawing_GraphicObjectShape			= STAR_NAMESPACE "drawing.GraphicObjectShape";
3306 const char* sUNO_service_drawing_OLE2Shape					= STAR_NAMESPACE "drawing.OLE2Shape";
3307 const char* sUNO_service_drawing_PageShape					= STAR_NAMESPACE "drawing.PageShape";
3308 const char* sUNO_service_drawing_CaptionShape				= STAR_NAMESPACE "drawing.CaptionShape";
3309 const char* sUNO_service_drawing_MeasureShape				= STAR_NAMESPACE "drawing.MeasureShape";
3310 const char* sUNO_service_drawing_FrameShape					= STAR_NAMESPACE "drawing.FrameShape";
3311 const char* sUNO_service_drawing_ControlShape				= STAR_NAMESPACE "drawing.ControlShape";
3312 const char* sUNO_service_drawing_ConnectorShape				= STAR_NAMESPACE "drawing.ConnectorShape";
3313 const char* sUNO_service_drawing_MediaShape					= STAR_NAMESPACE "drawing.MediaShape";
3314 
3315 
3316 uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
3317 	throw(uno::RuntimeException)
3318 {
3319 	if( mpImpl->mpMaster )
3320 	{
3321 		return mpImpl->mpMaster->getSupportedServiceNames();
3322 	}
3323 	else
3324 	{
3325 		return _getSupportedServiceNames();
3326 	}
3327 }
3328 
3329 uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames()
3330 	throw(uno::RuntimeException)
3331 {
3332 	OGuard aGuard( Application::GetSolarMutex() );
3333 
3334 	if( mpObj.is() && mpObj->GetObjInventor() == SdrInventor)
3335 	{
3336 		const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
3337 
3338 		switch(nIdent)
3339 		{
3340 		case OBJ_GRUP:
3341 			{
3342 				static uno::Sequence< OUString > *pSeq = 0;
3343 				if( 0 == pSeq )
3344 				{
3345 //					OGuard aGuard( Application::GetSolarMutex() );
3346 //					if( 0 == pSeq )
3347 					{
3348 						static uno::Sequence< OUString > SvxShape_GroupServices;
3349 
3350 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices, 2,
3351 							sUNO_service_drawing_GroupShape,
3352 					  		sUNO_service_drawing_Shape );
3353 
3354 						pSeq = &SvxShape_GroupServices;
3355 					}
3356 				}
3357 
3358 				return *pSeq;
3359 			}
3360 		case OBJ_CUSTOMSHAPE:
3361 			{
3362 				static uno::Sequence< OUString > *pSeq = 0;
3363 				if( 0 == pSeq )
3364 				{
3365 //					OGuard aGuard( Application::GetSolarMutex() );
3366 //					if( 0 == pSeq )
3367 					{
3368 						static uno::Sequence< OUString > SvxShape_CustomShapeServices;
3369 
3370 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices, 13,
3371 							sUNO_service_drawing_CustomShape,
3372 					  		sUNO_service_drawing_Shape,
3373 							sUNO_service_drawing_CustomShapeProperties,
3374 							sUNO_service_drawing_FillProperties,
3375 							sUNO_service_drawing_LineProperties,
3376 							sUNO_service_drawing_Text,
3377 							sUNO_service_drawing_TextProperties,
3378 							sUNO_service_style_ParagraphProperties,
3379 							sUNO_service_style_ParagraphPropertiesComplex,
3380 							sUNO_service_style_ParagraphPropertiesAsian,
3381 							sUNO_service_style_CharacterProperties,
3382 							sUNO_service_style_CharacterPropertiesComplex,
3383 							sUNO_service_style_CharacterPropertiesAsian,
3384 							sUNO_service_drawing_ShadowProperties,
3385 							sUNO_service_drawing_RotationDescriptor);
3386 						pSeq = &SvxShape_CustomShapeServices;
3387 					}
3388 				}
3389 				return *pSeq;
3390 			}
3391 		case OBJ_LINE:
3392 			{
3393 				static uno::Sequence< OUString > *pSeq = 0;
3394 				if( 0 == pSeq )
3395 				{
3396 //					OGuard aGuard( Application::GetSolarMutex() );
3397 //					if( 0 == pSeq )
3398 					{
3399 						static uno::Sequence< OUString > SvxShape_LineServices;
3400 
3401 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices,14,
3402 							sUNO_service_drawing_LineShape,
3403 
3404 							sUNO_service_drawing_Shape,
3405 							sUNO_service_drawing_LineProperties,
3406 
3407 							sUNO_service_drawing_Text,
3408 							sUNO_service_drawing_TextProperties,
3409 							sUNO_service_style_ParagraphProperties,
3410 							sUNO_service_style_ParagraphPropertiesComplex,
3411 							sUNO_service_style_ParagraphPropertiesAsian,
3412 							sUNO_service_style_CharacterProperties,
3413 							sUNO_service_style_CharacterPropertiesComplex,
3414 							sUNO_service_style_CharacterPropertiesAsian,
3415 
3416 							sUNO_service_drawing_PolyPolygonDescriptor,
3417 							sUNO_service_drawing_ShadowProperties,
3418 							sUNO_service_drawing_RotationDescriptor);
3419 
3420 						pSeq = &SvxShape_LineServices;
3421 					}
3422 				}
3423 				return *pSeq;
3424 			}
3425 
3426 		case OBJ_RECT:
3427 			{
3428 				static uno::Sequence< OUString > *pSeq = 0;
3429 				if( 0 == pSeq )
3430 				{
3431 //					OGuard aGuard( Application::GetSolarMutex() );
3432 //					if( 0 == pSeq )
3433 					{
3434 						static uno::Sequence< OUString > SvxShape_RectServices;
3435 
3436 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices,14,
3437 							sUNO_service_drawing_RectangleShape,
3438 
3439 							sUNO_service_drawing_Shape,
3440 							sUNO_service_drawing_FillProperties,
3441 							sUNO_service_drawing_LineProperties,
3442 							sUNO_service_drawing_Text,
3443 							sUNO_service_drawing_TextProperties,
3444 							sUNO_service_style_ParagraphProperties,
3445 							sUNO_service_style_ParagraphPropertiesComplex,
3446 							sUNO_service_style_ParagraphPropertiesAsian,
3447 							sUNO_service_style_CharacterProperties,
3448 							sUNO_service_style_CharacterPropertiesComplex,
3449 							sUNO_service_style_CharacterPropertiesAsian,
3450 
3451 							sUNO_service_drawing_ShadowProperties,
3452 							sUNO_service_drawing_RotationDescriptor);
3453 						pSeq = &SvxShape_RectServices;
3454 					}
3455 
3456 				}
3457 				return *pSeq;
3458 			}
3459 
3460 		case OBJ_CIRC:
3461 		case OBJ_SECT:
3462 		case OBJ_CARC:
3463 		case OBJ_CCUT:
3464 			{
3465 				static uno::Sequence< OUString > *pSeq = 0;
3466 				if( 0 == pSeq )
3467 				{
3468 //					OGuard aGuard( Application::GetSolarMutex() );
3469 //					if( 0 == pSeq )
3470 					{
3471 						static uno::Sequence< OUString > SvxShape_CircServices;
3472 
3473 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices,14,
3474 							sUNO_service_drawing_EllipseShape,
3475 
3476 							sUNO_service_drawing_Shape,
3477 							sUNO_service_drawing_FillProperties,
3478 							sUNO_service_drawing_LineProperties,
3479 
3480 							sUNO_service_drawing_Text,
3481 							sUNO_service_drawing_TextProperties,
3482 							sUNO_service_style_ParagraphProperties,
3483 							sUNO_service_style_ParagraphPropertiesComplex,
3484 							sUNO_service_style_ParagraphPropertiesAsian,
3485 							sUNO_service_style_CharacterProperties,
3486 							sUNO_service_style_CharacterPropertiesComplex,
3487 							sUNO_service_style_CharacterPropertiesAsian,
3488 
3489 							sUNO_service_drawing_ShadowProperties,
3490 							sUNO_service_drawing_RotationDescriptor);
3491 
3492 						pSeq = &SvxShape_CircServices;
3493 					}
3494 				}
3495 
3496 				return *pSeq;
3497 			}
3498 
3499 		case OBJ_PATHPLIN:
3500 		case OBJ_PLIN:
3501 			{
3502 				static uno::Sequence< OUString > *pSeq = 0;
3503 				if( 0 == pSeq )
3504 				{
3505 //					OGuard aGuard( Application::GetSolarMutex() );
3506 //					if( 0 == pSeq )
3507 					{
3508 						static uno::Sequence< OUString > SvxShape_PathServices;
3509 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices,14,
3510 							sUNO_service_drawing_PolyLineShape,
3511 
3512 							sUNO_service_drawing_Shape,
3513 							sUNO_service_drawing_LineProperties,
3514 
3515 							sUNO_service_drawing_PolyPolygonDescriptor,
3516 
3517 							sUNO_service_drawing_Text,
3518 							sUNO_service_drawing_TextProperties,
3519 							sUNO_service_style_ParagraphProperties,
3520 							sUNO_service_style_ParagraphPropertiesComplex,
3521 							sUNO_service_style_ParagraphPropertiesAsian,
3522 							sUNO_service_style_CharacterProperties,
3523 							sUNO_service_style_CharacterPropertiesComplex,
3524 							sUNO_service_style_CharacterPropertiesAsian,
3525 
3526 							sUNO_service_drawing_ShadowProperties,
3527 							sUNO_service_drawing_RotationDescriptor);
3528 						pSeq = &SvxShape_PathServices;
3529 					}
3530 				}
3531 				return *pSeq;
3532 			}
3533 
3534 		case OBJ_PATHPOLY:
3535 		case OBJ_POLY:
3536 			{
3537 				static uno::Sequence< OUString > *pSeq = 0;
3538 				if( 0 == pSeq )
3539 				{
3540 //					OGuard aGuard( Application::GetSolarMutex() );
3541 //					if( 0 == pSeq )
3542 					{
3543 						static uno::Sequence< OUString > SvxShape_PolyServices;
3544 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices,15,
3545 							sUNO_service_drawing_PolyPolygonShape,
3546 
3547 							sUNO_service_drawing_Shape,
3548 							sUNO_service_drawing_LineProperties,
3549 							sUNO_service_drawing_FillProperties,
3550 
3551 							sUNO_service_drawing_PolyPolygonDescriptor,
3552 
3553 							sUNO_service_drawing_Text,
3554 							sUNO_service_drawing_TextProperties,
3555 							sUNO_service_style_ParagraphProperties,
3556 							sUNO_service_style_ParagraphPropertiesComplex,
3557 							sUNO_service_style_ParagraphPropertiesAsian,
3558 							sUNO_service_style_CharacterProperties,
3559 							sUNO_service_style_CharacterPropertiesComplex,
3560 							sUNO_service_style_CharacterPropertiesAsian,
3561 
3562 							sUNO_service_drawing_ShadowProperties,
3563 							sUNO_service_drawing_RotationDescriptor);
3564 
3565 						pSeq = &SvxShape_PolyServices;
3566 					}
3567 				}
3568 				return *pSeq;
3569 			}
3570 
3571 		case OBJ_FREELINE:
3572 		case OBJ_PATHLINE:
3573 			{
3574 				static uno::Sequence< OUString > *pSeq = 0;
3575 				if( 0 == pSeq )
3576 				{
3577 //					OGuard aGuard( Application::GetSolarMutex() );
3578 //					if( 0 == pSeq )
3579 					{
3580 						static uno::Sequence< OUString > SvxShape_FreeLineServices;
3581 
3582 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices,15,
3583 							sUNO_service_drawing_OpenBezierShape,
3584 
3585 							sUNO_service_drawing_Shape,
3586 							sUNO_service_drawing_LineProperties,
3587 							sUNO_service_drawing_FillProperties,
3588 
3589 							sUNO_service_drawing_PolyPolygonBezierDescriptor,
3590 
3591 							sUNO_service_drawing_Text,
3592 							sUNO_service_drawing_TextProperties,
3593 							sUNO_service_style_ParagraphProperties,
3594 							sUNO_service_style_ParagraphPropertiesComplex,
3595 							sUNO_service_style_ParagraphPropertiesAsian,
3596 							sUNO_service_style_CharacterProperties,
3597 							sUNO_service_style_CharacterPropertiesComplex,
3598 							sUNO_service_style_CharacterPropertiesAsian,
3599 
3600 							sUNO_service_drawing_ShadowProperties,
3601 							sUNO_service_drawing_RotationDescriptor);
3602 
3603 						pSeq = &SvxShape_FreeLineServices;
3604 					}
3605 				}
3606 
3607 				return *pSeq;
3608 			}
3609 
3610 		case OBJ_FREEFILL:
3611 		case OBJ_PATHFILL:
3612 			{
3613 				static uno::Sequence< OUString > *pSeq = 0;
3614 				if( 0 == pSeq )
3615 				{
3616 //					OGuard aGuard( Application::GetSolarMutex() );
3617 //					if( 0 == pSeq )
3618 					{
3619 						static uno::Sequence< OUString > SvxShape_FreeFillServices;
3620 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices,15,
3621 							sUNO_service_drawing_ClosedBezierShape,
3622 
3623 							sUNO_service_drawing_Shape,
3624 							sUNO_service_drawing_LineProperties,
3625 							sUNO_service_drawing_FillProperties,
3626 
3627 							sUNO_service_drawing_PolyPolygonBezierDescriptor,
3628 
3629 							sUNO_service_drawing_Text,
3630 							sUNO_service_drawing_TextProperties,
3631 							sUNO_service_style_ParagraphProperties,
3632 							sUNO_service_style_ParagraphPropertiesComplex,
3633 							sUNO_service_style_ParagraphPropertiesAsian,
3634 							sUNO_service_style_CharacterProperties,
3635 							sUNO_service_style_CharacterPropertiesComplex,
3636 							sUNO_service_style_CharacterPropertiesAsian,
3637 
3638 							sUNO_service_drawing_ShadowProperties,
3639 							sUNO_service_drawing_RotationDescriptor);
3640 
3641 						pSeq = &SvxShape_FreeFillServices;
3642 					}
3643 				}
3644 				return *pSeq;
3645 			}
3646 
3647 		case OBJ_OUTLINETEXT:
3648 		case OBJ_TITLETEXT:
3649 		case OBJ_TEXT:
3650 			{
3651 				static uno::Sequence< OUString > *pSeq = 0;
3652 				if( 0 == pSeq )
3653 				{
3654 //					OGuard aGuard( Application::GetSolarMutex() );
3655 //					if( 0 == pSeq )
3656 					{
3657 						static uno::Sequence< OUString > SvxShape_TextServices;
3658 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices,14,
3659 							sUNO_service_drawing_TextShape,
3660 
3661 							sUNO_service_drawing_Shape,
3662 							sUNO_service_drawing_FillProperties,
3663 							sUNO_service_drawing_LineProperties,
3664 
3665 							sUNO_service_drawing_Text,
3666 							sUNO_service_drawing_TextProperties,
3667 							sUNO_service_style_ParagraphProperties,
3668 							sUNO_service_style_ParagraphPropertiesComplex,
3669 							sUNO_service_style_ParagraphPropertiesAsian,
3670 							sUNO_service_style_CharacterProperties,
3671 							sUNO_service_style_CharacterPropertiesComplex,
3672 							sUNO_service_style_CharacterPropertiesAsian,
3673 
3674 							sUNO_service_drawing_ShadowProperties,
3675 							sUNO_service_drawing_RotationDescriptor);
3676 
3677 						pSeq = &SvxShape_TextServices;
3678 					}
3679 				}
3680 				return *pSeq;
3681 			}
3682 
3683 		case OBJ_GRAF:
3684 			{
3685 				static uno::Sequence< OUString > *pSeq = 0;
3686 				if( 0 == pSeq )
3687 				{
3688 //					OGuard aGuard( Application::GetSolarMutex() );
3689 //					if( 0 == pSeq )
3690 					{
3691 						static uno::Sequence< OUString > SvxShape_GrafServices;
3692 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices, 12,
3693 							sUNO_service_drawing_GraphicObjectShape,
3694 
3695 							sUNO_service_drawing_Shape,
3696 
3697 							sUNO_service_drawing_Text,
3698 							sUNO_service_drawing_TextProperties,
3699 							sUNO_service_style_ParagraphProperties,
3700 							sUNO_service_style_ParagraphPropertiesComplex,
3701 							sUNO_service_style_ParagraphPropertiesAsian,
3702 							sUNO_service_style_CharacterProperties,
3703 							sUNO_service_style_CharacterPropertiesComplex,
3704 							sUNO_service_style_CharacterPropertiesAsian,
3705 
3706 							sUNO_service_drawing_ShadowProperties,
3707 							sUNO_service_drawing_RotationDescriptor);
3708 
3709 						pSeq = &SvxShape_GrafServices;
3710 					}
3711 				}
3712 				return *pSeq;
3713 			}
3714 
3715 		case OBJ_OLE2:
3716 			{
3717 				static uno::Sequence< OUString > *pSeq = 0;
3718 				if( 0 == pSeq )
3719 				{
3720 //					OGuard aGuard( Application::GetSolarMutex() );
3721 //					if( 0 == pSeq )
3722 					{
3723 						static uno::Sequence< OUString > SvxShape_Ole2Services;
3724 
3725 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services, 2,
3726 							sUNO_service_drawing_OLE2Shape,
3727 							sUNO_service_drawing_Shape,
3728 
3729                             // #i118485# Added Text, Shadow and Rotation
3730 							sUNO_service_drawing_Text,
3731 							sUNO_service_drawing_TextProperties,
3732 							sUNO_service_style_ParagraphProperties,
3733 							sUNO_service_style_ParagraphPropertiesComplex,
3734 							sUNO_service_style_ParagraphPropertiesAsian,
3735 							sUNO_service_style_CharacterProperties,
3736 							sUNO_service_style_CharacterPropertiesComplex,
3737 							sUNO_service_style_CharacterPropertiesAsian,
3738 
3739 							sUNO_service_drawing_ShadowProperties,
3740 							sUNO_service_drawing_RotationDescriptor);
3741 
3742 						pSeq = &SvxShape_Ole2Services;
3743 					}
3744 				}
3745 				return *pSeq;
3746 			}
3747 
3748 		case OBJ_CAPTION:
3749 			{
3750 				static uno::Sequence< OUString > *pSeq = 0;
3751 				if( 0 == pSeq )
3752 				{
3753 //					OGuard aGuard( Application::GetSolarMutex() );
3754 //					if( 0 == pSeq )
3755 					{
3756 						static uno::Sequence< OUString > SvxShape_CaptionServices;
3757 
3758 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices,14,
3759 							sUNO_service_drawing_CaptionShape,
3760 
3761 							sUNO_service_drawing_Shape,
3762 							sUNO_service_drawing_FillProperties,
3763 							sUNO_service_drawing_LineProperties,
3764 
3765 							sUNO_service_drawing_Text,
3766 							sUNO_service_drawing_TextProperties,
3767 							sUNO_service_style_ParagraphProperties,
3768 							sUNO_service_style_ParagraphPropertiesComplex,
3769 							sUNO_service_style_ParagraphPropertiesAsian,
3770 							sUNO_service_style_CharacterProperties,
3771 							sUNO_service_style_CharacterPropertiesComplex,
3772 							sUNO_service_style_CharacterPropertiesAsian,
3773 
3774 							sUNO_service_drawing_ShadowProperties,
3775 							sUNO_service_drawing_RotationDescriptor);
3776 
3777 						pSeq = &SvxShape_CaptionServices;
3778 					}
3779 				}
3780 
3781 				return *pSeq;
3782 			}
3783 
3784 		case OBJ_PAGE:
3785 			{
3786 				static uno::Sequence< OUString > *pSeq = 0;
3787 				if( 0 == pSeq )
3788 				{
3789 //					OGuard aGuard( Application::GetSolarMutex() );
3790 //					if( 0 == pSeq )
3791 					{
3792 						static uno::Sequence< OUString > SvxShape_PageServices;
3793 
3794 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices, 2,
3795 							sUNO_service_drawing_PageShape,
3796 							sUNO_service_drawing_Shape );
3797 
3798 						pSeq = &SvxShape_PageServices;
3799 					}
3800 				}
3801 
3802 				return *pSeq;
3803 			}
3804 
3805 		case OBJ_MEASURE:
3806 			{
3807 				static uno::Sequence< OUString > *pSeq = 0;
3808 				if( 0 == pSeq )
3809 				{
3810 //					OGuard aGuard( Application::GetSolarMutex() );
3811 //					if( 0 == pSeq )
3812 					{
3813 						static uno::Sequence< OUString > SvxShape_MeasureServices;
3814 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices,15,
3815 							sUNO_service_drawing_MeasureShape,
3816 
3817 							sUNO_service_drawing_MeasureProperties,
3818 
3819 							sUNO_service_drawing_Shape,
3820 							sUNO_service_drawing_LineProperties,
3821 
3822 							sUNO_service_drawing_Text,
3823 							sUNO_service_drawing_TextProperties,
3824 							sUNO_service_style_ParagraphProperties,
3825 							sUNO_service_style_ParagraphPropertiesComplex,
3826 							sUNO_service_style_ParagraphPropertiesAsian,
3827 							sUNO_service_style_CharacterProperties,
3828 							sUNO_service_style_CharacterPropertiesComplex,
3829 							sUNO_service_style_CharacterPropertiesAsian,
3830 
3831 							sUNO_service_drawing_PolyPolygonDescriptor,
3832 							sUNO_service_drawing_ShadowProperties,
3833 							sUNO_service_drawing_RotationDescriptor);
3834 
3835 						pSeq = &SvxShape_MeasureServices;
3836 					}
3837 				}
3838 
3839 				return *pSeq;
3840 			}
3841 
3842 		case OBJ_FRAME:
3843 			{
3844 				static uno::Sequence< OUString > *pSeq = 0;
3845 				if( 0 == pSeq )
3846 				{
3847 //					OGuard aGuard( Application::GetSolarMutex() );
3848 //					if( 0 == pSeq )
3849 					{
3850 						static uno::Sequence< OUString > SvxShape_FrameServices;
3851 
3852 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices, 2,
3853 							sUNO_service_drawing_FrameShape,
3854 							sUNO_service_drawing_Shape );
3855 
3856 						pSeq = &SvxShape_FrameServices;
3857 					}
3858 				}
3859 
3860 				return *pSeq;
3861 			}
3862 
3863 		case OBJ_UNO:
3864 			{
3865 				static uno::Sequence< OUString > *pSeq = 0;
3866 				if( 0 == pSeq )
3867 				{
3868 //					OGuard _aGuard( Application::GetSolarMutex() );
3869 //					if( 0 == pSeq )
3870 					{
3871 						static uno::Sequence< OUString > SvxShape_UnoServices;
3872 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
3873 							sUNO_service_drawing_ControlShape,
3874 							sUNO_service_drawing_Shape );
3875 
3876 						pSeq = &SvxShape_UnoServices;
3877 					}
3878 				}
3879 				return *pSeq;
3880 			}
3881 
3882 		case OBJ_EDGE:
3883 			{
3884 				static uno::Sequence< OUString > *pSeq = 0;
3885 				if( 0 == pSeq )
3886 				{
3887 //					OGuard aGuard( Application::GetSolarMutex() );
3888 //					if( 0 == pSeq )
3889 					{
3890 						static uno::Sequence< OUString > SvxShape_EdgeServices;
3891 
3892 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices,15,
3893 							sUNO_service_drawing_ConnectorShape,
3894 							sUNO_service_drawing_ConnectorProperties,
3895 
3896 							sUNO_service_drawing_Shape,
3897 							sUNO_service_drawing_LineProperties,
3898 
3899 							sUNO_service_drawing_Text,
3900 							sUNO_service_drawing_TextProperties,
3901 							sUNO_service_style_ParagraphProperties,
3902 							sUNO_service_style_ParagraphPropertiesComplex,
3903 							sUNO_service_style_ParagraphPropertiesAsian,
3904 							sUNO_service_style_CharacterProperties,
3905 							sUNO_service_style_CharacterPropertiesComplex,
3906 							sUNO_service_style_CharacterPropertiesAsian,
3907 
3908 							sUNO_service_drawing_PolyPolygonDescriptor,
3909 							sUNO_service_drawing_ShadowProperties,
3910 							sUNO_service_drawing_RotationDescriptor);
3911 
3912 						pSeq = &SvxShape_EdgeServices;
3913 					}
3914 				}
3915 				return *pSeq;
3916 			}
3917 		case OBJ_MEDIA:
3918 			{
3919 				static uno::Sequence< OUString > *pSeq = 0;
3920 				if( 0 == pSeq )
3921 				{
3922 //					OGuard aGuard( Application::GetSolarMutex() );
3923 //					if( 0 == pSeq )
3924 					{
3925 						static uno::Sequence< OUString > SvxShape_MediaServices;
3926 
3927 						comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices, 2,
3928 							sUNO_service_drawing_MediaShape,
3929 							sUNO_service_drawing_Shape);
3930 
3931 						pSeq = &SvxShape_MediaServices;
3932 					}
3933 				}
3934 				return *pSeq;
3935 			}
3936 		}
3937 	}
3938 	else if( mpObj.is() && mpObj->GetObjInventor() == FmFormInventor)
3939 	{
3940 #if OSL_DEBUG_LEVEL > 0
3941 		const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
3942         OSL_ENSURE( nIdent == OBJ_UNO, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
3943 #endif
3944 		static uno::Sequence< OUString > *pSeq = 0;
3945 		if( 0 == pSeq )
3946 		{
3947 //					OGuard aGuard( Application::GetSolarMutex() );
3948 //					if( 0 == pSeq )
3949 			{
3950 				static uno::Sequence< OUString > SvxShape_UnoServices;
3951 				comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
3952 					sUNO_service_drawing_ControlShape,
3953 					sUNO_service_drawing_Shape );
3954 
3955 				pSeq = &SvxShape_UnoServices;
3956 			}
3957 		}
3958 		return *pSeq;
3959 	}
3960     OSL_ENSURE( false, "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3961 	uno::Sequence< OUString > aSeq;
3962 	return aSeq;
3963 }
3964 
3965 //----------------------------------------------------------------------
3966 sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
3967 {
3968 	Sequence< OUString > SupportedServices( getSupportedServiceNames() );
3969 	const ::rtl::OUString * pArray = SupportedServices.getConstArray();
3970 	const sal_Int32 nCount = SupportedServices.getLength();
3971 	sal_Int32 i;
3972 	for( i = 0; i < nCount; i++ )
3973 		if( *pArray++ == ServiceName )
3974 			return sal_True;
3975 	return sal_False;
3976 }
3977 
3978 //----------------------------------------------------------------------
3979 
3980 // XGluePointsSupplier
3981 uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
3982 	throw(uno::RuntimeException)
3983 {
3984 	OGuard aGuard( Application::GetSolarMutex() );
3985     uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
3986 
3987 	if( mpObj.is() && !xGluePoints.is() )
3988 	{
3989 		uno::Reference< container::XIndexContainer > xNew( SvxUnoGluePointAccess_createInstance( mpObj.get() ), uno::UNO_QUERY );
3990 		mxGluePoints = xGluePoints = xNew;
3991 	}
3992 
3993 	return xGluePoints;
3994 }
3995 
3996 //----------------------------------------------------------------------
3997 
3998 // XChild
3999 uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent(  )
4000 	throw(uno::RuntimeException)
4001 {
4002 	OGuard aGuard( Application::GetSolarMutex() );
4003 
4004 	if( mpObj.is() && mpObj->GetObjList() )
4005 	{
4006 		SdrObjList* pObjList = mpObj->GetObjList();
4007 
4008 		switch( pObjList->GetListKind() )
4009 		{
4010 		case SDROBJLIST_GROUPOBJ:
4011 			if( pObjList->GetOwnerObj()->ISA( SdrObjGroup ) )
4012 				return PTR_CAST( SdrObjGroup, pObjList->GetOwnerObj())->getUnoShape();
4013 			else if( pObjList->GetOwnerObj()->ISA( E3dScene ) )
4014 				return PTR_CAST( E3dScene, pObjList->GetOwnerObj())->getUnoShape();
4015 			break;
4016 		case SDROBJLIST_DRAWPAGE:
4017 		case SDROBJLIST_MASTERPAGE:
4018 			return PTR_CAST( SdrPage, pObjList )->getUnoPage();
4019 		default:
4020 			DBG_ERROR( "SvxShape::getParent(  ): unexpected SdrObjListKind" );
4021 			break;
4022 		}
4023 	}
4024 
4025 	uno::Reference< uno::XInterface > xParent;
4026 	return xParent;
4027 }
4028 
4029 //----------------------------------------------------------------------
4030 
4031 void SAL_CALL SvxShape::setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& )
4032 	throw(lang::NoSupportException, uno::RuntimeException)
4033 {
4034 	throw lang::NoSupportException();
4035 }
4036 
4037 //----------------------------------------------------------------------
4038 
4039 /** called from the XActionLockable interface methods on initial locking */
4040 void SvxShape::lock()
4041 {
4042 }
4043 
4044 //----------------------------------------------------------------------
4045 
4046 /** called from the XActionLockable interface methods on final unlock */
4047 void SvxShape::unlock()
4048 {
4049 }
4050 
4051 //----------------------------------------------------------------------
4052 
4053 // XActionLockable
4054 sal_Bool SAL_CALL SvxShape::isActionLocked(  ) throw (::com::sun::star::uno::RuntimeException)
4055 {
4056 	OGuard aGuard( Application::GetSolarMutex() );
4057 
4058 	return mnLockCount != 0;
4059 }
4060 
4061 //----------------------------------------------------------------------
4062 
4063 void SAL_CALL SvxShape::addActionLock(  ) throw (::com::sun::star::uno::RuntimeException)
4064 {
4065 	OGuard aGuard( Application::GetSolarMutex() );
4066 
4067 	DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
4068 	mnLockCount++;
4069 
4070 	if( mnLockCount == 1 )
4071 		lock();
4072 }
4073 
4074 //----------------------------------------------------------------------
4075 
4076 void SAL_CALL SvxShape::removeActionLock(  ) throw (::com::sun::star::uno::RuntimeException)
4077 {
4078 	OGuard aGuard( Application::GetSolarMutex() );
4079 
4080 	DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
4081 	mnLockCount--;
4082 
4083 	if( mnLockCount == 0 )
4084 		unlock();
4085 }
4086 
4087 //----------------------------------------------------------------------
4088 
4089 void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock ) throw (::com::sun::star::uno::RuntimeException )
4090 {
4091 	OGuard aGuard( Application::GetSolarMutex() );
4092 
4093 	if( (mnLockCount == 0) && (nLock != 0) )
4094 		unlock();
4095 
4096 	if( (mnLockCount != 0) && (nLock == 0) )
4097 		lock();
4098 
4099 	mnLockCount = (sal_uInt16)nLock;
4100 }
4101 
4102 //----------------------------------------------------------------------
4103 
4104 sal_Int16 SAL_CALL SvxShape::resetActionLocks(  ) throw (::com::sun::star::uno::RuntimeException)
4105 {
4106 	OGuard aGuard( Application::GetSolarMutex() );
4107 
4108 	if( mnLockCount != 0 )
4109 		unlock();
4110 
4111 	sal_Int16 nOldLocks = (sal_Int16)mnLockCount;
4112 	mnLockCount = 0;
4113 
4114 	return nOldLocks;
4115 }
4116 
4117 //----------------------------------------------------------------------
4118 
4119 /** since polygon shapes can change theire kind during editing, we have
4120 	to recheck it here.
4121 	Circle shapes also change theire kind, but theire all treated equal
4122 	so no update is necessary.
4123 */
4124 void SvxShape::updateShapeKind()
4125 {
4126 	switch( mpImpl->mnObjId )
4127 	{
4128 		case OBJ_LINE:
4129 		case OBJ_POLY:
4130 		case OBJ_PLIN:
4131 		case OBJ_PATHLINE:
4132 		case OBJ_PATHFILL:
4133 		case OBJ_FREELINE:
4134 		case OBJ_FREEFILL:
4135 		case OBJ_PATHPOLY:
4136 		case OBJ_PATHPLIN:
4137 		{
4138 			const sal_uInt32 nId = mpObj->GetObjIdentifier();
4139 
4140 			if( nId != mpImpl->mnObjId )
4141 			{
4142 				mpImpl->mnObjId = nId;
4143 
4144 			}
4145 			break;
4146 		}
4147 	};
4148 }
4149 
4150 /***********************************************************************
4151 * class SvxShapeText                                                   *
4152 ***********************************************************************/
4153 SvxShapeText::SvxShapeText() throw ()
4154 : SvxShape(NULL, aSvxMapProvider.GetMap(SVXMAP_TEXT), aSvxMapProvider.GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
4155 {
4156 }
4157 
4158 //----------------------------------------------------------------------
4159 SvxShapeText::SvxShapeText( SdrObject* pObject ) throw ()
4160 : SvxShape( pObject, aSvxMapProvider.GetMap(SVXMAP_TEXT), aSvxMapProvider.GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
4161 {
4162 	if( pObject && pObject->GetModel() )
4163 		SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< uno::XWeak * >( this ) ) );
4164 }
4165 
4166 //----------------------------------------------------------------------
4167 SvxShapeText::SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ()
4168 : SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
4169 {
4170 	if( pObject && pObject->GetModel() )
4171 		SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< uno::XWeak * >( this ) ) );
4172 }
4173 
4174 //----------------------------------------------------------------------
4175 SvxShapeText::~SvxShapeText() throw ()
4176 {
4177 	// check if only this instance is registered at the ranges
4178 	DBG_ASSERT( (NULL == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
4179 		"svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
4180 }
4181 
4182 void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
4183 {
4184 	if( pNewObj && (NULL == GetEditSource()))
4185 		SetEditSource( new SvxTextEditSource( pNewObj, 0, static_cast< uno::XWeak* >(this) ) );
4186 
4187 	SvxShape::Create( pNewObj, pNewPage );
4188 }
4189 
4190 // XInterface
4191 //----------------------------------------------------------------------
4192 uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
4193 	throw( uno::RuntimeException )
4194 {
4195 	return SvxShape::queryInterface( rType );
4196 }
4197 
4198 //----------------------------------------------------------------------
4199 
4200 uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
4201 	throw( uno::RuntimeException )
4202 {
4203 	uno::Any aAny( SvxShape::queryAggregation( rType ) );
4204 	if( aAny.hasValue() )
4205 		return aAny;
4206 
4207 	return SvxUnoTextBase::queryAggregation( rType );
4208 }
4209 
4210 //----------------------------------------------------------------------
4211 
4212 void SAL_CALL SvxShapeText::acquire() throw()
4213 {
4214 	SvxShape::acquire();
4215 }
4216 
4217 //----------------------------------------------------------------------
4218 void SAL_CALL SvxShapeText::release() throw()
4219 {
4220 	SvxShape::release();
4221 }
4222 
4223 // XServiceInfo
4224 //----------------------------------------------------------------------
4225 OUString SAL_CALL SvxShapeText::getImplementationName() throw( uno::RuntimeException )
4226 {
4227 	static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShapeText") );
4228 	return aServiceName;
4229 }
4230 
4231 //----------------------------------------------------------------------
4232 uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException )
4233 {
4234 	return SvxShape::getSupportedServiceNames();
4235 }
4236 
4237 //----------------------------------------------------------------------
4238 sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
4239 {
4240 	return SvxShape::supportsService(ServiceName);
4241 }
4242 
4243 	// XTypeProvider
4244 //----------------------------------------------------------------------
4245 uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
4246 	throw( uno::RuntimeException )
4247 {
4248 	return SvxShape::getTypes();
4249 }
4250 
4251 sal_Int64 SAL_CALL SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
4252 {
4253 	const sal_Int64 nReturn = SvxShape::getSomething( rId );
4254 	if( nReturn )
4255 		return nReturn;
4256 
4257 	return SvxUnoTextBase::getSomething( rId );
4258 }
4259 
4260 //----------------------------------------------------------------------
4261 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
4262 	throw( uno::RuntimeException )
4263 {
4264 	static ::cppu::OImplementationId* pID = NULL ;
4265 
4266 	if ( pID == NULL )
4267 	{
4268 		// Ready for multithreading; get global mutex for first call of this method only! see before
4269 		MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
4270 
4271 		// Control these pointer again ... it can be, that another instance will be faster then these!
4272 		if ( pID == NULL )
4273 		{
4274 			// Create a new static ID ...
4275 			static ::cppu::OImplementationId aID( sal_False ) ;
4276 			// ... and set his address to static pointer!
4277 			pID = &aID ;
4278 		}
4279 	}
4280 
4281 	return pID->getImplementationId() ;
4282 }
4283 
4284 //----------------------------------------------------------------------
4285 
4286 /** called from the XActionLockable interface methods on initial locking */
4287 void SvxShapeText::lock()
4288 {
4289 	SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
4290 	if( pEditSource )
4291 		pEditSource->lock();
4292 }
4293 
4294 //----------------------------------------------------------------------
4295 
4296 /** called from the XActionLockable interface methods on final unlock */
4297 void SvxShapeText::unlock()
4298 {
4299 	SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
4300 	if( pEditSource )
4301 		pEditSource->unlock();
4302 }
4303 
4304 // ::com::sun::star::text::XTextRange
4305 uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart() throw(uno::RuntimeException)
4306 {
4307     ::vos::OGuard aGuard( Application::GetSolarMutex() );
4308 	SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4309 	if( pForwarder )
4310 		::GetSelection( maSelection, pForwarder );
4311 	return SvxUnoTextBase::getStart();
4312 
4313 }
4314 
4315 uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd() throw(uno::RuntimeException)
4316 {
4317     ::vos::OGuard aGuard( Application::GetSolarMutex() );
4318 	SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4319 	if( pForwarder )
4320 		::GetSelection( maSelection, pForwarder );
4321 	return SvxUnoTextBase::getEnd();
4322 }
4323 
4324 OUString SAL_CALL SvxShapeText::getString() throw(uno::RuntimeException)
4325 {
4326     ::vos::OGuard aGuard( Application::GetSolarMutex() );
4327 	SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4328 	if( pForwarder )
4329 		::GetSelection( maSelection, pForwarder );
4330 	return SvxUnoTextBase::getString();
4331 }
4332 
4333 
4334 void SAL_CALL SvxShapeText::setString( const OUString& aString ) throw(uno::RuntimeException)
4335 {
4336     ::vos::OGuard aGuard( Application::GetSolarMutex() );
4337 	SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4338 	if( pForwarder )
4339 		::GetSelection( maSelection, pForwarder );
4340 	SvxUnoTextBase::setString( aString );
4341 }
4342 
4343 // overide these for special property handling in subcasses. Return true if property is handled
4344 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)
4345 {
4346 	// HACK-fix #99090#
4347 	// since SdrTextObj::SetVerticalWriting exchanges
4348 	// SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
4349 	// we have to set the textdirection here
4350 
4351 	if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4352 	{
4353 		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
4354 		if( pTextObj )
4355 		{
4356 			com::sun::star::text::WritingMode eMode;
4357 			if( rValue >>= eMode )
4358 			{
4359 				pTextObj->SetVerticalWriting( eMode == com::sun::star::text::WritingMode_TB_RL );
4360 			}
4361 		}
4362 		return true;
4363 	}
4364     return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
4365 }
4366 
4367 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)
4368 {
4369 	if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4370 	{
4371 		SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
4372 		if( pTextObj && pTextObj->IsVerticalWriting() )
4373             rValue <<= com::sun::star::text::WritingMode_TB_RL;
4374         else
4375             rValue <<= com::sun::star::text::WritingMode_LR_TB;
4376 		return true;
4377 	}
4378 
4379     return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
4380 }
4381 
4382 bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
4383 {
4384 	return SvxShape::getPropertyStateImpl( pProperty, rState );
4385 }
4386 
4387 bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
4388 {
4389 	return SvxShape::setPropertyToDefaultImpl( pProperty );
4390 }
4391 
4392 /***********************************************************************
4393 * class SvxShapeRect                                                   *
4394 ***********************************************************************/
4395 DBG_NAME(SvxShapeRect)
4396 SvxShapeRect::SvxShapeRect( SdrObject* pObj ) throw()
4397 : SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_SHAPE), aSvxMapProvider.GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
4398 {
4399     DBG_CTOR(SvxShapeRect,NULL);
4400 }
4401 
4402 SvxShapeRect::~SvxShapeRect() throw()
4403 {
4404     DBG_DTOR(SvxShapeRect,NULL);
4405 }
4406 
4407 uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
4408 {
4409 	return SvxShapeText::queryInterface( rType );
4410 }
4411 
4412 uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
4413 {
4414 	return SvxShapeText::queryAggregation( rType );
4415 }
4416 
4417 void SAL_CALL SvxShapeRect::acquire() throw()
4418 {
4419 	OWeakAggObject::acquire();
4420 }
4421 
4422 void SAL_CALL SvxShapeRect::release() throw()
4423 {
4424 	OWeakAggObject::release();
4425 }
4426 //----------------------------------------------------------------------
4427 // XServiceInfo
4428 //----------------------------------------------------------------------
4429 uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames(void) throw( uno::RuntimeException )
4430 {
4431 	return SvxShape::getSupportedServiceNames();
4432 }
4433 
4434 /** returns a StarOffice API wrapper for the given SdrObject */
4435 uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw ()
4436 {
4437 	uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
4438 	return xShape;
4439 }
4440 
4441 /** returns the SdrObject from the given StarOffice API wrapper */
4442 SdrObject* GetSdrObjectFromXShape( uno::Reference< drawing::XShape > xShape ) throw()
4443 {
4444     SvxShape* pShape = SvxShape::getImplementation( xShape );
4445 	return pShape ? pShape->GetSdrObject() : 0;
4446 }
4447 
4448 //----------------------------------------------------------------------
4449 
4450 SdrObject* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt )
4451 {
4452     SvxShape* pSvxShape = SvxShape::getImplementation( xInt );
4453 	return pSvxShape ? pSvxShape->GetSdrObject() : 0;
4454 }
4455 
4456 uno::Any SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet )
4457 {
4458 	if(!pMap || !pMap->nWID)
4459 		return uno::Any();
4460 
4461 	// Check is for items that store either metric values if thei are positiv or percentage if thei are negativ.
4462     bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4463 	return rPropSet.getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
4464 }
4465 
4466 void SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
4467 {
4468 	if(!pMap || !pMap->nWID)
4469 		return;
4470 
4471     bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4472 	rPropSet.setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
4473 }
4474