1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoshape.cxx,v $
10 * $Revision: 1.178.104.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #define _SVX_USE_UNOGLOBALS_
35 #include <cppuhelper/typeprovider.hxx>
36 #include <com/sun/star/awt/XBitmap.hpp>
37 #include <com/sun/star/awt/Rectangle.hpp>
38 #include <com/sun/star/drawing/CircleKind.hpp>
39 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
40 #include <vcl/svapp.hxx>
41 #include <svtools/itemprop.hxx>
42 #include <svtools/fltcall.hxx>
43 #include <vos/mutex.hxx>
44 #include <svx/unotext.hxx>
45 #include <svx/svdobj.hxx>
46 #include <svx/svdoole2.hxx>
47 #include <osl/mutex.hxx>
48 #include <comphelper/extract.hxx>
49 #include "svx/shapepropertynotifier.hxx"
51 #include <toolkit/unohlp.hxx>
54 #include <rtl/memory.h>
55 #include <vcl/gfxlink.hxx>
56 #include <vcl/virdev.hxx>
57 #include <sfx2/objsh.hxx>
58 #include <sfx2/viewsh.hxx>
59 #include "svx/svdopage.hxx"
60 #include "svx/xflbstit.hxx"
61 #include "svx/xflbmtit.hxx"
62 #include "svx/xlnstit.hxx"
63 #include "svx/xlnedit.hxx"
64 #include "svx/svdogrp.hxx"
65 #include "svx/scene3d.hxx"
66 #include "svx/svdmodel.hxx"
67 #include "globl3d.hxx"
68 #include "svx/fmglob.hxx"
69 #include "svx/unopage.hxx"
70 #include "svx/view3d.hxx"
71 #include "svx/unoshape.hxx"
72 #include "svx/svxids.hrc"
73 #include "svx/unoshtxt.hxx"
74 #include "svx/svdpage.hxx"
75 #include "svx/unoshprp.hxx"
76 #include "svx/sxciaitm.hxx" // todo: remove
77 #include "svx/svdograf.hxx"
79 #include "svx/svdomeas.hxx"
80 #include "svx/svdpagv.hxx"
82 #include <tools/shl.hxx> //
83 #include "svx/dialmgr.hxx" // not nice, we need our own resources some day
84 #include "svx/dialogs.hrc" //
85 #include "svx/svdocapt.hxx"
86 #include <svx/obj3d.hxx>
87 #include <tools/diagnose_ex.h>
88 #include "svx/xflftrit.hxx"
89 #include "svx/xtable.hxx"
90 #include "svx/xbtmpit.hxx"
91 #include "svx/xflgrit.hxx"
92 #include "svx/xflhtit.hxx"
93 #include "svx/xlnedit.hxx"
94 #include "svx/xlnstit.hxx"
95 #include "svx/xlndsit.hxx"
96 #include "svdglob.hxx"
98 #include "unomaster.hxx"
99 #include <svx/outlobj.hxx>
100 #include <basegfx/matrix/b2dhommatrix.hxx>
105 #include "svx/lathe3d.hxx"
106 #include "svx/extrud3d.hxx"
107 #include "unopolyhelper.hxx"
109 #include <comphelper/scopeguard.hxx>
110 #include <boost/bind.hpp>
112 using ::rtl::OUString
;
113 using namespace ::osl
;
114 using namespace ::vos
;
115 using namespace ::cppu
;
116 using namespace ::com::sun::star
;
117 using namespace ::com::sun::star::uno
;
118 using namespace ::com::sun::star::lang
;
119 using namespace ::com::sun::star::container
;
120 using ::svx::PropertyValueProvider
;
121 using ::svx::IPropertyValueProvider
;
123 #define QUERYINT( xint ) \
124 if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
125 aAny <<= uno::Reference< xint >(this)
127 const SfxItemPropertyMapEntry
* ImplGetSvxUnoOutlinerTextCursorPropertyMap()
129 // Propertymap fuer einen Outliner Text
130 static const SfxItemPropertyMapEntry aSvxUnoOutlinerTextCursorPropertyMap
[] =
132 SVX_UNOEDIT_CHAR_PROPERTIES
,
133 SVX_UNOEDIT_FONT_PROPERTIES
,
134 SVX_UNOEDIT_OUTLINER_PROPERTIES
,
135 SVX_UNOEDIT_PARA_PROPERTIES
,
136 {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS
, &::getCppuType((const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
137 {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS
, &::getCppuType((const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
141 return aSvxUnoOutlinerTextCursorPropertyMap
;
143 const SfxItemPropertySet
* ImplGetSvxUnoOutlinerTextCursorSfxPropertySet()
145 static SfxItemPropertySet
aTextCursorSfxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap() );
146 return &aTextCursorSfxPropertySet
;
148 const SvxItemPropertySet
* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
150 static SvxItemPropertySet
aTextCursorSvxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap() );
151 return &aTextCursorSvxPropertySet
;
156 sal_Bool
ConvertGDIMetaFileToWMF( const GDIMetaFile
& rMTF
, SvStream
& rTargetStream
,
157 FilterConfigItem
* pFilterConfigItem
= NULL
, sal_Bool bPlaceable
= sal_True
);
159 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoGluePointAccess_createInstance( SdrObject
* pObject
);
161 /***********************************************************************
162 * class SvxShapeImpl *
163 ***********************************************************************/
167 SvxShape
& mrAntiImpl
;
168 SfxItemSet
* mpItemSet
;
170 SvxShapeMaster
* mpMaster
;
171 bool mbHasSdrObjectOwnership
;
174 /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
175 * a SvxShape::Create() call is executed. It is then set to the created
176 * SdrObject so a multiple call to SvxShape::Create() with same SdrObject
179 SdrObject
* mpCreatedObj
;
182 ::cppu::OInterfaceContainerHelper maDisposeListeners
;
183 ::svx::PropertyChangeNotifier maPropertyNotifier
;
185 SvxShapeImpl( SvxShape
& _rAntiImpl
, ::osl::Mutex
& _rMutex
)
186 :mrAntiImpl( _rAntiImpl
)
190 ,mbHasSdrObjectOwnership( false )
191 ,mbDisposing( false )
192 ,mpCreatedObj( NULL
)
193 ,maDisposeListeners( _rMutex
)
194 ,maPropertyNotifier( _rAntiImpl
, _rMutex
)
199 /**********************************************************************/
200 class ShapePositionProvider
: public PropertyValueProvider
203 ShapePositionProvider( const SvxShapeImpl
& _shapeImpl
)
204 :PropertyValueProvider( _shapeImpl
.mrAntiImpl
, "Position" )
209 virtual void getCurrentValue( Any
& _out_rCurrentValue
) const
211 _out_rCurrentValue
<<= static_cast< SvxShape
& >( getContext() ).getPosition();
215 //----------------------------------------------------------------------
216 class ShapeSizeProvider
: public PropertyValueProvider
219 ShapeSizeProvider( const SvxShapeImpl
& _shapeImpl
)
220 :PropertyValueProvider( _shapeImpl
.mrAntiImpl
, "Size" )
225 virtual void getCurrentValue( Any
& _out_rCurrentValue
) const
227 _out_rCurrentValue
<<= static_cast< SvxShape
& >( getContext() ).getSize();
231 /***********************************************************************
233 ***********************************************************************/
237 SvxShape::SvxShape( SdrObject
* pObject
) throw()
239 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
240 , mbIsMultiPropertyCall(false)
241 , mpPropSet(aSvxMapProvider
.GetPropertySet(SVXMAP_SHAPE
))
242 , maPropMapEntries(aSvxMapProvider
.GetMap(SVXMAP_SHAPE
))
247 DBG_CTOR(SvxShape
,NULL
);
251 //----------------------------------------------------------------------
252 SvxShape::SvxShape( SdrObject
* pObject
, const SfxItemPropertyMapEntry
* pEntries
, const SvxItemPropertySet
* pPropertySet
) throw()
254 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
255 , mbIsMultiPropertyCall(false)
256 , mpPropSet(pPropertySet
)
257 , maPropMapEntries(pEntries
)
262 DBG_CTOR(SvxShape
,NULL
);
266 //----------------------------------------------------------------------
267 SvxShape::SvxShape() throw()
269 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
270 , mbIsMultiPropertyCall(false)
271 , mpPropSet(aSvxMapProvider
.GetPropertySet(SVXMAP_SHAPE
))
272 , maPropMapEntries(aSvxMapProvider
.GetMap(SVXMAP_SHAPE
))
277 DBG_CTOR(SvxShape
,NULL
);
281 //----------------------------------------------------------------------
282 SvxShape::~SvxShape() throw()
284 OGuard
aGuard( Application::GetSolarMutex() );
286 DBG_ASSERT( mnLockCount
== 0, "Locked shape was disposed!" );
289 EndListening( *mpModel
);
291 if ( mpImpl
->mpMaster
)
292 mpImpl
->mpMaster
->dispose();
295 mpObj
->setUnoShape( NULL
, SdrObject::GrantXShapeAccess() );
297 if( HasSdrObjectOwnership() && mpObj
.is() )
299 mpImpl
->mbHasSdrObjectOwnership
= false;
300 SdrObject
* pObject
= mpObj
.get();
301 SdrObject::Free( pObject
);
304 delete mpImpl
, mpImpl
= NULL
;
306 DBG_DTOR(SvxShape
,NULL
);
309 //----------------------------------------------------------------------
311 void SvxShape::TakeSdrObjectOwnership()
313 mpImpl
->mbHasSdrObjectOwnership
= true;
316 //----------------------------------------------------------------------
318 bool SvxShape::HasSdrObjectOwnership() const
320 if ( !mpImpl
->mbHasSdrObjectOwnership
)
323 OSL_ENSURE( mpObj
.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
327 //----------------------------------------------------------------------
329 void SvxShape::setShapeKind( sal_uInt32 nKind
)
331 mpImpl
->mnObjId
= nKind
;
334 //----------------------------------------------------------------------
336 sal_uInt32
SvxShape::getShapeKind() const
338 return mpImpl
->mnObjId
;
341 //----------------------------------------------------------------------
343 void SvxShape::setMaster( SvxShapeMaster
* pMaster
)
345 mpImpl
->mpMaster
= pMaster
;
348 SvxShapeMaster
* SvxShape::getMaster()
350 return mpImpl
->mpMaster
;
353 const SvxShapeMaster
* SvxShape::getMaster() const
355 return mpImpl
->mpMaster
;
358 //----------------------------------------------------------------------
360 uno::Any SAL_CALL
SvxShape::queryAggregation( const uno::Type
& rType
) throw (uno::RuntimeException
)
362 if( mpImpl
->mpMaster
)
365 if( mpImpl
->mpMaster
->queryAggregation( rType
, aAny
) )
369 return SvxShape_UnoImplHelper::queryAggregation(rType
);
372 //----------------------------------------------------------------------
373 const ::com::sun::star::uno::Sequence
< sal_Int8
> & SvxShape::getUnoTunnelId() throw()
375 static ::com::sun::star::uno::Sequence
< sal_Int8
> * pSeq
= 0;
378 ::osl::Guard
< ::osl::Mutex
> aGuard( ::osl::Mutex::getGlobalMutex() );
381 static ::com::sun::star::uno::Sequence
< sal_Int8
> aSeq( 16 );
382 rtl_createUuid( (sal_uInt8
*)aSeq
.getArray(), 0, sal_True
);
389 //----------------------------------------------------------------------
390 SvxShape
* SvxShape::getImplementation( const uno::Reference
< uno::XInterface
>& xInt
)
392 uno::Reference
< lang::XUnoTunnel
> xUT( xInt
, ::com::sun::star::uno::UNO_QUERY
);
394 return reinterpret_cast<SvxShape
*>(sal::static_int_cast
<sal_uIntPtr
>(xUT
->getSomething( SvxShape::getUnoTunnelId())));
399 //----------------------------------------------------------------------
400 sal_Int64 SAL_CALL
SvxShape::getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw(::com::sun::star::uno::RuntimeException
) \
402 if( rId
.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId
.getConstArray(), 16 ) )
404 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_uIntPtr
>(this));
412 //----------------------------------------------------------------------
413 SvxShape
* SvxShape::GetShapeForSdrObj( SdrObject
* pObj
) throw()
415 return getImplementation( pObj
->getUnoShape() );
418 //----------------------------------------------------------------------
419 ::svx::PropertyChangeNotifier
& SvxShape::getShapePropertyChangeNotifier()
421 return mpImpl
->maPropertyNotifier
;
424 //----------------------------------------------------------------------
425 void SvxShape::impl_construct()
427 mpImpl
->maPropertyNotifier
.registerProvider( ::svx::eShapePosition
,
428 ::svx::PPropertyValueProvider( new ShapePositionProvider( *mpImpl
) ) );
429 mpImpl
->maPropertyNotifier
.registerProvider( ::svx::eShapeSize
,
430 ::svx::PPropertyValueProvider( new ShapeSizeProvider( *mpImpl
) ) );
433 impl_initFromSdrObject();
436 //----------------------------------------------------------------------
437 void SvxShape::impl_initFromSdrObject()
439 DBG_TESTSOLARMUTEX();
440 OSL_PRECOND( mpObj
.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
444 osl_incrementInterlockedCount( &m_refCount
);
446 mpObj
->setUnoShape( *this, SdrObject::GrantXShapeAccess() );
448 osl_decrementInterlockedCount( &m_refCount
);
450 mpModel
= mpObj
->GetModel();
453 // Do not simply return when no model but do the type corrections
457 StartListening( *mpModel
);
460 const sal_uInt32 nInventor
= mpObj
->GetObjInventor();
462 // is it one of ours (svx) ?
463 if( nInventor
== SdrInventor
|| nInventor
== E3dInventor
|| nInventor
== FmFormInventor
)
465 if(nInventor
== FmFormInventor
)
467 mpImpl
->mnObjId
= OBJ_UNO
;
471 mpImpl
->mnObjId
= mpObj
->GetObjIdentifier();
472 if( nInventor
== E3dInventor
)
473 mpImpl
->mnObjId
|= E3D_INVENTOR_FLAG
;
476 switch(mpImpl
->mnObjId
)
478 case OBJ_CCUT
: // Kreisabschnitt
479 case OBJ_CARC
: // Kreisbogen
480 case OBJ_SECT
: // Kreissektor
481 mpImpl
->mnObjId
= OBJ_CIRC
;
484 case E3D_SCENE_ID
| E3D_INVENTOR_FLAG
:
485 mpImpl
->mnObjId
= E3D_POLYSCENE_ID
| E3D_INVENTOR_FLAG
;
491 //----------------------------------------------------------------------
492 void SvxShape::Create( SdrObject
* pNewObj
, SvxDrawPage
* /*pNewPage*/ )
494 DBG_TESTSOLARMUTEX();
496 OSL_PRECOND( pNewObj
, "SvxShape::Create: invalid new object!" );
500 OSL_ENSURE( ( mpImpl
->mpCreatedObj
== NULL
) || ( mpImpl
->mpCreatedObj
== pNewObj
),
501 "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
503 // --> CL, OD 2005-07-19 #i52126# - correct condition
504 if ( mpImpl
->mpCreatedObj
!= pNewObj
)
507 DBG_ASSERT( pNewObj
->GetModel(), "no model for SdrObject?" );
508 // --> CL, OD 2005-07-19 #i52126#
509 mpImpl
->mpCreatedObj
= pNewObj
;
512 if( mpObj
.is() && mpObj
->GetModel() )
514 EndListening( *mpObj
->GetModel() );
517 mpObj
.reset( pNewObj
);
519 OSL_ENSURE( !mbIsMultiPropertyCall
, "SvxShape::Create: hmm?" );
520 // this was previously set in impl_initFromSdrObject, but I think it was superfluous
521 // (it definitely was in the other context where it was called, but I strongly suppose
522 // it was also superfluous when called from here)
523 impl_initFromSdrObject();
525 ObtainSettingsFromPropertySet( *mpPropSet
);
528 SdrObjUserCall
* pUser
= mpObj
->GetUserCall();
529 mpObj
->SetUserCall(NULL
);
531 setPosition( maPosition
);
534 // restore user call after we set the initial size
535 mpObj
->SetUserCall( pUser
);
537 // if this shape was already named, use this name
538 if( maShapeName
.getLength() )
540 mpObj
->SetName( maShapeName
);
541 maShapeName
= OUString();
546 //----------------------------------------------------------------------
548 void SvxShape::ChangeModel( SdrModel
* pNewModel
)
550 DBG_TESTSOLARMUTEX();
551 if( mpObj
.is() && mpObj
->GetModel() )
553 if( mpObj
->GetModel() != pNewModel
)
555 EndListening( *mpObj
->GetModel() );
559 // --> CL, OD 2005-07-19 #i52126# - always listen to new model
562 StartListening( *pNewModel
);
566 // HACK #i53696# ChangeModel should be virtual, but it isn't. can't change that for 2.0.1
567 SvxShapeText
* pShapeText
= dynamic_cast< SvxShapeText
* >( this );
570 SvxTextEditSource
* pTextEditSource
= dynamic_cast< SvxTextEditSource
* >( pShapeText
->GetEditSource() );
571 if( pTextEditSource
)
572 pTextEditSource
->ChangeModel( pNewModel
);
577 if( mpImpl
->mpMaster
)
578 mpImpl
->mpMaster
->modelChanged( pNewModel
);
581 //----------------------------------------------------------------------
583 void SvxShape::ForceMetricToItemPoolMetric(Pair
& rPoint
) const throw()
585 DBG_TESTSOLARMUTEX();
588 SfxMapUnit eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
589 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
593 case SFX_MAPUNIT_TWIP
:
595 rPoint
.A() = MM_TO_TWIPS(rPoint
.A());
596 rPoint
.B() = MM_TO_TWIPS(rPoint
.B());
601 DBG_ERROR("AW: Missing unit translation to PoolMetric!");
608 //----------------------------------------------------------------------
609 void SvxShape::ForceMetricTo100th_mm(Pair
& rPoint
) const throw()
611 DBG_TESTSOLARMUTEX();
612 SfxMapUnit eMapUnit
= SFX_MAPUNIT_100TH_MM
;
615 eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
616 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
620 case SFX_MAPUNIT_TWIP
:
622 rPoint
.A() = TWIPS_TO_MM(rPoint
.A());
623 rPoint
.B() = TWIPS_TO_MM(rPoint
.B());
628 DBG_ERROR("AW: Missing unit translation to 100th mm!");
635 //----------------------------------------------------------------------
636 void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet
& rPropSet
)
638 DBG_TESTSOLARMUTEX();
639 if(mpObj
.is() && rPropSet
.AreThereOwnUsrAnys() && mpModel
)
641 SfxItemSet
aSet( mpModel
->GetItemPool(), SDRATTR_START
, SDRATTR_END
, 0);
642 Reference
< beans::XPropertySet
> xShape( (OWeakObject
*)this, UNO_QUERY
);
643 mpPropSet
->ObtainSettingsFromPropertySet(rPropSet
, aSet
, xShape
);
645 mpObj
->SetMergedItemSetAndBroadcast(aSet
);
647 mpObj
->ApplyNotPersistAttr( aSet
);
651 //----------------------------------------------------------------------
653 uno::Any
SvxShape::GetBitmap( sal_Bool bMetaFile
/* = sal_False */ ) const throw()
655 DBG_TESTSOLARMUTEX();
658 if( !mpObj
.is() || mpModel
== NULL
|| !mpObj
->IsInserted() || NULL
== mpObj
->GetPage() )
662 aVDev
.SetMapMode(MapMode(MAP_100TH_MM
));
664 SdrModel
* pModel
= mpObj
->GetModel();
665 SdrPage
* pPage
= mpObj
->GetPage();
667 E3dView
* pView
= new E3dView( pModel
, &aVDev
);
668 pView
->hideMarkHandles();
669 SdrPageView
* pPageView
= pView
->ShowSdrPage(pPage
);
671 SdrObject
*pTempObj
= mpObj
.get();
672 pView
->MarkObj(pTempObj
,pPageView
);
674 Rectangle
aRect(pTempObj
->GetCurrentBoundRect());
676 Size
aSize(aRect
.GetSize());
678 GDIMetaFile
aMtf( pView
->GetAllMarkedMetaFile() );
681 SvMemoryStream
aDestStrm( 65535, 65535 );
682 ConvertGDIMetaFileToWMF( aMtf
, aDestStrm
, NULL
, sal_False
);
683 uno::Sequence
<sal_Int8
> aSeq((sal_Int8
*)aDestStrm
.GetData(), aDestStrm
.GetSize());
684 aAny
.setValue( &aSeq
, ::getCppuType((const uno::Sequence
< sal_Int8
>*)0) );
688 Graphic
aGraph(aMtf
);
689 aGraph
.SetPrefSize(aSize
);
690 aGraph
.SetPrefMapMode(MAP_100TH_MM
);
692 Reference
< awt::XBitmap
> xBmp( aGraph
.GetXGraphic(), UNO_QUERY
);
702 //----------------------------------------------------------------------
704 uno::Sequence
< uno::Type
> SAL_CALL
SvxShape::getTypes()
705 throw (uno::RuntimeException
)
707 if( mpImpl
->mpMaster
)
709 return mpImpl
->mpMaster
->getTypes();
717 //----------------------------------------------------------------------
719 uno::Sequence
< uno::Type
> SAL_CALL
SvxShape::_getTypes()
720 throw(uno::RuntimeException
)
722 switch( mpImpl
->mnObjId
)
724 // shapes without text
728 case OBJ_OLE2_PLUGIN
:
729 case OBJ_OLE2_APPLET
:
730 case E3D_CUBEOBJ_ID
|E3D_INVENTOR_FLAG
:
731 case E3D_SPHEREOBJ_ID
|E3D_INVENTOR_FLAG
:
732 case E3D_LATHEOBJ_ID
|E3D_INVENTOR_FLAG
:
733 case E3D_EXTRUDEOBJ_ID
|E3D_INVENTOR_FLAG
:
734 case E3D_POLYGONOBJ_ID
|E3D_INVENTOR_FLAG
:
737 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
739 if( aTypeSequence
.getLength() == 0 )
741 // Ready for multithreading; get global mutex for first call of this method only! see before
742 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
744 // Control these pointer again ... it can be, that another instance will be faster then these!
745 if( aTypeSequence
.getLength() == 0 )
747 aTypeSequence
.realloc( 12 );
748 uno::Type
* pTypes
= aTypeSequence
.getArray();
750 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
751 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
752 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
753 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
754 // *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
755 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
756 *pTypes
++ = beans::XMultiPropertyStates::static_type();
757 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
758 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
759 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
760 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
761 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
762 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
765 return aTypeSequence
;
770 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
772 if( aTypeSequence
.getLength() == 0 )
774 // Ready for multithreading; get global mutex for first call of this method only! see before
775 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
777 // Control these pointer again ... it can be, that another instance will be faster then these!
778 if( aTypeSequence
.getLength() == 0 )
780 aTypeSequence
.realloc( 14 );
781 uno::Type
* pTypes
= aTypeSequence
.getArray();
783 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
784 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
785 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
786 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
787 // *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
788 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
789 *pTypes
++ = beans::XMultiPropertyStates::static_type();
790 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
791 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
792 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
793 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
794 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
795 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
796 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShapes
>*)0);
797 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShapeGroup
>*)0);
800 return aTypeSequence
;
805 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
807 if( aTypeSequence
.getLength() == 0 )
809 // Ready for multithreading; get global mutex for first call of this method only! see before
810 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
812 // Control these pointer again ... it can be, that another instance will be faster then these!
813 if( aTypeSequence
.getLength() == 0 )
815 aTypeSequence
.realloc( 17 );
816 uno::Type
* pTypes
= aTypeSequence
.getArray();
818 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
819 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
820 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
821 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
822 // *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
823 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
824 *pTypes
++ = beans::XMultiPropertyStates::static_type();
825 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
826 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
827 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
828 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
829 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
830 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
831 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XConnectorShape
>*)0);
832 // from SvxUnoTextBase::getTypes()
833 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextAppend
>*)0);
834 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextCopy
>*)0);
835 *pTypes
++ = ::getCppuType(( const uno::Reference
< container::XEnumerationAccess
>*)0);
836 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeMover
>*)0);
839 return aTypeSequence
;
844 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
846 if( aTypeSequence
.getLength() == 0 )
848 // Ready for multithreading; get global mutex for first call of this method only! see before
849 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
851 // Control these pointer again ... it can be, that another instance will be faster then these!
852 if( aTypeSequence
.getLength() == 0 )
854 aTypeSequence
.realloc( 13 );
855 uno::Type
* pTypes
= aTypeSequence
.getArray();
857 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
858 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
859 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
860 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
861 // *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
862 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
863 *pTypes
++ = beans::XMultiPropertyStates::static_type();
864 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
865 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
866 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
867 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
868 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
869 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
870 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XControlShape
>*)0);
873 return aTypeSequence
;
876 case E3D_POLYSCENE_ID
|E3D_INVENTOR_FLAG
:
878 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
880 if( aTypeSequence
.getLength() == 0 )
882 // Ready for multithreading; get global mutex for first call of this method only! see before
883 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
885 // Control these pointer again ... it can be, that another instance will be faster then these!
886 if( aTypeSequence
.getLength() == 0 )
888 aTypeSequence
.realloc( 13 );
889 uno::Type
* pTypes
= aTypeSequence
.getArray();
891 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
892 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
893 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
894 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
895 // *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
896 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
897 *pTypes
++ = beans::XMultiPropertyStates::static_type();
898 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
899 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
900 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
901 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
902 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
903 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
904 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShapes
>*)0);
907 return aTypeSequence
;
909 case OBJ_CUSTOMSHAPE
:
911 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
913 if( aTypeSequence
.getLength() == 0 )
915 // Ready for multithreading; get global mutex for first call of this method only! see before
916 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
918 // Control these pointer again ... it can be, that another instance will be faster then these!
919 if( aTypeSequence
.getLength() == 0 )
921 aTypeSequence
.realloc( 16 );
922 uno::Type
* pTypes
= aTypeSequence
.getArray();
924 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
925 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
926 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
927 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
928 // *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
929 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
930 *pTypes
++ = beans::XMultiPropertyStates::static_type();
931 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
932 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
933 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
934 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
935 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
936 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
937 // from SvxUnoTextBase::getTypes()
938 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XText
>*)0);
939 *pTypes
++ = ::getCppuType(( const uno::Reference
< container::XEnumerationAccess
>*)0);
940 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeMover
>*)0);
941 *pTypes
++ = ::getCppuType(( const uno::Reference
< drawing::XEnhancedCustomShapeDefaulter
>*)0);
944 return aTypeSequence
;
965 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
967 if( aTypeSequence
.getLength() == 0 )
969 // Ready for multithreading; get global mutex for first call of this method only! see before
970 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
972 // Control these pointer again ... it can be, that another instance will be faster then these!
973 if( aTypeSequence
.getLength() == 0 )
975 aTypeSequence
.realloc( 16 );
976 uno::Type
* pTypes
= aTypeSequence
.getArray();
978 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
979 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
980 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
981 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
982 // *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
983 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
984 *pTypes
++ = beans::XMultiPropertyStates::static_type();
985 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
986 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
987 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
988 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
989 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
990 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
991 // from SvxUnoTextBase::getTypes()
992 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextAppend
>*)0);
993 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextCopy
>*)0);
994 *pTypes
++ = ::getCppuType(( const uno::Reference
< container::XEnumerationAccess
>*)0);
995 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeMover
>*)0);
998 return aTypeSequence
;
1003 //----------------------------------------------------------------------
1005 uno::Sequence
< sal_Int8
> SAL_CALL
SvxShape::getImplementationId()
1006 throw (uno::RuntimeException
)
1008 static ::cppu::OImplementationId
* pID
= NULL
;
1012 // Ready for multithreading; get global mutex for first call of this method only! see before
1013 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
1015 // Control these pointer again ... it can be, that another instance will be faster then these!
1018 // Create a new static ID ...
1019 static ::cppu::OImplementationId
aID( sal_False
) ;
1020 // ... and set his address to static pointer!
1025 return pID
->getImplementationId() ;
1028 //----------------------------------------------------------------------
1030 Reference
< uno::XInterface
> SvxShape_NewInstance()
1032 return uno::Reference
< uno::XInterface
>(static_cast< OWeakObject
* >( new SvxShape() ) );
1035 //----------------------------------------------------------------------
1037 void SvxShape::onUserCall(SdrUserCallType
/*_eUserCall*/, const Rectangle
& /*_rNewBoundRect*/ )
1039 // obsolete, not called anymore
1042 //----------------------------------------------------------------------
1044 //----------------------------------------------------------------------
1046 void SvxShape::Notify( SfxBroadcaster
&, const SfxHint
& rHint
) throw()
1048 DBG_TESTSOLARMUTEX();
1052 // #i55919# HINT_OBJCHG is only interesting if it's for this object
1054 const SdrHint
* pSdrHint
= PTR_CAST( SdrHint
, &rHint
);
1055 if (!pSdrHint
|| ( /* (pSdrHint->GetKind() != HINT_OBJREMOVED) && */
1056 (pSdrHint
->GetKind() != HINT_MODELCLEARED
) &&
1057 // #110094#-9 (pSdrHint->GetKind() != HINT_OBJLISTCLEAR) &&
1058 ((pSdrHint
->GetKind() != HINT_OBJCHG
|| pSdrHint
->GetObject() != mpObj
.get() ))))
1061 uno::Reference
< uno::XInterface
> xSelf( mpObj
->getWeakUnoShape() );
1064 mpObj
.reset( NULL
);
1068 sal_Bool bClearMe
= sal_False
;
1070 switch( pSdrHint
->GetKind() )
1077 case HINT_MODELCLEARED
:
1079 bClearMe
= sal_True
;
1089 if( !HasSdrObjectOwnership() )
1090 mpObj
.reset( NULL
);
1091 if ( !mpImpl
->mbDisposing
)
1098 //----------------------------------------------------------------------
1099 // The "*LogicRectHack" functions also existed in sch, and those
1100 // duplicate symbols cause Bad Things To Happen (TM) #i9462#.
1101 // Prefixing with 'svx' and marking static to make sure name collisions
1104 static sal_Bool
svx_needLogicRectHack( SdrObject
* pObj
)
1106 if( pObj
->GetObjInventor() == SdrInventor
)
1108 switch(pObj
->GetObjIdentifier())
1130 //----------------------------------------------------------------------
1132 static Rectangle
svx_getLogicRectHack( SdrObject
* pObj
)
1134 if(svx_needLogicRectHack(pObj
))
1136 return pObj
->GetSnapRect();
1140 return pObj
->GetLogicRect();
1144 //----------------------------------------------------------------------
1146 static void svx_setLogicRectHack( SdrObject
* pObj
, const Rectangle
& rRect
)
1148 if(svx_needLogicRectHack(pObj
))
1150 pObj
->SetSnapRect( rRect
);
1154 pObj
->SetLogicRect( rRect
);
1158 //----------------------------------------------------------------------
1160 awt::Point SAL_CALL
SvxShape::getPosition() throw(uno::RuntimeException
)
1162 OGuard
aGuard( Application::GetSolarMutex() );
1164 if( mpObj
.is() && mpModel
)
1166 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1167 Point
aPt( aRect
.Left(), aRect
.Top() );
1169 // Position is relativ to anchor, so recalc to absolut position
1170 if( mpModel
->IsWriter() )
1171 aPt
-= mpObj
->GetAnchorPos();
1173 ForceMetricTo100th_mm(aPt
);
1174 return ::com::sun::star::awt::Point( aPt
.X(), aPt
.Y() );
1182 //----------------------------------------------------------------------
1183 void SAL_CALL
SvxShape::setPosition( const awt::Point
& Position
) throw(uno::RuntimeException
)
1185 OGuard
aGuard( Application::GetSolarMutex() );
1187 if( mpObj
.is() && mpModel
)
1189 // do NOT move 3D objects, this would change the homogen
1190 // transformation matrix
1191 if(!mpObj
->ISA(E3dCompoundObject
))
1193 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1194 Point
aLocalPos( Position
.X
, Position
.Y
);
1195 ForceMetricToItemPoolMetric(aLocalPos
);
1197 // Position ist absolut, relativ zum Anker stellen
1198 if( mpModel
->IsWriter() )
1199 aLocalPos
+= mpObj
->GetAnchorPos();
1201 long nDX
= aLocalPos
.X() - aRect
.Left();
1202 long nDY
= aLocalPos
.Y() - aRect
.Top();
1204 mpObj
->Move( Size( nDX
, nDY
) );
1205 mpModel
->SetChanged();
1209 maPosition
= Position
;
1212 //----------------------------------------------------------------------
1213 awt::Size SAL_CALL
SvxShape::getSize() throw(uno::RuntimeException
)
1215 OGuard
aGuard( Application::GetSolarMutex() );
1217 if( mpObj
.is() && mpModel
)
1219 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1220 Size
aObjSize( aRect
.getWidth(), aRect
.getHeight() );
1221 ForceMetricTo100th_mm(aObjSize
);
1222 return ::com::sun::star::awt::Size( aObjSize
.getWidth(), aObjSize
.getHeight() );
1228 //----------------------------------------------------------------------
1229 void SAL_CALL
SvxShape::setSize( const awt::Size
& rSize
)
1230 throw(beans::PropertyVetoException
, uno::RuntimeException
)
1232 OGuard
aGuard( Application::GetSolarMutex() );
1234 if( mpObj
.is() && mpModel
)
1236 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1237 Size
aLocalSize( rSize
.Width
, rSize
.Height
);
1238 ForceMetricToItemPoolMetric(aLocalSize
);
1240 if(mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_MEASURE
)
1242 Fraction
aWdt(aLocalSize
.Width(),aRect
.Right()-aRect
.Left());
1243 Fraction
aHgt(aLocalSize
.Height(),aRect
.Bottom()-aRect
.Top());
1244 Point aPt
= mpObj
->GetSnapRect().TopLeft();
1245 mpObj
->Resize(aPt
,aWdt
,aHgt
);
1249 //aRect.SetSize(aLocalSize); // this call substract 1 // http://www.openoffice.org/issues/show_bug.cgi?id=83193
1250 if ( !aLocalSize
.Width() )
1252 aRect
.Right() = RECT_EMPTY
;
1255 aRect
.setWidth(aLocalSize
.Width());
1256 if ( !aLocalSize
.Height() )
1258 aRect
.Bottom() = RECT_EMPTY
;
1261 aRect
.setHeight(aLocalSize
.Height());
1263 svx_setLogicRectHack( mpObj
.get(), aRect
);
1266 mpModel
->SetChanged();
1271 //----------------------------------------------------------------------
1274 OUString SAL_CALL
SvxShape::getName( ) throw(::com::sun::star::uno::RuntimeException
)
1276 OGuard
aGuard( Application::GetSolarMutex() );
1279 return mpObj
->GetName();
1287 //----------------------------------------------------------------------
1289 void SAL_CALL
SvxShape::setName( const ::rtl::OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
)
1291 OGuard
aGuard( Application::GetSolarMutex() );
1294 mpObj
->SetName( aName
);
1298 maShapeName
= aName
;
1304 //----------------------------------------------------------------------
1305 OUString SAL_CALL
SvxShape::getShapeType() throw(uno::RuntimeException
)
1307 if( 0 == maShapeType
.getLength() )
1309 UHashMapEntry
* pMap
= pSdrShapeIdentifierMap
;
1310 while ( ( pMap
->nId
!= mpImpl
->mnObjId
) && pMap
->aIdentifier
.getLength() )
1313 if ( pMap
->aIdentifier
.getLength() )
1315 return pMap
->aIdentifier
;
1319 DBG_ERROR("[CL] unknown SdrObjekt identifier");
1328 //----------------------------------------------------------------------
1329 void SAL_CALL
SvxShape::dispose() throw(uno::RuntimeException
)
1331 OGuard
aGuard( Application::GetSolarMutex() );
1333 if( mpImpl
->mbDisposing
)
1334 return; // caught a recursion
1336 mpImpl
->mbDisposing
= true;
1338 lang::EventObject aEvt
;
1339 aEvt
.Source
= *(OWeakAggObject
*) this;
1340 mpImpl
->maDisposeListeners
.disposeAndClear(aEvt
);
1341 mpImpl
->maPropertyNotifier
.disposing();
1345 bool bFreeSdrObject
= false;
1347 if ( mpObj
->IsInserted() && mpObj
->GetPage() )
1349 OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
1350 // normally, we are allowed to free the SdrObject only if we have its ownership.
1351 // Why isn't this checked here?
1353 SdrPage
* pPage
= mpObj
->GetPage();
1354 // SdrObject aus der Page loeschen
1355 sal_uInt32 nCount
= pPage
->GetObjCount();
1356 for ( sal_uInt32 nNum
= 0; nNum
< nCount
; ++nNum
)
1358 if ( pPage
->GetObj( nNum
) == mpObj
.get() )
1360 OSL_VERIFY( pPage
->RemoveObject( nNum
) == mpObj
.get() );
1361 bFreeSdrObject
= true;
1367 mpObj
->setUnoShape( NULL
, SdrObject::GrantXShapeAccess() );
1369 if ( bFreeSdrObject
)
1371 // in case we have the ownership of the SdrObject, a Free
1372 // would do nothing. So ensure the ownership is reset.
1373 mpImpl
->mbHasSdrObjectOwnership
= false;
1374 SdrObject
* pObject
= mpObj
.get();
1375 SdrObject::Free( pObject
);
1381 EndListening( *mpModel
);
1386 //----------------------------------------------------------------------
1388 void SAL_CALL
SvxShape::addEventListener( const Reference
< lang::XEventListener
>& xListener
)
1389 throw(uno::RuntimeException
)
1391 mpImpl
->maDisposeListeners
.addInterface(xListener
);
1394 //----------------------------------------------------------------------
1396 void SAL_CALL
SvxShape::removeEventListener( const Reference
< lang::XEventListener
>& aListener
) throw(uno::RuntimeException
)
1398 mpImpl
->maDisposeListeners
.removeInterface(aListener
);
1403 //----------------------------------------------------------------------
1405 Reference
< beans::XPropertySetInfo
> SAL_CALL
1406 SvxShape::getPropertySetInfo() throw(uno::RuntimeException
)
1408 if( mpImpl
->mpMaster
)
1410 return mpImpl
->mpMaster
->getPropertySetInfo();
1414 return _getPropertySetInfo();
1418 Reference
< beans::XPropertySetInfo
> SAL_CALL
1419 SvxShape::_getPropertySetInfo() throw(uno::RuntimeException
)
1421 return mpPropSet
->getPropertySetInfo();
1424 //----------------------------------------------------------------------
1426 void SAL_CALL
SvxShape::addPropertyChangeListener( const OUString
& _propertyName
, const Reference
< beans::XPropertyChangeListener
>& _listener
) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1428 ::osl::MutexGuard
aGuard( maMutex
);
1429 mpImpl
->maPropertyNotifier
.addPropertyChangeListener( _propertyName
, _listener
);
1432 //----------------------------------------------------------------------
1434 void SAL_CALL
SvxShape::removePropertyChangeListener( const OUString
& _propertyName
, const Reference
< beans::XPropertyChangeListener
>& _listener
) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1436 ::osl::MutexGuard
aGuard( maMutex
);
1437 mpImpl
->maPropertyNotifier
.removePropertyChangeListener( _propertyName
, _listener
);
1440 //----------------------------------------------------------------------
1442 void SAL_CALL
SvxShape::addVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1444 OSL_ENSURE( false, "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1447 //----------------------------------------------------------------------
1449 void SAL_CALL
SvxShape::removeVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1451 OSL_ENSURE( false, "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1454 //----------------------------------------------------------------------
1456 sal_Bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
)
1458 SfxItemSet
aSet( mpModel
->GetItemPool(), (USHORT
)nWID
, (USHORT
)nWID
);
1460 if( SetFillAttribute( nWID
, rName
, aSet
, mpModel
) )
1462 //mpObj->SetItemSetAndBroadcast(aSet);
1463 mpObj
->SetMergedItemSetAndBroadcast(aSet
);
1473 //----------------------------------------------------------------------
1475 sal_Bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const ::rtl::OUString
& rName
, SfxItemSet
& rSet
, SdrModel
* pModel
)
1477 // check if an item with the given name and which id is inside the models
1478 // pool or the stylesheet pool, if found its puttet in the itemse
1479 if( !SetFillAttribute( nWID
, rName
, rSet
) )
1481 // we did not find such item in one of the pools, so we check
1482 // the property lists that are loaded for the model for items
1483 // that support such.
1485 SvxUnogetInternalNameForItem( (sal_Int16
)nWID
, rName
, aStrName
);
1489 case XATTR_FILLBITMAP
:
1491 XBitmapList
* pBitmapList
= pModel
->GetBitmapList();
1496 long nPos
= ((XPropertyList
*)pBitmapList
)->Get(aStrName
);
1500 XBitmapEntry
* pEntry
= pBitmapList
->GetBitmap( nPos
);
1501 XFillBitmapItem aBmpItem
;
1502 aBmpItem
.SetWhich( XATTR_FILLBITMAP
);
1503 aBmpItem
.SetName( rName
);
1504 aBmpItem
.SetBitmapValue( pEntry
->GetXBitmap() );
1505 rSet
.Put( aBmpItem
);
1508 case XATTR_FILLGRADIENT
:
1510 XGradientList
* pGradientList
= pModel
->GetGradientList();
1512 if( !pGradientList
)
1515 long nPos
= ((XPropertyList
*)pGradientList
)->Get(aStrName
);
1519 XGradientEntry
* pEntry
= pGradientList
->GetGradient( nPos
);
1520 XFillGradientItem aGrdItem
;
1521 aGrdItem
.SetWhich( XATTR_FILLGRADIENT
);
1522 aGrdItem
.SetName( rName
);
1523 aGrdItem
.SetGradientValue( pEntry
->GetGradient() );
1524 rSet
.Put( aGrdItem
);
1527 case XATTR_FILLHATCH
:
1529 XHatchList
* pHatchList
= pModel
->GetHatchList();
1534 long nPos
= ((XPropertyList
*)pHatchList
)->Get(aStrName
);
1538 XHatchEntry
* pEntry
= pHatchList
->GetHatch( nPos
);
1539 XFillHatchItem aHatchItem
;
1540 aHatchItem
.SetWhich( XATTR_FILLHATCH
);
1541 aHatchItem
.SetName( rName
);
1542 aHatchItem
.SetHatchValue( pEntry
->GetHatch() );
1543 rSet
.Put( aHatchItem
);
1547 case XATTR_LINESTART
:
1549 XLineEndList
* pLineEndList
= pModel
->GetLineEndList();
1554 long nPos
= ((XPropertyList
*)pLineEndList
)->Get(aStrName
);
1558 XLineEndEntry
* pEntry
= pLineEndList
->GetLineEnd( nPos
);
1559 if( XATTR_LINEEND
== nWID
)
1561 XLineEndItem aLEItem
;
1562 aLEItem
.SetWhich( XATTR_LINEEND
);
1563 aLEItem
.SetName( rName
);
1564 aLEItem
.SetLineEndValue( pEntry
->GetLineEnd() );
1565 rSet
.Put( aLEItem
);
1569 XLineStartItem aLSItem
;
1570 aLSItem
.SetWhich( XATTR_LINESTART
);
1571 aLSItem
.SetName( rName
);
1572 aLSItem
.SetLineStartValue( pEntry
->GetLineEnd() );
1573 rSet
.Put( aLSItem
);
1578 case XATTR_LINEDASH
:
1580 XDashList
* pDashList
= pModel
->GetDashList();
1585 long nPos
= ((XPropertyList
*)pDashList
)->Get(aStrName
);
1589 XDashEntry
* pEntry
= pDashList
->GetDash( nPos
);
1590 XLineDashItem aDashItem
;
1591 aDashItem
.SetWhich( XATTR_LINEDASH
);
1592 aDashItem
.SetName( rName
);
1593 aDashItem
.SetDashValue( pEntry
->GetDash() );
1594 rSet
.Put( aDashItem
);
1605 //----------------------------------------------------------------------
1607 sal_Bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
, SfxItemSet
& rSet
)
1610 SvxUnogetInternalNameForItem( (sal_Int16
)nWID
, rName
, aName
);
1612 if( aName
.Len() == 0 )
1617 case XATTR_LINESTART
:
1619 const String aEmpty
;
1620 const basegfx::B2DPolyPolygon aEmptyPoly
;
1621 if( nWID
== XATTR_LINEEND
)
1622 rSet
.Put( XLineEndItem( aEmpty
, aEmptyPoly
) );
1624 rSet
.Put( XLineStartItem( aEmpty
, aEmptyPoly
) );
1628 case XATTR_FILLFLOATTRANSPARENCE
:
1630 // #85953# Set a disabled XFillFloatTransparenceItem
1631 rSet
.Put(XFillFloatTransparenceItem());
1640 const SfxItemPool
* pPool
= rSet
.GetPool();
1642 const String
aSearchName( aName
);
1643 const USHORT nCount
= pPool
->GetItemCount((USHORT
)nWID
);
1644 const NameOrIndex
*pItem
;
1646 for( USHORT nSurrogate
= 0; nSurrogate
< nCount
; nSurrogate
++ )
1648 pItem
= (NameOrIndex
*)pPool
->GetItem((USHORT
)nWID
, nSurrogate
);
1649 if( pItem
&& ( pItem
->GetName() == aSearchName
) )
1659 //----------------------------------------------------------------------
1662 /* os: unused function
1663 uno::Any SAL_CALL SvxShape::GetFillAttributeByName(
1664 const ::rtl::OUString& rPropertyName, const ::rtl::OUString& rName, SdrModel* pModel )
1667 DBG_ASSERT( pModel, "Invalid Model in GetFillAttributeByName()" );
1671 sal_Int16 nWhich = SvxUnoGetWhichIdForNamedProperty( rPropertyName );
1673 // search pool for item
1674 const SfxItemPool& rPool = pModel->GetItemPool();
1676 const String aSearchName( rName );
1677 const USHORT nCount = rPool.GetItemCount((USHORT)nWhich);
1678 const NameOrIndex *pItem = 0;
1679 bool bFound = false;
1681 for( USHORT nSurrogate = 0; ! bFound && nSurrogate < nCount; nSurrogate++ )
1683 pItem = (NameOrIndex*)rPool.GetItem((USHORT)nWhich, nSurrogate);
1684 if( pItem && ( pItem->GetName() == aSearchName ) )
1690 // check the property lists that are loaded for the model for items that
1693 SvxUnogetInternalNameForItem( nWhich, rName, aStrName );
1697 case XATTR_FILLBITMAP:
1699 XFillBitmapItem aBmpItem;
1702 XBitmapList* pBitmapList = pModel->GetBitmapList();
1707 long nPos = ((XPropertyList*)pBitmapList)->Get(aStrName);
1711 XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos );
1712 aBmpItem.SetWhich( XATTR_FILLBITMAP );
1713 aBmpItem.SetName( rName );
1714 aBmpItem.SetBitmapValue( pEntry->GetXBitmap() );
1717 DBG_ASSERT( pItem, "Invalid Item" );
1719 pItem->QueryValue( aResult ); // default: XBitmap. MID_GRAFURL instead?
1723 case XATTR_FILLGRADIENT:
1725 XFillGradientItem aGrdItem;
1728 XGradientList* pGradientList = pModel->GetGradientList();
1730 if( !pGradientList )
1733 long nPos = ((XPropertyList*)pGradientList)->Get(aStrName);
1737 XGradientEntry* pEntry = pGradientList->GetGradient( nPos );
1738 aGrdItem.SetWhich( XATTR_FILLGRADIENT );
1739 aGrdItem.SetName( rName );
1740 aGrdItem.SetGradientValue( pEntry->GetGradient() );
1743 DBG_ASSERT( pItem, "Invalid Item" );
1745 pItem->QueryValue( aResult, MID_FILLGRADIENT );
1749 case XATTR_FILLHATCH:
1751 XFillHatchItem aHatchItem;
1754 XHatchList* pHatchList = pModel->GetHatchList();
1759 long nPos = ((XPropertyList*)pHatchList)->Get(aStrName);
1763 XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
1764 aHatchItem.SetWhich( XATTR_FILLHATCH );
1765 aHatchItem.SetName( rName );
1766 aHatchItem.SetHatchValue( pEntry->GetHatch() );
1767 pItem = & aHatchItem;
1769 DBG_ASSERT( pItem, "Invalid Item" );
1771 pItem->QueryValue( aResult, MID_FILLHATCH );
1776 case XATTR_LINESTART:
1780 XLineEndList* pLineEndList = pModel->GetLineEndList();
1785 long nPos = ((XPropertyList*)pLineEndList)->Get(aStrName);
1789 XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
1790 if( nWhich == XATTR_LINEEND )
1792 XLineEndItem aLEItem;
1793 aLEItem.SetWhich( XATTR_LINEEND );
1794 aLEItem.SetName( rName );
1795 aLEItem.SetLineEndValue( pEntry->GetLineEnd() );
1796 aLEItem.QueryValue( aResult );
1800 XLineStartItem aLSItem;
1801 aLSItem.SetWhich( XATTR_LINESTART );
1802 aLSItem.SetName( rName );
1803 aLSItem.SetLineStartValue( pEntry->GetLineEnd() );
1804 aLSItem.QueryValue( aResult );
1809 DBG_ASSERT( pItem, "Invalid Item" );
1811 pItem->QueryValue( aResult );
1816 case XATTR_LINEDASH:
1818 XLineDashItem aDashItem;
1821 XDashList* pDashList = pModel->GetDashList();
1826 long nPos = ((XPropertyList*)pDashList)->Get(aStrName);
1830 XDashEntry* pEntry = pDashList->GetDash( nPos );
1831 aDashItem.SetWhich( XATTR_LINEDASH );
1832 aDashItem.SetName( rName );
1833 aDashItem.SetDashValue( pEntry->GetDash() );
1834 pItem = & aDashItem;
1836 DBG_ASSERT( pItem, "Invalid Item" );
1838 pItem->QueryValue( aResult, MID_LINEDASH );
1846 //----------------------------------------------------------------------
1848 void SAL_CALL
SvxShape::setPropertyValue( const OUString
& rPropertyName
, const uno::Any
& rVal
)
1849 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
1851 if( mpImpl
->mpMaster
)
1853 mpImpl
->mpMaster
->setPropertyValue( rPropertyName
, rVal
);
1857 _setPropertyValue( rPropertyName
, rVal
);
1861 void SAL_CALL
SvxShape::_setPropertyValue( const OUString
& rPropertyName
, const uno::Any
& rVal
)
1862 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
1864 OGuard
aGuard( Application::GetSolarMutex() );
1866 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(rPropertyName
);
1868 if( mpObj
.is() && mpModel
)
1871 throw beans::UnknownPropertyException();
1873 if( (pMap
->nFlags
& beans::PropertyAttribute::READONLY
) != 0 )
1874 throw beans::PropertyVetoException();
1876 mpModel
->SetChanged();
1878 if(!setPropertyValueImpl( rPropertyName
, pMap
, rVal
) )
1880 DBG_ASSERT( pMap
->nWID
== SDRATTR_TEXTDIRECTION
|| pMap
->nWID
< SDRATTR_NOTPERSIST_FIRST
|| pMap
->nWID
> SDRATTR_NOTPERSIST_LAST
, "Not persist item not handled!" );
1881 DBG_ASSERT( pMap
->nWID
< OWN_ATTR_VALUE_START
|| pMap
->nWID
> OWN_ATTR_VALUE_END
, "Not item property not handled!" );
1883 sal_Bool bIsNotPersist
= pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
&& pMap
->nWID
!= SDRATTR_TEXTDIRECTION
;
1885 if( pMap
->nWID
== SDRATTR_ECKENRADIUS
)
1887 sal_Int32 nCornerRadius
= 0;
1888 if( !(rVal
>>= nCornerRadius
) || (nCornerRadius
< 0) || (nCornerRadius
> 5000000))
1889 throw IllegalArgumentException();
1893 if( mbIsMultiPropertyCall
&& !bIsNotPersist
)
1895 if( mpImpl
->mpItemSet
== NULL
)
1897 pSet
= mpImpl
->mpItemSet
= mpObj
->GetMergedItemSet().Clone();
1901 pSet
= mpImpl
->mpItemSet
;
1906 pSet
= new SfxItemSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1909 if( pSet
->GetItemState( pMap
->nWID
) != SFX_ITEM_SET
)
1910 pSet
->Put(mpObj
->GetMergedItem(pMap
->nWID
));
1912 if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet
, pMap
, rVal
, *pSet
))
1914 if( pSet
->GetItemState( pMap
->nWID
) != SFX_ITEM_SET
)
1918 // Not-Persistant Attribute, hole diese extra
1919 mpObj
->TakeNotPersistAttr(*pSet
, sal_False
);
1923 if( pSet
->GetItemState( pMap
->nWID
) != SFX_ITEM_SET
)
1925 // Default aus ItemPool holen
1926 if(mpModel
->GetItemPool().IsWhich(pMap
->nWID
))
1927 pSet
->Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
1930 if( pSet
->GetItemState( pMap
->nWID
) == SFX_ITEM_SET
)
1932 mpPropSet
->setPropertyValue( pMap
, rVal
, *pSet
);
1939 // Not-Persist Attribute extra setzen
1940 mpObj
->ApplyNotPersistAttr( *pSet
);
1945 // if we have a XMultiProperty call then the item set
1946 // will be set in setPropertyValues later
1947 if( !mbIsMultiPropertyCall
)
1949 mpObj
->SetMergedItemSetAndBroadcast( *pSet
);
1959 // since we have no actual sdr object right now
1960 // remember all properties in a list. These
1961 // properties will be set when the sdr object is
1964 if(pMap
&& pMap
->nWID
)
1965 // Fixme: We should throw a UnknownPropertyException here.
1966 // But since this class is aggregated from classes
1967 // that support additional properties that we don't
1968 // know here we silently store *all* properties, even
1969 // if they may be not supported after creation
1970 mpPropSet
->setPropertyValue( pMap
, rVal
);
1974 //----------------------------------------------------------------------
1976 uno::Any SAL_CALL
SvxShape::getPropertyValue( const OUString
& PropertyName
)
1977 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1979 if ( mpImpl
->mpMaster
)
1980 return mpImpl
->mpMaster
->getPropertyValue( PropertyName
);
1982 return _getPropertyValue( PropertyName
);
1985 //----------------------------------------------------------------------
1987 uno::Any
SvxShape::_getPropertyValue( const OUString
& PropertyName
)
1988 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1990 OGuard
aGuard( Application::GetSolarMutex() );
1992 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
1995 if( mpObj
.is() && mpModel
)
1998 throw beans::UnknownPropertyException();
2000 if( !getPropertyValueImpl( PropertyName
, pMap
, aAny
) )
2002 DBG_ASSERT( pMap
->nWID
== SDRATTR_TEXTDIRECTION
|| (pMap
->nWID
< SDRATTR_NOTPERSIST_FIRST
|| pMap
->nWID
> SDRATTR_NOTPERSIST_LAST
), "Not persist item not handled!" );
2003 DBG_ASSERT( pMap
->nWID
< OWN_ATTR_VALUE_START
|| pMap
->nWID
> OWN_ATTR_VALUE_END
, "Not item property not handled!" );
2005 SfxItemSet
aSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
2006 aSet
.Put(mpObj
->GetMergedItem(pMap
->nWID
));
2008 if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet
, pMap
, aAny
))
2013 if(pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
)
2015 // Not-Persistant Attribute, hole diese extra
2016 mpObj
->TakeNotPersistAttr(aSet
, sal_False
);
2022 // Default aus ItemPool holen
2023 if(mpModel
->GetItemPool().IsWhich(pMap
->nWID
))
2024 aSet
.Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
2028 aAny
= GetAnyForItem( aSet
, pMap
);
2034 // Fixme: we should return default values for OWN_ATTR !
2036 if(pMap
&& pMap
->nWID
)
2037 // FixMe: see setPropertyValue
2038 aAny
= mpPropSet
->getPropertyValue( pMap
);
2044 //----------------------------------------------------------------------
2046 // XMultiPropertySet
2047 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
)
2049 OGuard
aSolarGuard( Application::GetSolarMutex() );
2051 const sal_Int32 nCount
= aPropertyNames
.getLength();
2052 const OUString
* pNames
= aPropertyNames
.getConstArray();
2054 const uno::Any
* pValues
= aValues
.getConstArray();
2056 // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
2057 // reseted even when an execption is thrown
2058 const ::comphelper::ScopeGuard
aGuard( boost::bind( &SvxShape::endSetPropertyValues
, this ) );
2060 mbIsMultiPropertyCall
= sal_True
;
2062 if( mpImpl
->mpMaster
)
2064 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pValues
++ )
2068 setPropertyValue( *pNames
, *pValues
);
2070 catch( beans::UnknownPropertyException
& e
)
2074 catch( uno::Exception
& ex
)
2082 uno::Reference
< beans::XPropertySet
> xSet
;
2083 queryInterface( ::getCppuType( (const uno::Reference
< beans::XPropertySet
>*) 0) ) >>= xSet
;
2085 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pValues
++ )
2089 xSet
->setPropertyValue( *pNames
, *pValues
);
2091 catch( beans::UnknownPropertyException
& e
)
2095 catch( uno::Exception
& ex
)
2102 if( mpImpl
->mpItemSet
&& mpObj
.is() )
2103 mpObj
->SetMergedItemSetAndBroadcast( *mpImpl
->mpItemSet
);
2106 //----------------------------------------------------------------------
2108 void SvxShape::endSetPropertyValues()
2110 mbIsMultiPropertyCall
= sal_False
;
2111 if( mpImpl
->mpItemSet
)
2113 delete mpImpl
->mpItemSet
;
2114 mpImpl
->mpItemSet
= 0;
2118 //----------------------------------------------------------------------
2120 ::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
)
2122 const sal_Int32 nCount
= aPropertyNames
.getLength();
2123 const OUString
* pNames
= aPropertyNames
.getConstArray();
2125 uno::Sequence
< uno::Any
> aRet( nCount
);
2126 uno::Any
* pValue
= aRet
.getArray();;
2128 if( mpImpl
->mpMaster
)
2130 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pValue
++, pNames
++ )
2134 *pValue
= getPropertyValue( *pNames
);
2136 catch( uno::Exception
& )
2138 DBG_ERROR( "SvxShape::getPropertyValues, unknown property asked" );
2144 uno::Reference
< beans::XPropertySet
> xSet
;
2145 queryInterface( ::getCppuType( (const uno::Reference
< beans::XPropertySet
>*) 0) ) >>= xSet
;
2147 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pValue
++, pNames
++ )
2151 *pValue
= xSet
->getPropertyValue( *pNames
);
2153 catch( uno::Exception
& )
2155 DBG_ERROR( "SvxShape::getPropertyValues, unknown property asked" );
2163 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
)
2167 void SAL_CALL
SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& ) throw (::com::sun::star::uno::RuntimeException
)
2171 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
)
2175 //----------------------------------------------------------------------
2177 uno::Any
SvxShape::GetAnyForItem( SfxItemSet
& aSet
, const SfxItemPropertySimpleEntry
* pMap
) const
2179 DBG_TESTSOLARMUTEX();
2184 case SDRATTR_CIRCSTARTANGLE
:
2186 const SfxPoolItem
* pPoolItem
=NULL
;
2187 if(aSet
.GetItemState(SDRATTR_CIRCSTARTANGLE
,sal_False
,&pPoolItem
)==SFX_ITEM_SET
)
2189 sal_Int32 nAngle
= ((SdrCircStartAngleItem
*)pPoolItem
)->GetValue();
2195 case SDRATTR_CIRCENDANGLE
:
2197 const SfxPoolItem
* pPoolItem
=NULL
;
2198 if (aSet
.GetItemState(SDRATTR_CIRCENDANGLE
,sal_False
,&pPoolItem
)==SFX_ITEM_SET
)
2200 sal_Int32 nAngle
= ((SdrCircEndAngleItem
*)pPoolItem
)->GetValue();
2206 case SDRATTR_CIRCKIND
:
2208 if( mpObj
->GetObjInventor() == SdrInventor
)
2210 drawing::CircleKind eKind
;
2211 switch(mpObj
->GetObjIdentifier())
2213 case OBJ_CIRC
: // Kreis, Ellipse
2214 eKind
= drawing::CircleKind_FULL
;
2216 case OBJ_CCUT
: // Kreisabschnitt
2217 eKind
= drawing::CircleKind_CUT
;
2219 case OBJ_CARC
: // Kreisbogen
2220 eKind
= drawing::CircleKind_ARC
;
2222 case OBJ_SECT
: // Kreissektor
2223 eKind
= drawing::CircleKind_SECTION
;
2232 // Hole Wert aus ItemSet
2233 aAny
= mpPropSet
->getPropertyValue( pMap
, aSet
);
2235 if( *pMap
->pType
!= aAny
.getValueType() )
2237 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2238 if( ( *pMap
->pType
== ::getCppuType((const sal_Int16
*)0)) && aAny
.getValueType() == ::getCppuType((const sal_Int32
*)0) )
2240 sal_Int32 nValue
= 0;
2242 aAny
<<= (sal_Int16
)nValue
;
2246 DBG_ERROR("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
2256 //----------------------------------------------------------------------
2259 beans::PropertyState SAL_CALL
SvxShape::getPropertyState( const OUString
& PropertyName
)
2260 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
2262 if( mpImpl
->mpMaster
)
2264 return mpImpl
->mpMaster
->getPropertyState( PropertyName
);
2268 return _getPropertyState( PropertyName
);
2272 beans::PropertyState SAL_CALL
SvxShape::_getPropertyState( const OUString
& PropertyName
)
2273 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
2275 OGuard
aGuard( Application::GetSolarMutex() );
2277 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
2279 if( !mpObj
.is() || pMap
== NULL
)
2280 throw beans::UnknownPropertyException();
2282 beans::PropertyState eState
;
2283 if( !getPropertyStateImpl( pMap
, eState
) )
2285 const SfxItemSet
& rSet
= mpObj
->GetMergedItemSet();
2287 switch( rSet
.GetItemState( pMap
->nWID
, sal_False
) )
2289 case SFX_ITEM_READONLY
:
2291 eState
= beans::PropertyState_DIRECT_VALUE
;
2293 case SFX_ITEM_DEFAULT
:
2294 eState
= beans::PropertyState_DEFAULT_VALUE
;
2296 // case SFX_ITEM_UNKNOWN:
2297 // case SFX_ITEM_DONTCARE:
2298 // case SFX_ITEM_DISABLED:
2300 eState
= beans::PropertyState_AMBIGUOUS_VALUE
;
2304 // if a item is set, this doesn't mean we want it :)
2305 if( ( beans::PropertyState_DIRECT_VALUE
== eState
) )
2307 switch( pMap
->nWID
)
2309 // the following items are disabled by changing the
2310 // fill style or the line style. so there is no need
2311 // to export items without names which should be empty
2312 case XATTR_FILLBITMAP
:
2313 case XATTR_FILLGRADIENT
:
2314 case XATTR_FILLHATCH
:
2315 case XATTR_LINEDASH
:
2317 NameOrIndex
* pItem
= (NameOrIndex
*)rSet
.GetItem((USHORT
)pMap
->nWID
);
2318 if( ( pItem
== NULL
) || ( pItem
->GetName().Len() == 0) )
2319 eState
= beans::PropertyState_DEFAULT_VALUE
;
2324 // If e.g. the LineStart is on NONE and thus the string has length 0, it still
2325 // may be a hard attribute covering the set LineStart of the parent (Style).
2327 // same is for fill float transparency
2329 case XATTR_LINESTART
:
2330 case XATTR_FILLFLOATTRANSPARENCE
:
2332 NameOrIndex
* pItem
= (NameOrIndex
*)rSet
.GetItem((USHORT
)pMap
->nWID
);
2333 if( ( pItem
== NULL
) )
2334 eState
= beans::PropertyState_DEFAULT_VALUE
;
2343 //----------------------------------------------------------------------
2345 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
)
2347 switch( pProperty
->nWID
)
2349 case OWN_ATTR_CAPTION_POINT
:
2352 if( rValue
>>= aPnt
)
2354 Point
aVclPoint( aPnt
.X
, aPnt
.Y
);
2356 // #90763# position is relative to top left, make it absolute
2357 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2358 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2359 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2361 aVclPoint
.X() += basegfx::fround(aNewHomogenMatrix
.get(0, 2));
2362 aVclPoint
.Y() += basegfx::fround(aNewHomogenMatrix
.get(1, 2));
2364 // #88657# metric of pool maybe twips (writer)
2365 ForceMetricToItemPoolMetric(aVclPoint
);
2367 // #88491# position relative to anchor
2368 if( mpModel
->IsWriter() )
2370 aVclPoint
+= mpObj
->GetAnchorPos();
2373 ((SdrCaptionObj
*)mpObj
.get())->SetTailPos(aVclPoint
);
2379 case OWN_ATTR_TRANSFORMATION
:
2381 drawing::HomogenMatrix3 aMatrix
;
2382 if(rValue
>>= aMatrix
)
2384 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2385 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2387 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2389 aNewHomogenMatrix
.set(0, 0, aMatrix
.Line1
.Column1
);
2390 aNewHomogenMatrix
.set(0, 1, aMatrix
.Line1
.Column2
);
2391 aNewHomogenMatrix
.set(0, 2, aMatrix
.Line1
.Column3
);
2392 aNewHomogenMatrix
.set(1, 0, aMatrix
.Line2
.Column1
);
2393 aNewHomogenMatrix
.set(1, 1, aMatrix
.Line2
.Column2
);
2394 aNewHomogenMatrix
.set(1, 2, aMatrix
.Line2
.Column3
);
2395 aNewHomogenMatrix
.set(2, 0, aMatrix
.Line3
.Column1
);
2396 aNewHomogenMatrix
.set(2, 1, aMatrix
.Line3
.Column2
);
2397 aNewHomogenMatrix
.set(2, 2, aMatrix
.Line3
.Column3
);
2399 mpObj
->TRSetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2405 case OWN_ATTR_ZORDER
:
2407 sal_Int32 nNewOrdNum
= 0;
2408 if(rValue
>>= nNewOrdNum
)
2410 SdrObjList
* pObjList
= mpObj
->GetObjList();
2416 pObjList
->SetObjectOrdNum( mpObj
->GetOrdNum(), (ULONG
)nNewOrdNum
);
2417 DBG_ASSERT( pCheck
== mpObj
.get(), "GetOrdNum() failed!" );
2423 case OWN_ATTR_FRAMERECT
:
2425 awt::Rectangle aUnoRect
;
2426 if(rValue
>>= aUnoRect
)
2428 Point
aTopLeft( aUnoRect
.X
, aUnoRect
.Y
);
2429 Size
aObjSize( aUnoRect
.Width
, aUnoRect
.Height
);
2430 ForceMetricToItemPoolMetric(aTopLeft
);
2431 ForceMetricToItemPoolMetric(aObjSize
);
2433 aRect
.SetPos(aTopLeft
);
2434 aRect
.SetSize(aObjSize
);
2435 mpObj
->SetSnapRect(aRect
);
2440 case OWN_ATTR_MIRRORED
:
2442 sal_Bool bMirror
= sal_Bool();
2443 if(rValue
>>= bMirror
)
2445 SdrGrafObj
* pObj
= dynamic_cast< SdrGrafObj
* >( mpObj
.get() );
2447 pObj
->SetMirrored(bMirror
);
2452 case OWN_ATTR_EDGE_START_OBJ
:
2453 case OWN_ATTR_EDGE_END_OBJ
:
2454 case OWN_ATTR_GLUEID_HEAD
:
2455 case OWN_ATTR_GLUEID_TAIL
:
2456 case OWN_ATTR_EDGE_START_POS
:
2457 case OWN_ATTR_EDGE_END_POS
:
2458 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2460 SdrEdgeObj
* pEdgeObj
= dynamic_cast< SdrEdgeObj
* >(mpObj
.get());
2463 switch(pProperty
->nWID
)
2465 case OWN_ATTR_EDGE_START_OBJ
:
2466 case OWN_ATTR_EDGE_END_OBJ
:
2468 Reference
< drawing::XShape
> xShape
;
2469 if( rValue
>>= xShape
)
2471 SdrObject
* pNode
= GetSdrObjectFromXShape( xShape
);
2474 pEdgeObj
->ConnectToNode( pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
, pNode
);
2475 pEdgeObj
->setGluePointIndex( pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
, -1 );
2482 case OWN_ATTR_EDGE_START_POS
:
2483 case OWN_ATTR_EDGE_END_POS
:
2485 awt::Point aUnoPoint
;
2486 if( rValue
>>= aUnoPoint
)
2488 Point
aPoint( aUnoPoint
.X
, aUnoPoint
.Y
);
2489 if( mpModel
->IsWriter() )
2490 aPoint
+= mpObj
->GetAnchorPos();
2492 ForceMetricToItemPoolMetric( aPoint
);
2493 pEdgeObj
->SetTailPoint( pProperty
->nWID
== OWN_ATTR_EDGE_START_POS
, aPoint
);
2499 case OWN_ATTR_GLUEID_HEAD
:
2500 case OWN_ATTR_GLUEID_TAIL
:
2503 if( rValue
>>= nId
)
2505 pEdgeObj
->setGluePointIndex( pProperty
->nWID
== OWN_ATTR_GLUEID_HEAD
, nId
);
2510 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2512 drawing::PolyPolygonBezierCoords aPolyPoly
;
2513 if ( rValue
>>= aPolyPoly
)
2515 basegfx::B2DPolyPolygon
aNewPolyPolygon( SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aPolyPoly
) );
2516 if( mpModel
->IsWriter() )
2518 Point
aPoint( mpObj
->GetAnchorPos() );
2520 basegfx::B2DHomMatrix aMatrix
;
2521 aMatrix
.translate( aPoint
.X(), aPoint
.Y() );
2522 aNewPolyPolygon
.transform( aMatrix
);
2524 pEdgeObj
->SetEdgeTrackPath( aNewPolyPolygon
);
2532 case OWN_ATTR_MEASURE_START_POS
:
2533 case OWN_ATTR_MEASURE_END_POS
:
2535 SdrMeasureObj
* pMeasureObj
= dynamic_cast< SdrMeasureObj
* >(mpObj
.get());
2536 awt::Point aUnoPoint
;
2537 if(pMeasureObj
&& ( rValue
>>= aUnoPoint
) )
2539 Point
aPoint( aUnoPoint
.X
, aUnoPoint
.Y
);
2541 if( mpModel
->IsWriter() )
2542 aPoint
+= mpObj
->GetAnchorPos();
2544 pMeasureObj
->NbcSetPoint( aPoint
, pProperty
->nWID
== OWN_ATTR_MEASURE_START_POS
? 0L : 1L );
2545 pMeasureObj
->SetChanged();
2546 pMeasureObj
->BroadcastObjectChange();
2551 case OWN_ATTR_FILLBMP_MODE
:
2553 drawing::BitmapMode eMode
;
2554 if(!(rValue
>>= eMode
) )
2556 sal_Int32 nMode
= 0;
2557 if(!(rValue
>>= nMode
))
2560 eMode
= (drawing::BitmapMode
)nMode
;
2562 mpObj
->SetMergedItem( XFillBmpStretchItem( eMode
== drawing::BitmapMode_STRETCH
) );
2563 mpObj
->SetMergedItem( XFillBmpTileItem( eMode
== drawing::BitmapMode_REPEAT
) );
2567 case SDRATTR_LAYERID
:
2569 sal_Int16 nLayerId
= sal_Int16();
2570 if( rValue
>>= nLayerId
)
2572 SdrLayer
* pLayer
= mpModel
->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId
);
2575 mpObj
->SetLayer((unsigned char)nLayerId
);
2582 case SDRATTR_LAYERNAME
:
2584 OUString aLayerName
;
2585 if( rValue
>>= aLayerName
)
2587 const SdrLayer
* pLayer
=mpModel
->GetLayerAdmin().GetLayer(aLayerName
, TRUE
);
2588 if( pLayer
!= NULL
)
2590 mpObj
->SetLayer( pLayer
->GetID() );
2596 case SDRATTR_ROTATEANGLE
:
2598 sal_Int32 nAngle
= 0;
2599 if( rValue
>>= nAngle
)
2601 Point
aRef1(mpObj
->GetSnapRect().Center());
2602 nAngle
-= mpObj
->GetRotateAngle();
2605 double nSin
=sin(nAngle
*nPi180
);
2606 double nCos
=cos(nAngle
*nPi180
);
2607 mpObj
->Rotate(aRef1
,nAngle
,nSin
,nCos
);
2615 case SDRATTR_SHEARANGLE
:
2617 sal_Int32 nShear
= 0;
2618 if( rValue
>>= nShear
)
2620 nShear
-= mpObj
->GetShearAngle();
2623 Point
aRef1(mpObj
->GetSnapRect().Center());
2624 double nTan
=tan(nShear
*nPi180
);
2625 mpObj
->Shear(aRef1
,nShear
,nTan
,FALSE
);
2633 case SDRATTR_OBJMOVEPROTECT
:
2635 sal_Bool bMoveProtect
= sal_Bool();
2636 if( rValue
>>= bMoveProtect
)
2638 mpObj
->SetMoveProtect(bMoveProtect
);
2643 case SDRATTR_OBJECTNAME
:
2646 if( rValue
>>= aName
)
2648 mpObj
->SetName( aName
);
2655 case OWN_ATTR_MISC_OBJ_TITLE
:
2658 if( rValue
>>= aTitle
)
2660 mpObj
->SetTitle( aTitle
);
2665 case OWN_ATTR_MISC_OBJ_DESCRIPTION
:
2667 OUString aDescription
;
2668 if( rValue
>>= aDescription
)
2670 mpObj
->SetDescription( aDescription
);
2676 case SDRATTR_OBJPRINTABLE
:
2678 sal_Bool bPrintable
= sal_Bool();
2679 if( rValue
>>= bPrintable
)
2681 mpObj
->SetPrintable(bPrintable
);
2686 case SDRATTR_OBJSIZEPROTECT
:
2688 sal_Bool bResizeProtect
= sal_Bool();
2689 if( rValue
>>= bResizeProtect
)
2691 mpObj
->SetResizeProtect(bResizeProtect
);
2696 case OWN_ATTR_PAGE_NUMBER
:
2698 sal_Int32 nPageNum
= 0;
2699 if( (rValue
>>= nPageNum
) && ( nPageNum
>= 0 ) && ( nPageNum
<= 0xffff ) )
2701 SdrPageObj
* pPageObj
= dynamic_cast< SdrPageObj
* >(mpObj
.get());
2704 SdrModel
* pModel
= pPageObj
->GetModel();
2705 SdrPage
* pNewPage
= 0L;
2706 const sal_uInt16
nDestinationPageNum((sal_uInt16
)((nPageNum
<< 1L) - 1L));
2710 if(nDestinationPageNum
< pModel
->GetPageCount())
2712 pNewPage
= pModel
->GetPage(nDestinationPageNum
);
2716 pPageObj
->SetReferencedPage(pNewPage
);
2723 case XATTR_FILLBITMAP
:
2724 case XATTR_FILLGRADIENT
:
2725 case XATTR_FILLHATCH
:
2726 case XATTR_FILLFLOATTRANSPARENCE
:
2728 case XATTR_LINESTART
:
2729 case XATTR_LINEDASH
:
2731 if( pProperty
->nMemberId
== MID_NAME
)
2734 if( rValue
>>= aApiName
)
2736 if( SetFillAttribute( pProperty
->nWID
, aApiName
) )
2751 throw lang::IllegalArgumentException();
2754 //----------------------------------------------------------------------
2756 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
)
2758 switch( pProperty
->nWID
)
2761 case OWN_ATTR_HASLEVELS:
2763 rValue <<= SvxTextEditSource::hasLevels( mpObj.get() );
2767 case OWN_ATTR_CAPTION_POINT
:
2769 Point aVclPoint
= ((SdrCaptionObj
*)mpObj
.get())->GetTailPos();
2771 // #88491# make pos relative to anchor
2772 if( mpModel
->IsWriter() )
2774 aVclPoint
-= mpObj
->GetAnchorPos();
2777 // #88657# metric of pool maybe twips (writer)
2778 ForceMetricTo100th_mm(aVclPoint
);
2780 // #90763# pos is absolute, make it relative to top left
2781 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2782 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2783 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2785 aVclPoint
.X() -= basegfx::fround(aNewHomogenMatrix
.get(0, 2));
2786 aVclPoint
.Y() -= basegfx::fround(aNewHomogenMatrix
.get(1, 2));
2788 awt::Point
aPnt( aVclPoint
.X(), aVclPoint
.Y() );
2793 case OWN_ATTR_TRANSFORMATION
:
2795 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2796 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2797 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2798 drawing::HomogenMatrix3 aMatrix
;
2800 aMatrix
.Line1
.Column1
= aNewHomogenMatrix
.get(0, 0);
2801 aMatrix
.Line1
.Column2
= aNewHomogenMatrix
.get(0, 1);
2802 aMatrix
.Line1
.Column3
= aNewHomogenMatrix
.get(0, 2);
2803 aMatrix
.Line2
.Column1
= aNewHomogenMatrix
.get(1, 0);
2804 aMatrix
.Line2
.Column2
= aNewHomogenMatrix
.get(1, 1);
2805 aMatrix
.Line2
.Column3
= aNewHomogenMatrix
.get(1, 2);
2806 aMatrix
.Line3
.Column1
= aNewHomogenMatrix
.get(2, 0);
2807 aMatrix
.Line3
.Column2
= aNewHomogenMatrix
.get(2, 1);
2808 aMatrix
.Line3
.Column3
= aNewHomogenMatrix
.get(2, 2);
2815 case OWN_ATTR_ZORDER
:
2817 rValue
<<= (sal_Int32
)mpObj
->GetOrdNum();
2821 case OWN_ATTR_BITMAP
:
2823 rValue
= GetBitmap();
2824 if(!rValue
.hasValue())
2825 throw uno::RuntimeException();
2830 case OWN_ATTR_ISFONTWORK
:
2832 rValue
<<= (sal_Bool
)(mpObj
->ISA(SdrTextObj
) && ((SdrTextObj
*)mpObj
.get())->IsFontwork());
2836 case OWN_ATTR_FRAMERECT
:
2838 Rectangle
aRect( mpObj
->GetSnapRect() );
2839 Point
aTopLeft( aRect
.TopLeft() );
2840 Size
aObjSize( aRect
.GetWidth(), aRect
.GetHeight() );
2841 ForceMetricTo100th_mm(aTopLeft
);
2842 ForceMetricTo100th_mm(aObjSize
);
2843 ::com::sun::star::awt::Rectangle
aUnoRect(
2844 aTopLeft
.X(), aTopLeft
.Y(),
2845 aObjSize
.getWidth(), aObjSize
.getHeight() );
2846 rValue
<<= aUnoRect
;
2850 case OWN_ATTR_BOUNDRECT
:
2852 Rectangle
aRect( mpObj
->GetCurrentBoundRect() );
2853 Point
aTopLeft( aRect
.TopLeft() );
2854 Size
aObjSize( aRect
.GetWidth(), aRect
.GetHeight() );
2855 ForceMetricTo100th_mm(aTopLeft
);
2856 ForceMetricTo100th_mm(aObjSize
);
2857 ::com::sun::star::awt::Rectangle
aUnoRect(
2858 aTopLeft
.X(), aTopLeft
.Y(),
2859 aObjSize
.getWidth(), aObjSize
.getHeight() );
2860 rValue
<<= aUnoRect
;
2864 case OWN_ATTR_LDNAME
:
2866 OUString
aName( mpObj
->GetName() );
2871 case OWN_ATTR_LDBITMAP
:
2874 if( mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_OLE2
)
2876 nId
= RID_UNODRAW_OLE2
;
2878 else if( mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_GRAF
)
2880 nId
= RID_UNODRAW_GRAPHICS
;
2884 nId
= RID_UNODRAW_OBJECTS
;
2887 BitmapEx
aBmp( SVX_RES(nId
) );
2888 Reference
< awt::XBitmap
> xBmp( VCLUnoHelper::CreateBitmap( aBmp
) );
2894 case OWN_ATTR_MIRRORED
:
2896 sal_Bool bMirror
= sal_False
;
2897 if( mpObj
.is() && mpObj
->ISA(SdrGrafObj
) )
2898 bMirror
= ((SdrGrafObj
*)mpObj
.get())->IsMirrored();
2903 case OWN_ATTR_EDGE_START_OBJ
:
2904 case OWN_ATTR_EDGE_START_POS
:
2905 case OWN_ATTR_EDGE_END_POS
:
2906 case OWN_ATTR_EDGE_END_OBJ
:
2907 case OWN_ATTR_GLUEID_HEAD
:
2908 case OWN_ATTR_GLUEID_TAIL
:
2909 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2911 SdrEdgeObj
* pEdgeObj
= dynamic_cast<SdrEdgeObj
*>(mpObj
.get());
2914 switch(pProperty
->nWID
)
2916 case OWN_ATTR_EDGE_START_OBJ
:
2917 case OWN_ATTR_EDGE_END_OBJ
:
2919 SdrObject
* pNode
= pEdgeObj
->GetConnectedNode(pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
);
2922 Reference
< drawing::XShape
> xShape( GetXShapeForSdrObject( pNode
) );
2930 case OWN_ATTR_EDGE_START_POS
:
2931 case OWN_ATTR_EDGE_END_POS
:
2933 Point
aPoint( pEdgeObj
->GetTailPoint( pProperty
->nWID
== OWN_ATTR_EDGE_START_POS
) );
2934 if( mpModel
->IsWriter() )
2935 aPoint
-= mpObj
->GetAnchorPos();
2937 ForceMetricTo100th_mm( aPoint
);
2938 awt::Point
aUnoPoint( aPoint
.X(), aPoint
.Y() );
2940 rValue
<<= aUnoPoint
;
2943 case OWN_ATTR_GLUEID_HEAD
:
2944 case OWN_ATTR_GLUEID_TAIL
:
2946 rValue
<<= pEdgeObj
->getGluePointIndex( pProperty
->nWID
== OWN_ATTR_GLUEID_HEAD
);
2949 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2951 basegfx::B2DPolyPolygon
aPolyPoly( pEdgeObj
->GetEdgeTrackPath() );
2952 if( mpModel
->IsWriter() )
2954 Point
aPoint( mpObj
->GetAnchorPos() );
2956 basegfx::B2DHomMatrix aMatrix
;
2957 aMatrix
.translate( -aPoint
.X(), -aPoint
.Y() );
2958 aPolyPoly
.transform( aMatrix
);
2960 drawing::PolyPolygonBezierCoords aRetval
;
2961 SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly
, aRetval
);
2970 case OWN_ATTR_MEASURE_START_POS
:
2971 case OWN_ATTR_MEASURE_END_POS
:
2973 SdrMeasureObj
* pMeasureObj
= dynamic_cast<SdrMeasureObj
*>(mpObj
.get());
2976 Point
aPoint( pMeasureObj
->GetPoint( pProperty
->nWID
== OWN_ATTR_MEASURE_START_POS
? 0 : 1 ) );
2977 if( mpModel
->IsWriter() )
2978 aPoint
-= mpObj
->GetAnchorPos();
2980 awt::Point
aUnoPoint( aPoint
.X(), aPoint
.Y() );
2982 rValue
<<= aUnoPoint
;
2988 case OWN_ATTR_FILLBMP_MODE
:
2990 const SfxItemSet
& rObjItemSet
= mpObj
->GetMergedItemSet();
2992 XFillBmpStretchItem
* pStretchItem
= (XFillBmpStretchItem
*)&rObjItemSet
.Get(XATTR_FILLBMP_STRETCH
);
2993 XFillBmpTileItem
* pTileItem
= (XFillBmpTileItem
*)&rObjItemSet
.Get(XATTR_FILLBMP_TILE
);
2995 if( pTileItem
&& pTileItem
->GetValue() )
2997 rValue
<<= drawing::BitmapMode_REPEAT
;
2999 else if( pStretchItem
&& pStretchItem
->GetValue() )
3001 rValue
<<= drawing::BitmapMode_STRETCH
;
3005 rValue
<<= drawing::BitmapMode_NO_REPEAT
;
3009 case SDRATTR_LAYERID
:
3010 rValue
<<= (sal_Int16
)mpObj
->GetLayer();
3013 case SDRATTR_LAYERNAME
:
3015 SdrLayer
* pLayer
= mpModel
->GetLayerAdmin().GetLayerPerID(mpObj
->GetLayer());
3018 OUString
aName( pLayer
->GetName() );
3024 case SDRATTR_ROTATEANGLE
:
3025 rValue
<<= mpObj
->GetRotateAngle();
3028 case SDRATTR_SHEARANGLE
:
3029 rValue
<<= mpObj
->GetShearAngle();
3032 case SDRATTR_OBJMOVEPROTECT
:
3033 rValue
= uno::makeAny( (sal_Bool
) mpObj
->IsMoveProtect() );
3036 case SDRATTR_OBJECTNAME
:
3038 OUString
aName( mpObj
->GetName() );
3044 case OWN_ATTR_MISC_OBJ_TITLE
:
3046 OUString
aTitle( mpObj
->GetTitle() );
3051 case OWN_ATTR_MISC_OBJ_DESCRIPTION
:
3053 OUString
aDescription( mpObj
->GetDescription() );
3054 rValue
<<= aDescription
;
3058 case SDRATTR_OBJPRINTABLE
:
3059 rValue
= uno::makeAny( (sal_Bool
) mpObj
->IsPrintable() );
3062 case SDRATTR_OBJSIZEPROTECT
:
3063 rValue
= uno::makeAny( (sal_Bool
)mpObj
->IsResizeProtect() );
3066 case OWN_ATTR_PAGE_NUMBER
:
3068 SdrPageObj
* pPageObj
= dynamic_cast<SdrPageObj
*>(mpObj
.get());
3071 SdrPage
* pPage
= pPageObj
->GetReferencedPage();
3072 sal_Int32 nPageNumber
= (pPage
) ? pPage
->GetPageNum() : 0L;
3075 rValue
<<= nPageNumber
;
3080 case OWN_ATTR_UINAME_SINGULAR
:
3083 mpObj
->TakeObjNameSingul( aTmp
);
3084 rValue
<<= OUString( aTmp
);
3088 case OWN_ATTR_UINAME_PLURAL
:
3091 mpObj
->TakeObjNamePlural( aTmp
);
3092 rValue
<<= OUString( aTmp
);
3095 case OWN_ATTR_METAFILE
:
3097 SdrOle2Obj
* pObj
= dynamic_cast<SdrOle2Obj
*>(mpObj
.get());
3100 Graphic
* pGraphic
= pObj
->GetGraphic();
3103 BOOL bIsWMF
= FALSE
;
3104 if ( pGraphic
->IsLink() )
3106 GfxLink aLnk
= pGraphic
->GetLink();
3107 if ( aLnk
.GetType() == GFX_LINK_TYPE_NATIVE_WMF
)
3110 uno::Sequence
<sal_Int8
> aSeq((sal_Int8
*)aLnk
.GetData(), (sal_Int32
) aLnk
.GetDataSize());
3117 if ( pGraphic
->GetType() != GRAPHIC_BITMAP
)
3118 aMtf
= pObj
->GetGraphic()->GetGDIMetaFile();
3121 VirtualDevice aVirDev
;
3122 aMtf
.Record( &aVirDev
);
3123 pGraphic
->Draw( &aVirDev
, Point(), pGraphic
->GetPrefSize() );
3125 aMtf
.SetPrefSize( pGraphic
->GetPrefSize() );
3126 aMtf
.SetPrefMapMode( pGraphic
->GetPrefMapMode() );
3128 SvMemoryStream
aDestStrm( 65535, 65535 );
3129 ConvertGDIMetaFileToWMF( aMtf
, aDestStrm
, NULL
, sal_False
);
3130 uno::Sequence
<sal_Int8
> aSeq((sal_Int8
*)aDestStrm
.GetData(), aDestStrm
.GetSize());
3137 rValue
= GetBitmap( sal_True
);
3149 //----------------------------------------------------------------------
3151 bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry
* pProperty
, ::com::sun::star::beans::PropertyState
& rState
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
3153 if( pProperty
->nWID
== OWN_ATTR_FILLBMP_MODE
)
3155 const SfxItemSet
& rSet
= mpObj
->GetMergedItemSet();
3157 if( rSet
.GetItemState( XATTR_FILLBMP_STRETCH
, false ) == SFX_ITEM_SET
||
3158 rSet
.GetItemState( XATTR_FILLBMP_TILE
, false ) == SFX_ITEM_SET
)
3160 rState
= beans::PropertyState_DIRECT_VALUE
;
3164 rState
= beans::PropertyState_AMBIGUOUS_VALUE
;
3167 else if((( pProperty
->nWID
>= OWN_ATTR_VALUE_START
&& pProperty
->nWID
<= OWN_ATTR_VALUE_END
) ||
3168 ( pProperty
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pProperty
->nWID
<= SDRATTR_NOTPERSIST_LAST
)) && ( pProperty
->nWID
!= SDRATTR_TEXTDIRECTION
) )
3170 rState
= beans::PropertyState_DIRECT_VALUE
;
3180 //----------------------------------------------------------------------
3182 bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry
* pProperty
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
3184 if( pProperty
->nWID
== OWN_ATTR_FILLBMP_MODE
)
3186 mpObj
->ClearMergedItem( XATTR_FILLBMP_STRETCH
);
3187 mpObj
->ClearMergedItem( XATTR_FILLBMP_TILE
);
3190 else if((pProperty
->nWID
>= OWN_ATTR_VALUE_START
&& pProperty
->nWID
<= OWN_ATTR_VALUE_END
) ||
3191 ( pProperty
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pProperty
->nWID
<= SDRATTR_NOTPERSIST_LAST
))
3201 //----------------------------------------------------------------------
3203 uno::Sequence
< beans::PropertyState
> SAL_CALL
SvxShape::getPropertyStates( const uno::Sequence
< OUString
>& aPropertyName
)
3204 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
3206 const sal_Int32 nCount
= aPropertyName
.getLength();
3207 const OUString
* pNames
= aPropertyName
.getConstArray();
3209 uno::Sequence
< beans::PropertyState
> aRet( nCount
);
3210 beans::PropertyState
* pState
= aRet
.getArray();
3212 if( mpImpl
->mpMaster
)
3214 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++ )
3215 pState
[nIdx
] = getPropertyState( pNames
[nIdx
] );
3220 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++ )
3221 pState
[nIdx
] = getPropertyState( pNames
[nIdx
] );
3227 //----------------------------------------------------------------------
3229 void SAL_CALL
SvxShape::setPropertyToDefault( const OUString
& PropertyName
)
3230 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
3232 if( mpImpl
->mpMaster
)
3234 mpImpl
->mpMaster
->setPropertyToDefault( PropertyName
);
3238 _setPropertyToDefault( PropertyName
);
3242 void SAL_CALL
SvxShape::_setPropertyToDefault( const OUString
& PropertyName
)
3243 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
3245 OGuard
aGuard( Application::GetSolarMutex() );
3247 const SfxItemPropertySimpleEntry
* pProperty
= mpPropSet
->getPropertyMapEntry(PropertyName
);
3249 if( !mpObj
.is() || mpModel
== NULL
|| pProperty
== NULL
)
3250 throw beans::UnknownPropertyException();
3252 if( !setPropertyToDefaultImpl( pProperty
) )
3254 mpObj
->ClearMergedItem( pProperty
->nWID
);
3257 mpModel
->SetChanged();
3260 //----------------------------------------------------------------------
3262 uno::Any SAL_CALL
SvxShape::getPropertyDefault( const OUString
& aPropertyName
)
3263 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
3265 if( mpImpl
->mpMaster
)
3267 return mpImpl
->mpMaster
->getPropertyDefault( aPropertyName
);
3271 return _getPropertyDefault( aPropertyName
);
3275 uno::Any SAL_CALL
SvxShape::_getPropertyDefault( const OUString
& aPropertyName
)
3276 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
3278 OGuard
aGuard( Application::GetSolarMutex() );
3280 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
3282 if( !mpObj
.is() || pMap
== NULL
|| mpModel
== NULL
)
3283 throw beans::UnknownPropertyException();
3285 if(( pMap
->nWID
>= OWN_ATTR_VALUE_START
&& pMap
->nWID
<= OWN_ATTR_VALUE_END
) ||
3286 ( pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
))
3288 return getPropertyValue( aPropertyName
);
3291 // Default aus ItemPool holen
3292 if(!mpModel
->GetItemPool().IsWhich(pMap
->nWID
))
3293 throw beans::UnknownPropertyException();
3295 SfxItemSet
aSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
3296 aSet
.Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
3298 return GetAnyForItem( aSet
, pMap
);
3301 // XMultiPropertyStates
3302 void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException
)
3304 OGuard
aGuard( Application::GetSolarMutex() );
3307 throw lang::DisposedException();
3308 mpObj
->ClearMergedItem(); // nWhich == 0 => all
3310 if(mpObj
->ISA(SdrGrafObj
))
3312 // defaults for graphic objects have changed:
3313 mpObj
->SetMergedItem( XFillStyleItem( XFILL_NONE
) );
3314 mpObj
->SetMergedItem( XLineStyleItem( XLINE_NONE
) );
3317 // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3318 // but needs to be TRUE in svx, pool default (false) in sch. Since sch
3319 // does not load lathe or extrude objects, it is possible to set the items
3321 // For other solution possibilities, see task description.
3322 if(mpObj
->ISA(E3dLatheObj
) || mpObj
->ISA(E3dExtrudeObj
))
3324 mpObj
->SetMergedItem(Svx3DCharacterModeItem(true));
3327 mpModel
->SetChanged();
3330 void SvxShape::setPropertiesToDefault(
3331 const uno::Sequence
<OUString
>& aPropertyNames
)
3332 throw (beans::UnknownPropertyException
, uno::RuntimeException
)
3334 for ( sal_Int32 pos
= 0; pos
< aPropertyNames
.getLength(); ++pos
)
3335 setPropertyToDefault( aPropertyNames
[pos
] );
3338 uno::Sequence
<uno::Any
> SvxShape::getPropertyDefaults(
3339 const uno::Sequence
<OUString
>& aPropertyNames
)
3340 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
,
3341 uno::RuntimeException
)
3343 ::std::vector
<uno::Any
> ret
;
3344 for ( sal_Int32 pos
= 0; pos
< aPropertyNames
.getLength(); ++pos
)
3345 ret
.push_back( getPropertyDefault( aPropertyNames
[pos
] ) );
3346 return uno::Sequence
<uno::Any
>( &ret
[0], ret
.size() );
3349 //----------------------------------------------------------------------
3351 //----------------------------------------------------------------------
3353 //----------------------------------------------------------------------
3354 OUString SAL_CALL
SvxShape::getImplementationName()
3355 throw(uno::RuntimeException
)
3357 static OUString
aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShape") );
3358 return aServiceName
;
3361 #define STAR_NAMESPACE "com.sun.star."
3363 const char* sUNO_service_style_ParagraphProperties
= STAR_NAMESPACE
"style.ParagraphProperties";
3364 const char* sUNO_service_style_ParagraphPropertiesComplex
= STAR_NAMESPACE
"style.ParagraphPropertiesComplex";
3365 const char* sUNO_service_style_ParagraphPropertiesAsian
= STAR_NAMESPACE
"style.ParagraphPropertiesAsian";
3366 const char* sUNO_service_style_CharacterProperties
= STAR_NAMESPACE
"style.CharacterProperties";
3367 const char* sUNO_service_style_CharacterPropertiesComplex
= STAR_NAMESPACE
"style.CharacterPropertiesComplex";
3368 const char* sUNO_service_style_CharacterPropertiesAsian
= STAR_NAMESPACE
"style.CharacterPropertiesAsian";
3370 const char* sUNO_service_drawing_FillProperties
= STAR_NAMESPACE
"drawing.FillProperties";
3371 const char* sUNO_service_drawing_TextProperties
= STAR_NAMESPACE
"drawing.TextProperties";
3372 const char* sUNO_service_drawing_LineProperties
= STAR_NAMESPACE
"drawing.LineProperties";
3373 const char* sUNO_service_drawing_ConnectorProperties
= STAR_NAMESPACE
"drawing.ConnectorProperties";
3374 const char* sUNO_service_drawing_MeasureProperties
= STAR_NAMESPACE
"drawing.MeasureProperties";
3375 const char* sUNO_service_drawing_ShadowProperties
= STAR_NAMESPACE
"drawing.ShadowProperties";
3377 const char* sUNO_service_drawing_RotationDescriptor
= STAR_NAMESPACE
"drawing.RotationDescriptor";
3379 const char* sUNO_service_drawing_Text
= STAR_NAMESPACE
"drawing.Text";
3380 const char* sUNO_service_drawing_GroupShape
= STAR_NAMESPACE
"drawing.GroupShape";
3382 const char* sUNO_service_drawing_CustomShapeProperties
= STAR_NAMESPACE
"drawing.CustomShapeProperties";
3383 const char* sUNO_service_drawing_CustomShape
= STAR_NAMESPACE
"drawing.CustomShape";
3385 const char* sUNO_service_drawing_PolyPolygonDescriptor
= STAR_NAMESPACE
"drawing.PolyPolygonDescriptor";
3386 const char* sUNO_service_drawing_PolyPolygonBezierDescriptor
= STAR_NAMESPACE
"drawing.PolyPolygonBezierDescriptor";
3388 const char* sUNO_service_drawing_LineShape
= STAR_NAMESPACE
"drawing.LineShape";
3389 const char* sUNO_service_drawing_Shape
= STAR_NAMESPACE
"drawing.Shape";
3390 const char* sUNO_service_drawing_RectangleShape
= STAR_NAMESPACE
"drawing.RectangleShape";
3391 const char* sUNO_service_drawing_EllipseShape
= STAR_NAMESPACE
"drawing.EllipseShape";
3392 const char* sUNO_service_drawing_PolyPolygonShape
= STAR_NAMESPACE
"drawing.PolyPolygonShape";
3393 const char* sUNO_service_drawing_PolyLineShape
= STAR_NAMESPACE
"drawing.PolyLineShape";
3394 const char* sUNO_service_drawing_OpenBezierShape
= STAR_NAMESPACE
"drawing.OpenBezierShape";
3395 const char* sUNO_service_drawing_ClosedBezierShape
= STAR_NAMESPACE
"drawing.ClosedBezierShape";
3396 const char* sUNO_service_drawing_TextShape
= STAR_NAMESPACE
"drawing.TextShape";
3397 const char* sUNO_service_drawing_GraphicObjectShape
= STAR_NAMESPACE
"drawing.GraphicObjectShape";
3398 const char* sUNO_service_drawing_OLE2Shape
= STAR_NAMESPACE
"drawing.OLE2Shape";
3399 const char* sUNO_service_drawing_PageShape
= STAR_NAMESPACE
"drawing.PageShape";
3400 const char* sUNO_service_drawing_CaptionShape
= STAR_NAMESPACE
"drawing.CaptionShape";
3401 const char* sUNO_service_drawing_MeasureShape
= STAR_NAMESPACE
"drawing.MeasureShape";
3402 const char* sUNO_service_drawing_FrameShape
= STAR_NAMESPACE
"drawing.FrameShape";
3403 const char* sUNO_service_drawing_ControlShape
= STAR_NAMESPACE
"drawing.ControlShape";
3404 const char* sUNO_service_drawing_ConnectorShape
= STAR_NAMESPACE
"drawing.ConnectorShape";
3405 const char* sUNO_service_drawing_MediaShape
= STAR_NAMESPACE
"drawing.MediaShape";
3408 uno::Sequence
< OUString
> SAL_CALL
SvxShape::getSupportedServiceNames()
3409 throw(uno::RuntimeException
)
3411 if( mpImpl
->mpMaster
)
3413 return mpImpl
->mpMaster
->getSupportedServiceNames();
3417 return _getSupportedServiceNames();
3421 uno::Sequence
< OUString
> SAL_CALL
SvxShape::_getSupportedServiceNames()
3422 throw(uno::RuntimeException
)
3424 OGuard
aGuard( Application::GetSolarMutex() );
3426 if( mpObj
.is() && mpObj
->GetObjInventor() == SdrInventor
)
3428 const UINT16 nIdent
= mpObj
->GetObjIdentifier();
3434 static uno::Sequence
< OUString
> *pSeq
= 0;
3437 // OGuard aGuard( Application::GetSolarMutex() );
3440 static uno::Sequence
< OUString
> SvxShape_GroupServices
;
3442 SvxServiceInfoHelper::addToSequence( SvxShape_GroupServices
, 2,
3443 sUNO_service_drawing_GroupShape
,
3444 sUNO_service_drawing_Shape
);
3446 pSeq
= &SvxShape_GroupServices
;
3452 case OBJ_CUSTOMSHAPE
:
3454 static uno::Sequence
< OUString
> *pSeq
= 0;
3457 // OGuard aGuard( Application::GetSolarMutex() );
3460 static uno::Sequence
< OUString
> SvxShape_CustomShapeServices
;
3462 SvxServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices
, 13,
3463 sUNO_service_drawing_CustomShape
,
3464 sUNO_service_drawing_Shape
,
3465 sUNO_service_drawing_CustomShapeProperties
,
3466 sUNO_service_drawing_FillProperties
,
3467 sUNO_service_drawing_LineProperties
,
3468 sUNO_service_drawing_Text
,
3469 sUNO_service_drawing_TextProperties
,
3470 sUNO_service_style_ParagraphProperties
,
3471 sUNO_service_style_ParagraphPropertiesComplex
,
3472 sUNO_service_style_ParagraphPropertiesAsian
,
3473 sUNO_service_style_CharacterProperties
,
3474 sUNO_service_style_CharacterPropertiesComplex
,
3475 sUNO_service_style_CharacterPropertiesAsian
,
3476 sUNO_service_drawing_ShadowProperties
,
3477 sUNO_service_drawing_RotationDescriptor
);
3478 pSeq
= &SvxShape_CustomShapeServices
;
3485 static uno::Sequence
< OUString
> *pSeq
= 0;
3488 // OGuard aGuard( Application::GetSolarMutex() );
3491 static uno::Sequence
< OUString
> SvxShape_LineServices
;
3493 SvxServiceInfoHelper::addToSequence( SvxShape_LineServices
,14,
3494 sUNO_service_drawing_LineShape
,
3496 sUNO_service_drawing_Shape
,
3497 sUNO_service_drawing_LineProperties
,
3499 sUNO_service_drawing_Text
,
3500 sUNO_service_drawing_TextProperties
,
3501 sUNO_service_style_ParagraphProperties
,
3502 sUNO_service_style_ParagraphPropertiesComplex
,
3503 sUNO_service_style_ParagraphPropertiesAsian
,
3504 sUNO_service_style_CharacterProperties
,
3505 sUNO_service_style_CharacterPropertiesComplex
,
3506 sUNO_service_style_CharacterPropertiesAsian
,
3508 sUNO_service_drawing_PolyPolygonDescriptor
,
3509 sUNO_service_drawing_ShadowProperties
,
3510 sUNO_service_drawing_RotationDescriptor
);
3512 pSeq
= &SvxShape_LineServices
;
3520 static uno::Sequence
< OUString
> *pSeq
= 0;
3523 // OGuard aGuard( Application::GetSolarMutex() );
3526 static uno::Sequence
< OUString
> SvxShape_RectServices
;
3528 SvxServiceInfoHelper::addToSequence( SvxShape_RectServices
,14,
3529 sUNO_service_drawing_RectangleShape
,
3531 sUNO_service_drawing_Shape
,
3532 sUNO_service_drawing_FillProperties
,
3533 sUNO_service_drawing_LineProperties
,
3534 sUNO_service_drawing_Text
,
3535 sUNO_service_drawing_TextProperties
,
3536 sUNO_service_style_ParagraphProperties
,
3537 sUNO_service_style_ParagraphPropertiesComplex
,
3538 sUNO_service_style_ParagraphPropertiesAsian
,
3539 sUNO_service_style_CharacterProperties
,
3540 sUNO_service_style_CharacterPropertiesComplex
,
3541 sUNO_service_style_CharacterPropertiesAsian
,
3543 sUNO_service_drawing_ShadowProperties
,
3544 sUNO_service_drawing_RotationDescriptor
);
3545 pSeq
= &SvxShape_RectServices
;
3557 static uno::Sequence
< OUString
> *pSeq
= 0;
3560 // OGuard aGuard( Application::GetSolarMutex() );
3563 static uno::Sequence
< OUString
> SvxShape_CircServices
;
3565 SvxServiceInfoHelper::addToSequence( SvxShape_CircServices
,14,
3566 sUNO_service_drawing_EllipseShape
,
3568 sUNO_service_drawing_Shape
,
3569 sUNO_service_drawing_FillProperties
,
3570 sUNO_service_drawing_LineProperties
,
3572 sUNO_service_drawing_Text
,
3573 sUNO_service_drawing_TextProperties
,
3574 sUNO_service_style_ParagraphProperties
,
3575 sUNO_service_style_ParagraphPropertiesComplex
,
3576 sUNO_service_style_ParagraphPropertiesAsian
,
3577 sUNO_service_style_CharacterProperties
,
3578 sUNO_service_style_CharacterPropertiesComplex
,
3579 sUNO_service_style_CharacterPropertiesAsian
,
3581 sUNO_service_drawing_ShadowProperties
,
3582 sUNO_service_drawing_RotationDescriptor
);
3584 pSeq
= &SvxShape_CircServices
;
3594 static uno::Sequence
< OUString
> *pSeq
= 0;
3597 // OGuard aGuard( Application::GetSolarMutex() );
3600 static uno::Sequence
< OUString
> SvxShape_PathServices
;
3601 SvxServiceInfoHelper::addToSequence( SvxShape_PathServices
,14,
3602 sUNO_service_drawing_PolyLineShape
,
3604 sUNO_service_drawing_Shape
,
3605 sUNO_service_drawing_LineProperties
,
3607 sUNO_service_drawing_PolyPolygonDescriptor
,
3609 sUNO_service_drawing_Text
,
3610 sUNO_service_drawing_TextProperties
,
3611 sUNO_service_style_ParagraphProperties
,
3612 sUNO_service_style_ParagraphPropertiesComplex
,
3613 sUNO_service_style_ParagraphPropertiesAsian
,
3614 sUNO_service_style_CharacterProperties
,
3615 sUNO_service_style_CharacterPropertiesComplex
,
3616 sUNO_service_style_CharacterPropertiesAsian
,
3618 sUNO_service_drawing_ShadowProperties
,
3619 sUNO_service_drawing_RotationDescriptor
);
3620 pSeq
= &SvxShape_PathServices
;
3629 static uno::Sequence
< OUString
> *pSeq
= 0;
3632 // OGuard aGuard( Application::GetSolarMutex() );
3635 static uno::Sequence
< OUString
> SvxShape_PolyServices
;
3636 SvxServiceInfoHelper::addToSequence( SvxShape_PolyServices
,15,
3637 sUNO_service_drawing_PolyPolygonShape
,
3639 sUNO_service_drawing_Shape
,
3640 sUNO_service_drawing_LineProperties
,
3641 sUNO_service_drawing_FillProperties
,
3643 sUNO_service_drawing_PolyPolygonDescriptor
,
3645 sUNO_service_drawing_Text
,
3646 sUNO_service_drawing_TextProperties
,
3647 sUNO_service_style_ParagraphProperties
,
3648 sUNO_service_style_ParagraphPropertiesComplex
,
3649 sUNO_service_style_ParagraphPropertiesAsian
,
3650 sUNO_service_style_CharacterProperties
,
3651 sUNO_service_style_CharacterPropertiesComplex
,
3652 sUNO_service_style_CharacterPropertiesAsian
,
3654 sUNO_service_drawing_ShadowProperties
,
3655 sUNO_service_drawing_RotationDescriptor
);
3657 pSeq
= &SvxShape_PolyServices
;
3666 static uno::Sequence
< OUString
> *pSeq
= 0;
3669 // OGuard aGuard( Application::GetSolarMutex() );
3672 static uno::Sequence
< OUString
> SvxShape_FreeLineServices
;
3674 SvxServiceInfoHelper::addToSequence( SvxShape_FreeLineServices
,15,
3675 sUNO_service_drawing_OpenBezierShape
,
3677 sUNO_service_drawing_Shape
,
3678 sUNO_service_drawing_LineProperties
,
3679 sUNO_service_drawing_FillProperties
,
3681 sUNO_service_drawing_PolyPolygonBezierDescriptor
,
3683 sUNO_service_drawing_Text
,
3684 sUNO_service_drawing_TextProperties
,
3685 sUNO_service_style_ParagraphProperties
,
3686 sUNO_service_style_ParagraphPropertiesComplex
,
3687 sUNO_service_style_ParagraphPropertiesAsian
,
3688 sUNO_service_style_CharacterProperties
,
3689 sUNO_service_style_CharacterPropertiesComplex
,
3690 sUNO_service_style_CharacterPropertiesAsian
,
3692 sUNO_service_drawing_ShadowProperties
,
3693 sUNO_service_drawing_RotationDescriptor
);
3695 pSeq
= &SvxShape_FreeLineServices
;
3705 static uno::Sequence
< OUString
> *pSeq
= 0;
3708 // OGuard aGuard( Application::GetSolarMutex() );
3711 static uno::Sequence
< OUString
> SvxShape_FreeFillServices
;
3712 SvxServiceInfoHelper::addToSequence( SvxShape_FreeFillServices
,15,
3713 sUNO_service_drawing_ClosedBezierShape
,
3715 sUNO_service_drawing_Shape
,
3716 sUNO_service_drawing_LineProperties
,
3717 sUNO_service_drawing_FillProperties
,
3719 sUNO_service_drawing_PolyPolygonBezierDescriptor
,
3721 sUNO_service_drawing_Text
,
3722 sUNO_service_drawing_TextProperties
,
3723 sUNO_service_style_ParagraphProperties
,
3724 sUNO_service_style_ParagraphPropertiesComplex
,
3725 sUNO_service_style_ParagraphPropertiesAsian
,
3726 sUNO_service_style_CharacterProperties
,
3727 sUNO_service_style_CharacterPropertiesComplex
,
3728 sUNO_service_style_CharacterPropertiesAsian
,
3730 sUNO_service_drawing_ShadowProperties
,
3731 sUNO_service_drawing_RotationDescriptor
);
3733 pSeq
= &SvxShape_FreeFillServices
;
3739 case OBJ_OUTLINETEXT
:
3743 static uno::Sequence
< OUString
> *pSeq
= 0;
3746 // OGuard aGuard( Application::GetSolarMutex() );
3749 static uno::Sequence
< OUString
> SvxShape_TextServices
;
3750 SvxServiceInfoHelper::addToSequence( SvxShape_TextServices
,14,
3751 sUNO_service_drawing_TextShape
,
3753 sUNO_service_drawing_Shape
,
3754 sUNO_service_drawing_FillProperties
,
3755 sUNO_service_drawing_LineProperties
,
3757 sUNO_service_drawing_Text
,
3758 sUNO_service_drawing_TextProperties
,
3759 sUNO_service_style_ParagraphProperties
,
3760 sUNO_service_style_ParagraphPropertiesComplex
,
3761 sUNO_service_style_ParagraphPropertiesAsian
,
3762 sUNO_service_style_CharacterProperties
,
3763 sUNO_service_style_CharacterPropertiesComplex
,
3764 sUNO_service_style_CharacterPropertiesAsian
,
3766 sUNO_service_drawing_ShadowProperties
,
3767 sUNO_service_drawing_RotationDescriptor
);
3769 pSeq
= &SvxShape_TextServices
;
3777 static uno::Sequence
< OUString
> *pSeq
= 0;
3780 // OGuard aGuard( Application::GetSolarMutex() );
3783 static uno::Sequence
< OUString
> SvxShape_GrafServices
;
3784 SvxServiceInfoHelper::addToSequence( SvxShape_GrafServices
, 12,
3785 sUNO_service_drawing_GraphicObjectShape
,
3787 sUNO_service_drawing_Shape
,
3789 sUNO_service_drawing_Text
,
3790 sUNO_service_drawing_TextProperties
,
3791 sUNO_service_style_ParagraphProperties
,
3792 sUNO_service_style_ParagraphPropertiesComplex
,
3793 sUNO_service_style_ParagraphPropertiesAsian
,
3794 sUNO_service_style_CharacterProperties
,
3795 sUNO_service_style_CharacterPropertiesComplex
,
3796 sUNO_service_style_CharacterPropertiesAsian
,
3798 sUNO_service_drawing_ShadowProperties
,
3799 sUNO_service_drawing_RotationDescriptor
);
3801 pSeq
= &SvxShape_GrafServices
;
3809 static uno::Sequence
< OUString
> *pSeq
= 0;
3812 // OGuard aGuard( Application::GetSolarMutex() );
3815 static uno::Sequence
< OUString
> SvxShape_Ole2Services
;
3817 SvxServiceInfoHelper::addToSequence( SvxShape_Ole2Services
, 2,
3818 sUNO_service_drawing_OLE2Shape
,
3819 sUNO_service_drawing_Shape
);
3821 pSeq
= &SvxShape_Ole2Services
;
3829 static uno::Sequence
< OUString
> *pSeq
= 0;
3832 // OGuard aGuard( Application::GetSolarMutex() );
3835 static uno::Sequence
< OUString
> SvxShape_CaptionServices
;
3837 SvxServiceInfoHelper::addToSequence( SvxShape_CaptionServices
,14,
3838 sUNO_service_drawing_CaptionShape
,
3840 sUNO_service_drawing_Shape
,
3841 sUNO_service_drawing_FillProperties
,
3842 sUNO_service_drawing_LineProperties
,
3844 sUNO_service_drawing_Text
,
3845 sUNO_service_drawing_TextProperties
,
3846 sUNO_service_style_ParagraphProperties
,
3847 sUNO_service_style_ParagraphPropertiesComplex
,
3848 sUNO_service_style_ParagraphPropertiesAsian
,
3849 sUNO_service_style_CharacterProperties
,
3850 sUNO_service_style_CharacterPropertiesComplex
,
3851 sUNO_service_style_CharacterPropertiesAsian
,
3853 sUNO_service_drawing_ShadowProperties
,
3854 sUNO_service_drawing_RotationDescriptor
);
3856 pSeq
= &SvxShape_CaptionServices
;
3865 static uno::Sequence
< OUString
> *pSeq
= 0;
3868 // OGuard aGuard( Application::GetSolarMutex() );
3871 static uno::Sequence
< OUString
> SvxShape_PageServices
;
3873 SvxServiceInfoHelper::addToSequence( SvxShape_PageServices
, 2,
3874 sUNO_service_drawing_PageShape
,
3875 sUNO_service_drawing_Shape
);
3877 pSeq
= &SvxShape_PageServices
;
3886 static uno::Sequence
< OUString
> *pSeq
= 0;
3889 // OGuard aGuard( Application::GetSolarMutex() );
3892 static uno::Sequence
< OUString
> SvxShape_MeasureServices
;
3893 SvxServiceInfoHelper::addToSequence( SvxShape_MeasureServices
,15,
3894 sUNO_service_drawing_MeasureShape
,
3896 sUNO_service_drawing_MeasureProperties
,
3898 sUNO_service_drawing_Shape
,
3899 sUNO_service_drawing_LineProperties
,
3901 sUNO_service_drawing_Text
,
3902 sUNO_service_drawing_TextProperties
,
3903 sUNO_service_style_ParagraphProperties
,
3904 sUNO_service_style_ParagraphPropertiesComplex
,
3905 sUNO_service_style_ParagraphPropertiesAsian
,
3906 sUNO_service_style_CharacterProperties
,
3907 sUNO_service_style_CharacterPropertiesComplex
,
3908 sUNO_service_style_CharacterPropertiesAsian
,
3910 sUNO_service_drawing_PolyPolygonDescriptor
,
3911 sUNO_service_drawing_ShadowProperties
,
3912 sUNO_service_drawing_RotationDescriptor
);
3914 pSeq
= &SvxShape_MeasureServices
;
3923 static uno::Sequence
< OUString
> *pSeq
= 0;
3926 // OGuard aGuard( Application::GetSolarMutex() );
3929 static uno::Sequence
< OUString
> SvxShape_FrameServices
;
3931 SvxServiceInfoHelper::addToSequence( SvxShape_FrameServices
, 2,
3932 sUNO_service_drawing_FrameShape
,
3933 sUNO_service_drawing_Shape
);
3935 pSeq
= &SvxShape_FrameServices
;
3944 static uno::Sequence
< OUString
> *pSeq
= 0;
3947 // OGuard _aGuard( Application::GetSolarMutex() );
3950 static uno::Sequence
< OUString
> SvxShape_UnoServices
;
3951 SvxServiceInfoHelper::addToSequence( SvxShape_UnoServices
, 2,
3952 sUNO_service_drawing_ControlShape
,
3953 sUNO_service_drawing_Shape
);
3955 pSeq
= &SvxShape_UnoServices
;
3963 static uno::Sequence
< OUString
> *pSeq
= 0;
3966 // OGuard aGuard( Application::GetSolarMutex() );
3969 static uno::Sequence
< OUString
> SvxShape_EdgeServices
;
3971 SvxServiceInfoHelper::addToSequence( SvxShape_EdgeServices
,15,
3972 sUNO_service_drawing_ConnectorShape
,
3973 sUNO_service_drawing_ConnectorProperties
,
3975 sUNO_service_drawing_Shape
,
3976 sUNO_service_drawing_LineProperties
,
3978 sUNO_service_drawing_Text
,
3979 sUNO_service_drawing_TextProperties
,
3980 sUNO_service_style_ParagraphProperties
,
3981 sUNO_service_style_ParagraphPropertiesComplex
,
3982 sUNO_service_style_ParagraphPropertiesAsian
,
3983 sUNO_service_style_CharacterProperties
,
3984 sUNO_service_style_CharacterPropertiesComplex
,
3985 sUNO_service_style_CharacterPropertiesAsian
,
3987 sUNO_service_drawing_PolyPolygonDescriptor
,
3988 sUNO_service_drawing_ShadowProperties
,
3989 sUNO_service_drawing_RotationDescriptor
);
3991 pSeq
= &SvxShape_EdgeServices
;
3998 static uno::Sequence
< OUString
> *pSeq
= 0;
4001 // OGuard aGuard( Application::GetSolarMutex() );
4004 static uno::Sequence
< OUString
> SvxShape_MediaServices
;
4006 SvxServiceInfoHelper::addToSequence( SvxShape_MediaServices
, 2,
4007 sUNO_service_drawing_MediaShape
,
4008 sUNO_service_drawing_Shape
);
4010 pSeq
= &SvxShape_MediaServices
;
4017 else if( mpObj
.is() && mpObj
->GetObjInventor() == FmFormInventor
)
4019 #if OSL_DEBUG_LEVEL > 0
4020 const UINT16 nIdent
= mpObj
->GetObjIdentifier();
4021 OSL_ENSURE( nIdent
== OBJ_UNO
, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
4023 static uno::Sequence
< OUString
> *pSeq
= 0;
4026 // OGuard aGuard( Application::GetSolarMutex() );
4029 static uno::Sequence
< OUString
> SvxShape_UnoServices
;
4030 SvxServiceInfoHelper::addToSequence( SvxShape_UnoServices
, 2,
4031 sUNO_service_drawing_ControlShape
,
4032 sUNO_service_drawing_Shape
);
4034 pSeq
= &SvxShape_UnoServices
;
4039 OSL_ENSURE( false, "SvxShape::_getSupportedServiceNames: could not determine object type!" );
4040 uno::Sequence
< OUString
> aSeq
;
4044 //----------------------------------------------------------------------
4045 sal_Bool SAL_CALL
SvxShape::supportsService( const OUString
& ServiceName
) throw ( uno::RuntimeException
)
4047 Sequence
< OUString
> SupportedServices( getSupportedServiceNames() );
4048 const ::rtl::OUString
* pArray
= SupportedServices
.getConstArray();
4049 const sal_Int32 nCount
= SupportedServices
.getLength();
4051 for( i
= 0; i
< nCount
; i
++ )
4052 if( *pArray
++ == ServiceName
)
4057 //----------------------------------------------------------------------
4059 // XGluePointsSupplier
4060 uno::Reference
< container::XIndexContainer
> SAL_CALL
SvxShape::getGluePoints()
4061 throw(uno::RuntimeException
)
4063 OGuard
aGuard( Application::GetSolarMutex() );
4064 uno::Reference
< container::XIndexContainer
> xGluePoints( mxGluePoints
);
4066 if( mpObj
.is() && !xGluePoints
.is() )
4068 uno::Reference
< container::XIndexContainer
> xNew( SvxUnoGluePointAccess_createInstance( mpObj
.get() ), uno::UNO_QUERY
);
4069 mxGluePoints
= xGluePoints
= xNew
;
4075 //----------------------------------------------------------------------
4078 uno::Reference
< uno::XInterface
> SAL_CALL
SvxShape::getParent( )
4079 throw(uno::RuntimeException
)
4081 OGuard
aGuard( Application::GetSolarMutex() );
4083 if( mpObj
.is() && mpObj
->GetObjList() )
4085 SdrObjList
* pObjList
= mpObj
->GetObjList();
4087 switch( pObjList
->GetListKind() )
4089 case SDROBJLIST_GROUPOBJ
:
4090 if( pObjList
->GetOwnerObj()->ISA( SdrObjGroup
) )
4091 return PTR_CAST( SdrObjGroup
, pObjList
->GetOwnerObj())->getUnoShape();
4092 else if( pObjList
->GetOwnerObj()->ISA( E3dScene
) )
4093 return PTR_CAST( E3dScene
, pObjList
->GetOwnerObj())->getUnoShape();
4095 case SDROBJLIST_DRAWPAGE
:
4096 case SDROBJLIST_MASTERPAGE
:
4097 return PTR_CAST( SdrPage
, pObjList
)->getUnoPage();
4099 DBG_ERROR( "SvxShape::getParent( ): unexpected SdrObjListKind" );
4104 uno::Reference
< uno::XInterface
> xParent
;
4108 //----------------------------------------------------------------------
4110 void SAL_CALL
SvxShape::setParent( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& )
4111 throw(lang::NoSupportException
, uno::RuntimeException
)
4113 throw lang::NoSupportException();
4116 //----------------------------------------------------------------------
4118 /** called from the XActionLockable interface methods on initial locking */
4119 void SvxShape::lock()
4123 //----------------------------------------------------------------------
4125 /** called from the XActionLockable interface methods on final unlock */
4126 void SvxShape::unlock()
4130 //----------------------------------------------------------------------
4133 sal_Bool SAL_CALL
SvxShape::isActionLocked( ) throw (::com::sun::star::uno::RuntimeException
)
4135 OGuard
aGuard( Application::GetSolarMutex() );
4137 return mnLockCount
!= 0;
4140 //----------------------------------------------------------------------
4142 void SAL_CALL
SvxShape::addActionLock( ) throw (::com::sun::star::uno::RuntimeException
)
4144 OGuard
aGuard( Application::GetSolarMutex() );
4146 DBG_ASSERT( mnLockCount
< 0xffff, "lock overflow in SvxShape!" );
4149 if( mnLockCount
== 1 )
4153 //----------------------------------------------------------------------
4155 void SAL_CALL
SvxShape::removeActionLock( ) throw (::com::sun::star::uno::RuntimeException
)
4157 OGuard
aGuard( Application::GetSolarMutex() );
4159 DBG_ASSERT( mnLockCount
> 0, "lock underflow in SvxShape!" );
4162 if( mnLockCount
== 0 )
4166 //----------------------------------------------------------------------
4168 void SAL_CALL
SvxShape::setActionLocks( sal_Int16 nLock
) throw (::com::sun::star::uno::RuntimeException
)
4170 OGuard
aGuard( Application::GetSolarMutex() );
4172 if( (mnLockCount
== 0) && (nLock
!= 0) )
4175 if( (mnLockCount
!= 0) && (nLock
== 0) )
4178 mnLockCount
= (sal_uInt16
)nLock
;
4181 //----------------------------------------------------------------------
4183 sal_Int16 SAL_CALL
SvxShape::resetActionLocks( ) throw (::com::sun::star::uno::RuntimeException
)
4185 OGuard
aGuard( Application::GetSolarMutex() );
4187 if( mnLockCount
!= 0 )
4190 sal_Int16 nOldLocks
= (sal_Int16
)mnLockCount
;
4196 //----------------------------------------------------------------------
4198 /** since polygon shapes can change theire kind during editing, we have
4200 Circle shapes also change theire kind, but theire all treated equal
4201 so no update is necessary.
4203 void SvxShape::updateShapeKind()
4205 switch( mpImpl
->mnObjId
)
4217 const sal_uInt32 nId
= mpObj
->GetObjIdentifier();
4219 if( nId
!= mpImpl
->mnObjId
)
4221 mpImpl
->mnObjId
= nId
;
4229 /***********************************************************************
4230 * class SvxShapeText *
4231 ***********************************************************************/
4232 SvxShapeText::SvxShapeText() throw ()
4233 : SvxShape(NULL
, aSvxMapProvider
.GetMap(SVXMAP_TEXT
), aSvxMapProvider
.GetPropertySet(SVXMAP_TEXT
) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
4237 //----------------------------------------------------------------------
4238 SvxShapeText::SvxShapeText( SdrObject
* pObject
) throw ()
4239 : SvxShape( pObject
, aSvxMapProvider
.GetMap(SVXMAP_TEXT
), aSvxMapProvider
.GetPropertySet(SVXMAP_TEXT
) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
4241 if( pObject
&& pObject
->GetModel() )
4242 SetEditSource( new SvxTextEditSource( pObject
, 0, static_cast< uno::XWeak
* >( this ) ) );
4245 //----------------------------------------------------------------------
4246 SvxShapeText::SvxShapeText( SdrObject
* pObject
, const SfxItemPropertyMapEntry
* pPropertyMap
, const SvxItemPropertySet
* pPropertySet
) throw ()
4247 : SvxShape( pObject
, pPropertyMap
, pPropertySet
), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
4249 if( pObject
&& pObject
->GetModel() )
4250 SetEditSource( new SvxTextEditSource( pObject
, 0, static_cast< uno::XWeak
* >( this ) ) );
4253 //----------------------------------------------------------------------
4254 SvxShapeText::~SvxShapeText() throw ()
4256 // check if only this instance is registered at the ranges
4257 DBG_ASSERT( (NULL
== GetEditSource()) || (GetEditSource()->getRanges().size()==1),
4258 "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
4261 void SvxShapeText::Create( SdrObject
* pNewObj
, SvxDrawPage
* pNewPage
)
4263 if( pNewObj
&& (NULL
== GetEditSource()))
4264 SetEditSource( new SvxTextEditSource( pNewObj
, 0, static_cast< uno::XWeak
* >(this) ) );
4266 SvxShape::Create( pNewObj
, pNewPage
);
4270 //----------------------------------------------------------------------
4271 uno::Any SAL_CALL
SvxShapeText::queryInterface( const uno::Type
& rType
)
4272 throw( uno::RuntimeException
)
4274 return SvxShape::queryInterface( rType
);
4277 //----------------------------------------------------------------------
4279 uno::Any SAL_CALL
SvxShapeText::queryAggregation( const uno::Type
& rType
)
4280 throw( uno::RuntimeException
)
4282 uno::Any
aAny( SvxShape::queryAggregation( rType
) );
4283 if( aAny
.hasValue() )
4286 return SvxUnoTextBase::queryAggregation( rType
);
4289 //----------------------------------------------------------------------
4291 void SAL_CALL
SvxShapeText::acquire() throw()
4293 SvxShape::acquire();
4296 //----------------------------------------------------------------------
4297 void SAL_CALL
SvxShapeText::release() throw()
4299 SvxShape::release();
4303 //----------------------------------------------------------------------
4304 OUString SAL_CALL
SvxShapeText::getImplementationName() throw( uno::RuntimeException
)
4306 static OUString
aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShapeText") );
4307 return aServiceName
;
4310 //----------------------------------------------------------------------
4311 uno::Sequence
< OUString
> SAL_CALL
SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException
)
4313 return SvxShape::getSupportedServiceNames();
4316 //----------------------------------------------------------------------
4317 sal_Bool SAL_CALL
SvxShapeText::supportsService( const OUString
& ServiceName
) throw ( uno::RuntimeException
)
4319 return SvxShape::supportsService(ServiceName
);
4323 //----------------------------------------------------------------------
4324 uno::Sequence
< uno::Type
> SAL_CALL
SvxShapeText::getTypes()
4325 throw( uno::RuntimeException
)
4327 return SvxShape::getTypes();
4330 sal_Int64 SAL_CALL
SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw(::com::sun::star::uno::RuntimeException
) \
4332 const sal_Int64 nReturn
= SvxShape::getSomething( rId
);
4336 return SvxUnoTextBase::getSomething( rId
);
4339 //----------------------------------------------------------------------
4340 uno::Sequence
< sal_Int8
> SAL_CALL
SvxShapeText::getImplementationId()
4341 throw( uno::RuntimeException
)
4343 static ::cppu::OImplementationId
* pID
= NULL
;
4347 // Ready for multithreading; get global mutex for first call of this method only! see before
4348 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
4350 // Control these pointer again ... it can be, that another instance will be faster then these!
4353 // Create a new static ID ...
4354 static ::cppu::OImplementationId
aID( sal_False
) ;
4355 // ... and set his address to static pointer!
4360 return pID
->getImplementationId() ;
4363 //----------------------------------------------------------------------
4365 /** called from the XActionLockable interface methods on initial locking */
4366 void SvxShapeText::lock()
4368 SvxTextEditSource
* pEditSource
= (SvxTextEditSource
*)GetEditSource();
4370 pEditSource
->lock();
4373 //----------------------------------------------------------------------
4375 /** called from the XActionLockable interface methods on final unlock */
4376 void SvxShapeText::unlock()
4378 SvxTextEditSource
* pEditSource
= (SvxTextEditSource
*)GetEditSource();
4380 pEditSource
->unlock();
4383 // ::com::sun::star::text::XTextRange
4384 uno::Reference
< text::XTextRange
> SAL_CALL
SvxShapeText::getStart() throw(uno::RuntimeException
)
4386 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
4387 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4389 ::GetSelection( maSelection
, pForwarder
);
4390 return SvxUnoTextBase::getStart();
4394 uno::Reference
< text::XTextRange
> SAL_CALL
SvxShapeText::getEnd() throw(uno::RuntimeException
)
4396 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
4397 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4399 ::GetSelection( maSelection
, pForwarder
);
4400 return SvxUnoTextBase::getEnd();
4403 OUString SAL_CALL
SvxShapeText::getString() throw(uno::RuntimeException
)
4405 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
4406 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4408 ::GetSelection( maSelection
, pForwarder
);
4409 return SvxUnoTextBase::getString();
4413 void SAL_CALL
SvxShapeText::setString( const OUString
& aString
) throw(uno::RuntimeException
)
4415 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
4416 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4418 ::GetSelection( maSelection
, pForwarder
);
4419 SvxUnoTextBase::setString( aString
);
4422 // overide these for special property handling in subcasses. Return true if property is handled
4423 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
)
4426 // since SdrTextObj::SetVerticalWriting exchanges
4427 // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
4428 // we have to set the textdirection here
4430 if( pProperty
->nWID
== SDRATTR_TEXTDIRECTION
)
4432 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( mpObj
.get() );
4435 com::sun::star::text::WritingMode eMode
;
4436 if( rValue
>>= eMode
)
4438 pTextObj
->SetVerticalWriting( eMode
== com::sun::star::text::WritingMode_TB_RL
);
4443 return SvxShape::setPropertyValueImpl( rName
, pProperty
, rValue
);
4446 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
)
4448 if( pProperty
->nWID
== SDRATTR_TEXTDIRECTION
)
4450 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( mpObj
.get() );
4451 if( pTextObj
&& pTextObj
->IsVerticalWriting() )
4452 rValue
<<= com::sun::star::text::WritingMode_TB_RL
;
4454 rValue
<<= com::sun::star::text::WritingMode_LR_TB
;
4458 return SvxShape::getPropertyValueImpl( rName
, pProperty
, rValue
);
4461 bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry
* pProperty
, ::com::sun::star::beans::PropertyState
& rState
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
4463 return SvxShape::getPropertyStateImpl( pProperty
, rState
);
4466 bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry
* pProperty
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
4468 return SvxShape::setPropertyToDefaultImpl( pProperty
);
4471 /***********************************************************************
4472 * class SvxShapeRect *
4473 ***********************************************************************/
4474 DBG_NAME(SvxShapeRect
)
4475 SvxShapeRect::SvxShapeRect( SdrObject
* pObj
) throw()
4476 : SvxShapeText( pObj
, aSvxMapProvider
.GetMap(SVXMAP_SHAPE
), aSvxMapProvider
.GetPropertySet(SVXMAP_SHAPE
) )
4479 DBG_CTOR(SvxShapeRect
,NULL
);
4482 SvxShapeRect::~SvxShapeRect() throw()
4484 DBG_DTOR(SvxShapeRect
,NULL
);
4487 uno::Any SAL_CALL
SvxShapeRect::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
)
4489 return SvxShapeText::queryInterface( rType
);
4492 uno::Any SAL_CALL
SvxShapeRect::queryAggregation( const uno::Type
& rType
) throw(uno::RuntimeException
)
4494 return SvxShapeText::queryAggregation( rType
);
4497 void SAL_CALL
SvxShapeRect::acquire() throw()
4499 OWeakAggObject::acquire();
4502 void SAL_CALL
SvxShapeRect::release() throw()
4504 OWeakAggObject::release();
4506 //----------------------------------------------------------------------
4508 //----------------------------------------------------------------------
4509 uno::Sequence
< OUString
> SvxShapeRect::getSupportedServiceNames(void) throw( uno::RuntimeException
)
4511 return SvxShape::getSupportedServiceNames();
4514 /** returns a StarOffice API wrapper for the given SdrObject */
4515 uno::Reference
< drawing::XShape
> GetXShapeForSdrObject( SdrObject
* pObj
) throw ()
4517 uno::Reference
< drawing::XShape
> xShape( pObj
->getUnoShape(), uno::UNO_QUERY
);
4521 /** returns the SdrObject from the given StarOffice API wrapper */
4522 SdrObject
* GetSdrObjectFromXShape( uno::Reference
< drawing::XShape
> xShape
) throw()
4524 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
4525 return pShape
? pShape
->GetSdrObject() : 0;
4528 //----------------------------------------------------------------------
4530 SdrObject
* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xInt
)
4532 SvxShape
* pSvxShape
= SvxShape::getImplementation( xInt
);
4533 return pSvxShape
? pSvxShape
->GetSdrObject() : 0;