1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cppuhelper/typeprovider.hxx>
21 #include <cppuhelper/supportsservice.hxx>
22 #include <com/sun/star/awt/XBitmap.hpp>
23 #include <com/sun/star/awt/Rectangle.hpp>
24 #include <com/sun/star/drawing/CircleKind.hpp>
25 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
26 #include <vcl/svapp.hxx>
27 #include <svl/itemprop.hxx>
28 #include <vcl/fltcall.hxx>
29 #include <osl/mutex.hxx>
30 #include <editeng/unotext.hxx>
31 #include <svx/svdobj.hxx>
32 #include <svx/svdoole2.hxx>
33 #include "svx/shapepropertynotifier.hxx"
34 #include <comphelper/extract.hxx>
35 #include <comphelper/scopeguard.hxx>
36 #include <comphelper/servicehelper.hxx>
37 #include <comphelper/serviceinfohelper.hxx>
38 #include <toolkit/helper/vclunohelper.hxx>
39 #include <vcl/gfxlink.hxx>
40 #include <vcl/virdev.hxx>
41 #include <sfx2/objsh.hxx>
42 #include <sfx2/viewsh.hxx>
43 #include "svx/svdopage.hxx"
44 #include "svx/xflbstit.hxx"
45 #include "svx/xflbmtit.hxx"
46 #include "svx/xlnstit.hxx"
47 #include "svx/xlnedit.hxx"
48 #include "svx/svdogrp.hxx"
49 #include "svx/scene3d.hxx"
50 #include "svx/svdmodel.hxx"
51 #include "svx/globl3d.hxx"
52 #include "svx/fmglob.hxx"
53 #include "svx/unopage.hxx"
54 #include "svx/view3d.hxx"
55 #include "svx/unoshape.hxx"
56 #include "svx/svxids.hrc"
57 #include "svx/unoshtxt.hxx"
58 #include "svx/svdpage.hxx"
59 #include "svx/unoshprp.hxx"
60 #include "svx/sxciaitm.hxx"
61 #include "svx/svdograf.hxx"
62 #include "svx/unoapi.hxx"
63 #include "svx/svdomeas.hxx"
64 #include "svx/svdpagv.hxx"
65 #include "svx/svdpool.hxx"
66 #include <tools/gen.hxx>
67 #include "svx/dialmgr.hxx"
68 #include "svx/dialogs.hrc"
69 #include "svx/svdocapt.hxx"
70 #include <svx/obj3d.hxx>
71 #include <tools/diagnose_ex.h>
72 #include "svx/xflftrit.hxx"
73 #include "svx/xtable.hxx"
74 #include "svx/xbtmpit.hxx"
75 #include "svx/xflgrit.hxx"
76 #include "svx/xflhtit.hxx"
77 #include "svx/xlndsit.hxx"
78 #include "svdglob.hxx"
79 #include "svx/svdstr.hrc"
80 #include "svx/unomaster.hxx"
81 #include <editeng/outlobj.hxx>
82 #include <basegfx/matrix/b2dhommatrix.hxx>
83 #include <basegfx/matrix/b2dhommatrixtools.hxx>
84 #include <basegfx/polygon/b2dpolypolygontools.hxx>
85 #include <basegfx/tools/unotools.hxx>
86 #include "gluepts.hxx"
87 #include "shapeimpl.hxx"
88 #include <sal/log.hxx>
92 #include "svx/lathe3d.hxx"
93 #include "svx/extrud3d.hxx"
95 #include <boost/bind.hpp>
96 #include <boost/scoped_ptr.hpp>
97 #include <vcl/wmf.hxx>
99 using namespace ::osl
;
100 using namespace ::cppu
;
101 using namespace ::com::sun::star
;
102 using namespace ::com::sun::star::uno
;
103 using namespace ::com::sun::star::lang
;
104 using namespace ::com::sun::star::container
;
105 using svx::PropertyValueProvider
;
106 using svx::IPropertyValueProvider
;
112 SvxShape
& mrAntiImpl
;
113 SfxItemSet
* mpItemSet
;
115 SvxShapeMaster
* mpMaster
;
116 bool mbHasSdrObjectOwnership
;
119 /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
120 * a SvxShape::Create() call is executed. It is then set to the created
121 * SdrObject so a multiple call to SvxShape::Create() with same SdrObject
124 ::tools::WeakReference
< SdrObject
> mpCreatedObj
;
127 ::cppu::OInterfaceContainerHelper maDisposeListeners
;
128 svx::PropertyChangeNotifier maPropertyNotifier
;
130 SvxShapeImpl( SvxShape
& _rAntiImpl
, ::osl::Mutex
& _rMutex
)
131 :mrAntiImpl( _rAntiImpl
)
135 ,mbHasSdrObjectOwnership( false )
136 ,mbDisposing( false )
138 ,maDisposeListeners( _rMutex
)
139 ,maPropertyNotifier( _rAntiImpl
, _rMutex
)
144 class ShapePositionProvider
: public PropertyValueProvider
147 ShapePositionProvider( const SvxShapeImpl
& _shapeImpl
)
148 :PropertyValueProvider( _shapeImpl
.mrAntiImpl
, "Position" )
153 virtual void getCurrentValue( Any
& _out_rCurrentValue
) const SAL_OVERRIDE
155 _out_rCurrentValue
<<= static_cast< SvxShape
& >( getContext() ).getPosition();
160 class ShapeSizeProvider
: public PropertyValueProvider
163 ShapeSizeProvider( const SvxShapeImpl
& _shapeImpl
)
164 :PropertyValueProvider( _shapeImpl
.mrAntiImpl
, "Size" )
169 virtual void getCurrentValue( Any
& _out_rCurrentValue
) const SAL_OVERRIDE
171 _out_rCurrentValue
<<= static_cast< SvxShape
& >( getContext() ).getSize();
175 SvxShape::SvxShape( SdrObject
* pObject
) throw( uno::RuntimeException
)
177 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
178 , mbIsMultiPropertyCall(false)
179 , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE
, SdrObject::GetGlobalDrawObjectItemPool()))
180 , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE
))
189 SvxShape::SvxShape( SdrObject
* pObject
, const SfxItemPropertyMapEntry
* pEntries
, const SvxItemPropertySet
* pPropertySet
) throw( uno::RuntimeException
)
191 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
192 , mbIsMultiPropertyCall(false)
193 , mpPropSet(pPropertySet
)
194 , maPropMapEntries(pEntries
)
203 SvxShape::SvxShape() throw( uno::RuntimeException
)
205 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
206 , mbIsMultiPropertyCall(false)
207 , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE
, SdrObject::GetGlobalDrawObjectItemPool()))
208 , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE
))
217 SvxShape::~SvxShape() throw()
219 ::SolarMutexGuard aGuard
;
221 DBG_ASSERT( mnLockCount
== 0, "Locked shape was disposed!" );
224 EndListening( *mpModel
);
226 if ( mpImpl
->mpMaster
)
227 mpImpl
->mpMaster
->dispose();
230 mpObj
->setUnoShape(NULL
);
232 if( HasSdrObjectOwnership() && mpObj
.is() )
234 mpImpl
->mbHasSdrObjectOwnership
= false;
235 SdrObject
* pObject
= mpObj
.get();
236 SdrObject::Free( pObject
);
239 delete mpImpl
, mpImpl
= NULL
;
241 EndListeningAll(); // call explictily within SolarMutexGuard
246 void SvxShape::TakeSdrObjectOwnership()
248 mpImpl
->mbHasSdrObjectOwnership
= true;
253 bool SvxShape::HasSdrObjectOwnership() const
255 if ( !mpImpl
->mbHasSdrObjectOwnership
)
258 OSL_ENSURE( mpObj
.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
264 void SvxShape::setShapeKind( sal_uInt32 nKind
)
266 mpImpl
->mnObjId
= nKind
;
271 sal_uInt32
SvxShape::getShapeKind() const
273 return mpImpl
->mnObjId
;
278 void SvxShape::setMaster( SvxShapeMaster
* pMaster
)
280 mpImpl
->mpMaster
= pMaster
;
285 uno::Any SAL_CALL
SvxShape::queryAggregation( const uno::Type
& rType
) throw (uno::RuntimeException
, std::exception
)
287 if( mpImpl
->mpMaster
)
290 if( mpImpl
->mpMaster
->queryAggregation( rType
, aAny
) )
294 return SvxShape_UnoImplHelper::queryAggregation(rType
);
299 class theSvxShapeUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theSvxShapeUnoTunnelId
> {};
302 const ::com::sun::star::uno::Sequence
< sal_Int8
> & SvxShape::getUnoTunnelId() throw()
304 return theSvxShapeUnoTunnelId::get().getSeq();
308 SvxShape
* SvxShape::getImplementation( const uno::Reference
< uno::XInterface
>& xInt
)
310 uno::Reference
< lang::XUnoTunnel
> xUT( xInt
, ::com::sun::star::uno::UNO_QUERY
);
312 return reinterpret_cast<SvxShape
*>(sal::static_int_cast
<sal_uIntPtr
>(xUT
->getSomething( SvxShape::getUnoTunnelId())));
318 sal_Int64 SAL_CALL
SvxShape::getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) \
320 if( rId
.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId
.getConstArray(), 16 ) )
322 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_uIntPtr
>(this));
331 svx::PropertyChangeNotifier
& SvxShape::getShapePropertyChangeNotifier()
333 return mpImpl
->maPropertyNotifier
;
337 void SvxShape::impl_construct()
339 mpImpl
->maPropertyNotifier
.registerProvider( svx::eShapePosition
,
340 svx::PPropertyValueProvider( new ShapePositionProvider( *mpImpl
) ) );
341 mpImpl
->maPropertyNotifier
.registerProvider( svx::eShapeSize
,
342 svx::PPropertyValueProvider( new ShapeSizeProvider( *mpImpl
) ) );
345 impl_initFromSdrObject();
349 void SvxShape::impl_initFromSdrObject()
351 DBG_TESTSOLARMUTEX();
352 OSL_PRECOND( mpObj
.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
356 osl_atomic_increment( &m_refCount
);
358 mpObj
->setUnoShape(*this);
360 osl_atomic_decrement( &m_refCount
);
362 mpModel
= mpObj
->GetModel();
365 // Do not simply return when no model but do the type corrections
369 StartListening( *mpModel
);
372 const sal_uInt32 nInventor
= mpObj
->GetObjInventor();
374 // is it one of ours (svx) ?
375 if( nInventor
== SdrInventor
|| nInventor
== E3dInventor
|| nInventor
== FmFormInventor
)
377 if(nInventor
== FmFormInventor
)
379 mpImpl
->mnObjId
= OBJ_UNO
;
383 mpImpl
->mnObjId
= mpObj
->GetObjIdentifier();
384 if( nInventor
== E3dInventor
)
385 mpImpl
->mnObjId
|= E3D_INVENTOR_FLAG
;
388 switch(mpImpl
->mnObjId
)
390 case OBJ_CCUT
: // segment of circle
391 case OBJ_CARC
: // arc of circle
392 case OBJ_SECT
: // sector
393 mpImpl
->mnObjId
= OBJ_CIRC
;
396 case E3D_SCENE_ID
| E3D_INVENTOR_FLAG
:
397 mpImpl
->mnObjId
= E3D_POLYSCENE_ID
| E3D_INVENTOR_FLAG
;
404 void SvxShape::Create( SdrObject
* pNewObj
, SvxDrawPage
* /*pNewPage*/ )
406 DBG_TESTSOLARMUTEX();
408 OSL_PRECOND( pNewObj
, "SvxShape::Create: invalid new object!" );
412 SdrObject
* pCreatedObj
= mpImpl
->mpCreatedObj
.get();
413 OSL_ENSURE( ( pCreatedObj
== NULL
) || ( pCreatedObj
== pNewObj
),
414 "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
416 // Correct condition (#i52126#)
417 if ( pCreatedObj
!= pNewObj
)
419 DBG_ASSERT( pNewObj
->GetModel(), "no model for SdrObject?" );
420 // Correct condition (#i52126#)
421 mpImpl
->mpCreatedObj
= pNewObj
;
423 if( mpObj
.is() && mpObj
->GetModel() )
425 EndListening( *mpObj
->GetModel() );
428 mpObj
.reset( pNewObj
);
430 OSL_ENSURE( !mbIsMultiPropertyCall
, "SvxShape::Create: hmm?" );
431 // this was previously set in impl_initFromSdrObject, but I think it was superfluous
432 // (it definitely was in the other context where it was called, but I strongly suppose
433 // it was also superfluous when called from here)
434 impl_initFromSdrObject();
436 ObtainSettingsFromPropertySet( *mpPropSet
);
439 SdrObjUserCall
* pUser
= mpObj
->GetUserCall();
440 mpObj
->SetUserCall(NULL
);
442 setPosition( maPosition
);
445 // restore user call after we set the initial size
446 mpObj
->SetUserCall( pUser
);
448 // if this shape was already named, use this name
449 if( !maShapeName
.isEmpty() )
451 mpObj
->SetName( maShapeName
);
459 void SvxShape::ChangeModel( SdrModel
* pNewModel
)
461 DBG_TESTSOLARMUTEX();
462 if( mpObj
.is() && mpObj
->GetModel() )
464 if( mpObj
->GetModel() != pNewModel
)
466 EndListening( *mpObj
->GetModel() );
470 // Always listen to new model (#i52126#)
473 StartListening( *pNewModel
);
476 // HACK #i53696# ChangeModel should be virtual, but it isn't. can't change that for 2.0.1
477 SvxShapeText
* pShapeText
= dynamic_cast< SvxShapeText
* >( this );
480 SvxTextEditSource
* pTextEditSource
= dynamic_cast< SvxTextEditSource
* >( pShapeText
->GetEditSource() );
481 if( pTextEditSource
)
482 pTextEditSource
->ChangeModel( pNewModel
);
487 if( mpImpl
->mpMaster
)
488 mpImpl
->mpMaster
->modelChanged( pNewModel
);
493 void SvxShape::ForceMetricToItemPoolMetric(Pair
& rPoint
) const throw()
495 DBG_TESTSOLARMUTEX();
498 SfxMapUnit eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
499 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
503 case SFX_MAPUNIT_TWIP
:
505 rPoint
.A() = MM_TO_TWIPS(rPoint
.A());
506 rPoint
.B() = MM_TO_TWIPS(rPoint
.B());
511 OSL_FAIL("AW: Missing unit translation to PoolMetric!");
518 // Reintroduction of fix for issue i59051 (#i108851#)
519 void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon
& rPolyPolygon
) const throw()
521 DBG_TESTSOLARMUTEX();
524 SfxMapUnit eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
525 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
529 case SFX_MAPUNIT_TWIP
:
531 basegfx::B2DHomMatrix aTransform
;
532 const double fMMToTWIPS(72.0 / 127.0);
534 aTransform
.scale(fMMToTWIPS
, fMMToTWIPS
);
535 rPolyPolygon
.transform(aTransform
);
540 OSL_FAIL("Missing unit translation to PoolMetric!");
548 void SvxShape::ForceMetricTo100th_mm(Pair
& rPoint
) const throw()
550 DBG_TESTSOLARMUTEX();
551 SfxMapUnit eMapUnit
= SFX_MAPUNIT_100TH_MM
;
554 eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
555 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
559 case SFX_MAPUNIT_TWIP
:
561 rPoint
.A() = TWIPS_TO_MM(rPoint
.A());
562 rPoint
.B() = TWIPS_TO_MM(rPoint
.B());
567 OSL_FAIL("AW: Missing unit translation to 100th mm!");
574 // Reintroduction of fix for issue i59051 (#i108851#)
575 void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon
& rPolyPolygon
) const throw()
577 DBG_TESTSOLARMUTEX();
578 SfxMapUnit eMapUnit
= SFX_MAPUNIT_100TH_MM
;
581 eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
582 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
586 case SFX_MAPUNIT_TWIP
:
588 basegfx::B2DHomMatrix aTransform
;
589 const double fTWIPSToMM(127.0 / 72.0);
590 aTransform
.scale(fTWIPSToMM
, fTWIPSToMM
);
591 rPolyPolygon
.transform(aTransform
);
596 OSL_FAIL("Missing unit translation to 100th mm!");
604 void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet
& rPropSet
,
605 SfxItemSet
& rSet
, uno::Reference
< beans::XPropertySet
> xSet
, const SfxItemPropertyMap
* pMap
)
607 if(rPropSet
.AreThereOwnUsrAnys())
609 const SfxItemPropertyMap
& rSrc
= rPropSet
.getPropertyMap();
610 PropertyEntryVector_t aSrcPropVector
= rSrc
.getPropertyEntries();
611 PropertyEntryVector_t::const_iterator aSrcIt
= aSrcPropVector
.begin();
612 while(aSrcIt
!= aSrcPropVector
.end())
616 uno::Any
* pUsrAny
= rPropSet
.GetUsrAnyForID(aSrcIt
->nWID
);
619 // search for equivalent entry in pDst
620 const SfxItemPropertySimpleEntry
* pEntry
= pMap
->getByName( aSrcIt
->sName
);
624 if(pEntry
->nWID
>= OWN_ATTR_VALUE_START
&& pEntry
->nWID
<= OWN_ATTR_VALUE_END
)
626 // special ID in PropertySet, can only be set
627 // directly at the object
628 xSet
->setPropertyValue( aSrcIt
->sName
, *pUsrAny
);
632 if(SfxItemPool::IsWhich(pEntry
->nWID
))
633 rSet
.Put(rSet
.GetPool()->GetDefaultItem(pEntry
->nWID
));
635 SvxItemPropertySet_setPropertyValue(pEntry
, *pUsrAny
, rSet
);
644 const_cast< SvxItemPropertySet
& >(rPropSet
).ClearAllUsrAny();
649 void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet
& rPropSet
)
651 DBG_TESTSOLARMUTEX();
652 if(mpObj
.is() && rPropSet
.AreThereOwnUsrAnys() && mpModel
)
654 SfxItemSet
aSet( mpModel
->GetItemPool(), SDRATTR_START
, SDRATTR_END
);
655 Reference
< beans::XPropertySet
> xShape( (OWeakObject
*)this, UNO_QUERY
);
656 SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet
, aSet
, xShape
, &mpPropSet
->getPropertyMap() );
658 mpObj
->SetMergedItemSetAndBroadcast(aSet
);
660 mpObj
->ApplyNotPersistAttr( aSet
);
664 uno::Any
SvxShape::GetBitmap( bool bMetaFile
/* = false */ ) const
665 throw (uno::RuntimeException
, std::exception
)
667 DBG_TESTSOLARMUTEX();
670 if( !mpObj
.is() || mpModel
== NULL
|| !mpObj
->IsInserted() || NULL
== mpObj
->GetPage() )
673 ScopedVclPtrInstance
< VirtualDevice
> pVDev
;
674 pVDev
->SetMapMode(MapMode(MAP_100TH_MM
));
676 SdrModel
* pModel
= mpObj
->GetModel();
677 SdrPage
* pPage
= mpObj
->GetPage();
679 boost::scoped_ptr
<E3dView
> pView(new E3dView( pModel
, pVDev
.get() ));
680 pView
->hideMarkHandles();
681 SdrPageView
* pPageView
= pView
->ShowSdrPage(pPage
);
683 SdrObject
*pTempObj
= mpObj
.get();
684 pView
->MarkObj(pTempObj
,pPageView
);
686 Rectangle
aRect(pTempObj
->GetCurrentBoundRect());
688 Size
aSize(aRect
.GetSize());
690 GDIMetaFile
aMtf( pView
->GetMarkedObjMetaFile() );
693 SvMemoryStream
aDestStrm( 65535, 65535 );
694 ConvertGDIMetaFileToWMF( aMtf
, aDestStrm
, NULL
, false );
695 const uno::Sequence
<sal_Int8
> aSeq(
696 static_cast< const sal_Int8
* >(aDestStrm
.GetData()),
697 aDestStrm
.GetEndOfData());
698 aAny
.setValue( &aSeq
, cppu::UnoType
<uno::Sequence
< sal_Int8
>>::get() );
702 Graphic
aGraph(aMtf
);
703 aGraph
.SetPrefSize(aSize
);
704 aGraph
.SetPrefMapMode(MAP_100TH_MM
);
706 Reference
< awt::XBitmap
> xBmp( aGraph
.GetXGraphic(), UNO_QUERY
);
715 uno::Sequence
< uno::Type
> SAL_CALL
SvxShape::getTypes()
716 throw (uno::RuntimeException
, std::exception
)
718 if( mpImpl
->mpMaster
)
720 return mpImpl
->mpMaster
->getTypes();
730 uno::Sequence
< uno::Type
> SAL_CALL
SvxShape::_getTypes()
731 throw(uno::RuntimeException
)
733 switch( mpImpl
->mnObjId
)
735 // shapes without text
738 case OBJ_OLE2_PLUGIN
:
739 case OBJ_OLE2_APPLET
:
740 case E3D_CUBEOBJ_ID
|E3D_INVENTOR_FLAG
:
741 case E3D_SPHEREOBJ_ID
|E3D_INVENTOR_FLAG
:
742 case E3D_LATHEOBJ_ID
|E3D_INVENTOR_FLAG
:
743 case E3D_EXTRUDEOBJ_ID
|E3D_INVENTOR_FLAG
:
744 case E3D_POLYGONOBJ_ID
|E3D_INVENTOR_FLAG
:
747 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
749 if( aTypeSequence
.getLength() == 0 )
751 // Ready for multithreading; get global mutex for first call of this method only! see before
752 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
754 // Control these pointer again ... it can be, that another instance will be faster then these!
755 if( aTypeSequence
.getLength() == 0 )
757 aTypeSequence
.realloc( 12 );
758 uno::Type
* pTypes
= aTypeSequence
.getArray();
760 *pTypes
++ = cppu::UnoType
<drawing::XShape
>::get();
761 *pTypes
++ = cppu::UnoType
<lang::XComponent
>::get();
762 *pTypes
++ = cppu::UnoType
<beans::XPropertySet
>::get();
763 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertySet
>::get();
764 *pTypes
++ = cppu::UnoType
<beans::XPropertyState
>::get();
765 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertyStates
>::get();
766 *pTypes
++ = cppu::UnoType
<drawing::XGluePointsSupplier
>::get();
767 *pTypes
++ = cppu::UnoType
<container::XChild
>::get();
768 *pTypes
++ = cppu::UnoType
<lang::XServiceInfo
>::get();
769 *pTypes
++ = cppu::UnoType
<lang::XTypeProvider
>::get();
770 *pTypes
++ = cppu::UnoType
<lang::XUnoTunnel
>::get();
771 *pTypes
++ = cppu::UnoType
<container::XNamed
>::get();
774 return aTypeSequence
;
779 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
781 if( aTypeSequence
.getLength() == 0 )
783 // Ready for multithreading; get global mutex for first call of this method only! see before
784 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
786 // Control these pointer again ... it can be, that another instance will be faster then these!
787 if( aTypeSequence
.getLength() == 0 )
789 aTypeSequence
.realloc( 14 );
790 uno::Type
* pTypes
= aTypeSequence
.getArray();
792 *pTypes
++ = cppu::UnoType
<drawing::XShape
>::get();
793 *pTypes
++ = cppu::UnoType
<lang::XComponent
>::get();
794 *pTypes
++ = cppu::UnoType
<beans::XPropertySet
>::get();
795 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertySet
>::get();
796 *pTypes
++ = cppu::UnoType
<beans::XPropertyState
>::get();
797 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertyStates
>::get();
798 *pTypes
++ = cppu::UnoType
<drawing::XGluePointsSupplier
>::get();
799 *pTypes
++ = cppu::UnoType
<container::XChild
>::get();
800 *pTypes
++ = cppu::UnoType
<lang::XServiceInfo
>::get();
801 *pTypes
++ = cppu::UnoType
<lang::XTypeProvider
>::get();
802 *pTypes
++ = cppu::UnoType
<lang::XUnoTunnel
>::get();
803 *pTypes
++ = cppu::UnoType
<container::XNamed
>::get();
804 *pTypes
++ = cppu::UnoType
<drawing::XShapes
>::get();
805 *pTypes
++ = cppu::UnoType
<drawing::XShapeGroup
>::get();
808 return aTypeSequence
;
813 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
815 if( aTypeSequence
.getLength() == 0 )
817 // Ready for multithreading; get global mutex for first call of this method only! see before
818 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
820 // Control these pointer again ... it can be, that another instance will be faster then these!
821 if( aTypeSequence
.getLength() == 0 )
823 aTypeSequence
.realloc( 17 );
824 uno::Type
* pTypes
= aTypeSequence
.getArray();
826 *pTypes
++ = cppu::UnoType
<drawing::XShape
>::get();
827 *pTypes
++ = cppu::UnoType
<lang::XComponent
>::get();
828 *pTypes
++ = cppu::UnoType
<beans::XPropertySet
>::get();
829 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertySet
>::get();
830 *pTypes
++ = cppu::UnoType
<beans::XPropertyState
>::get();
831 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertyStates
>::get();
832 *pTypes
++ = cppu::UnoType
<drawing::XGluePointsSupplier
>::get();
833 *pTypes
++ = cppu::UnoType
<container::XChild
>::get();
834 *pTypes
++ = cppu::UnoType
<lang::XServiceInfo
>::get();
835 *pTypes
++ = cppu::UnoType
<lang::XTypeProvider
>::get();
836 *pTypes
++ = cppu::UnoType
<lang::XUnoTunnel
>::get();
837 *pTypes
++ = cppu::UnoType
<container::XNamed
>::get();
838 *pTypes
++ = cppu::UnoType
<drawing::XConnectorShape
>::get();
839 // from SvxUnoTextBase::getTypes()
840 *pTypes
++ = cppu::UnoType
<text::XTextAppend
>::get();
841 *pTypes
++ = cppu::UnoType
<text::XTextCopy
>::get();
842 *pTypes
++ = cppu::UnoType
<container::XEnumerationAccess
>::get();
843 *pTypes
++ = cppu::UnoType
<text::XTextRangeMover
>::get();
846 return aTypeSequence
;
851 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
853 if( aTypeSequence
.getLength() == 0 )
855 // Ready for multithreading; get global mutex for first call of this method only! see before
856 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
858 // Control these pointer again ... it can be, that another instance will be faster then these!
859 if( aTypeSequence
.getLength() == 0 )
861 aTypeSequence
.realloc( 13 );
862 uno::Type
* pTypes
= aTypeSequence
.getArray();
864 *pTypes
++ = cppu::UnoType
<drawing::XShape
>::get();
865 *pTypes
++ = cppu::UnoType
<lang::XComponent
>::get();
866 *pTypes
++ = cppu::UnoType
<beans::XPropertySet
>::get();
867 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertySet
>::get();
868 *pTypes
++ = cppu::UnoType
<beans::XPropertyState
>::get();
869 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertyStates
>::get();
870 *pTypes
++ = cppu::UnoType
<drawing::XGluePointsSupplier
>::get();
871 *pTypes
++ = cppu::UnoType
<container::XChild
>::get();
872 *pTypes
++ = cppu::UnoType
<lang::XServiceInfo
>::get();
873 *pTypes
++ = cppu::UnoType
<lang::XTypeProvider
>::get();
874 *pTypes
++ = cppu::UnoType
<lang::XUnoTunnel
>::get();
875 *pTypes
++ = cppu::UnoType
<container::XNamed
>::get();
876 *pTypes
++ = cppu::UnoType
<drawing::XControlShape
>::get();
879 return aTypeSequence
;
882 case E3D_POLYSCENE_ID
|E3D_INVENTOR_FLAG
:
884 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
886 if( aTypeSequence
.getLength() == 0 )
888 // Ready for multithreading; get global mutex for first call of this method only! see before
889 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
891 // Control these pointer again ... it can be, that another instance will be faster then these!
892 if( aTypeSequence
.getLength() == 0 )
894 aTypeSequence
.realloc( 13 );
895 uno::Type
* pTypes
= aTypeSequence
.getArray();
897 *pTypes
++ = cppu::UnoType
<drawing::XShape
>::get();
898 *pTypes
++ = cppu::UnoType
<lang::XComponent
>::get();
899 *pTypes
++ = cppu::UnoType
<beans::XPropertySet
>::get();
900 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertySet
>::get();
901 *pTypes
++ = cppu::UnoType
<beans::XPropertyState
>::get();
902 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertyStates
>::get();
903 *pTypes
++ = cppu::UnoType
<drawing::XGluePointsSupplier
>::get();
904 *pTypes
++ = cppu::UnoType
<container::XChild
>::get();
905 *pTypes
++ = cppu::UnoType
<lang::XServiceInfo
>::get();
906 *pTypes
++ = cppu::UnoType
<lang::XTypeProvider
>::get();
907 *pTypes
++ = cppu::UnoType
<lang::XUnoTunnel
>::get();
908 *pTypes
++ = cppu::UnoType
<container::XNamed
>::get();
909 *pTypes
++ = cppu::UnoType
<drawing::XShapes
>::get();
912 return aTypeSequence
;
914 case OBJ_CUSTOMSHAPE
:
916 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
918 if( aTypeSequence
.getLength() == 0 )
920 // Ready for multithreading; get global mutex for first call of this method only! see before
921 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
923 // Control these pointer again ... it can be, that another instance will be faster then these!
924 if( aTypeSequence
.getLength() == 0 )
926 aTypeSequence
.realloc( 16 );
927 uno::Type
* pTypes
= aTypeSequence
.getArray();
929 *pTypes
++ = cppu::UnoType
<drawing::XShape
>::get();
930 *pTypes
++ = cppu::UnoType
<lang::XComponent
>::get();
931 *pTypes
++ = cppu::UnoType
<beans::XPropertySet
>::get();
932 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertySet
>::get();
933 *pTypes
++ = cppu::UnoType
<beans::XPropertyState
>::get();
934 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertyStates
>::get();
935 *pTypes
++ = cppu::UnoType
<drawing::XGluePointsSupplier
>::get();
936 *pTypes
++ = cppu::UnoType
<container::XChild
>::get();
937 *pTypes
++ = cppu::UnoType
<lang::XServiceInfo
>::get();
938 *pTypes
++ = cppu::UnoType
<lang::XTypeProvider
>::get();
939 *pTypes
++ = cppu::UnoType
<lang::XUnoTunnel
>::get();
940 *pTypes
++ = cppu::UnoType
<container::XNamed
>::get();
941 // from SvxUnoTextBase::getTypes()
942 *pTypes
++ = cppu::UnoType
<text::XText
>::get();
943 *pTypes
++ = cppu::UnoType
<container::XEnumerationAccess
>::get();
944 *pTypes
++ = cppu::UnoType
<text::XTextRangeMover
>::get();
945 *pTypes
++ = cppu::UnoType
<drawing::XEnhancedCustomShapeDefaulter
>::get();
948 return aTypeSequence
;
967 case OBJ_OLE2
: // #i118485# Moved to shapes with text
970 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
972 if( aTypeSequence
.getLength() == 0 )
974 // Ready for multithreading; get global mutex for first call of this method only! see before
975 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
977 // Control these pointer again ... it can be, that another instance will be faster then these!
978 if( aTypeSequence
.getLength() == 0 )
980 aTypeSequence
.realloc( 16 );
981 uno::Type
* pTypes
= aTypeSequence
.getArray();
983 *pTypes
++ = cppu::UnoType
<drawing::XShape
>::get();
984 *pTypes
++ = cppu::UnoType
<lang::XComponent
>::get();
985 *pTypes
++ = cppu::UnoType
<beans::XPropertySet
>::get();
986 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertySet
>::get();
987 *pTypes
++ = cppu::UnoType
<beans::XPropertyState
>::get();
988 *pTypes
++ = cppu::UnoType
<beans::XMultiPropertyStates
>::get();
989 *pTypes
++ = cppu::UnoType
<drawing::XGluePointsSupplier
>::get();
990 *pTypes
++ = cppu::UnoType
<container::XChild
>::get();
991 *pTypes
++ = cppu::UnoType
<lang::XServiceInfo
>::get();
992 *pTypes
++ = cppu::UnoType
<lang::XTypeProvider
>::get();
993 *pTypes
++ = cppu::UnoType
<lang::XUnoTunnel
>::get();
994 *pTypes
++ = cppu::UnoType
<container::XNamed
>::get();
995 // from SvxUnoTextBase::getTypes()
996 *pTypes
++ = cppu::UnoType
<text::XTextAppend
>::get();
997 *pTypes
++ = cppu::UnoType
<text::XTextCopy
>::get();
998 *pTypes
++ = cppu::UnoType
<container::XEnumerationAccess
>::get();
999 *pTypes
++ = cppu::UnoType
<text::XTextRangeMover
>::get();
1002 return aTypeSequence
;
1009 uno::Sequence
< sal_Int8
> SAL_CALL
SvxShape::getImplementationId()
1010 throw (uno::RuntimeException
, std::exception
)
1012 return css::uno::Sequence
<sal_Int8
>();
1015 void SvxShape::Notify( SfxBroadcaster
&, const SfxHint
& rHint
) throw()
1017 DBG_TESTSOLARMUTEX();
1021 // #i55919# HINT_OBJCHG is only interesting if it's for this object
1023 const SdrHint
* pSdrHint
= dynamic_cast<const SdrHint
*>(&rHint
);
1024 if (!pSdrHint
|| ( /* (pSdrHint->GetKind() != HINT_OBJREMOVED) && */
1025 (pSdrHint
->GetKind() != HINT_MODELCLEARED
) &&
1026 // #110094#-9 (pSdrHint->GetKind() != HINT_OBJLISTCLEAR) &&
1027 ((pSdrHint
->GetKind() != HINT_OBJCHG
|| pSdrHint
->GetObject() != mpObj
.get() ))))
1030 uno::Reference
< uno::XInterface
> xSelf( mpObj
->getWeakUnoShape() );
1033 mpObj
.reset( NULL
);
1037 bool bClearMe
= false;
1039 switch( pSdrHint
->GetKind() )
1046 case HINT_MODELCLEARED
:
1058 if( !HasSdrObjectOwnership() ) {
1060 mpObj
->setUnoShape( NULL
);
1061 mpObj
.reset( NULL
);
1063 if ( !mpImpl
->mbDisposing
)
1071 // The "*LogicRectHack" functions also existed in sch, and those
1072 // duplicate symbols cause Bad Things To Happen (TM) #i9462#.
1073 // Prefixing with 'svx' and marking static to make sure name collisions
1076 static bool svx_needLogicRectHack( SdrObject
* pObj
)
1078 if( pObj
->GetObjInventor() == SdrInventor
)
1080 switch(pObj
->GetObjIdentifier())
1104 static Rectangle
svx_getLogicRectHack( SdrObject
* pObj
)
1106 if(svx_needLogicRectHack(pObj
))
1108 return pObj
->GetSnapRect();
1112 return pObj
->GetLogicRect();
1118 static void svx_setLogicRectHack( SdrObject
* pObj
, const Rectangle
& rRect
)
1120 if(svx_needLogicRectHack(pObj
))
1122 pObj
->SetSnapRect( rRect
);
1126 pObj
->SetLogicRect( rRect
);
1132 awt::Point SAL_CALL
SvxShape::getPosition() throw(uno::RuntimeException
, std::exception
)
1134 ::SolarMutexGuard aGuard
;
1136 if( mpObj
.is() && mpModel
)
1138 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1139 Point
aPt( aRect
.Left(), aRect
.Top() );
1141 // Position is relativ to anchor, so recalc to absolut position
1142 if( mpModel
->IsWriter() )
1143 aPt
-= mpObj
->GetAnchorPos();
1145 ForceMetricTo100th_mm(aPt
);
1146 return ::com::sun::star::awt::Point( aPt
.X(), aPt
.Y() );
1155 void SAL_CALL
SvxShape::setPosition( const awt::Point
& Position
) throw(uno::RuntimeException
, std::exception
)
1157 ::SolarMutexGuard aGuard
;
1159 if( mpObj
.is() && mpModel
)
1161 // do NOT move 3D objects, this would change the homogen
1162 // transformation matrix
1163 if(!mpObj
->ISA(E3dCompoundObject
))
1165 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1166 Point
aLocalPos( Position
.X
, Position
.Y
);
1167 ForceMetricToItemPoolMetric(aLocalPos
);
1169 // Position is absolut, so recalc to position relativ to anchor
1170 if( mpModel
->IsWriter() )
1171 aLocalPos
+= mpObj
->GetAnchorPos();
1173 long nDX
= aLocalPos
.X() - aRect
.Left();
1174 long nDY
= aLocalPos
.Y() - aRect
.Top();
1176 mpObj
->Move( Size( nDX
, nDY
) );
1177 mpModel
->SetChanged();
1181 maPosition
= Position
;
1185 awt::Size SAL_CALL
SvxShape::getSize() throw(uno::RuntimeException
, std::exception
)
1187 ::SolarMutexGuard aGuard
;
1189 if( mpObj
.is() && mpModel
)
1191 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1192 Size
aObjSize( aRect
.getWidth(), aRect
.getHeight() );
1193 ForceMetricTo100th_mm(aObjSize
);
1194 return ::com::sun::star::awt::Size( aObjSize
.getWidth(), aObjSize
.getHeight() );
1201 void SAL_CALL
SvxShape::setSize( const awt::Size
& rSize
)
1202 throw(beans::PropertyVetoException
, uno::RuntimeException
, std::exception
)
1204 ::SolarMutexGuard aGuard
;
1206 if( mpObj
.is() && mpModel
)
1208 // #i123539# optimization for 3D chart object generation: do not use UNO
1209 // API commmands to get the range, this is too expensive since for 3D
1210 // scenes it may recalculate the whole scene since in AOO this depends
1211 // on the contained geometry (layouted to show all content)
1212 const bool b3DConstruction(dynamic_cast< E3dObject
* >(mpObj
.get()) && mpModel
->isLocked());
1215 Rectangle(maPosition
.X
, maPosition
.Y
, maSize
.Width
, maSize
.Height
) :
1216 svx_getLogicRectHack(mpObj
.get()) );
1217 Size
aLocalSize( rSize
.Width
, rSize
.Height
);
1218 ForceMetricToItemPoolMetric(aLocalSize
);
1220 if(mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_MEASURE
)
1222 Fraction
aWdt(aLocalSize
.Width(),aRect
.Right()-aRect
.Left());
1223 Fraction
aHgt(aLocalSize
.Height(),aRect
.Bottom()-aRect
.Top());
1224 Point aPt
= mpObj
->GetSnapRect().TopLeft();
1225 mpObj
->Resize(aPt
,aWdt
,aHgt
);
1229 //aRect.SetSize(aLocalSize); // this call subtract 1 // http://www.openoffice.org/issues/show_bug.cgi?id=83193
1230 if ( !aLocalSize
.Width() )
1232 aRect
.Right() = RECT_EMPTY
;
1235 aRect
.setWidth(aLocalSize
.Width());
1236 if ( !aLocalSize
.Height() )
1238 aRect
.Bottom() = RECT_EMPTY
;
1241 aRect
.setHeight(aLocalSize
.Height());
1243 svx_setLogicRectHack( mpObj
.get(), aRect
);
1246 mpModel
->SetChanged();
1254 OUString SAL_CALL
SvxShape::getName( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1256 ::SolarMutexGuard aGuard
;
1259 return mpObj
->GetName();
1269 void SAL_CALL
SvxShape::setName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
)
1271 ::SolarMutexGuard aGuard
;
1274 mpObj
->SetName( aName
);
1278 maShapeName
= aName
;
1285 OUString SAL_CALL
SvxShape::getShapeType() throw(uno::RuntimeException
, std::exception
)
1287 if( !maShapeType
.getLength() )
1288 return UHashMap::getNameFromId( mpImpl
->mnObjId
);
1296 void SAL_CALL
SvxShape::dispose() throw(uno::RuntimeException
, std::exception
)
1298 ::SolarMutexGuard aGuard
;
1300 if( mpImpl
->mbDisposing
)
1301 return; // caught a recursion
1303 mpImpl
->mbDisposing
= true;
1305 lang::EventObject aEvt
;
1306 aEvt
.Source
= *(OWeakAggObject
*) this;
1307 mpImpl
->maDisposeListeners
.disposeAndClear(aEvt
);
1308 mpImpl
->maPropertyNotifier
.disposing();
1312 bool bFreeSdrObject
= false;
1314 if ( mpObj
->IsInserted() && mpObj
->GetPage() )
1316 OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
1317 // normally, we are allowed to free the SdrObject only if we have its ownership.
1318 // Why isn't this checked here?
1320 SdrPage
* pPage
= mpObj
->GetPage();
1321 // SdrObject aus der Page loeschen
1322 const size_t nCount
= pPage
->GetObjCount();
1323 for ( size_t nNum
= 0; nNum
< nCount
; ++nNum
)
1325 if ( pPage
->GetObj( nNum
) == mpObj
.get() )
1327 OSL_VERIFY( pPage
->RemoveObject( nNum
) == mpObj
.get() );
1328 bFreeSdrObject
= true;
1334 mpObj
->setUnoShape(NULL
);
1336 if ( bFreeSdrObject
)
1338 // in case we have the ownership of the SdrObject, a Free
1339 // would do nothing. So ensure the ownership is reset.
1340 mpImpl
->mbHasSdrObjectOwnership
= false;
1341 SdrObject
* pObject
= mpObj
.get();
1342 SdrObject::Free( pObject
);
1348 EndListening( *mpModel
);
1355 void SAL_CALL
SvxShape::addEventListener( const Reference
< lang::XEventListener
>& xListener
)
1356 throw(uno::RuntimeException
, std::exception
)
1358 mpImpl
->maDisposeListeners
.addInterface(xListener
);
1363 void SAL_CALL
SvxShape::removeEventListener( const Reference
< lang::XEventListener
>& aListener
) throw(uno::RuntimeException
, std::exception
)
1365 mpImpl
->maDisposeListeners
.removeInterface(aListener
);
1372 Reference
< beans::XPropertySetInfo
> SAL_CALL
1373 SvxShape::getPropertySetInfo() throw(uno::RuntimeException
, std::exception
)
1375 if( mpImpl
->mpMaster
)
1377 return mpImpl
->mpMaster
->getPropertySetInfo();
1381 return _getPropertySetInfo();
1385 Reference
< beans::XPropertySetInfo
> SAL_CALL
1386 SvxShape::_getPropertySetInfo() throw(uno::RuntimeException
)
1388 return mpPropSet
->getPropertySetInfo();
1393 void SAL_CALL
SvxShape::addPropertyChangeListener( const OUString
& _propertyName
, const Reference
< beans::XPropertyChangeListener
>& _listener
) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
1395 ::osl::MutexGuard
aGuard( maMutex
);
1396 mpImpl
->maPropertyNotifier
.addPropertyChangeListener( _propertyName
, _listener
);
1401 void SAL_CALL
SvxShape::removePropertyChangeListener( const OUString
& _propertyName
, const Reference
< beans::XPropertyChangeListener
>& _listener
) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
1403 ::osl::MutexGuard
aGuard( maMutex
);
1404 mpImpl
->maPropertyNotifier
.removePropertyChangeListener( _propertyName
, _listener
);
1409 void SAL_CALL
SvxShape::addVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
1411 OSL_FAIL( "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1416 void SAL_CALL
SvxShape::removeVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
1418 OSL_FAIL( "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1423 bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
)
1425 SfxItemSet
aSet( mpModel
->GetItemPool(), (sal_uInt16
)nWID
, (sal_uInt16
)nWID
);
1427 if( SetFillAttribute( nWID
, rName
, aSet
, mpModel
) )
1429 //mpObj->SetItemSetAndBroadcast(aSet);
1430 mpObj
->SetMergedItemSetAndBroadcast(aSet
);
1442 bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
, SfxItemSet
& rSet
, SdrModel
* pModel
)
1444 // check if an item with the given name and which id is inside the models
1445 // pool or the stylesheet pool, if found its puttet in the itemse
1446 if( !SetFillAttribute( nWID
, rName
, rSet
) )
1448 // we did not find such item in one of the pools, so we check
1449 // the property lists that are loaded for the model for items
1450 // that support such.
1451 OUString aStrName
= SvxUnogetInternalNameForItem((sal_Int16
)nWID
, rName
);
1455 case XATTR_FILLBITMAP
:
1457 XBitmapListRef pBitmapList
= pModel
->GetBitmapList();
1459 if( !pBitmapList
.is() )
1462 long nPos
= pBitmapList
->GetIndex(aStrName
);
1466 XBitmapEntry
* pEntry
= pBitmapList
->GetBitmap( nPos
);
1467 XFillBitmapItem aBmpItem
;
1468 aBmpItem
.SetWhich( XATTR_FILLBITMAP
);
1469 aBmpItem
.SetName( rName
);
1470 aBmpItem
.SetGraphicObject(pEntry
->GetGraphicObject());
1471 rSet
.Put( aBmpItem
);
1474 case XATTR_FILLGRADIENT
:
1476 XGradientListRef pGradientList
= pModel
->GetGradientList();
1478 if( !pGradientList
.is() )
1481 long nPos
= pGradientList
->GetIndex(aStrName
);
1485 XGradientEntry
* pEntry
= pGradientList
->GetGradient( nPos
);
1486 XFillGradientItem aGrdItem
;
1487 aGrdItem
.SetWhich( XATTR_FILLGRADIENT
);
1488 aGrdItem
.SetName( rName
);
1489 aGrdItem
.SetGradientValue( pEntry
->GetGradient() );
1490 rSet
.Put( aGrdItem
);
1493 case XATTR_FILLHATCH
:
1495 XHatchListRef pHatchList
= pModel
->GetHatchList();
1497 if( !pHatchList
.is() )
1500 long nPos
= pHatchList
->GetIndex(aStrName
);
1504 XHatchEntry
* pEntry
= pHatchList
->GetHatch( nPos
);
1505 XFillHatchItem aHatchItem
;
1506 aHatchItem
.SetWhich( XATTR_FILLHATCH
);
1507 aHatchItem
.SetName( rName
);
1508 aHatchItem
.SetHatchValue( pEntry
->GetHatch() );
1509 rSet
.Put( aHatchItem
);
1513 case XATTR_LINESTART
:
1515 XLineEndListRef pLineEndList
= pModel
->GetLineEndList();
1517 if( !pLineEndList
.is() )
1520 long nPos
= pLineEndList
->GetIndex(aStrName
);
1524 XLineEndEntry
* pEntry
= pLineEndList
->GetLineEnd( nPos
);
1525 if( XATTR_LINEEND
== nWID
)
1527 XLineEndItem aLEItem
;
1528 aLEItem
.SetWhich( XATTR_LINEEND
);
1529 aLEItem
.SetName( rName
);
1530 aLEItem
.SetLineEndValue( pEntry
->GetLineEnd() );
1531 rSet
.Put( aLEItem
);
1535 XLineStartItem aLSItem
;
1536 aLSItem
.SetWhich( XATTR_LINESTART
);
1537 aLSItem
.SetName( rName
);
1538 aLSItem
.SetLineStartValue( pEntry
->GetLineEnd() );
1539 rSet
.Put( aLSItem
);
1544 case XATTR_LINEDASH
:
1546 XDashListRef pDashList
= pModel
->GetDashList();
1548 if( !pDashList
.is() )
1551 long nPos
= pDashList
->GetIndex(aStrName
);
1555 XDashEntry
* pEntry
= pDashList
->GetDash( nPos
);
1556 XLineDashItem aDashItem
;
1557 aDashItem
.SetWhich( XATTR_LINEDASH
);
1558 aDashItem
.SetName( rName
);
1559 aDashItem
.SetDashValue( pEntry
->GetDash() );
1560 rSet
.Put( aDashItem
);
1573 bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
, SfxItemSet
& rSet
)
1575 OUString aName
= SvxUnogetInternalNameForItem((sal_Int16
)nWID
, rName
);
1577 if (aName
.isEmpty())
1582 case XATTR_LINESTART
:
1584 const OUString aEmpty
;
1585 const basegfx::B2DPolyPolygon aEmptyPoly
;
1586 if( nWID
== XATTR_LINEEND
)
1587 rSet
.Put( XLineEndItem( aEmpty
, aEmptyPoly
) );
1589 rSet
.Put( XLineStartItem( aEmpty
, aEmptyPoly
) );
1593 case XATTR_FILLFLOATTRANSPARENCE
:
1595 // #85953# Set a disabled XFillFloatTransparenceItem
1596 rSet
.Put(XFillFloatTransparenceItem());
1605 const SfxItemPool
* pPool
= rSet
.GetPool();
1607 const OUString
aSearchName( aName
);
1608 const sal_uInt32 nCount
= pPool
->GetItemCount2((sal_uInt16
)nWID
);
1610 for( sal_uInt32 nSurrogate
= 0; nSurrogate
< nCount
; nSurrogate
++ )
1612 const NameOrIndex
* pItem
= static_cast<const NameOrIndex
*>(pPool
->GetItem2((sal_uInt16
)nWID
, nSurrogate
));
1613 if( pItem
&& ( pItem
->GetName() == aSearchName
) )
1625 void SAL_CALL
SvxShape::setPropertyValue( const OUString
& rPropertyName
, const uno::Any
& rVal
)
1626 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
1628 if( mpImpl
->mpMaster
)
1630 mpImpl
->mpMaster
->setPropertyValue( rPropertyName
, rVal
);
1634 _setPropertyValue( rPropertyName
, rVal
);
1638 void SAL_CALL
SvxShape::_setPropertyValue( const OUString
& rPropertyName
, const uno::Any
& rVal
)
1639 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
1641 ::SolarMutexGuard aGuard
;
1643 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(rPropertyName
);
1645 if (!mpObj
.is() || !mpModel
)
1647 // Since we have no actual sdr object right now, remember all
1648 // properties in a list. These properties will be set when the sdr
1649 // object is created.
1651 if (pMap
&& pMap
->nWID
)
1653 // FIXME: We should throw a UnknownPropertyException here.
1654 // But since this class is aggregated from classes that
1655 // support additional properties that we don't know here we
1656 // silently store *all* properties, even if they may be not
1657 // supported after creation.
1658 mpPropSet
->setPropertyValue( pMap
, rVal
);
1664 throw beans::UnknownPropertyException();
1666 if ((pMap
->nFlags
& beans::PropertyAttribute::READONLY
) != 0)
1667 throw beans::PropertyVetoException(
1668 "Readonly property can't be set: " + rPropertyName
,
1669 uno::Reference
<drawing::XShape
>(this));
1671 mpModel
->SetChanged();
1673 if (setPropertyValueImpl(rPropertyName
, pMap
, rVal
))
1676 DBG_ASSERT( pMap
->nWID
== SDRATTR_TEXTDIRECTION
|| pMap
->nWID
< SDRATTR_NOTPERSIST_FIRST
|| pMap
->nWID
> SDRATTR_NOTPERSIST_LAST
, "Not persist item not handled!" );
1677 DBG_ASSERT( pMap
->nWID
< OWN_ATTR_VALUE_START
|| pMap
->nWID
> OWN_ATTR_VALUE_END
, "Not item property not handled!" );
1679 bool bIsNotPersist
= pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
&& pMap
->nWID
!= SDRATTR_TEXTDIRECTION
;
1681 if( pMap
->nWID
== SDRATTR_ECKENRADIUS
)
1683 sal_Int32 nCornerRadius
= 0;
1684 if( !(rVal
>>= nCornerRadius
) || (nCornerRadius
< 0) || (nCornerRadius
> 5000000))
1685 throw IllegalArgumentException();
1689 if( mbIsMultiPropertyCall
&& !bIsNotPersist
)
1691 if( mpImpl
->mpItemSet
== NULL
)
1693 pSet
= mpImpl
->mpItemSet
= mpObj
->GetMergedItemSet().Clone();
1697 pSet
= mpImpl
->mpItemSet
;
1702 pSet
= new SfxItemSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1705 if( pSet
->GetItemState( pMap
->nWID
) != SfxItemState::SET
)
1706 pSet
->Put(mpObj
->GetMergedItem(pMap
->nWID
));
1708 if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet
, pMap
, rVal
, *pSet
))
1710 if( pSet
->GetItemState( pMap
->nWID
) != SfxItemState::SET
)
1714 // not-persistent attribute, get those extra
1715 mpObj
->TakeNotPersistAttr(*pSet
, false);
1719 if( pSet
->GetItemState( pMap
->nWID
) != SfxItemState::SET
)
1721 // get default from ItemPool
1722 if(SfxItemPool::IsWhich(pMap
->nWID
))
1723 pSet
->Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
1726 if( pSet
->GetItemState( pMap
->nWID
) == SfxItemState::SET
)
1728 SvxItemPropertySet_setPropertyValue( pMap
, rVal
, *pSet
);
1734 // set not-persistent attribute extra
1735 mpObj
->ApplyNotPersistAttr( *pSet
);
1740 // if we have a XMultiProperty call then the item set
1741 // will be set in setPropertyValues later
1742 if( !mbIsMultiPropertyCall
)
1744 mpObj
->SetMergedItemSetAndBroadcast( *pSet
);
1753 uno::Any SAL_CALL
SvxShape::getPropertyValue( const OUString
& PropertyName
)
1754 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
1756 if ( mpImpl
->mpMaster
)
1757 return mpImpl
->mpMaster
->getPropertyValue( PropertyName
);
1759 return _getPropertyValue( PropertyName
);
1764 uno::Any
SvxShape::_getPropertyValue( const OUString
& PropertyName
)
1765 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1767 ::SolarMutexGuard aGuard
;
1769 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
1772 if( mpObj
.is() && mpModel
)
1775 throw beans::UnknownPropertyException();
1777 if( !getPropertyValueImpl( PropertyName
, pMap
, aAny
) )
1779 DBG_ASSERT( pMap
->nWID
== SDRATTR_TEXTDIRECTION
|| (pMap
->nWID
< SDRATTR_NOTPERSIST_FIRST
|| pMap
->nWID
> SDRATTR_NOTPERSIST_LAST
), "Not persist item not handled!" );
1780 DBG_ASSERT( pMap
->nWID
< OWN_ATTR_VALUE_START
|| pMap
->nWID
> OWN_ATTR_VALUE_END
, "Not item property not handled!" );
1782 SfxItemSet
aSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1783 aSet
.Put(mpObj
->GetMergedItem(pMap
->nWID
));
1785 if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet
, pMap
, aAny
))
1790 if(pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
)
1792 // not-persistent attribute, get those extra
1793 mpObj
->TakeNotPersistAttr(aSet
, false);
1799 // get default from ItemPool
1800 if(SfxItemPool::IsWhich(pMap
->nWID
))
1801 aSet
.Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
1805 aAny
= GetAnyForItem( aSet
, pMap
);
1811 // Fixme: we should return default values for OWN_ATTR !
1813 if(pMap
&& pMap
->nWID
)
1814 // FixMe: see setPropertyValue
1815 aAny
= mpPropSet
->getPropertyValue( pMap
);
1823 // XMultiPropertySet
1824 void SAL_CALL
SvxShape::setPropertyValues( const ::com::sun::star::uno::Sequence
< 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
, std::exception
)
1826 ::SolarMutexGuard aSolarGuard
;
1828 const sal_Int32 nCount
= aPropertyNames
.getLength();
1829 const OUString
* pNames
= aPropertyNames
.getConstArray();
1831 const uno::Any
* pValues
= aValues
.getConstArray();
1833 // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1834 // reseted even when an exception is thrown
1835 const ::comphelper::ScopeGuard
aGuard( boost::bind( &SvxShape::endSetPropertyValues
, this ) );
1837 mbIsMultiPropertyCall
= true;
1839 if( mpImpl
->mpMaster
)
1841 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pValues
++ )
1845 setPropertyValue( *pNames
, *pValues
);
1847 catch( beans::UnknownPropertyException
& e
)
1851 catch( uno::Exception
& ex
)
1859 uno::Reference
< beans::XPropertySet
> xSet
;
1860 queryInterface( cppu::UnoType
<beans::XPropertySet
>::get()) >>= xSet
;
1862 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pValues
++ )
1866 xSet
->setPropertyValue( *pNames
, *pValues
);
1868 catch( beans::UnknownPropertyException
& e
)
1872 catch( uno::Exception
& ex
)
1879 if( mpImpl
->mpItemSet
&& mpObj
.is() )
1880 mpObj
->SetMergedItemSetAndBroadcast( *mpImpl
->mpItemSet
);
1885 void SvxShape::endSetPropertyValues()
1887 mbIsMultiPropertyCall
= false;
1888 if( mpImpl
->mpItemSet
)
1890 delete mpImpl
->mpItemSet
;
1891 mpImpl
->mpItemSet
= 0;
1897 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
SvxShape::getPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
1899 const sal_Int32 nCount
= aPropertyNames
.getLength();
1900 const OUString
* pNames
= aPropertyNames
.getConstArray();
1902 uno::Sequence
< uno::Any
> aRet( nCount
);
1903 uno::Any
* pValue
= aRet
.getArray();;
1905 if( mpImpl
->mpMaster
)
1907 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pValue
++, pNames
++ )
1911 *pValue
= getPropertyValue( *pNames
);
1913 catch( uno::Exception
& )
1915 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1921 uno::Reference
< beans::XPropertySet
> xSet
;
1922 queryInterface( cppu::UnoType
<beans::XPropertySet
>::get()) >>= xSet
;
1924 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pValue
++, pNames
++ )
1928 *pValue
= xSet
->getPropertyValue( *pNames
);
1930 catch( uno::Exception
& )
1932 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1940 void SAL_CALL
SvxShape::addPropertiesChangeListener( const ::com::sun::star::uno::Sequence
< OUString
>& , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
1944 void SAL_CALL
SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
1948 void SAL_CALL
SvxShape::firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence
< OUString
>& , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
1954 uno::Any
SvxShape::GetAnyForItem( SfxItemSet
& aSet
, const SfxItemPropertySimpleEntry
* pMap
) const
1956 DBG_TESTSOLARMUTEX();
1961 case SDRATTR_CIRCSTARTANGLE
:
1963 const SfxPoolItem
* pPoolItem
=NULL
;
1964 if(aSet
.GetItemState(SDRATTR_CIRCSTARTANGLE
,false,&pPoolItem
)==SfxItemState::SET
)
1966 sal_Int32 nAngle
= static_cast<const SdrAngleItem
*>(pPoolItem
)->GetValue();
1972 case SDRATTR_CIRCENDANGLE
:
1974 const SfxPoolItem
* pPoolItem
=NULL
;
1975 if (aSet
.GetItemState(SDRATTR_CIRCENDANGLE
,false,&pPoolItem
)==SfxItemState::SET
)
1977 sal_Int32 nAngle
= static_cast<const SdrAngleItem
*>(pPoolItem
)->GetValue();
1983 case SDRATTR_CIRCKIND
:
1985 if( mpObj
->GetObjInventor() == SdrInventor
)
1987 drawing::CircleKind eKind
;
1988 switch(mpObj
->GetObjIdentifier())
1990 case OBJ_CIRC
: // circle, ellipse
1991 eKind
= drawing::CircleKind_FULL
;
1993 case OBJ_CCUT
: // segment of circle
1994 eKind
= drawing::CircleKind_CUT
;
1996 case OBJ_CARC
: // arc of circle
1997 eKind
= drawing::CircleKind_ARC
;
1999 case OBJ_SECT
: // sector
2000 eKind
= drawing::CircleKind_SECTION
;
2009 // get value form ItemSet
2010 aAny
= SvxItemPropertySet_getPropertyValue( pMap
, aSet
);
2012 if( pMap
->aType
!= aAny
.getValueType() )
2014 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2015 if( ( pMap
->aType
== ::cppu::UnoType
<sal_Int16
>::get()) && aAny
.getValueType() == ::cppu::UnoType
<sal_Int32
>::get() )
2017 sal_Int32 nValue
= 0;
2019 aAny
<<= (sal_Int16
)nValue
;
2023 OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
2036 beans::PropertyState SAL_CALL
SvxShape::getPropertyState( const OUString
& PropertyName
)
2037 throw(beans::UnknownPropertyException
, uno::RuntimeException
, std::exception
)
2039 if( mpImpl
->mpMaster
)
2041 return mpImpl
->mpMaster
->getPropertyState( PropertyName
);
2045 return _getPropertyState( PropertyName
);
2049 beans::PropertyState SAL_CALL
SvxShape::_getPropertyState( const OUString
& PropertyName
)
2050 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
2052 ::SolarMutexGuard aGuard
;
2054 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
2056 if( !mpObj
.is() || pMap
== NULL
)
2057 throw beans::UnknownPropertyException();
2059 beans::PropertyState eState
;
2060 if( !getPropertyStateImpl( pMap
, eState
) )
2062 const SfxItemSet
& rSet
= mpObj
->GetMergedItemSet();
2064 switch( rSet
.GetItemState( pMap
->nWID
, false ) )
2066 case SfxItemState::READONLY
:
2067 case SfxItemState::SET
:
2068 eState
= beans::PropertyState_DIRECT_VALUE
;
2070 case SfxItemState::DEFAULT
:
2071 eState
= beans::PropertyState_DEFAULT_VALUE
;
2074 eState
= beans::PropertyState_AMBIGUOUS_VALUE
;
2078 // if a item is set, this doesn't mean we want it :)
2079 if( ( beans::PropertyState_DIRECT_VALUE
== eState
) )
2081 switch( pMap
->nWID
)
2083 // the following items are disabled by changing the
2084 // fill style or the line style. so there is no need
2085 // to export items without names which should be empty
2086 case XATTR_FILLBITMAP
:
2087 case XATTR_FILLGRADIENT
:
2088 case XATTR_FILLHATCH
:
2089 case XATTR_LINEDASH
:
2091 const NameOrIndex
* pItem
= static_cast<const NameOrIndex
*>(rSet
.GetItem((sal_uInt16
)pMap
->nWID
));
2092 if( ( pItem
== NULL
) || pItem
->GetName().isEmpty() )
2093 eState
= beans::PropertyState_DEFAULT_VALUE
;
2098 // If e.g. the LineStart is on NONE and thus the string has length 0, it still
2099 // may be a hard attribute covering the set LineStart of the parent (Style).
2101 // same is for fill float transparency
2103 case XATTR_LINESTART
:
2104 case XATTR_FILLFLOATTRANSPARENCE
:
2106 const NameOrIndex
* pItem
= static_cast<const NameOrIndex
*>(rSet
.GetItem((sal_uInt16
)pMap
->nWID
));
2107 if ( pItem
== NULL
)
2108 eState
= beans::PropertyState_DEFAULT_VALUE
;
2117 bool SvxShape::setPropertyValueImpl( const 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
, std::exception
)
2119 switch( pProperty
->nWID
)
2121 case OWN_ATTR_CAPTION_POINT
:
2124 if( rValue
>>= aPnt
)
2126 Point
aVclPoint( aPnt
.X
, aPnt
.Y
);
2128 // #90763# position is relative to top left, make it absolute
2129 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2130 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2131 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2133 aVclPoint
.X() += basegfx::fround(aNewHomogenMatrix
.get(0, 2));
2134 aVclPoint
.Y() += basegfx::fround(aNewHomogenMatrix
.get(1, 2));
2136 // #88657# metric of pool maybe twips (writer)
2137 ForceMetricToItemPoolMetric(aVclPoint
);
2139 // #88491# position relative to anchor
2140 if( mpModel
->IsWriter() )
2142 aVclPoint
+= mpObj
->GetAnchorPos();
2145 static_cast<SdrCaptionObj
*>(mpObj
.get())->SetTailPos(aVclPoint
);
2151 case OWN_ATTR_TRANSFORMATION
:
2153 drawing::HomogenMatrix3 aMatrix
;
2154 if(rValue
>>= aMatrix
)
2156 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2157 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2159 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2161 aNewHomogenMatrix
.set(0, 0, aMatrix
.Line1
.Column1
);
2162 aNewHomogenMatrix
.set(0, 1, aMatrix
.Line1
.Column2
);
2163 aNewHomogenMatrix
.set(0, 2, aMatrix
.Line1
.Column3
);
2164 aNewHomogenMatrix
.set(1, 0, aMatrix
.Line2
.Column1
);
2165 aNewHomogenMatrix
.set(1, 1, aMatrix
.Line2
.Column2
);
2166 aNewHomogenMatrix
.set(1, 2, aMatrix
.Line2
.Column3
);
2167 aNewHomogenMatrix
.set(2, 0, aMatrix
.Line3
.Column1
);
2168 aNewHomogenMatrix
.set(2, 1, aMatrix
.Line3
.Column2
);
2169 aNewHomogenMatrix
.set(2, 2, aMatrix
.Line3
.Column3
);
2171 mpObj
->TRSetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2177 case OWN_ATTR_ZORDER
:
2179 sal_Int32 nNewOrdNum
= 0;
2180 if(rValue
>>= nNewOrdNum
)
2182 SdrObjList
* pObjList
= mpObj
->GetObjList();
2188 pObjList
->SetObjectOrdNum( mpObj
->GetOrdNum(), static_cast<size_t>(nNewOrdNum
) );
2189 DBG_ASSERT( pCheck
== mpObj
.get(), "GetOrdNum() failed!" );
2195 case OWN_ATTR_FRAMERECT
:
2197 awt::Rectangle aUnoRect
;
2198 if(rValue
>>= aUnoRect
)
2200 Point
aTopLeft( aUnoRect
.X
, aUnoRect
.Y
);
2201 Size
aObjSize( aUnoRect
.Width
, aUnoRect
.Height
);
2202 ForceMetricToItemPoolMetric(aTopLeft
);
2203 ForceMetricToItemPoolMetric(aObjSize
);
2205 aRect
.SetPos(aTopLeft
);
2206 aRect
.SetSize(aObjSize
);
2207 mpObj
->SetSnapRect(aRect
);
2212 case OWN_ATTR_MIRRORED
:
2215 if(rValue
>>= bMirror
)
2217 SdrGrafObj
* pObj
= dynamic_cast< SdrGrafObj
* >( mpObj
.get() );
2219 pObj
->SetMirrored(bMirror
);
2224 case OWN_ATTR_EDGE_START_OBJ
:
2225 case OWN_ATTR_EDGE_END_OBJ
:
2226 case OWN_ATTR_GLUEID_HEAD
:
2227 case OWN_ATTR_GLUEID_TAIL
:
2228 case OWN_ATTR_EDGE_START_POS
:
2229 case OWN_ATTR_EDGE_END_POS
:
2230 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2232 SdrEdgeObj
* pEdgeObj
= dynamic_cast< SdrEdgeObj
* >(mpObj
.get());
2235 switch(pProperty
->nWID
)
2237 case OWN_ATTR_EDGE_START_OBJ
:
2238 case OWN_ATTR_EDGE_END_OBJ
:
2240 Reference
< drawing::XShape
> xShape
;
2241 if( rValue
>>= xShape
)
2243 SdrObject
* pNode
= GetSdrObjectFromXShape( xShape
);
2246 pEdgeObj
->ConnectToNode( pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
, pNode
);
2247 pEdgeObj
->setGluePointIndex( pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
, -1 );
2254 case OWN_ATTR_EDGE_START_POS
:
2255 case OWN_ATTR_EDGE_END_POS
:
2257 awt::Point aUnoPoint
;
2258 if( rValue
>>= aUnoPoint
)
2260 Point
aPoint( aUnoPoint
.X
, aUnoPoint
.Y
);
2262 // Reintroduction of fix for issue i59051 (#i108851#)
2263 // perform metric change before applying anchor position,
2264 // because the anchor position is in pool metric.
2265 ForceMetricToItemPoolMetric( aPoint
);
2266 if( mpModel
->IsWriter() )
2267 aPoint
+= mpObj
->GetAnchorPos();
2269 pEdgeObj
->SetTailPoint( pProperty
->nWID
== OWN_ATTR_EDGE_START_POS
, aPoint
);
2275 case OWN_ATTR_GLUEID_HEAD
:
2276 case OWN_ATTR_GLUEID_TAIL
:
2279 if( rValue
>>= nId
)
2281 pEdgeObj
->setGluePointIndex( pProperty
->nWID
== OWN_ATTR_GLUEID_HEAD
, nId
);
2286 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2288 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2290 // #123616# be a little bit more flexible regardin gthe data type used
2291 if( rValue
.getValueType() == cppu::UnoType
<drawing::PointSequenceSequence
>::get())
2293 // get polygpon data from PointSequenceSequence
2294 aNewPolyPolygon
= basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(
2295 *static_cast<const drawing::PointSequenceSequence
*>(rValue
.getValue()));
2297 else if( rValue
.getValueType() == cppu::UnoType
<drawing::PolyPolygonBezierCoords
>::get())
2299 // get polygpon data from PolyPolygonBezierCoords
2300 aNewPolyPolygon
= basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
2301 *static_cast<const drawing::PolyPolygonBezierCoords
*>(rValue
.getValue()));
2304 if(aNewPolyPolygon
.count())
2306 // Reintroduction of fix for issue i59051 (#i108851#)
2307 ForceMetricToItemPoolMetric( aNewPolyPolygon
);
2308 if( mpModel
->IsWriter() )
2310 Point
aPoint( mpObj
->GetAnchorPos() );
2311 aNewPolyPolygon
.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint
.X(), aPoint
.Y()));
2313 pEdgeObj
->SetEdgeTrackPath( aNewPolyPolygon
);
2321 case OWN_ATTR_MEASURE_START_POS
:
2322 case OWN_ATTR_MEASURE_END_POS
:
2324 SdrMeasureObj
* pMeasureObj
= dynamic_cast< SdrMeasureObj
* >(mpObj
.get());
2325 awt::Point aUnoPoint
;
2326 if(pMeasureObj
&& ( rValue
>>= aUnoPoint
) )
2328 Point
aPoint( aUnoPoint
.X
, aUnoPoint
.Y
);
2330 // Reintroduction of fix for issue #i59051# (#i108851#)
2331 ForceMetricToItemPoolMetric( aPoint
);
2332 if( mpModel
->IsWriter() )
2333 aPoint
+= mpObj
->GetAnchorPos();
2335 pMeasureObj
->NbcSetPoint( aPoint
, pProperty
->nWID
== OWN_ATTR_MEASURE_START_POS
? 0L : 1L );
2336 pMeasureObj
->SetChanged();
2337 pMeasureObj
->BroadcastObjectChange();
2342 case OWN_ATTR_FILLBMP_MODE
:
2344 drawing::BitmapMode eMode
;
2345 if(!(rValue
>>= eMode
) )
2347 sal_Int32 nMode
= 0;
2348 if(!(rValue
>>= nMode
))
2351 eMode
= (drawing::BitmapMode
)nMode
;
2353 mpObj
->SetMergedItem( XFillBmpStretchItem( eMode
== drawing::BitmapMode_STRETCH
) );
2354 mpObj
->SetMergedItem( XFillBmpTileItem( eMode
== drawing::BitmapMode_REPEAT
) );
2358 case SDRATTR_LAYERID
:
2360 sal_Int16 nLayerId
= sal_Int16();
2361 if( rValue
>>= nLayerId
)
2363 SdrLayer
* pLayer
= mpModel
->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId
);
2366 mpObj
->SetLayer((unsigned char)nLayerId
);
2373 case SDRATTR_LAYERNAME
:
2375 OUString aLayerName
;
2376 if( rValue
>>= aLayerName
)
2378 const SdrLayer
* pLayer
=mpModel
->GetLayerAdmin().GetLayer(aLayerName
, true);
2379 if( pLayer
!= NULL
)
2381 mpObj
->SetLayer( pLayer
->GetID() );
2387 case SDRATTR_ROTATEANGLE
:
2389 sal_Int32 nAngle
= 0;
2390 if( rValue
>>= nAngle
)
2392 Point
aRef1(mpObj
->GetSnapRect().Center());
2393 nAngle
-= mpObj
->GetRotateAngle();
2396 double nSin
=sin(nAngle
*nPi180
);
2397 double nCos
=cos(nAngle
*nPi180
);
2398 mpObj
->Rotate(aRef1
,nAngle
,nSin
,nCos
);
2406 case SDRATTR_SHEARANGLE
:
2408 sal_Int32 nShear
= 0;
2409 if( rValue
>>= nShear
)
2411 nShear
-= mpObj
->GetShearAngle();
2414 Point
aRef1(mpObj
->GetSnapRect().Center());
2415 double nTan
=tan(nShear
*nPi180
);
2416 mpObj
->Shear(aRef1
,nShear
,nTan
,false);
2424 case OWN_ATTR_INTEROPGRABBAG
:
2426 mpObj
->SetGrabBagItem(rValue
);
2430 case SDRATTR_OBJMOVEPROTECT
:
2433 if( rValue
>>= bMoveProtect
)
2435 mpObj
->SetMoveProtect(bMoveProtect
);
2440 case SDRATTR_OBJECTNAME
:
2443 if( rValue
>>= aName
)
2445 mpObj
->SetName( aName
);
2452 case OWN_ATTR_MISC_OBJ_TITLE
:
2455 if( rValue
>>= aTitle
)
2457 mpObj
->SetTitle( aTitle
);
2462 case OWN_ATTR_MISC_OBJ_DESCRIPTION
:
2464 OUString aDescription
;
2465 if( rValue
>>= aDescription
)
2467 mpObj
->SetDescription( aDescription
);
2473 case SDRATTR_OBJPRINTABLE
:
2476 if( rValue
>>= bPrintable
)
2478 mpObj
->SetPrintable(bPrintable
);
2483 case SDRATTR_OBJVISIBLE
:
2486 if( rValue
>>= bVisible
)
2488 mpObj
->SetVisible(bVisible
);
2493 case SDRATTR_OBJSIZEPROTECT
:
2495 bool bResizeProtect
;
2496 if( rValue
>>= bResizeProtect
)
2498 mpObj
->SetResizeProtect(bResizeProtect
);
2503 case OWN_ATTR_PAGE_NUMBER
:
2505 sal_Int32 nPageNum
= 0;
2506 if( (rValue
>>= nPageNum
) && ( nPageNum
>= 0 ) && ( nPageNum
<= 0xffff ) )
2508 SdrPageObj
* pPageObj
= dynamic_cast< SdrPageObj
* >(mpObj
.get());
2511 SdrModel
* pModel
= pPageObj
->GetModel();
2512 SdrPage
* pNewPage
= 0L;
2513 const sal_uInt16
nDestinationPageNum((sal_uInt16
)((nPageNum
<< 1L) - 1L));
2517 if(nDestinationPageNum
< pModel
->GetPageCount())
2519 pNewPage
= pModel
->GetPage(nDestinationPageNum
);
2523 pPageObj
->SetReferencedPage(pNewPage
);
2530 case XATTR_FILLBITMAP
:
2531 case XATTR_FILLGRADIENT
:
2532 case XATTR_FILLHATCH
:
2533 case XATTR_FILLFLOATTRANSPARENCE
:
2535 case XATTR_LINESTART
:
2536 case XATTR_LINEDASH
:
2538 if( pProperty
->nMemberId
== MID_NAME
)
2541 if( rValue
>>= aApiName
)
2543 if( SetFillAttribute( pProperty
->nWID
, aApiName
) )
2558 throw lang::IllegalArgumentException();
2563 bool SvxShape::getPropertyValueImpl( const 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
, std::exception
)
2565 switch( pProperty
->nWID
)
2567 case OWN_ATTR_CAPTION_POINT
:
2569 Point aVclPoint
= static_cast<SdrCaptionObj
*>(mpObj
.get())->GetTailPos();
2571 // #88491# make pos relative to anchor
2572 if( mpModel
->IsWriter() )
2574 aVclPoint
-= mpObj
->GetAnchorPos();
2577 // #88657# metric of pool maybe twips (writer)
2578 ForceMetricTo100th_mm(aVclPoint
);
2580 // #90763# pos is absolute, make it relative to top left
2581 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2582 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2583 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2585 aVclPoint
.X() -= basegfx::fround(aNewHomogenMatrix
.get(0, 2));
2586 aVclPoint
.Y() -= basegfx::fround(aNewHomogenMatrix
.get(1, 2));
2588 awt::Point
aPnt( aVclPoint
.X(), aVclPoint
.Y() );
2593 case OWN_ATTR_TRANSFORMATION
:
2595 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2596 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2597 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2598 drawing::HomogenMatrix3 aMatrix
;
2600 aMatrix
.Line1
.Column1
= aNewHomogenMatrix
.get(0, 0);
2601 aMatrix
.Line1
.Column2
= aNewHomogenMatrix
.get(0, 1);
2602 aMatrix
.Line1
.Column3
= aNewHomogenMatrix
.get(0, 2);
2603 aMatrix
.Line2
.Column1
= aNewHomogenMatrix
.get(1, 0);
2604 aMatrix
.Line2
.Column2
= aNewHomogenMatrix
.get(1, 1);
2605 aMatrix
.Line2
.Column3
= aNewHomogenMatrix
.get(1, 2);
2606 aMatrix
.Line3
.Column1
= aNewHomogenMatrix
.get(2, 0);
2607 aMatrix
.Line3
.Column2
= aNewHomogenMatrix
.get(2, 1);
2608 aMatrix
.Line3
.Column3
= aNewHomogenMatrix
.get(2, 2);
2615 case OWN_ATTR_ZORDER
:
2617 rValue
<<= (sal_Int32
)mpObj
->GetOrdNum();
2621 case OWN_ATTR_BITMAP
:
2623 rValue
= GetBitmap();
2624 if(!rValue
.hasValue())
2625 throw uno::RuntimeException();
2630 case OWN_ATTR_ISFONTWORK
:
2632 rValue
<<= mpObj
->ISA(SdrTextObj
) && static_cast<SdrTextObj
*>(mpObj
.get())->IsFontwork();
2636 case OWN_ATTR_FRAMERECT
:
2638 Rectangle
aRect( mpObj
->GetSnapRect() );
2639 Point
aTopLeft( aRect
.TopLeft() );
2640 Size
aObjSize( aRect
.GetWidth(), aRect
.GetHeight() );
2641 ForceMetricTo100th_mm(aTopLeft
);
2642 ForceMetricTo100th_mm(aObjSize
);
2643 ::com::sun::star::awt::Rectangle
aUnoRect(
2644 aTopLeft
.X(), aTopLeft
.Y(),
2645 aObjSize
.getWidth(), aObjSize
.getHeight() );
2646 rValue
<<= aUnoRect
;
2650 case OWN_ATTR_BOUNDRECT
:
2652 Rectangle
aRect( mpObj
->GetCurrentBoundRect() );
2653 Point
aTopLeft( aRect
.TopLeft() );
2654 Size
aObjSize( aRect
.GetWidth(), aRect
.GetHeight() );
2655 ForceMetricTo100th_mm(aTopLeft
);
2656 ForceMetricTo100th_mm(aObjSize
);
2657 ::com::sun::star::awt::Rectangle
aUnoRect(
2658 aTopLeft
.X(), aTopLeft
.Y(),
2659 aObjSize
.getWidth(), aObjSize
.getHeight() );
2660 rValue
<<= aUnoRect
;
2664 case OWN_ATTR_LDNAME
:
2666 OUString
aName( mpObj
->GetName() );
2671 case OWN_ATTR_LDBITMAP
:
2674 if( mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_OLE2
)
2676 nId
= RID_UNODRAW_OLE2
;
2678 else if( mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_GRAF
)
2680 nId
= RID_UNODRAW_GRAPHICS
;
2684 nId
= RID_UNODRAW_OBJECTS
;
2687 BitmapEx
aBmp( SVX_RES(nId
) );
2688 Reference
< awt::XBitmap
> xBmp( VCLUnoHelper::CreateBitmap( aBmp
) );
2694 case OWN_ATTR_MIRRORED
:
2696 bool bMirror
= false;
2697 if( mpObj
.is() && mpObj
->ISA(SdrGrafObj
) )
2698 bMirror
= static_cast<SdrGrafObj
*>(mpObj
.get())->IsMirrored();
2704 case OWN_ATTR_EDGE_START_OBJ
:
2705 case OWN_ATTR_EDGE_START_POS
:
2706 case OWN_ATTR_EDGE_END_POS
:
2707 case OWN_ATTR_EDGE_END_OBJ
:
2708 case OWN_ATTR_GLUEID_HEAD
:
2709 case OWN_ATTR_GLUEID_TAIL
:
2710 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2712 SdrEdgeObj
* pEdgeObj
= dynamic_cast<SdrEdgeObj
*>(mpObj
.get());
2715 switch(pProperty
->nWID
)
2717 case OWN_ATTR_EDGE_START_OBJ
:
2718 case OWN_ATTR_EDGE_END_OBJ
:
2720 SdrObject
* pNode
= pEdgeObj
->GetConnectedNode(pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
);
2723 Reference
< drawing::XShape
> xShape( GetXShapeForSdrObject( pNode
) );
2731 case OWN_ATTR_EDGE_START_POS
:
2732 case OWN_ATTR_EDGE_END_POS
:
2734 Point
aPoint( pEdgeObj
->GetTailPoint( pProperty
->nWID
== OWN_ATTR_EDGE_START_POS
) );
2735 if( mpModel
->IsWriter() )
2736 aPoint
-= mpObj
->GetAnchorPos();
2738 ForceMetricTo100th_mm( aPoint
);
2739 awt::Point
aUnoPoint( aPoint
.X(), aPoint
.Y() );
2741 rValue
<<= aUnoPoint
;
2744 case OWN_ATTR_GLUEID_HEAD
:
2745 case OWN_ATTR_GLUEID_TAIL
:
2747 rValue
<<= (sal_Int32
)pEdgeObj
->getGluePointIndex( pProperty
->nWID
== OWN_ATTR_GLUEID_HEAD
);
2750 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2752 basegfx::B2DPolyPolygon
aPolyPoly( pEdgeObj
->GetEdgeTrackPath() );
2753 if( mpModel
->IsWriter() )
2755 Point
aPoint( mpObj
->GetAnchorPos() );
2756 aPolyPoly
.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint
.X(), -aPoint
.Y()));
2758 // Reintroduction of fix for issue #i59051# (#i108851#)
2759 ForceMetricTo100th_mm( aPolyPoly
);
2760 drawing::PolyPolygonBezierCoords aRetval
;
2761 basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPoly
, aRetval
);
2770 case OWN_ATTR_MEASURE_START_POS
:
2771 case OWN_ATTR_MEASURE_END_POS
:
2773 SdrMeasureObj
* pMeasureObj
= dynamic_cast<SdrMeasureObj
*>(mpObj
.get());
2776 Point
aPoint( pMeasureObj
->GetPoint( pProperty
->nWID
== OWN_ATTR_MEASURE_START_POS
? 0 : 1 ) );
2777 if( mpModel
->IsWriter() )
2778 aPoint
-= mpObj
->GetAnchorPos();
2780 // Reintroduction of fix for issue #i59051# (#i108851#)
2781 ForceMetricTo100th_mm( aPoint
);
2782 awt::Point
aUnoPoint( aPoint
.X(), aPoint
.Y() );
2784 rValue
<<= aUnoPoint
;
2790 case OWN_ATTR_FILLBMP_MODE
:
2792 const SfxItemSet
& rObjItemSet
= mpObj
->GetMergedItemSet();
2794 const XFillBmpStretchItem
* pStretchItem
= static_cast<const XFillBmpStretchItem
*>(&rObjItemSet
.Get(XATTR_FILLBMP_STRETCH
));
2795 const XFillBmpTileItem
* pTileItem
= static_cast<const XFillBmpTileItem
*>(&rObjItemSet
.Get(XATTR_FILLBMP_TILE
));
2797 if( pTileItem
&& pTileItem
->GetValue() )
2799 rValue
<<= drawing::BitmapMode_REPEAT
;
2801 else if( pStretchItem
&& pStretchItem
->GetValue() )
2803 rValue
<<= drawing::BitmapMode_STRETCH
;
2807 rValue
<<= drawing::BitmapMode_NO_REPEAT
;
2811 case SDRATTR_LAYERID
:
2812 rValue
<<= (sal_Int16
)mpObj
->GetLayer();
2815 case SDRATTR_LAYERNAME
:
2817 SdrLayer
* pLayer
= mpModel
->GetLayerAdmin().GetLayerPerID(mpObj
->GetLayer());
2820 OUString
aName( pLayer
->GetName() );
2826 case SDRATTR_ROTATEANGLE
:
2827 rValue
<<= (sal_Int32
)mpObj
->GetRotateAngle();
2830 case SDRATTR_SHEARANGLE
:
2831 rValue
<<= (sal_Int32
)mpObj
->GetShearAngle();
2834 case OWN_ATTR_INTEROPGRABBAG
:
2836 mpObj
->GetGrabBagItem(rValue
);
2840 case SDRATTR_OBJMOVEPROTECT
:
2841 rValue
= uno::makeAny( mpObj
->IsMoveProtect() );
2844 case SDRATTR_OBJECTNAME
:
2846 OUString
aName( mpObj
->GetName() );
2852 case OWN_ATTR_MISC_OBJ_TITLE
:
2854 OUString
aTitle( mpObj
->GetTitle() );
2859 case OWN_ATTR_MISC_OBJ_DESCRIPTION
:
2861 OUString
aDescription( mpObj
->GetDescription() );
2862 rValue
<<= aDescription
;
2866 case SDRATTR_OBJPRINTABLE
:
2867 rValue
<<= mpObj
->IsPrintable();
2870 case SDRATTR_OBJVISIBLE
:
2871 rValue
<<= mpObj
->IsVisible();
2874 case SDRATTR_OBJSIZEPROTECT
:
2875 rValue
<<= mpObj
->IsResizeProtect();
2878 case OWN_ATTR_PAGE_NUMBER
:
2880 SdrPageObj
* pPageObj
= dynamic_cast<SdrPageObj
*>(mpObj
.get());
2883 SdrPage
* pPage
= pPageObj
->GetReferencedPage();
2884 sal_Int32 nPageNumber
= (pPage
) ? pPage
->GetPageNum() : 0L;
2887 rValue
<<= nPageNumber
;
2892 case OWN_ATTR_UINAME_SINGULAR
:
2894 rValue
<<= mpObj
->TakeObjNameSingul();
2898 case OWN_ATTR_UINAME_PLURAL
:
2900 rValue
<<= mpObj
->TakeObjNamePlural();
2903 case OWN_ATTR_METAFILE
:
2905 SdrOle2Obj
* pObj
= dynamic_cast<SdrOle2Obj
*>(mpObj
.get());
2908 const Graphic
* pGraphic
= pObj
->GetGraphic();
2911 bool bIsWMF
= false;
2912 if ( pGraphic
->IsLink() )
2914 GfxLink aLnk
= pGraphic
->GetLink();
2915 if ( aLnk
.GetType() == GFX_LINK_TYPE_NATIVE_WMF
)
2918 uno::Sequence
<sal_Int8
> aSeq(reinterpret_cast<sal_Int8
const *>(aLnk
.GetData()), (sal_Int32
) aLnk
.GetDataSize());
2924 // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
2925 GDIMetaFile
aMtf(pObj
->GetGraphic()->GetGDIMetaFile());
2926 SvMemoryStream
aDestStrm( 65535, 65535 );
2927 ConvertGDIMetaFileToWMF( aMtf
, aDestStrm
, NULL
, false );
2928 const uno::Sequence
<sal_Int8
> aSeq(
2929 static_cast< const sal_Int8
* >(aDestStrm
.GetData()),
2930 aDestStrm
.GetEndOfData());
2937 rValue
= GetBitmap( true );
2951 bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry
* pProperty
, ::com::sun::star::beans::PropertyState
& rState
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
2953 if( pProperty
->nWID
== OWN_ATTR_FILLBMP_MODE
)
2955 const SfxItemSet
& rSet
= mpObj
->GetMergedItemSet();
2957 if( rSet
.GetItemState( XATTR_FILLBMP_STRETCH
, false ) == SfxItemState::SET
||
2958 rSet
.GetItemState( XATTR_FILLBMP_TILE
, false ) == SfxItemState::SET
)
2960 rState
= beans::PropertyState_DIRECT_VALUE
;
2964 rState
= beans::PropertyState_AMBIGUOUS_VALUE
;
2967 else if((( pProperty
->nWID
>= OWN_ATTR_VALUE_START
&& pProperty
->nWID
<= OWN_ATTR_VALUE_END
) ||
2968 ( pProperty
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pProperty
->nWID
<= SDRATTR_NOTPERSIST_LAST
)) && ( pProperty
->nWID
!= SDRATTR_TEXTDIRECTION
) )
2970 rState
= beans::PropertyState_DIRECT_VALUE
;
2982 bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry
* pProperty
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
2984 if( pProperty
->nWID
== OWN_ATTR_FILLBMP_MODE
)
2986 mpObj
->ClearMergedItem( XATTR_FILLBMP_STRETCH
);
2987 mpObj
->ClearMergedItem( XATTR_FILLBMP_TILE
);
2990 else if((pProperty
->nWID
>= OWN_ATTR_VALUE_START
&& pProperty
->nWID
<= OWN_ATTR_VALUE_END
) ||
2991 ( pProperty
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pProperty
->nWID
<= SDRATTR_NOTPERSIST_LAST
))
3003 uno::Sequence
< beans::PropertyState
> SAL_CALL
SvxShape::getPropertyStates( const uno::Sequence
< OUString
>& aPropertyName
)
3004 throw(beans::UnknownPropertyException
, uno::RuntimeException
, std::exception
)
3006 const sal_Int32 nCount
= aPropertyName
.getLength();
3007 const OUString
* pNames
= aPropertyName
.getConstArray();
3009 uno::Sequence
< beans::PropertyState
> aRet( nCount
);
3010 beans::PropertyState
* pState
= aRet
.getArray();
3012 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++ )
3013 pState
[nIdx
] = getPropertyState( pNames
[nIdx
] );
3020 void SAL_CALL
SvxShape::setPropertyToDefault( const OUString
& PropertyName
)
3021 throw(beans::UnknownPropertyException
, uno::RuntimeException
, std::exception
)
3023 if( mpImpl
->mpMaster
)
3025 mpImpl
->mpMaster
->setPropertyToDefault( PropertyName
);
3029 _setPropertyToDefault( PropertyName
);
3033 void SAL_CALL
SvxShape::_setPropertyToDefault( const OUString
& PropertyName
)
3034 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
3036 ::SolarMutexGuard aGuard
;
3038 const SfxItemPropertySimpleEntry
* pProperty
= mpPropSet
->getPropertyMapEntry(PropertyName
);
3040 if( !mpObj
.is() || mpModel
== NULL
|| pProperty
== NULL
)
3041 throw beans::UnknownPropertyException();
3043 if( !setPropertyToDefaultImpl( pProperty
) )
3045 mpObj
->ClearMergedItem( pProperty
->nWID
);
3048 mpModel
->SetChanged();
3053 uno::Any SAL_CALL
SvxShape::getPropertyDefault( const OUString
& aPropertyName
)
3054 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
3056 if( mpImpl
->mpMaster
)
3058 return mpImpl
->mpMaster
->getPropertyDefault( aPropertyName
);
3062 return _getPropertyDefault( aPropertyName
);
3066 uno::Any SAL_CALL
SvxShape::_getPropertyDefault( const OUString
& aPropertyName
)
3067 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
3069 ::SolarMutexGuard aGuard
;
3071 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
3073 if( !mpObj
.is() || pMap
== NULL
|| mpModel
== NULL
)
3074 throw beans::UnknownPropertyException();
3076 if(( pMap
->nWID
>= OWN_ATTR_VALUE_START
&& pMap
->nWID
<= OWN_ATTR_VALUE_END
) ||
3077 ( pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
))
3079 return getPropertyValue( aPropertyName
);
3082 // get default from ItemPool
3083 if(!SfxItemPool::IsWhich(pMap
->nWID
))
3084 throw beans::UnknownPropertyException();
3086 SfxItemSet
aSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
3087 aSet
.Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
3089 return GetAnyForItem( aSet
, pMap
);
3092 // XMultiPropertyStates
3093 void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException
, std::exception
)
3095 ::SolarMutexGuard aGuard
;
3098 throw lang::DisposedException();
3099 mpObj
->ClearMergedItem(); // nWhich == 0 => all
3101 if(mpObj
->ISA(SdrGrafObj
))
3103 // defaults for graphic objects have changed:
3104 mpObj
->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE
) );
3105 mpObj
->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE
) );
3108 // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3109 // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3110 // does not load lathe or extrude objects, it is possible to set the items
3112 // For other solution possibilities, see task description.
3113 if(mpObj
->ISA(E3dLatheObj
) || mpObj
->ISA(E3dExtrudeObj
))
3115 mpObj
->SetMergedItem(Svx3DCharacterModeItem(true));
3118 mpModel
->SetChanged();
3121 void SvxShape::setPropertiesToDefault(
3122 const uno::Sequence
<OUString
>& aPropertyNames
)
3123 throw (beans::UnknownPropertyException
, uno::RuntimeException
, std::exception
)
3125 for ( sal_Int32 pos
= 0; pos
< aPropertyNames
.getLength(); ++pos
)
3126 setPropertyToDefault( aPropertyNames
[pos
] );
3129 uno::Sequence
<uno::Any
> SvxShape::getPropertyDefaults(
3130 const uno::Sequence
<OUString
>& aPropertyNames
)
3131 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
,
3132 uno::RuntimeException
, std::exception
)
3134 ::std::vector
<uno::Any
> ret
;
3135 for ( sal_Int32 pos
= 0; pos
< aPropertyNames
.getLength(); ++pos
)
3136 ret
.push_back( getPropertyDefault( aPropertyNames
[pos
] ) );
3137 return uno::Sequence
<uno::Any
>( &ret
[0], ret
.size() );
3145 OUString SAL_CALL
SvxShape::getImplementationName()
3146 throw(uno::RuntimeException
, std::exception
)
3148 return OUString("SvxShape");
3151 #define STAR_NAMESPACE "com.sun.star."
3153 const char* sUNO_service_style_ParagraphProperties
= STAR_NAMESPACE
"style.ParagraphProperties";
3154 const char* sUNO_service_style_ParagraphPropertiesComplex
= STAR_NAMESPACE
"style.ParagraphPropertiesComplex";
3155 const char* sUNO_service_style_ParagraphPropertiesAsian
= STAR_NAMESPACE
"style.ParagraphPropertiesAsian";
3156 const char* sUNO_service_style_CharacterProperties
= STAR_NAMESPACE
"style.CharacterProperties";
3157 const char* sUNO_service_style_CharacterPropertiesComplex
= STAR_NAMESPACE
"style.CharacterPropertiesComplex";
3158 const char* sUNO_service_style_CharacterPropertiesAsian
= STAR_NAMESPACE
"style.CharacterPropertiesAsian";
3160 const char* sUNO_service_drawing_FillProperties
= STAR_NAMESPACE
"drawing.FillProperties";
3161 const char* sUNO_service_drawing_TextProperties
= STAR_NAMESPACE
"drawing.TextProperties";
3162 const char* sUNO_service_drawing_LineProperties
= STAR_NAMESPACE
"drawing.LineProperties";
3163 const char* sUNO_service_drawing_ConnectorProperties
= STAR_NAMESPACE
"drawing.ConnectorProperties";
3164 const char* sUNO_service_drawing_MeasureProperties
= STAR_NAMESPACE
"drawing.MeasureProperties";
3165 const char* sUNO_service_drawing_ShadowProperties
= STAR_NAMESPACE
"drawing.ShadowProperties";
3167 const char* sUNO_service_drawing_RotationDescriptor
= STAR_NAMESPACE
"drawing.RotationDescriptor";
3169 const char* sUNO_service_drawing_Text
= STAR_NAMESPACE
"drawing.Text";
3170 const char* sUNO_service_drawing_GroupShape
= STAR_NAMESPACE
"drawing.GroupShape";
3172 const char* sUNO_service_drawing_CustomShapeProperties
= STAR_NAMESPACE
"drawing.CustomShapeProperties";
3173 const char* sUNO_service_drawing_CustomShape
= STAR_NAMESPACE
"drawing.CustomShape";
3175 const char* sUNO_service_drawing_PolyPolygonDescriptor
= STAR_NAMESPACE
"drawing.PolyPolygonDescriptor";
3176 const char* sUNO_service_drawing_PolyPolygonBezierDescriptor
= STAR_NAMESPACE
"drawing.PolyPolygonBezierDescriptor";
3178 const char* sUNO_service_drawing_LineShape
= STAR_NAMESPACE
"drawing.LineShape";
3179 const char* sUNO_service_drawing_Shape
= STAR_NAMESPACE
"drawing.Shape";
3180 const char* sUNO_service_drawing_RectangleShape
= STAR_NAMESPACE
"drawing.RectangleShape";
3181 const char* sUNO_service_drawing_EllipseShape
= STAR_NAMESPACE
"drawing.EllipseShape";
3182 const char* sUNO_service_drawing_PolyPolygonShape
= STAR_NAMESPACE
"drawing.PolyPolygonShape";
3183 const char* sUNO_service_drawing_PolyLineShape
= STAR_NAMESPACE
"drawing.PolyLineShape";
3184 const char* sUNO_service_drawing_OpenBezierShape
= STAR_NAMESPACE
"drawing.OpenBezierShape";
3185 const char* sUNO_service_drawing_ClosedBezierShape
= STAR_NAMESPACE
"drawing.ClosedBezierShape";
3186 const char* sUNO_service_drawing_TextShape
= STAR_NAMESPACE
"drawing.TextShape";
3187 const char* sUNO_service_drawing_GraphicObjectShape
= STAR_NAMESPACE
"drawing.GraphicObjectShape";
3188 const char* sUNO_service_drawing_OLE2Shape
= STAR_NAMESPACE
"drawing.OLE2Shape";
3189 const char* sUNO_service_drawing_PageShape
= STAR_NAMESPACE
"drawing.PageShape";
3190 const char* sUNO_service_drawing_CaptionShape
= STAR_NAMESPACE
"drawing.CaptionShape";
3191 const char* sUNO_service_drawing_MeasureShape
= STAR_NAMESPACE
"drawing.MeasureShape";
3192 const char* sUNO_service_drawing_FrameShape
= STAR_NAMESPACE
"drawing.FrameShape";
3193 const char* sUNO_service_drawing_ControlShape
= STAR_NAMESPACE
"drawing.ControlShape";
3194 const char* sUNO_service_drawing_ConnectorShape
= STAR_NAMESPACE
"drawing.ConnectorShape";
3195 const char* sUNO_service_drawing_MediaShape
= STAR_NAMESPACE
"drawing.MediaShape";
3198 uno::Sequence
< OUString
> SAL_CALL
SvxShape::getSupportedServiceNames()
3199 throw(uno::RuntimeException
, std::exception
)
3201 if( mpImpl
->mpMaster
)
3203 return mpImpl
->mpMaster
->getSupportedServiceNames();
3207 return _getSupportedServiceNames();
3211 uno::Sequence
< OUString
> SAL_CALL
SvxShape::_getSupportedServiceNames()
3212 throw(uno::RuntimeException
)
3214 ::SolarMutexGuard aGuard
;
3216 if( mpObj
.is() && mpObj
->GetObjInventor() == SdrInventor
)
3218 const sal_uInt16 nIdent
= mpObj
->GetObjIdentifier();
3224 static uno::Sequence
< OUString
> *pSeq
= 0;
3227 static uno::Sequence
< OUString
> SvxShape_GroupServices
;
3229 comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices
, 2,
3230 sUNO_service_drawing_GroupShape
,
3231 sUNO_service_drawing_Shape
);
3233 pSeq
= &SvxShape_GroupServices
;
3238 case OBJ_CUSTOMSHAPE
:
3240 static uno::Sequence
< OUString
> *pSeq
= 0;
3243 static uno::Sequence
< OUString
> SvxShape_CustomShapeServices
;
3245 comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices
, 13,
3246 sUNO_service_drawing_CustomShape
,
3247 sUNO_service_drawing_Shape
,
3248 sUNO_service_drawing_CustomShapeProperties
,
3249 sUNO_service_drawing_FillProperties
,
3250 sUNO_service_drawing_LineProperties
,
3251 sUNO_service_drawing_Text
,
3252 sUNO_service_drawing_TextProperties
,
3253 sUNO_service_style_ParagraphProperties
,
3254 sUNO_service_style_ParagraphPropertiesComplex
,
3255 sUNO_service_style_ParagraphPropertiesAsian
,
3256 sUNO_service_style_CharacterProperties
,
3257 sUNO_service_style_CharacterPropertiesComplex
,
3258 sUNO_service_style_CharacterPropertiesAsian
,
3259 sUNO_service_drawing_ShadowProperties
,
3260 sUNO_service_drawing_RotationDescriptor
);
3261 pSeq
= &SvxShape_CustomShapeServices
;
3267 static uno::Sequence
< OUString
> *pSeq
= 0;
3270 static uno::Sequence
< OUString
> SvxShape_LineServices
;
3272 comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices
,14,
3273 sUNO_service_drawing_LineShape
,
3275 sUNO_service_drawing_Shape
,
3276 sUNO_service_drawing_LineProperties
,
3278 sUNO_service_drawing_Text
,
3279 sUNO_service_drawing_TextProperties
,
3280 sUNO_service_style_ParagraphProperties
,
3281 sUNO_service_style_ParagraphPropertiesComplex
,
3282 sUNO_service_style_ParagraphPropertiesAsian
,
3283 sUNO_service_style_CharacterProperties
,
3284 sUNO_service_style_CharacterPropertiesComplex
,
3285 sUNO_service_style_CharacterPropertiesAsian
,
3287 sUNO_service_drawing_PolyPolygonDescriptor
,
3288 sUNO_service_drawing_ShadowProperties
,
3289 sUNO_service_drawing_RotationDescriptor
);
3291 pSeq
= &SvxShape_LineServices
;
3298 static uno::Sequence
< OUString
> *pSeq
= 0;
3301 static uno::Sequence
< OUString
> SvxShape_RectServices
;
3303 comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices
,14,
3304 sUNO_service_drawing_RectangleShape
,
3306 sUNO_service_drawing_Shape
,
3307 sUNO_service_drawing_FillProperties
,
3308 sUNO_service_drawing_LineProperties
,
3309 sUNO_service_drawing_Text
,
3310 sUNO_service_drawing_TextProperties
,
3311 sUNO_service_style_ParagraphProperties
,
3312 sUNO_service_style_ParagraphPropertiesComplex
,
3313 sUNO_service_style_ParagraphPropertiesAsian
,
3314 sUNO_service_style_CharacterProperties
,
3315 sUNO_service_style_CharacterPropertiesComplex
,
3316 sUNO_service_style_CharacterPropertiesAsian
,
3318 sUNO_service_drawing_ShadowProperties
,
3319 sUNO_service_drawing_RotationDescriptor
);
3320 pSeq
= &SvxShape_RectServices
;
3330 static uno::Sequence
< OUString
> *pSeq
= 0;
3333 static uno::Sequence
< OUString
> SvxShape_CircServices
;
3335 comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices
,14,
3336 sUNO_service_drawing_EllipseShape
,
3338 sUNO_service_drawing_Shape
,
3339 sUNO_service_drawing_FillProperties
,
3340 sUNO_service_drawing_LineProperties
,
3342 sUNO_service_drawing_Text
,
3343 sUNO_service_drawing_TextProperties
,
3344 sUNO_service_style_ParagraphProperties
,
3345 sUNO_service_style_ParagraphPropertiesComplex
,
3346 sUNO_service_style_ParagraphPropertiesAsian
,
3347 sUNO_service_style_CharacterProperties
,
3348 sUNO_service_style_CharacterPropertiesComplex
,
3349 sUNO_service_style_CharacterPropertiesAsian
,
3351 sUNO_service_drawing_ShadowProperties
,
3352 sUNO_service_drawing_RotationDescriptor
);
3354 pSeq
= &SvxShape_CircServices
;
3363 static uno::Sequence
< OUString
> *pSeq
= 0;
3366 static uno::Sequence
< OUString
> SvxShape_PathServices
;
3367 comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices
,14,
3368 sUNO_service_drawing_PolyLineShape
,
3370 sUNO_service_drawing_Shape
,
3371 sUNO_service_drawing_LineProperties
,
3373 sUNO_service_drawing_PolyPolygonDescriptor
,
3375 sUNO_service_drawing_Text
,
3376 sUNO_service_drawing_TextProperties
,
3377 sUNO_service_style_ParagraphProperties
,
3378 sUNO_service_style_ParagraphPropertiesComplex
,
3379 sUNO_service_style_ParagraphPropertiesAsian
,
3380 sUNO_service_style_CharacterProperties
,
3381 sUNO_service_style_CharacterPropertiesComplex
,
3382 sUNO_service_style_CharacterPropertiesAsian
,
3384 sUNO_service_drawing_ShadowProperties
,
3385 sUNO_service_drawing_RotationDescriptor
);
3386 pSeq
= &SvxShape_PathServices
;
3394 static uno::Sequence
< OUString
> *pSeq
= 0;
3397 static uno::Sequence
< OUString
> SvxShape_PolyServices
;
3398 comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices
,15,
3399 sUNO_service_drawing_PolyPolygonShape
,
3401 sUNO_service_drawing_Shape
,
3402 sUNO_service_drawing_LineProperties
,
3403 sUNO_service_drawing_FillProperties
,
3405 sUNO_service_drawing_PolyPolygonDescriptor
,
3407 sUNO_service_drawing_Text
,
3408 sUNO_service_drawing_TextProperties
,
3409 sUNO_service_style_ParagraphProperties
,
3410 sUNO_service_style_ParagraphPropertiesComplex
,
3411 sUNO_service_style_ParagraphPropertiesAsian
,
3412 sUNO_service_style_CharacterProperties
,
3413 sUNO_service_style_CharacterPropertiesComplex
,
3414 sUNO_service_style_CharacterPropertiesAsian
,
3416 sUNO_service_drawing_ShadowProperties
,
3417 sUNO_service_drawing_RotationDescriptor
);
3419 pSeq
= &SvxShape_PolyServices
;
3427 static uno::Sequence
< OUString
> *pSeq
= 0;
3430 static uno::Sequence
< OUString
> SvxShape_FreeLineServices
;
3432 comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices
,15,
3433 sUNO_service_drawing_OpenBezierShape
,
3435 sUNO_service_drawing_Shape
,
3436 sUNO_service_drawing_LineProperties
,
3437 sUNO_service_drawing_FillProperties
,
3439 sUNO_service_drawing_PolyPolygonBezierDescriptor
,
3441 sUNO_service_drawing_Text
,
3442 sUNO_service_drawing_TextProperties
,
3443 sUNO_service_style_ParagraphProperties
,
3444 sUNO_service_style_ParagraphPropertiesComplex
,
3445 sUNO_service_style_ParagraphPropertiesAsian
,
3446 sUNO_service_style_CharacterProperties
,
3447 sUNO_service_style_CharacterPropertiesComplex
,
3448 sUNO_service_style_CharacterPropertiesAsian
,
3450 sUNO_service_drawing_ShadowProperties
,
3451 sUNO_service_drawing_RotationDescriptor
);
3453 pSeq
= &SvxShape_FreeLineServices
;
3462 static uno::Sequence
< OUString
> *pSeq
= 0;
3465 static uno::Sequence
< OUString
> SvxShape_FreeFillServices
;
3466 comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices
,15,
3467 sUNO_service_drawing_ClosedBezierShape
,
3469 sUNO_service_drawing_Shape
,
3470 sUNO_service_drawing_LineProperties
,
3471 sUNO_service_drawing_FillProperties
,
3473 sUNO_service_drawing_PolyPolygonBezierDescriptor
,
3475 sUNO_service_drawing_Text
,
3476 sUNO_service_drawing_TextProperties
,
3477 sUNO_service_style_ParagraphProperties
,
3478 sUNO_service_style_ParagraphPropertiesComplex
,
3479 sUNO_service_style_ParagraphPropertiesAsian
,
3480 sUNO_service_style_CharacterProperties
,
3481 sUNO_service_style_CharacterPropertiesComplex
,
3482 sUNO_service_style_CharacterPropertiesAsian
,
3484 sUNO_service_drawing_ShadowProperties
,
3485 sUNO_service_drawing_RotationDescriptor
);
3487 pSeq
= &SvxShape_FreeFillServices
;
3492 case OBJ_OUTLINETEXT
:
3496 static uno::Sequence
< OUString
> *pSeq
= 0;
3499 static uno::Sequence
< OUString
> SvxShape_TextServices
;
3500 comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices
,14,
3501 sUNO_service_drawing_TextShape
,
3503 sUNO_service_drawing_Shape
,
3504 sUNO_service_drawing_FillProperties
,
3505 sUNO_service_drawing_LineProperties
,
3507 sUNO_service_drawing_Text
,
3508 sUNO_service_drawing_TextProperties
,
3509 sUNO_service_style_ParagraphProperties
,
3510 sUNO_service_style_ParagraphPropertiesComplex
,
3511 sUNO_service_style_ParagraphPropertiesAsian
,
3512 sUNO_service_style_CharacterProperties
,
3513 sUNO_service_style_CharacterPropertiesComplex
,
3514 sUNO_service_style_CharacterPropertiesAsian
,
3516 sUNO_service_drawing_ShadowProperties
,
3517 sUNO_service_drawing_RotationDescriptor
);
3519 pSeq
= &SvxShape_TextServices
;
3526 static uno::Sequence
< OUString
> *pSeq
= 0;
3529 static uno::Sequence
< OUString
> SvxShape_GrafServices
;
3530 comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices
, 12,
3531 sUNO_service_drawing_GraphicObjectShape
,
3533 sUNO_service_drawing_Shape
,
3535 sUNO_service_drawing_Text
,
3536 sUNO_service_drawing_TextProperties
,
3537 sUNO_service_style_ParagraphProperties
,
3538 sUNO_service_style_ParagraphPropertiesComplex
,
3539 sUNO_service_style_ParagraphPropertiesAsian
,
3540 sUNO_service_style_CharacterProperties
,
3541 sUNO_service_style_CharacterPropertiesComplex
,
3542 sUNO_service_style_CharacterPropertiesAsian
,
3544 sUNO_service_drawing_ShadowProperties
,
3545 sUNO_service_drawing_RotationDescriptor
);
3547 pSeq
= &SvxShape_GrafServices
;
3554 static uno::Sequence
< OUString
> *pSeq
= 0;
3557 static uno::Sequence
< OUString
> SvxShape_Ole2Services
;
3559 comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services
, 12,
3560 sUNO_service_drawing_OLE2Shape
,
3561 sUNO_service_drawing_Shape
,
3563 // #i118485# Added Text, Shadow and Rotation
3564 sUNO_service_drawing_Text
,
3565 sUNO_service_drawing_TextProperties
,
3566 sUNO_service_style_ParagraphProperties
,
3567 sUNO_service_style_ParagraphPropertiesComplex
,
3568 sUNO_service_style_ParagraphPropertiesAsian
,
3569 sUNO_service_style_CharacterProperties
,
3570 sUNO_service_style_CharacterPropertiesComplex
,
3571 sUNO_service_style_CharacterPropertiesAsian
,
3573 sUNO_service_drawing_ShadowProperties
,
3574 sUNO_service_drawing_RotationDescriptor
);
3576 pSeq
= &SvxShape_Ole2Services
;
3583 static uno::Sequence
< OUString
> *pSeq
= 0;
3586 static uno::Sequence
< OUString
> SvxShape_CaptionServices
;
3588 comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices
,14,
3589 sUNO_service_drawing_CaptionShape
,
3591 sUNO_service_drawing_Shape
,
3592 sUNO_service_drawing_FillProperties
,
3593 sUNO_service_drawing_LineProperties
,
3595 sUNO_service_drawing_Text
,
3596 sUNO_service_drawing_TextProperties
,
3597 sUNO_service_style_ParagraphProperties
,
3598 sUNO_service_style_ParagraphPropertiesComplex
,
3599 sUNO_service_style_ParagraphPropertiesAsian
,
3600 sUNO_service_style_CharacterProperties
,
3601 sUNO_service_style_CharacterPropertiesComplex
,
3602 sUNO_service_style_CharacterPropertiesAsian
,
3604 sUNO_service_drawing_ShadowProperties
,
3605 sUNO_service_drawing_RotationDescriptor
);
3607 pSeq
= &SvxShape_CaptionServices
;
3615 static uno::Sequence
< OUString
> *pSeq
= 0;
3618 static uno::Sequence
< OUString
> SvxShape_PageServices
;
3620 comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices
, 2,
3621 sUNO_service_drawing_PageShape
,
3622 sUNO_service_drawing_Shape
);
3624 pSeq
= &SvxShape_PageServices
;
3632 static uno::Sequence
< OUString
> *pSeq
= 0;
3635 static uno::Sequence
< OUString
> SvxShape_MeasureServices
;
3636 comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices
,15,
3637 sUNO_service_drawing_MeasureShape
,
3639 sUNO_service_drawing_MeasureProperties
,
3641 sUNO_service_drawing_Shape
,
3642 sUNO_service_drawing_LineProperties
,
3644 sUNO_service_drawing_Text
,
3645 sUNO_service_drawing_TextProperties
,
3646 sUNO_service_style_ParagraphProperties
,
3647 sUNO_service_style_ParagraphPropertiesComplex
,
3648 sUNO_service_style_ParagraphPropertiesAsian
,
3649 sUNO_service_style_CharacterProperties
,
3650 sUNO_service_style_CharacterPropertiesComplex
,
3651 sUNO_service_style_CharacterPropertiesAsian
,
3653 sUNO_service_drawing_PolyPolygonDescriptor
,
3654 sUNO_service_drawing_ShadowProperties
,
3655 sUNO_service_drawing_RotationDescriptor
);
3657 pSeq
= &SvxShape_MeasureServices
;
3665 static uno::Sequence
< OUString
> *pSeq
= 0;
3668 static uno::Sequence
< OUString
> SvxShape_FrameServices
;
3670 comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices
, 2,
3671 sUNO_service_drawing_FrameShape
,
3672 sUNO_service_drawing_Shape
);
3674 pSeq
= &SvxShape_FrameServices
;
3682 static uno::Sequence
< OUString
> *pSeq
= 0;
3685 static uno::Sequence
< OUString
> SvxShape_UnoServices
;
3686 comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices
, 2,
3687 sUNO_service_drawing_ControlShape
,
3688 sUNO_service_drawing_Shape
);
3690 pSeq
= &SvxShape_UnoServices
;
3697 static uno::Sequence
< OUString
> *pSeq
= 0;
3700 static uno::Sequence
< OUString
> SvxShape_EdgeServices
;
3702 comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices
,15,
3703 sUNO_service_drawing_ConnectorShape
,
3704 sUNO_service_drawing_ConnectorProperties
,
3706 sUNO_service_drawing_Shape
,
3707 sUNO_service_drawing_LineProperties
,
3709 sUNO_service_drawing_Text
,
3710 sUNO_service_drawing_TextProperties
,
3711 sUNO_service_style_ParagraphProperties
,
3712 sUNO_service_style_ParagraphPropertiesComplex
,
3713 sUNO_service_style_ParagraphPropertiesAsian
,
3714 sUNO_service_style_CharacterProperties
,
3715 sUNO_service_style_CharacterPropertiesComplex
,
3716 sUNO_service_style_CharacterPropertiesAsian
,
3718 sUNO_service_drawing_PolyPolygonDescriptor
,
3719 sUNO_service_drawing_ShadowProperties
,
3720 sUNO_service_drawing_RotationDescriptor
);
3722 pSeq
= &SvxShape_EdgeServices
;
3728 static uno::Sequence
< OUString
> *pSeq
= 0;
3731 static uno::Sequence
< OUString
> SvxShape_MediaServices
;
3733 comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices
, 2,
3734 sUNO_service_drawing_MediaShape
,
3735 sUNO_service_drawing_Shape
);
3737 pSeq
= &SvxShape_MediaServices
;
3743 else if( mpObj
.is() && mpObj
->GetObjInventor() == FmFormInventor
)
3745 #if OSL_DEBUG_LEVEL > 0
3746 const sal_uInt16 nIdent
= mpObj
->GetObjIdentifier();
3747 OSL_ENSURE( nIdent
== OBJ_UNO
, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
3749 static uno::Sequence
< OUString
> *pSeq
= 0;
3752 static uno::Sequence
< OUString
> SvxShape_UnoServices
;
3753 comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices
, 2,
3754 sUNO_service_drawing_ControlShape
,
3755 sUNO_service_drawing_Shape
);
3757 pSeq
= &SvxShape_UnoServices
;
3761 OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3762 uno::Sequence
< OUString
> aSeq
;
3766 sal_Bool SAL_CALL
SvxShape::supportsService( const OUString
& ServiceName
) throw ( uno::RuntimeException
, std::exception
)
3768 return cppu::supportsService(this, ServiceName
);
3771 // XGluePointsSupplier
3772 uno::Reference
< container::XIndexContainer
> SAL_CALL
SvxShape::getGluePoints()
3773 throw(uno::RuntimeException
, std::exception
)
3775 ::SolarMutexGuard aGuard
;
3776 uno::Reference
< container::XIndexContainer
> xGluePoints( mxGluePoints
);
3778 if( mpObj
.is() && !xGluePoints
.is() )
3780 uno::Reference
< container::XIndexContainer
> xNew( SvxUnoGluePointAccess_createInstance( mpObj
.get() ), uno::UNO_QUERY
);
3781 mxGluePoints
= xGluePoints
= xNew
;
3790 uno::Reference
< uno::XInterface
> SAL_CALL
SvxShape::getParent( )
3791 throw(uno::RuntimeException
, std::exception
)
3793 ::SolarMutexGuard aGuard
;
3795 if( mpObj
.is() && mpObj
->GetObjList() )
3797 SdrObjList
* pObjList
= mpObj
->GetObjList();
3799 switch( pObjList
->GetListKind() )
3801 case SDROBJLIST_GROUPOBJ
:
3802 if( pObjList
->GetOwnerObj()->ISA( SdrObjGroup
) )
3803 return PTR_CAST( SdrObjGroup
, pObjList
->GetOwnerObj())->getUnoShape();
3804 else if( pObjList
->GetOwnerObj()->ISA( E3dScene
) )
3805 return PTR_CAST( E3dScene
, pObjList
->GetOwnerObj())->getUnoShape();
3807 case SDROBJLIST_DRAWPAGE
:
3808 case SDROBJLIST_MASTERPAGE
:
3809 return PTR_CAST( SdrPage
, pObjList
)->getUnoPage();
3811 OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
3816 uno::Reference
< uno::XInterface
> xParent
;
3822 void SAL_CALL
SvxShape::setParent( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& )
3823 throw(lang::NoSupportException
, uno::RuntimeException
, std::exception
)
3825 throw lang::NoSupportException();
3830 /** called from the XActionLockable interface methods on initial locking */
3831 void SvxShape::lock()
3837 /** called from the XActionLockable interface methods on final unlock */
3838 void SvxShape::unlock()
3845 sal_Bool SAL_CALL
SvxShape::isActionLocked( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
3847 ::SolarMutexGuard aGuard
;
3849 return mnLockCount
!= 0;
3854 void SAL_CALL
SvxShape::addActionLock( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
3856 ::SolarMutexGuard aGuard
;
3858 DBG_ASSERT( mnLockCount
< 0xffff, "lock overflow in SvxShape!" );
3861 if( mnLockCount
== 1 )
3867 void SAL_CALL
SvxShape::removeActionLock( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
3869 ::SolarMutexGuard aGuard
;
3871 DBG_ASSERT( mnLockCount
> 0, "lock underflow in SvxShape!" );
3874 if( mnLockCount
== 0 )
3880 void SAL_CALL
SvxShape::setActionLocks( sal_Int16 nLock
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
3882 ::SolarMutexGuard aGuard
;
3884 if( (mnLockCount
== 0) && (nLock
!= 0) )
3887 if( (mnLockCount
!= 0) && (nLock
== 0) )
3890 mnLockCount
= (sal_uInt16
)nLock
;
3895 sal_Int16 SAL_CALL
SvxShape::resetActionLocks( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
3897 ::SolarMutexGuard aGuard
;
3899 if( mnLockCount
!= 0 )
3902 sal_Int16 nOldLocks
= (sal_Int16
)mnLockCount
;
3910 /** since polygon shapes can change theire kind during editing, we have
3912 Circle shapes also change theire kind, but theire all treated equal
3913 so no update is necessary.
3915 void SvxShape::updateShapeKind()
3917 switch( mpImpl
->mnObjId
)
3929 const sal_uInt32 nId
= mpObj
->GetObjIdentifier();
3931 if( nId
!= mpImpl
->mnObjId
)
3933 mpImpl
->mnObjId
= nId
;
3941 SvxShapeText::SvxShapeText( SdrObject
* pObject
) throw ()
3942 : SvxShape( pObject
, getSvxMapProvider().GetMap(SVXMAP_TEXT
), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT
, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3944 if( pObject
&& pObject
->GetModel() )
3945 SetEditSource( new SvxTextEditSource( pObject
, 0 ) );
3949 SvxShapeText::SvxShapeText( SdrObject
* pObject
, const SfxItemPropertyMapEntry
* pPropertyMap
, const SvxItemPropertySet
* pPropertySet
) throw ()
3950 : SvxShape( pObject
, pPropertyMap
, pPropertySet
), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3952 if( pObject
&& pObject
->GetModel() )
3953 SetEditSource( new SvxTextEditSource( pObject
, 0 ) );
3957 SvxShapeText::~SvxShapeText() throw ()
3959 // check if only this instance is registered at the ranges
3960 DBG_ASSERT( (NULL
== GetEditSource()) || (GetEditSource()->getRanges().size()==1),
3961 "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
3964 void SvxShapeText::Create( SdrObject
* pNewObj
, SvxDrawPage
* pNewPage
)
3966 if( pNewObj
&& (NULL
== GetEditSource()))
3967 SetEditSource( new SvxTextEditSource( pNewObj
, 0 ) );
3968 SvxShape::Create( pNewObj
, pNewPage
);
3973 uno::Any SAL_CALL
SvxShapeText::queryInterface( const uno::Type
& rType
)
3974 throw( uno::RuntimeException
, std::exception
)
3976 return SvxShape::queryInterface( rType
);
3981 uno::Any SAL_CALL
SvxShapeText::queryAggregation( const uno::Type
& rType
)
3982 throw( uno::RuntimeException
, std::exception
)
3984 uno::Any
aAny( SvxShape::queryAggregation( rType
) );
3985 if( aAny
.hasValue() )
3988 return SvxUnoTextBase::queryAggregation( rType
);
3993 void SAL_CALL
SvxShapeText::acquire() throw()
3995 SvxShape::acquire();
3999 void SAL_CALL
SvxShapeText::release() throw()
4001 SvxShape::release();
4006 OUString SAL_CALL
SvxShapeText::getImplementationName() throw( uno::RuntimeException
, std::exception
)
4008 return OUString("SvxShapeText");
4012 uno::Sequence
< OUString
> SAL_CALL
SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException
, std::exception
)
4014 return SvxShape::getSupportedServiceNames();
4018 sal_Bool SAL_CALL
SvxShapeText::supportsService( const OUString
& ServiceName
) throw ( uno::RuntimeException
, std::exception
)
4020 return cppu::supportsService(static_cast<SvxShape
*>(this), ServiceName
);
4025 uno::Sequence
< uno::Type
> SAL_CALL
SvxShapeText::getTypes()
4026 throw( uno::RuntimeException
, std::exception
)
4028 return SvxShape::getTypes();
4031 sal_Int64 SAL_CALL
SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) \
4033 const sal_Int64 nReturn
= SvxShape::getSomething( rId
);
4037 return SvxUnoTextBase::getSomething( rId
);
4041 uno::Sequence
< sal_Int8
> SAL_CALL
SvxShapeText::getImplementationId()
4042 throw( uno::RuntimeException
, std::exception
)
4044 return css::uno::Sequence
<sal_Int8
>();
4049 /** called from the XActionLockable interface methods on initial locking */
4050 void SvxShapeText::lock()
4052 SvxTextEditSource
* pEditSource
= static_cast<SvxTextEditSource
*>(GetEditSource());
4054 pEditSource
->lock();
4059 /** called from the XActionLockable interface methods on final unlock */
4060 void SvxShapeText::unlock()
4062 SvxTextEditSource
* pEditSource
= static_cast<SvxTextEditSource
*>(GetEditSource());
4064 pEditSource
->unlock();
4067 // ::com::sun::star::text::XTextRange
4068 uno::Reference
< text::XTextRange
> SAL_CALL
SvxShapeText::getStart() throw(uno::RuntimeException
, std::exception
)
4070 ::SolarMutexGuard aGuard
;
4071 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4073 ::GetSelection( maSelection
, pForwarder
);
4074 return SvxUnoTextBase::getStart();
4078 uno::Reference
< text::XTextRange
> SAL_CALL
SvxShapeText::getEnd() throw(uno::RuntimeException
, std::exception
)
4080 ::SolarMutexGuard aGuard
;
4081 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4083 ::GetSelection( maSelection
, pForwarder
);
4084 return SvxUnoTextBase::getEnd();
4087 OUString SAL_CALL
SvxShapeText::getString() throw(uno::RuntimeException
, std::exception
)
4089 ::SolarMutexGuard aGuard
;
4090 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4092 ::GetSelection( maSelection
, pForwarder
);
4093 return SvxUnoTextBase::getString();
4097 void SAL_CALL
SvxShapeText::setString( const OUString
& aString
) throw(uno::RuntimeException
, std::exception
)
4099 ::SolarMutexGuard aGuard
;
4100 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4102 ::GetSelection( maSelection
, pForwarder
);
4103 SvxUnoTextBase::setString( aString
);
4106 // override these for special property handling in subcasses. Return true if property is handled
4107 bool SvxShapeText::setPropertyValueImpl( const 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
, std::exception
)
4110 // since SdrTextObj::SetVerticalWriting exchanges
4111 // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
4112 // we have to set the textdirection here
4114 if( pProperty
->nWID
== SDRATTR_TEXTDIRECTION
)
4116 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( mpObj
.get() );
4119 com::sun::star::text::WritingMode eMode
;
4120 if( rValue
>>= eMode
)
4122 pTextObj
->SetVerticalWriting( eMode
== com::sun::star::text::WritingMode_TB_RL
);
4127 return SvxShape::setPropertyValueImpl( rName
, pProperty
, rValue
);
4130 bool SvxShapeText::getPropertyValueImpl( const 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
, std::exception
)
4132 if( pProperty
->nWID
== SDRATTR_TEXTDIRECTION
)
4134 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( mpObj
.get() );
4135 if( pTextObj
&& pTextObj
->IsVerticalWriting() )
4136 rValue
<<= com::sun::star::text::WritingMode_TB_RL
;
4138 rValue
<<= com::sun::star::text::WritingMode_LR_TB
;
4142 return SvxShape::getPropertyValueImpl( rName
, pProperty
, rValue
);
4145 bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry
* pProperty
, ::com::sun::star::beans::PropertyState
& rState
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
4147 return SvxShape::getPropertyStateImpl( pProperty
, rState
);
4150 bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry
* pProperty
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
4152 return SvxShape::setPropertyToDefaultImpl( pProperty
);
4155 SvxShapeRect::SvxShapeRect( SdrObject
* pObj
) throw()
4156 : SvxShapeText( pObj
, getSvxMapProvider().GetMap(SVXMAP_SHAPE
), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE
, SdrObject::GetGlobalDrawObjectItemPool()))
4160 SvxShapeRect::~SvxShapeRect() throw()
4164 uno::Any SAL_CALL
SvxShapeRect::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
, std::exception
)
4166 return SvxShapeText::queryInterface( rType
);
4169 uno::Any SAL_CALL
SvxShapeRect::queryAggregation( const uno::Type
& rType
) throw(uno::RuntimeException
, std::exception
)
4171 return SvxShapeText::queryAggregation( rType
);
4174 void SAL_CALL
SvxShapeRect::acquire() throw()
4176 OWeakAggObject::acquire();
4179 void SAL_CALL
SvxShapeRect::release() throw()
4181 OWeakAggObject::release();
4186 uno::Sequence
< OUString
> SvxShapeRect::getSupportedServiceNames() throw( uno::RuntimeException
, std::exception
)
4188 return SvxShape::getSupportedServiceNames();
4191 /** returns a StarOffice API wrapper for the given SdrObject */
4192 uno::Reference
< drawing::XShape
> GetXShapeForSdrObject( SdrObject
* pObj
) throw ()
4194 uno::Reference
< drawing::XShape
> xShape( pObj
->getUnoShape(), uno::UNO_QUERY
);
4198 /** returns the SdrObject from the given StarOffice API wrapper */
4199 SdrObject
* GetSdrObjectFromXShape( uno::Reference
< drawing::XShape
> xShape
) throw()
4201 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
4202 return pShape
? pShape
->GetSdrObject() : 0;
4207 SdrObject
* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xInt
)
4209 SvxShape
* pSvxShape
= SvxShape::getImplementation( xInt
);
4210 return pSvxShape
? pSvxShape
->GetSdrObject() : 0;
4213 uno::Any
SvxItemPropertySet_getPropertyValue( const SfxItemPropertySimpleEntry
* pMap
, const SfxItemSet
& rSet
)
4215 if(!pMap
|| !pMap
->nWID
)
4218 // Check is for items that store either metric values if thei are positiv or percentage if thei are negativ.
4219 bool bDontConvertNegativeValues
= ( pMap
->nWID
== XATTR_FILLBMP_SIZEX
|| pMap
->nWID
== XATTR_FILLBMP_SIZEY
);
4220 return SvxItemPropertySet::getPropertyValue( pMap
, rSet
, (pMap
->nWID
!= SDRATTR_XMLATTRIBUTES
), bDontConvertNegativeValues
);
4223 void SvxItemPropertySet_setPropertyValue( const SfxItemPropertySimpleEntry
* pMap
, const uno::Any
& rVal
, SfxItemSet
& rSet
)
4225 if(!pMap
|| !pMap
->nWID
)
4228 bool bDontConvertNegativeValues
= ( pMap
->nWID
== XATTR_FILLBMP_SIZEX
|| pMap
->nWID
== XATTR_FILLBMP_SIZEY
);
4229 SvxItemPropertySet::setPropertyValue( pMap
, rVal
, rSet
, bDontConvertNegativeValues
);
4232 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */