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