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