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