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