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