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