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 <com/sun/star/awt/XBitmap.hpp>
22 #include <com/sun/star/awt/Rectangle.hpp>
23 #include <com/sun/star/drawing/CircleKind.hpp>
24 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
25 #include <vcl/svapp.hxx>
26 #include <svl/itemprop.hxx>
27 #include <vcl/fltcall.hxx>
28 #include <osl/mutex.hxx>
29 #include <editeng/unotext.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svx/svdoole2.hxx>
32 #include "svx/shapepropertynotifier.hxx"
33 #include <comphelper/extract.hxx>
34 #include <comphelper/scopeguard.hxx>
35 #include <comphelper/servicehelper.hxx>
36 #include <comphelper/serviceinfohelper.hxx>
37 #include <toolkit/unohlp.hxx>
38 #include <vcl/gfxlink.hxx>
39 #include <vcl/virdev.hxx>
40 #include <sfx2/objsh.hxx>
41 #include <sfx2/viewsh.hxx>
42 #include "svx/svdopage.hxx"
43 #include "svx/xflbstit.hxx"
44 #include "svx/xflbmtit.hxx"
45 #include "svx/xlnstit.hxx"
46 #include "svx/xlnedit.hxx"
47 #include "svx/svdogrp.hxx"
48 #include "svx/scene3d.hxx"
49 #include "svx/svdmodel.hxx"
50 #include "svx/globl3d.hxx"
51 #include "svx/fmglob.hxx"
52 #include "svx/unopage.hxx"
53 #include "svx/view3d.hxx"
54 #include "svx/unoshape.hxx"
55 #include "svx/svxids.hrc"
56 #include "svx/unoshtxt.hxx"
57 #include "svx/svdpage.hxx"
58 #include "svx/unoshprp.hxx"
59 #include "svx/sxciaitm.hxx" // todo: remove
60 #include "svx/svdograf.hxx"
61 #include "svx/unoapi.hxx"
62 #include "svx/svdomeas.hxx"
63 #include "svx/svdpagv.hxx"
64 #include "svx/svdpool.hxx"
65 #include <tools/gen.hxx>
66 #include <tools/shl.hxx> //
67 #include "svx/dialmgr.hxx" // not nice, we need our own resources some day
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 "svx/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/tools/unotools.hxx>
85 #include "shapeimpl.hxx"
86 #include <sal/log.hxx>
91 #include "svx/lathe3d.hxx"
92 #include "svx/extrud3d.hxx"
94 #include <boost/bind.hpp>
95 #include <vcl/wmf.hxx>
97 using namespace ::osl
;
98 using namespace ::cppu
;
99 using namespace ::com::sun::star
;
100 using namespace ::com::sun::star::uno
;
101 using namespace ::com::sun::star::lang
;
102 using namespace ::com::sun::star::container
;
103 using ::svx::PropertyValueProvider
;
104 using ::svx::IPropertyValueProvider
;
108 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoGluePointAccess_createInstance( SdrObject
* pObject
);
110 /***********************************************************************
111 * class SvxShapeImpl *
112 ***********************************************************************/
116 SvxShape
& mrAntiImpl
;
117 SfxItemSet
* mpItemSet
;
119 SvxShapeMaster
* mpMaster
;
120 bool mbHasSdrObjectOwnership
;
123 /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
124 * a SvxShape::Create() call is executed. It is then set to the created
125 * SdrObject so a multiple call to SvxShape::Create() with same SdrObject
128 ::tools::WeakReference
< SdrObject
> mpCreatedObj
;
131 ::cppu::OInterfaceContainerHelper maDisposeListeners
;
132 ::svx::PropertyChangeNotifier maPropertyNotifier
;
134 SvxShapeImpl( SvxShape
& _rAntiImpl
, ::osl::Mutex
& _rMutex
)
135 :mrAntiImpl( _rAntiImpl
)
139 ,mbHasSdrObjectOwnership( false )
140 ,mbDisposing( false )
142 ,maDisposeListeners( _rMutex
)
143 ,maPropertyNotifier( _rAntiImpl
, _rMutex
)
148 /**********************************************************************/
149 class ShapePositionProvider
: public PropertyValueProvider
152 ShapePositionProvider( const SvxShapeImpl
& _shapeImpl
)
153 :PropertyValueProvider( _shapeImpl
.mrAntiImpl
, "Position" )
158 virtual void getCurrentValue( Any
& _out_rCurrentValue
) const
160 _out_rCurrentValue
<<= static_cast< SvxShape
& >( getContext() ).getPosition();
164 //----------------------------------------------------------------------
165 class ShapeSizeProvider
: public PropertyValueProvider
168 ShapeSizeProvider( const SvxShapeImpl
& _shapeImpl
)
169 :PropertyValueProvider( _shapeImpl
.mrAntiImpl
, "Size" )
174 virtual void getCurrentValue( Any
& _out_rCurrentValue
) const
176 _out_rCurrentValue
<<= static_cast< SvxShape
& >( getContext() ).getSize();
180 /***********************************************************************
182 ***********************************************************************/
186 SvxShape::SvxShape( SdrObject
* pObject
) throw()
188 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
189 , mbIsMultiPropertyCall(false)
190 , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE
, SdrObject::GetGlobalDrawObjectItemPool()))
191 , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE
))
196 DBG_CTOR(SvxShape
,NULL
);
200 //----------------------------------------------------------------------
201 SvxShape::SvxShape( SdrObject
* pObject
, const SfxItemPropertyMapEntry
* pEntries
, const SvxItemPropertySet
* pPropertySet
) throw()
203 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
204 , mbIsMultiPropertyCall(false)
205 , mpPropSet(pPropertySet
)
206 , maPropMapEntries(pEntries
)
211 DBG_CTOR(SvxShape
,NULL
);
215 //----------------------------------------------------------------------
216 SvxShape::SvxShape() throw()
218 , mpImpl( new SvxShapeImpl( *this, maMutex
) )
219 , mbIsMultiPropertyCall(false)
220 , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE
, SdrObject::GetGlobalDrawObjectItemPool()))
221 , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE
))
226 DBG_CTOR(SvxShape
,NULL
);
230 //----------------------------------------------------------------------
231 SvxShape::~SvxShape() throw()
233 ::SolarMutexGuard aGuard
;
235 DBG_ASSERT( mnLockCount
== 0, "Locked shape was disposed!" );
238 EndListening( *mpModel
);
240 if ( mpImpl
->mpMaster
)
241 mpImpl
->mpMaster
->dispose();
244 mpObj
->setUnoShape(NULL
);
246 if( HasSdrObjectOwnership() && mpObj
.is() )
248 mpImpl
->mbHasSdrObjectOwnership
= false;
249 SdrObject
* pObject
= mpObj
.get();
250 SdrObject::Free( pObject
);
253 delete mpImpl
, mpImpl
= NULL
;
255 DBG_DTOR(SvxShape
,NULL
);
258 //----------------------------------------------------------------------
260 void SvxShape::TakeSdrObjectOwnership()
262 mpImpl
->mbHasSdrObjectOwnership
= true;
265 //----------------------------------------------------------------------
267 bool SvxShape::HasSdrObjectOwnership() const
269 if ( !mpImpl
->mbHasSdrObjectOwnership
)
272 OSL_ENSURE( mpObj
.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
276 //----------------------------------------------------------------------
278 void SvxShape::setShapeKind( sal_uInt32 nKind
)
280 mpImpl
->mnObjId
= nKind
;
283 //----------------------------------------------------------------------
285 sal_uInt32
SvxShape::getShapeKind() const
287 return mpImpl
->mnObjId
;
290 //----------------------------------------------------------------------
292 void SvxShape::setMaster( SvxShapeMaster
* pMaster
)
294 mpImpl
->mpMaster
= pMaster
;
297 //----------------------------------------------------------------------
299 uno::Any SAL_CALL
SvxShape::queryAggregation( const uno::Type
& rType
) throw (uno::RuntimeException
)
301 if( mpImpl
->mpMaster
)
304 if( mpImpl
->mpMaster
->queryAggregation( rType
, aAny
) )
308 return SvxShape_UnoImplHelper::queryAggregation(rType
);
313 class theSvxShapeUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theSvxShapeUnoTunnelId
> {};
316 const ::com::sun::star::uno::Sequence
< sal_Int8
> & SvxShape::getUnoTunnelId() throw()
318 return theSvxShapeUnoTunnelId::get().getSeq();
321 //----------------------------------------------------------------------
322 SvxShape
* SvxShape::getImplementation( const uno::Reference
< uno::XInterface
>& xInt
)
324 uno::Reference
< lang::XUnoTunnel
> xUT( xInt
, ::com::sun::star::uno::UNO_QUERY
);
326 return reinterpret_cast<SvxShape
*>(sal::static_int_cast
<sal_uIntPtr
>(xUT
->getSomething( SvxShape::getUnoTunnelId())));
331 //----------------------------------------------------------------------
332 sal_Int64 SAL_CALL
SvxShape::getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw(::com::sun::star::uno::RuntimeException
) \
334 if( rId
.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId
.getConstArray(), 16 ) )
336 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_uIntPtr
>(this));
344 //----------------------------------------------------------------------
345 ::svx::PropertyChangeNotifier
& SvxShape::getShapePropertyChangeNotifier()
347 return mpImpl
->maPropertyNotifier
;
350 //----------------------------------------------------------------------
351 void SvxShape::impl_construct()
353 mpImpl
->maPropertyNotifier
.registerProvider( ::svx::eShapePosition
,
354 ::svx::PPropertyValueProvider( new ShapePositionProvider( *mpImpl
) ) );
355 mpImpl
->maPropertyNotifier
.registerProvider( ::svx::eShapeSize
,
356 ::svx::PPropertyValueProvider( new ShapeSizeProvider( *mpImpl
) ) );
359 impl_initFromSdrObject();
362 //----------------------------------------------------------------------
363 void SvxShape::impl_initFromSdrObject()
365 DBG_TESTSOLARMUTEX();
366 OSL_PRECOND( mpObj
.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
370 osl_atomic_increment( &m_refCount
);
372 mpObj
->setUnoShape(*this);
374 osl_atomic_decrement( &m_refCount
);
376 mpModel
= mpObj
->GetModel();
379 // Do not simply return when no model but do the type corrections
383 StartListening( *mpModel
);
386 const sal_uInt32 nInventor
= mpObj
->GetObjInventor();
388 // is it one of ours (svx) ?
389 if( nInventor
== SdrInventor
|| nInventor
== E3dInventor
|| nInventor
== FmFormInventor
)
391 if(nInventor
== FmFormInventor
)
393 mpImpl
->mnObjId
= OBJ_UNO
;
397 mpImpl
->mnObjId
= mpObj
->GetObjIdentifier();
398 if( nInventor
== E3dInventor
)
399 mpImpl
->mnObjId
|= E3D_INVENTOR_FLAG
;
402 switch(mpImpl
->mnObjId
)
404 case OBJ_CCUT
: // Kreisabschnitt
405 case OBJ_CARC
: // Kreisbogen
406 case OBJ_SECT
: // Kreissektor
407 mpImpl
->mnObjId
= OBJ_CIRC
;
410 case E3D_SCENE_ID
| E3D_INVENTOR_FLAG
:
411 mpImpl
->mnObjId
= E3D_POLYSCENE_ID
| E3D_INVENTOR_FLAG
;
417 //----------------------------------------------------------------------
418 void SvxShape::Create( SdrObject
* pNewObj
, SvxDrawPage
* /*pNewPage*/ )
420 DBG_TESTSOLARMUTEX();
422 OSL_PRECOND( pNewObj
, "SvxShape::Create: invalid new object!" );
426 SdrObject
* pCreatedObj
= mpImpl
->mpCreatedObj
.get();
427 OSL_ENSURE( ( pCreatedObj
== NULL
) || ( pCreatedObj
== pNewObj
),
428 "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
430 // Correct condition (#i52126#)
431 if ( pCreatedObj
!= pNewObj
)
433 DBG_ASSERT( pNewObj
->GetModel(), "no model for SdrObject?" );
434 // Correct condition (#i52126#)
435 mpImpl
->mpCreatedObj
= pNewObj
;
437 if( mpObj
.is() && mpObj
->GetModel() )
439 EndListening( *mpObj
->GetModel() );
442 mpObj
.reset( pNewObj
);
444 OSL_ENSURE( !mbIsMultiPropertyCall
, "SvxShape::Create: hmm?" );
445 // this was previously set in impl_initFromSdrObject, but I think it was superfluous
446 // (it definitely was in the other context where it was called, but I strongly suppose
447 // it was also superfluous when called from here)
448 impl_initFromSdrObject();
450 ObtainSettingsFromPropertySet( *mpPropSet
);
453 SdrObjUserCall
* pUser
= mpObj
->GetUserCall();
454 mpObj
->SetUserCall(NULL
);
456 setPosition( maPosition
);
459 // restore user call after we set the initial size
460 mpObj
->SetUserCall( pUser
);
462 // if this shape was already named, use this name
463 if( !maShapeName
.isEmpty() )
465 mpObj
->SetName( maShapeName
);
466 maShapeName
= OUString();
471 //----------------------------------------------------------------------
473 void SvxShape::ChangeModel( SdrModel
* pNewModel
)
475 DBG_TESTSOLARMUTEX();
476 if( mpObj
.is() && mpObj
->GetModel() )
478 if( mpObj
->GetModel() != pNewModel
)
480 EndListening( *mpObj
->GetModel() );
484 // Always listen to new model (#i52126#)
487 StartListening( *pNewModel
);
490 // HACK #i53696# ChangeModel should be virtual, but it isn't. can't change that for 2.0.1
491 SvxShapeText
* pShapeText
= dynamic_cast< SvxShapeText
* >( this );
494 SvxTextEditSource
* pTextEditSource
= dynamic_cast< SvxTextEditSource
* >( pShapeText
->GetEditSource() );
495 if( pTextEditSource
)
496 pTextEditSource
->ChangeModel( pNewModel
);
501 if( mpImpl
->mpMaster
)
502 mpImpl
->mpMaster
->modelChanged( pNewModel
);
505 //----------------------------------------------------------------------
507 void SvxShape::ForceMetricToItemPoolMetric(Pair
& rPoint
) const throw()
509 DBG_TESTSOLARMUTEX();
512 SfxMapUnit eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
513 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
517 case SFX_MAPUNIT_TWIP
:
519 rPoint
.A() = MM_TO_TWIPS(rPoint
.A());
520 rPoint
.B() = MM_TO_TWIPS(rPoint
.B());
525 OSL_FAIL("AW: Missing unit translation to PoolMetric!");
532 // Reintroduction of fix for issue i59051 (#i108851#)
533 void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon
& rPolyPolygon
) const throw()
535 DBG_TESTSOLARMUTEX();
538 SfxMapUnit eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
539 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
543 case SFX_MAPUNIT_TWIP
:
545 basegfx::B2DHomMatrix aTransform
;
546 const double fMMToTWIPS(72.0 / 127.0);
548 aTransform
.scale(fMMToTWIPS
, fMMToTWIPS
);
549 rPolyPolygon
.transform(aTransform
);
554 OSL_FAIL("Missing unit translation to PoolMetric!");
561 //----------------------------------------------------------------------
562 void SvxShape::ForceMetricTo100th_mm(Pair
& rPoint
) const throw()
564 DBG_TESTSOLARMUTEX();
565 SfxMapUnit eMapUnit
= SFX_MAPUNIT_100TH_MM
;
568 eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
569 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
573 case SFX_MAPUNIT_TWIP
:
575 rPoint
.A() = TWIPS_TO_MM(rPoint
.A());
576 rPoint
.B() = TWIPS_TO_MM(rPoint
.B());
581 OSL_FAIL("AW: Missing unit translation to 100th mm!");
588 // Reintroduction of fix for issue i59051 (#i108851#)
589 void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon
& rPolyPolygon
) const throw()
591 DBG_TESTSOLARMUTEX();
592 SfxMapUnit eMapUnit
= SFX_MAPUNIT_100TH_MM
;
595 eMapUnit
= mpModel
->GetItemPool().GetMetric(0);
596 if(eMapUnit
!= SFX_MAPUNIT_100TH_MM
)
600 case SFX_MAPUNIT_TWIP
:
602 basegfx::B2DHomMatrix aTransform
;
603 const double fTWIPSToMM(127.0 / 72.0);
604 aTransform
.scale(fTWIPSToMM
, fTWIPSToMM
);
605 rPolyPolygon
.transform(aTransform
);
610 OSL_FAIL("Missing unit translation to 100th mm!");
617 //----------------------------------------------------------------------
618 void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet
& rPropSet
,
619 SfxItemSet
& rSet
, uno::Reference
< beans::XPropertySet
> xSet
, const SfxItemPropertyMap
* pMap
)
621 if(rPropSet
.AreThereOwnUsrAnys())
623 const SfxItemPropertyMap
* pSrc
= rPropSet
.getPropertyMap();
624 PropertyEntryVector_t aSrcPropVector
= pSrc
->getPropertyEntries();
625 PropertyEntryVector_t::const_iterator aSrcIt
= aSrcPropVector
.begin();
626 while(aSrcIt
!= aSrcPropVector
.end())
630 uno::Any
* pUsrAny
= rPropSet
.GetUsrAnyForID(aSrcIt
->nWID
);
633 // Aequivalenten Eintrag in pDst suchen
634 const SfxItemPropertySimpleEntry
* pEntry
= pMap
->getByName( aSrcIt
->sName
);
638 if(pEntry
->nWID
>= OWN_ATTR_VALUE_START
&& pEntry
->nWID
<= OWN_ATTR_VALUE_END
)
640 // Special ID im PropertySet, kann nur direkt am
641 // Objekt gesetzt werden+
642 xSet
->setPropertyValue( aSrcIt
->sName
, *pUsrAny
);
646 if(rSet
.GetPool()->IsWhich(pEntry
->nWID
))
647 rSet
.Put(rSet
.GetPool()->GetDefaultItem(pEntry
->nWID
));
649 SvxItemPropertySet_setPropertyValue(rPropSet
, pEntry
, *pUsrAny
, rSet
);
658 const_cast< SvxItemPropertySet
& >(rPropSet
).ClearAllUsrAny();
663 void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet
& rPropSet
)
665 DBG_TESTSOLARMUTEX();
666 if(mpObj
.is() && rPropSet
.AreThereOwnUsrAnys() && mpModel
)
668 SfxItemSet
aSet( mpModel
->GetItemPool(), SDRATTR_START
, SDRATTR_END
);
669 Reference
< beans::XPropertySet
> xShape( (OWeakObject
*)this, UNO_QUERY
);
670 SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet
, aSet
, xShape
, mpPropSet
->getPropertyMap() );
672 mpObj
->SetMergedItemSetAndBroadcast(aSet
);
674 mpObj
->ApplyNotPersistAttr( aSet
);
678 //----------------------------------------------------------------------
680 uno::Any
SvxShape::GetBitmap( sal_Bool bMetaFile
/* = sal_False */ ) const throw()
682 DBG_TESTSOLARMUTEX();
685 if( !mpObj
.is() || mpModel
== NULL
|| !mpObj
->IsInserted() || NULL
== mpObj
->GetPage() )
689 aVDev
.SetMapMode(MapMode(MAP_100TH_MM
));
691 SdrModel
* pModel
= mpObj
->GetModel();
692 SdrPage
* pPage
= mpObj
->GetPage();
694 E3dView
* pView
= new E3dView( pModel
, &aVDev
);
695 pView
->hideMarkHandles();
696 SdrPageView
* pPageView
= pView
->ShowSdrPage(pPage
);
698 SdrObject
*pTempObj
= mpObj
.get();
699 pView
->MarkObj(pTempObj
,pPageView
);
701 Rectangle
aRect(pTempObj
->GetCurrentBoundRect());
703 Size
aSize(aRect
.GetSize());
705 GDIMetaFile
aMtf( pView
->GetMarkedObjMetaFile() );
708 SvMemoryStream
aDestStrm( 65535, 65535 );
709 ConvertGDIMetaFileToWMF( aMtf
, aDestStrm
, NULL
, sal_False
);
710 const uno::Sequence
<sal_Int8
> aSeq(
711 static_cast< const sal_Int8
* >(aDestStrm
.GetData()),
712 aDestStrm
.GetEndOfData());
713 aAny
.setValue( &aSeq
, ::getCppuType((const uno::Sequence
< sal_Int8
>*)0) );
717 Graphic
aGraph(aMtf
);
718 aGraph
.SetPrefSize(aSize
);
719 aGraph
.SetPrefMapMode(MAP_100TH_MM
);
721 Reference
< awt::XBitmap
> xBmp( aGraph
.GetXGraphic(), UNO_QUERY
);
731 //----------------------------------------------------------------------
733 uno::Sequence
< uno::Type
> SAL_CALL
SvxShape::getTypes()
734 throw (uno::RuntimeException
)
736 if( mpImpl
->mpMaster
)
738 return mpImpl
->mpMaster
->getTypes();
746 //----------------------------------------------------------------------
748 uno::Sequence
< uno::Type
> SAL_CALL
SvxShape::_getTypes()
749 throw(uno::RuntimeException
)
751 switch( mpImpl
->mnObjId
)
753 // shapes without text
756 case OBJ_OLE2_PLUGIN
:
757 case OBJ_OLE2_APPLET
:
758 case E3D_CUBEOBJ_ID
|E3D_INVENTOR_FLAG
:
759 case E3D_SPHEREOBJ_ID
|E3D_INVENTOR_FLAG
:
760 case E3D_LATHEOBJ_ID
|E3D_INVENTOR_FLAG
:
761 case E3D_EXTRUDEOBJ_ID
|E3D_INVENTOR_FLAG
:
762 case E3D_POLYGONOBJ_ID
|E3D_INVENTOR_FLAG
:
765 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
767 if( aTypeSequence
.getLength() == 0 )
769 // Ready for multithreading; get global mutex for first call of this method only! see before
770 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
772 // Control these pointer again ... it can be, that another instance will be faster then these!
773 if( aTypeSequence
.getLength() == 0 )
775 aTypeSequence
.realloc( 12 );
776 uno::Type
* pTypes
= aTypeSequence
.getArray();
778 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
779 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
780 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
781 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
782 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
783 *pTypes
++ = beans::XMultiPropertyStates::static_type();
784 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
785 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
786 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
787 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
788 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
789 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
792 return aTypeSequence
;
797 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
799 if( aTypeSequence
.getLength() == 0 )
801 // Ready for multithreading; get global mutex for first call of this method only! see before
802 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
804 // Control these pointer again ... it can be, that another instance will be faster then these!
805 if( aTypeSequence
.getLength() == 0 )
807 aTypeSequence
.realloc( 14 );
808 uno::Type
* pTypes
= aTypeSequence
.getArray();
810 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
811 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
812 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
813 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
814 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
815 *pTypes
++ = beans::XMultiPropertyStates::static_type();
816 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
817 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
818 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
819 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
820 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
821 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
822 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShapes
>*)0);
823 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShapeGroup
>*)0);
826 return aTypeSequence
;
831 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
833 if( aTypeSequence
.getLength() == 0 )
835 // Ready for multithreading; get global mutex for first call of this method only! see before
836 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
838 // Control these pointer again ... it can be, that another instance will be faster then these!
839 if( aTypeSequence
.getLength() == 0 )
841 aTypeSequence
.realloc( 17 );
842 uno::Type
* pTypes
= aTypeSequence
.getArray();
844 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
845 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
846 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
847 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
848 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
849 *pTypes
++ = beans::XMultiPropertyStates::static_type();
850 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
851 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
852 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
853 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
854 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
855 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
856 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XConnectorShape
>*)0);
857 // from SvxUnoTextBase::getTypes()
858 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextAppend
>*)0);
859 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextCopy
>*)0);
860 *pTypes
++ = ::getCppuType(( const uno::Reference
< container::XEnumerationAccess
>*)0);
861 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeMover
>*)0);
864 return aTypeSequence
;
869 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
871 if( aTypeSequence
.getLength() == 0 )
873 // Ready for multithreading; get global mutex for first call of this method only! see before
874 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
876 // Control these pointer again ... it can be, that another instance will be faster then these!
877 if( aTypeSequence
.getLength() == 0 )
879 aTypeSequence
.realloc( 13 );
880 uno::Type
* pTypes
= aTypeSequence
.getArray();
882 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
883 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
884 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
885 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
886 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
887 *pTypes
++ = beans::XMultiPropertyStates::static_type();
888 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
889 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
890 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
891 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
892 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
893 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
894 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XControlShape
>*)0);
897 return aTypeSequence
;
900 case E3D_POLYSCENE_ID
|E3D_INVENTOR_FLAG
:
902 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
904 if( aTypeSequence
.getLength() == 0 )
906 // Ready for multithreading; get global mutex for first call of this method only! see before
907 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
909 // Control these pointer again ... it can be, that another instance will be faster then these!
910 if( aTypeSequence
.getLength() == 0 )
912 aTypeSequence
.realloc( 13 );
913 uno::Type
* pTypes
= aTypeSequence
.getArray();
915 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
916 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
917 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
918 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
919 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
920 *pTypes
++ = beans::XMultiPropertyStates::static_type();
921 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
922 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
923 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
924 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
925 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
926 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
927 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShapes
>*)0);
930 return aTypeSequence
;
932 case OBJ_CUSTOMSHAPE
:
934 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
936 if( aTypeSequence
.getLength() == 0 )
938 // Ready for multithreading; get global mutex for first call of this method only! see before
939 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
941 // Control these pointer again ... it can be, that another instance will be faster then these!
942 if( aTypeSequence
.getLength() == 0 )
944 aTypeSequence
.realloc( 16 );
945 uno::Type
* pTypes
= aTypeSequence
.getArray();
947 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
948 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
949 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
950 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
951 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
952 *pTypes
++ = beans::XMultiPropertyStates::static_type();
953 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
954 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
955 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
956 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
957 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
958 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
959 // from SvxUnoTextBase::getTypes()
960 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XText
>*)0);
961 *pTypes
++ = ::getCppuType(( const uno::Reference
< container::XEnumerationAccess
>*)0);
962 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeMover
>*)0);
963 *pTypes
++ = ::getCppuType(( const uno::Reference
< drawing::XEnhancedCustomShapeDefaulter
>*)0);
966 return aTypeSequence
;
985 case OBJ_OLE2
: // #i118485# Moved to shapes with text
988 static ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> aTypeSequence
;
990 if( aTypeSequence
.getLength() == 0 )
992 // Ready for multithreading; get global mutex for first call of this method only! see before
993 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
995 // Control these pointer again ... it can be, that another instance will be faster then these!
996 if( aTypeSequence
.getLength() == 0 )
998 aTypeSequence
.realloc( 16 );
999 uno::Type
* pTypes
= aTypeSequence
.getArray();
1001 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XShape
>*)0);
1002 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XComponent
>*)0);
1003 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
1004 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XMultiPropertySet
>*)0);
1005 *pTypes
++ = ::getCppuType((const uno::Reference
< beans::XPropertyState
>*)0);
1006 *pTypes
++ = beans::XMultiPropertyStates::static_type();
1007 *pTypes
++ = ::getCppuType((const uno::Reference
< drawing::XGluePointsSupplier
>*)0);
1008 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XChild
>*)0);
1009 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XServiceInfo
>*)0);
1010 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XTypeProvider
>*)0);
1011 *pTypes
++ = ::getCppuType((const uno::Reference
< lang::XUnoTunnel
>*)0);
1012 *pTypes
++ = ::getCppuType((const uno::Reference
< container::XNamed
>*)0);
1013 // from SvxUnoTextBase::getTypes()
1014 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextAppend
>*)0);
1015 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextCopy
>*)0);
1016 *pTypes
++ = ::getCppuType(( const uno::Reference
< container::XEnumerationAccess
>*)0);
1017 *pTypes
++ = ::getCppuType(( const uno::Reference
< text::XTextRangeMover
>*)0);
1020 return aTypeSequence
;
1025 //----------------------------------------------------------------------
1027 uno::Sequence
< sal_Int8
> SAL_CALL
SvxShape::getImplementationId()
1028 throw (uno::RuntimeException
)
1030 static ::cppu::OImplementationId
* pID
= NULL
;
1034 // Ready for multithreading; get global mutex for first call of this method only! see before
1035 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
1037 // Control these pointer again ... it can be, that another instance will be faster then these!
1040 // Create a new static ID ...
1041 static ::cppu::OImplementationId
aID( sal_False
) ;
1042 // ... and set his address to static pointer!
1047 return pID
->getImplementationId() ;
1050 //----------------------------------------------------------------------
1052 Reference
< uno::XInterface
> SvxShape_NewInstance()
1054 return uno::Reference
< uno::XInterface
>(static_cast< OWeakObject
* >( new SvxShape() ) );
1057 //----------------------------------------------------------------------
1059 //----------------------------------------------------------------------
1061 void SvxShape::Notify( SfxBroadcaster
&, const SfxHint
& rHint
) throw()
1063 DBG_TESTSOLARMUTEX();
1067 // #i55919# HINT_OBJCHG is only interesting if it's for this object
1069 const SdrHint
* pSdrHint
= PTR_CAST( SdrHint
, &rHint
);
1070 if (!pSdrHint
|| ( /* (pSdrHint->GetKind() != HINT_OBJREMOVED) && */
1071 (pSdrHint
->GetKind() != HINT_MODELCLEARED
) &&
1072 // #110094#-9 (pSdrHint->GetKind() != HINT_OBJLISTCLEAR) &&
1073 ((pSdrHint
->GetKind() != HINT_OBJCHG
|| pSdrHint
->GetObject() != mpObj
.get() ))))
1076 uno::Reference
< uno::XInterface
> xSelf( mpObj
->getWeakUnoShape() );
1079 mpObj
.reset( NULL
);
1083 bool bClearMe
= false;
1085 switch( pSdrHint
->GetKind() )
1092 case HINT_MODELCLEARED
:
1104 if( !HasSdrObjectOwnership() ) {
1106 mpObj
->setUnoShape( NULL
);
1107 mpObj
.reset( NULL
);
1109 if ( !mpImpl
->mbDisposing
)
1116 //----------------------------------------------------------------------
1117 // The "*LogicRectHack" functions also existed in sch, and those
1118 // duplicate symbols cause Bad Things To Happen (TM) #i9462#.
1119 // Prefixing with 'svx' and marking static to make sure name collisions
1122 static bool svx_needLogicRectHack( SdrObject
* pObj
)
1124 if( pObj
->GetObjInventor() == SdrInventor
)
1126 switch(pObj
->GetObjIdentifier())
1148 //----------------------------------------------------------------------
1150 static Rectangle
svx_getLogicRectHack( SdrObject
* pObj
)
1152 if(svx_needLogicRectHack(pObj
))
1154 return pObj
->GetSnapRect();
1158 return pObj
->GetLogicRect();
1162 //----------------------------------------------------------------------
1164 static void svx_setLogicRectHack( SdrObject
* pObj
, const Rectangle
& rRect
)
1166 if(svx_needLogicRectHack(pObj
))
1168 pObj
->SetSnapRect( rRect
);
1172 pObj
->SetLogicRect( rRect
);
1176 //----------------------------------------------------------------------
1178 awt::Point SAL_CALL
SvxShape::getPosition() throw(uno::RuntimeException
)
1180 ::SolarMutexGuard aGuard
;
1182 if( mpObj
.is() && mpModel
)
1184 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1185 Point
aPt( aRect
.Left(), aRect
.Top() );
1187 // Position is relativ to anchor, so recalc to absolut position
1188 if( mpModel
->IsWriter() )
1189 aPt
-= mpObj
->GetAnchorPos();
1191 ForceMetricTo100th_mm(aPt
);
1192 return ::com::sun::star::awt::Point( aPt
.X(), aPt
.Y() );
1200 //----------------------------------------------------------------------
1201 void SAL_CALL
SvxShape::setPosition( const awt::Point
& Position
) throw(uno::RuntimeException
)
1203 ::SolarMutexGuard aGuard
;
1205 if( mpObj
.is() && mpModel
)
1207 // do NOT move 3D objects, this would change the homogen
1208 // transformation matrix
1209 if(!mpObj
->ISA(E3dCompoundObject
))
1211 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1212 Point
aLocalPos( Position
.X
, Position
.Y
);
1213 ForceMetricToItemPoolMetric(aLocalPos
);
1215 // Position ist absolut, relativ zum Anker stellen
1216 if( mpModel
->IsWriter() )
1217 aLocalPos
+= mpObj
->GetAnchorPos();
1219 long nDX
= aLocalPos
.X() - aRect
.Left();
1220 long nDY
= aLocalPos
.Y() - aRect
.Top();
1222 mpObj
->Move( Size( nDX
, nDY
) );
1223 mpModel
->SetChanged();
1227 maPosition
= Position
;
1230 //----------------------------------------------------------------------
1231 awt::Size SAL_CALL
SvxShape::getSize() throw(uno::RuntimeException
)
1233 ::SolarMutexGuard aGuard
;
1235 if( mpObj
.is() && mpModel
)
1237 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1238 Size
aObjSize( aRect
.getWidth(), aRect
.getHeight() );
1239 ForceMetricTo100th_mm(aObjSize
);
1240 return ::com::sun::star::awt::Size( aObjSize
.getWidth(), aObjSize
.getHeight() );
1246 //----------------------------------------------------------------------
1247 void SAL_CALL
SvxShape::setSize( const awt::Size
& rSize
)
1248 throw(beans::PropertyVetoException
, uno::RuntimeException
)
1250 ::SolarMutexGuard aGuard
;
1252 if( mpObj
.is() && mpModel
)
1254 Rectangle
aRect( svx_getLogicRectHack(mpObj
.get()) );
1255 Size
aLocalSize( rSize
.Width
, rSize
.Height
);
1256 ForceMetricToItemPoolMetric(aLocalSize
);
1258 if(mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_MEASURE
)
1260 Fraction
aWdt(aLocalSize
.Width(),aRect
.Right()-aRect
.Left());
1261 Fraction
aHgt(aLocalSize
.Height(),aRect
.Bottom()-aRect
.Top());
1262 Point aPt
= mpObj
->GetSnapRect().TopLeft();
1263 mpObj
->Resize(aPt
,aWdt
,aHgt
);
1267 //aRect.SetSize(aLocalSize); // this call substract 1 // http://www.openoffice.org/issues/show_bug.cgi?id=83193
1268 if ( !aLocalSize
.Width() )
1270 aRect
.Right() = RECT_EMPTY
;
1273 aRect
.setWidth(aLocalSize
.Width());
1274 if ( !aLocalSize
.Height() )
1276 aRect
.Bottom() = RECT_EMPTY
;
1279 aRect
.setHeight(aLocalSize
.Height());
1281 svx_setLogicRectHack( mpObj
.get(), aRect
);
1284 mpModel
->SetChanged();
1289 //----------------------------------------------------------------------
1292 OUString SAL_CALL
SvxShape::getName( ) throw(::com::sun::star::uno::RuntimeException
)
1294 ::SolarMutexGuard aGuard
;
1297 return mpObj
->GetName();
1305 //----------------------------------------------------------------------
1307 void SAL_CALL
SvxShape::setName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
)
1309 ::SolarMutexGuard aGuard
;
1312 mpObj
->SetName( aName
);
1316 maShapeName
= aName
;
1322 //----------------------------------------------------------------------
1323 OUString SAL_CALL
SvxShape::getShapeType() throw(uno::RuntimeException
)
1325 if( !maShapeType
.getLength() )
1326 return UHashMap::getNameFromId( mpImpl
->mnObjId
);
1333 //----------------------------------------------------------------------
1334 void SAL_CALL
SvxShape::dispose() throw(uno::RuntimeException
)
1336 ::SolarMutexGuard aGuard
;
1338 if( mpImpl
->mbDisposing
)
1339 return; // caught a recursion
1341 mpImpl
->mbDisposing
= true;
1343 lang::EventObject aEvt
;
1344 aEvt
.Source
= *(OWeakAggObject
*) this;
1345 mpImpl
->maDisposeListeners
.disposeAndClear(aEvt
);
1346 mpImpl
->maPropertyNotifier
.disposing();
1350 bool bFreeSdrObject
= false;
1352 if ( mpObj
->IsInserted() && mpObj
->GetPage() )
1354 OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
1355 // normally, we are allowed to free the SdrObject only if we have its ownership.
1356 // Why isn't this checked here?
1358 SdrPage
* pPage
= mpObj
->GetPage();
1359 // SdrObject aus der Page loeschen
1360 sal_uInt32 nCount
= pPage
->GetObjCount();
1361 for ( sal_uInt32 nNum
= 0; nNum
< nCount
; ++nNum
)
1363 if ( pPage
->GetObj( nNum
) == mpObj
.get() )
1365 OSL_VERIFY( pPage
->RemoveObject( nNum
) == mpObj
.get() );
1366 bFreeSdrObject
= true;
1372 mpObj
->setUnoShape(NULL
);
1374 if ( bFreeSdrObject
)
1376 // in case we have the ownership of the SdrObject, a Free
1377 // would do nothing. So ensure the ownership is reset.
1378 mpImpl
->mbHasSdrObjectOwnership
= false;
1379 SdrObject
* pObject
= mpObj
.get();
1380 SdrObject::Free( pObject
);
1386 EndListening( *mpModel
);
1391 //----------------------------------------------------------------------
1393 void SAL_CALL
SvxShape::addEventListener( const Reference
< lang::XEventListener
>& xListener
)
1394 throw(uno::RuntimeException
)
1396 mpImpl
->maDisposeListeners
.addInterface(xListener
);
1399 //----------------------------------------------------------------------
1401 void SAL_CALL
SvxShape::removeEventListener( const Reference
< lang::XEventListener
>& aListener
) throw(uno::RuntimeException
)
1403 mpImpl
->maDisposeListeners
.removeInterface(aListener
);
1408 //----------------------------------------------------------------------
1410 Reference
< beans::XPropertySetInfo
> SAL_CALL
1411 SvxShape::getPropertySetInfo() throw(uno::RuntimeException
)
1413 if( mpImpl
->mpMaster
)
1415 return mpImpl
->mpMaster
->getPropertySetInfo();
1419 return _getPropertySetInfo();
1423 Reference
< beans::XPropertySetInfo
> SAL_CALL
1424 SvxShape::_getPropertySetInfo() throw(uno::RuntimeException
)
1426 return mpPropSet
->getPropertySetInfo();
1429 //----------------------------------------------------------------------
1431 void SAL_CALL
SvxShape::addPropertyChangeListener( const OUString
& _propertyName
, const Reference
< beans::XPropertyChangeListener
>& _listener
) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1433 ::osl::MutexGuard
aGuard( maMutex
);
1434 mpImpl
->maPropertyNotifier
.addPropertyChangeListener( _propertyName
, _listener
);
1437 //----------------------------------------------------------------------
1439 void SAL_CALL
SvxShape::removePropertyChangeListener( const OUString
& _propertyName
, const Reference
< beans::XPropertyChangeListener
>& _listener
) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1441 ::osl::MutexGuard
aGuard( maMutex
);
1442 mpImpl
->maPropertyNotifier
.removePropertyChangeListener( _propertyName
, _listener
);
1445 //----------------------------------------------------------------------
1447 void SAL_CALL
SvxShape::addVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1449 OSL_FAIL( "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1452 //----------------------------------------------------------------------
1454 void SAL_CALL
SvxShape::removeVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1456 OSL_FAIL( "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1459 //----------------------------------------------------------------------
1461 sal_Bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
)
1463 SfxItemSet
aSet( mpModel
->GetItemPool(), (sal_uInt16
)nWID
, (sal_uInt16
)nWID
);
1465 if( SetFillAttribute( nWID
, rName
, aSet
, mpModel
) )
1467 //mpObj->SetItemSetAndBroadcast(aSet);
1468 mpObj
->SetMergedItemSetAndBroadcast(aSet
);
1478 //----------------------------------------------------------------------
1480 sal_Bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
, SfxItemSet
& rSet
, SdrModel
* pModel
)
1482 // check if an item with the given name and which id is inside the models
1483 // pool or the stylesheet pool, if found its puttet in the itemse
1484 if( !SetFillAttribute( nWID
, rName
, rSet
) )
1486 // we did not find such item in one of the pools, so we check
1487 // the property lists that are loaded for the model for items
1488 // that support such.
1489 OUString aStrName
= SvxUnogetInternalNameForItem((sal_Int16
)nWID
, rName
);
1493 case XATTR_FILLBITMAP
:
1495 XBitmapListRef pBitmapList
= pModel
->GetBitmapList();
1497 if( !pBitmapList
.is() )
1500 long nPos
= pBitmapList
->Get(aStrName
);
1504 XBitmapEntry
* pEntry
= pBitmapList
->GetBitmap( nPos
);
1505 XFillBitmapItem aBmpItem
;
1506 aBmpItem
.SetWhich( XATTR_FILLBITMAP
);
1507 aBmpItem
.SetName( rName
);
1508 aBmpItem
.SetGraphicObject(pEntry
->GetGraphicObject());
1509 rSet
.Put( aBmpItem
);
1512 case XATTR_FILLGRADIENT
:
1514 XGradientListRef pGradientList
= pModel
->GetGradientList();
1516 if( !pGradientList
.is() )
1519 long nPos
= pGradientList
->Get(aStrName
);
1523 XGradientEntry
* pEntry
= pGradientList
->GetGradient( nPos
);
1524 XFillGradientItem aGrdItem
;
1525 aGrdItem
.SetWhich( XATTR_FILLGRADIENT
);
1526 aGrdItem
.SetName( rName
);
1527 aGrdItem
.SetGradientValue( pEntry
->GetGradient() );
1528 rSet
.Put( aGrdItem
);
1531 case XATTR_FILLHATCH
:
1533 XHatchListRef pHatchList
= pModel
->GetHatchList();
1535 if( !pHatchList
.is() )
1538 long nPos
= pHatchList
->Get(aStrName
);
1542 XHatchEntry
* pEntry
= pHatchList
->GetHatch( nPos
);
1543 XFillHatchItem aHatchItem
;
1544 aHatchItem
.SetWhich( XATTR_FILLHATCH
);
1545 aHatchItem
.SetName( rName
);
1546 aHatchItem
.SetHatchValue( pEntry
->GetHatch() );
1547 rSet
.Put( aHatchItem
);
1551 case XATTR_LINESTART
:
1553 XLineEndListRef pLineEndList
= pModel
->GetLineEndList();
1555 if( !pLineEndList
.is() )
1558 long nPos
= pLineEndList
->Get(aStrName
);
1562 XLineEndEntry
* pEntry
= pLineEndList
->GetLineEnd( nPos
);
1563 if( XATTR_LINEEND
== nWID
)
1565 XLineEndItem aLEItem
;
1566 aLEItem
.SetWhich( XATTR_LINEEND
);
1567 aLEItem
.SetName( rName
);
1568 aLEItem
.SetLineEndValue( pEntry
->GetLineEnd() );
1569 rSet
.Put( aLEItem
);
1573 XLineStartItem aLSItem
;
1574 aLSItem
.SetWhich( XATTR_LINESTART
);
1575 aLSItem
.SetName( rName
);
1576 aLSItem
.SetLineStartValue( pEntry
->GetLineEnd() );
1577 rSet
.Put( aLSItem
);
1582 case XATTR_LINEDASH
:
1584 XDashListRef pDashList
= pModel
->GetDashList();
1586 if( !pDashList
.is() )
1589 long nPos
= pDashList
->Get(aStrName
);
1593 XDashEntry
* pEntry
= pDashList
->GetDash( nPos
);
1594 XLineDashItem aDashItem
;
1595 aDashItem
.SetWhich( XATTR_LINEDASH
);
1596 aDashItem
.SetName( rName
);
1597 aDashItem
.SetDashValue( pEntry
->GetDash() );
1598 rSet
.Put( aDashItem
);
1609 //----------------------------------------------------------------------
1611 sal_Bool SAL_CALL
SvxShape::SetFillAttribute( sal_Int32 nWID
, const OUString
& rName
, SfxItemSet
& rSet
)
1613 OUString aName
= SvxUnogetInternalNameForItem((sal_Int16
)nWID
, rName
);
1615 if (aName
.isEmpty())
1620 case XATTR_LINESTART
:
1622 const String aEmpty
;
1623 const basegfx::B2DPolyPolygon aEmptyPoly
;
1624 if( nWID
== XATTR_LINEEND
)
1625 rSet
.Put( XLineEndItem( aEmpty
, aEmptyPoly
) );
1627 rSet
.Put( XLineStartItem( aEmpty
, aEmptyPoly
) );
1631 case XATTR_FILLFLOATTRANSPARENCE
:
1633 // #85953# Set a disabled XFillFloatTransparenceItem
1634 rSet
.Put(XFillFloatTransparenceItem());
1643 const SfxItemPool
* pPool
= rSet
.GetPool();
1645 const String
aSearchName( aName
);
1646 const sal_uInt32 nCount
= pPool
->GetItemCount2((sal_uInt16
)nWID
);
1647 const NameOrIndex
* pItem
;
1649 for( sal_uInt32 nSurrogate
= 0; nSurrogate
< nCount
; nSurrogate
++ )
1651 pItem
= (NameOrIndex
*)pPool
->GetItem2((sal_uInt16
)nWID
, nSurrogate
);
1652 if( pItem
&& ( pItem
->GetName() == aSearchName
) )
1662 //----------------------------------------------------------------------
1664 void SAL_CALL
SvxShape::setPropertyValue( const OUString
& rPropertyName
, const uno::Any
& rVal
)
1665 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
1667 if( mpImpl
->mpMaster
)
1669 mpImpl
->mpMaster
->setPropertyValue( rPropertyName
, rVal
);
1673 _setPropertyValue( rPropertyName
, rVal
);
1677 void SAL_CALL
SvxShape::_setPropertyValue( const OUString
& rPropertyName
, const uno::Any
& rVal
)
1678 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
1680 ::SolarMutexGuard aGuard
;
1682 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(rPropertyName
);
1684 if( mpObj
.is() && mpModel
)
1687 throw beans::UnknownPropertyException();
1689 if( (pMap
->nFlags
& beans::PropertyAttribute::READONLY
) != 0 )
1690 throw beans::PropertyVetoException(
1692 "Readonly property can't be set: " )
1694 uno::Reference
< drawing::XShape
>( this ) );
1696 mpModel
->SetChanged();
1698 if(!setPropertyValueImpl( rPropertyName
, pMap
, rVal
) )
1700 DBG_ASSERT( pMap
->nWID
== SDRATTR_TEXTDIRECTION
|| pMap
->nWID
< SDRATTR_NOTPERSIST_FIRST
|| pMap
->nWID
> SDRATTR_NOTPERSIST_LAST
, "Not persist item not handled!" );
1701 DBG_ASSERT( pMap
->nWID
< OWN_ATTR_VALUE_START
|| pMap
->nWID
> OWN_ATTR_VALUE_END
, "Not item property not handled!" );
1703 bool bIsNotPersist
= pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
&& pMap
->nWID
!= SDRATTR_TEXTDIRECTION
;
1705 if( pMap
->nWID
== SDRATTR_ECKENRADIUS
)
1707 sal_Int32 nCornerRadius
= 0;
1708 if( !(rVal
>>= nCornerRadius
) || (nCornerRadius
< 0) || (nCornerRadius
> 5000000))
1709 throw IllegalArgumentException();
1713 if( mbIsMultiPropertyCall
&& !bIsNotPersist
)
1715 if( mpImpl
->mpItemSet
== NULL
)
1717 pSet
= mpImpl
->mpItemSet
= mpObj
->GetMergedItemSet().Clone();
1721 pSet
= mpImpl
->mpItemSet
;
1726 pSet
= new SfxItemSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1729 if( pSet
->GetItemState( pMap
->nWID
) != SFX_ITEM_SET
)
1730 pSet
->Put(mpObj
->GetMergedItem(pMap
->nWID
));
1732 if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet
, pMap
, rVal
, *pSet
))
1734 if( pSet
->GetItemState( pMap
->nWID
) != SFX_ITEM_SET
)
1738 // Not-Persistent Attribute, hole diese extra
1739 mpObj
->TakeNotPersistAttr(*pSet
, sal_False
);
1743 if( pSet
->GetItemState( pMap
->nWID
) != SFX_ITEM_SET
)
1745 // Default aus ItemPool holen
1746 if(mpModel
->GetItemPool().IsWhich(pMap
->nWID
))
1747 pSet
->Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
1750 if( pSet
->GetItemState( pMap
->nWID
) == SFX_ITEM_SET
)
1752 SvxItemPropertySet_setPropertyValue( *mpPropSet
, pMap
, rVal
, *pSet
);
1758 // Not-Persist Attribute extra setzen
1759 mpObj
->ApplyNotPersistAttr( *pSet
);
1764 // if we have a XMultiProperty call then the item set
1765 // will be set in setPropertyValues later
1766 if( !mbIsMultiPropertyCall
)
1768 mpObj
->SetMergedItemSetAndBroadcast( *pSet
);
1778 // since we have no actual sdr object right now
1779 // remember all properties in a list. These
1780 // properties will be set when the sdr object is
1783 if(pMap
&& pMap
->nWID
)
1784 // Fixme: We should throw a UnknownPropertyException here.
1785 // But since this class is aggregated from classes
1786 // that support additional properties that we don't
1787 // know here we silently store *all* properties, even
1788 // if they may be not supported after creation
1789 mpPropSet
->setPropertyValue( pMap
, rVal
);
1793 //----------------------------------------------------------------------
1795 uno::Any SAL_CALL
SvxShape::getPropertyValue( const OUString
& PropertyName
)
1796 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1798 if ( mpImpl
->mpMaster
)
1799 return mpImpl
->mpMaster
->getPropertyValue( PropertyName
);
1801 return _getPropertyValue( PropertyName
);
1804 //----------------------------------------------------------------------
1806 uno::Any
SvxShape::_getPropertyValue( const OUString
& PropertyName
)
1807 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1809 ::SolarMutexGuard aGuard
;
1811 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
1814 if( mpObj
.is() && mpModel
)
1817 throw beans::UnknownPropertyException();
1819 if( !getPropertyValueImpl( PropertyName
, pMap
, aAny
) )
1821 DBG_ASSERT( pMap
->nWID
== SDRATTR_TEXTDIRECTION
|| (pMap
->nWID
< SDRATTR_NOTPERSIST_FIRST
|| pMap
->nWID
> SDRATTR_NOTPERSIST_LAST
), "Not persist item not handled!" );
1822 DBG_ASSERT( pMap
->nWID
< OWN_ATTR_VALUE_START
|| pMap
->nWID
> OWN_ATTR_VALUE_END
, "Not item property not handled!" );
1824 SfxItemSet
aSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1825 aSet
.Put(mpObj
->GetMergedItem(pMap
->nWID
));
1827 if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet
, pMap
, aAny
))
1832 if(pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
)
1834 // Not-Persistent Attribute, hole diese extra
1835 mpObj
->TakeNotPersistAttr(aSet
, sal_False
);
1841 // Default aus ItemPool holen
1842 if(mpModel
->GetItemPool().IsWhich(pMap
->nWID
))
1843 aSet
.Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
1847 aAny
= GetAnyForItem( aSet
, pMap
);
1853 // Fixme: we should return default values for OWN_ATTR !
1855 if(pMap
&& pMap
->nWID
)
1856 // FixMe: see setPropertyValue
1857 aAny
= mpPropSet
->getPropertyValue( pMap
);
1863 //----------------------------------------------------------------------
1865 // XMultiPropertySet
1866 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
)
1868 ::SolarMutexGuard aSolarGuard
;
1870 const sal_Int32 nCount
= aPropertyNames
.getLength();
1871 const OUString
* pNames
= aPropertyNames
.getConstArray();
1873 const uno::Any
* pValues
= aValues
.getConstArray();
1875 // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1876 // reseted even when an execption is thrown
1877 const ::comphelper::ScopeGuard
aGuard( boost::bind( &SvxShape::endSetPropertyValues
, this ) );
1879 mbIsMultiPropertyCall
= sal_True
;
1881 if( mpImpl
->mpMaster
)
1883 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pValues
++ )
1887 setPropertyValue( *pNames
, *pValues
);
1889 catch( beans::UnknownPropertyException
& e
)
1893 catch( uno::Exception
& ex
)
1901 uno::Reference
< beans::XPropertySet
> xSet
;
1902 queryInterface( ::getCppuType( (const uno::Reference
< beans::XPropertySet
>*) 0) ) >>= xSet
;
1904 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pValues
++ )
1908 xSet
->setPropertyValue( *pNames
, *pValues
);
1910 catch( beans::UnknownPropertyException
& e
)
1914 catch( uno::Exception
& ex
)
1921 if( mpImpl
->mpItemSet
&& mpObj
.is() )
1922 mpObj
->SetMergedItemSetAndBroadcast( *mpImpl
->mpItemSet
);
1925 //----------------------------------------------------------------------
1927 void SvxShape::endSetPropertyValues()
1929 mbIsMultiPropertyCall
= sal_False
;
1930 if( mpImpl
->mpItemSet
)
1932 delete mpImpl
->mpItemSet
;
1933 mpImpl
->mpItemSet
= 0;
1937 //----------------------------------------------------------------------
1939 ::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
)
1941 const sal_Int32 nCount
= aPropertyNames
.getLength();
1942 const OUString
* pNames
= aPropertyNames
.getConstArray();
1944 uno::Sequence
< uno::Any
> aRet( nCount
);
1945 uno::Any
* pValue
= aRet
.getArray();;
1947 if( mpImpl
->mpMaster
)
1949 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pValue
++, pNames
++ )
1953 *pValue
= getPropertyValue( *pNames
);
1955 catch( uno::Exception
& )
1957 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1963 uno::Reference
< beans::XPropertySet
> xSet
;
1964 queryInterface( ::getCppuType( (const uno::Reference
< beans::XPropertySet
>*) 0) ) >>= xSet
;
1966 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pValue
++, pNames
++ )
1970 *pValue
= xSet
->getPropertyValue( *pNames
);
1972 catch( uno::Exception
& )
1974 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1982 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
)
1986 void SAL_CALL
SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& ) throw (::com::sun::star::uno::RuntimeException
)
1990 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
)
1994 //----------------------------------------------------------------------
1996 uno::Any
SvxShape::GetAnyForItem( SfxItemSet
& aSet
, const SfxItemPropertySimpleEntry
* pMap
) const
1998 DBG_TESTSOLARMUTEX();
2003 case SDRATTR_CIRCSTARTANGLE
:
2005 const SfxPoolItem
* pPoolItem
=NULL
;
2006 if(aSet
.GetItemState(SDRATTR_CIRCSTARTANGLE
,sal_False
,&pPoolItem
)==SFX_ITEM_SET
)
2008 sal_Int32 nAngle
= ((SdrCircStartAngleItem
*)pPoolItem
)->GetValue();
2014 case SDRATTR_CIRCENDANGLE
:
2016 const SfxPoolItem
* pPoolItem
=NULL
;
2017 if (aSet
.GetItemState(SDRATTR_CIRCENDANGLE
,sal_False
,&pPoolItem
)==SFX_ITEM_SET
)
2019 sal_Int32 nAngle
= ((SdrCircEndAngleItem
*)pPoolItem
)->GetValue();
2025 case SDRATTR_CIRCKIND
:
2027 if( mpObj
->GetObjInventor() == SdrInventor
)
2029 drawing::CircleKind eKind
;
2030 switch(mpObj
->GetObjIdentifier())
2032 case OBJ_CIRC
: // Kreis, Ellipse
2033 eKind
= drawing::CircleKind_FULL
;
2035 case OBJ_CCUT
: // Kreisabschnitt
2036 eKind
= drawing::CircleKind_CUT
;
2038 case OBJ_CARC
: // Kreisbogen
2039 eKind
= drawing::CircleKind_ARC
;
2041 case OBJ_SECT
: // Kreissektor
2042 eKind
= drawing::CircleKind_SECTION
;
2051 // Hole Wert aus ItemSet
2052 aAny
= SvxItemPropertySet_getPropertyValue( *mpPropSet
, pMap
, aSet
);
2054 if( *pMap
->pType
!= aAny
.getValueType() )
2056 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2057 if( ( *pMap
->pType
== ::getCppuType((const sal_Int16
*)0)) && aAny
.getValueType() == ::getCppuType((const sal_Int32
*)0) )
2059 sal_Int32 nValue
= 0;
2061 aAny
<<= (sal_Int16
)nValue
;
2065 OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
2075 //----------------------------------------------------------------------
2078 beans::PropertyState SAL_CALL
SvxShape::getPropertyState( const OUString
& PropertyName
)
2079 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
2081 if( mpImpl
->mpMaster
)
2083 return mpImpl
->mpMaster
->getPropertyState( PropertyName
);
2087 return _getPropertyState( PropertyName
);
2091 beans::PropertyState SAL_CALL
SvxShape::_getPropertyState( const OUString
& PropertyName
)
2092 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
2094 ::SolarMutexGuard aGuard
;
2096 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
2098 if( !mpObj
.is() || pMap
== NULL
)
2099 throw beans::UnknownPropertyException();
2101 beans::PropertyState eState
;
2102 if( !getPropertyStateImpl( pMap
, eState
) )
2104 const SfxItemSet
& rSet
= mpObj
->GetMergedItemSet();
2106 switch( rSet
.GetItemState( pMap
->nWID
, sal_False
) )
2108 case SFX_ITEM_READONLY
:
2110 eState
= beans::PropertyState_DIRECT_VALUE
;
2112 case SFX_ITEM_DEFAULT
:
2113 eState
= beans::PropertyState_DEFAULT_VALUE
;
2116 eState
= beans::PropertyState_AMBIGUOUS_VALUE
;
2120 // if a item is set, this doesn't mean we want it :)
2121 if( ( beans::PropertyState_DIRECT_VALUE
== eState
) )
2123 switch( pMap
->nWID
)
2125 // the following items are disabled by changing the
2126 // fill style or the line style. so there is no need
2127 // to export items without names which should be empty
2128 case XATTR_FILLBITMAP
:
2129 case XATTR_FILLGRADIENT
:
2130 case XATTR_FILLHATCH
:
2131 case XATTR_LINEDASH
:
2133 NameOrIndex
* pItem
= (NameOrIndex
*)rSet
.GetItem((sal_uInt16
)pMap
->nWID
);
2134 if( ( pItem
== NULL
) || ( pItem
->GetName().Len() == 0) )
2135 eState
= beans::PropertyState_DEFAULT_VALUE
;
2140 // If e.g. the LineStart is on NONE and thus the string has length 0, it still
2141 // may be a hard attribute covering the set LineStart of the parent (Style).
2143 // same is for fill float transparency
2145 case XATTR_LINESTART
:
2146 case XATTR_FILLFLOATTRANSPARENCE
:
2148 NameOrIndex
* pItem
= (NameOrIndex
*)rSet
.GetItem((sal_uInt16
)pMap
->nWID
);
2149 if ( pItem
== NULL
)
2150 eState
= beans::PropertyState_DEFAULT_VALUE
;
2159 //----------------------------------------------------------------------
2161 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
)
2163 switch( pProperty
->nWID
)
2165 case OWN_ATTR_CAPTION_POINT
:
2168 if( rValue
>>= aPnt
)
2170 Point
aVclPoint( aPnt
.X
, aPnt
.Y
);
2172 // #90763# position is relative to top left, make it absolute
2173 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2174 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2175 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2177 aVclPoint
.X() += basegfx::fround(aNewHomogenMatrix
.get(0, 2));
2178 aVclPoint
.Y() += basegfx::fround(aNewHomogenMatrix
.get(1, 2));
2180 // #88657# metric of pool maybe twips (writer)
2181 ForceMetricToItemPoolMetric(aVclPoint
);
2183 // #88491# position relative to anchor
2184 if( mpModel
->IsWriter() )
2186 aVclPoint
+= mpObj
->GetAnchorPos();
2189 ((SdrCaptionObj
*)mpObj
.get())->SetTailPos(aVclPoint
);
2195 case OWN_ATTR_TRANSFORMATION
:
2197 drawing::HomogenMatrix3 aMatrix
;
2198 if(rValue
>>= aMatrix
)
2200 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2201 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2203 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2205 aNewHomogenMatrix
.set(0, 0, aMatrix
.Line1
.Column1
);
2206 aNewHomogenMatrix
.set(0, 1, aMatrix
.Line1
.Column2
);
2207 aNewHomogenMatrix
.set(0, 2, aMatrix
.Line1
.Column3
);
2208 aNewHomogenMatrix
.set(1, 0, aMatrix
.Line2
.Column1
);
2209 aNewHomogenMatrix
.set(1, 1, aMatrix
.Line2
.Column2
);
2210 aNewHomogenMatrix
.set(1, 2, aMatrix
.Line2
.Column3
);
2211 aNewHomogenMatrix
.set(2, 0, aMatrix
.Line3
.Column1
);
2212 aNewHomogenMatrix
.set(2, 1, aMatrix
.Line3
.Column2
);
2213 aNewHomogenMatrix
.set(2, 2, aMatrix
.Line3
.Column3
);
2215 mpObj
->TRSetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2221 case OWN_ATTR_ZORDER
:
2223 sal_Int32 nNewOrdNum
= 0;
2224 if(rValue
>>= nNewOrdNum
)
2226 SdrObjList
* pObjList
= mpObj
->GetObjList();
2232 pObjList
->SetObjectOrdNum( mpObj
->GetOrdNum(), (sal_uIntPtr
)nNewOrdNum
);
2233 DBG_ASSERT( pCheck
== mpObj
.get(), "GetOrdNum() failed!" );
2239 case OWN_ATTR_FRAMERECT
:
2241 awt::Rectangle aUnoRect
;
2242 if(rValue
>>= aUnoRect
)
2244 Point
aTopLeft( aUnoRect
.X
, aUnoRect
.Y
);
2245 Size
aObjSize( aUnoRect
.Width
, aUnoRect
.Height
);
2246 ForceMetricToItemPoolMetric(aTopLeft
);
2247 ForceMetricToItemPoolMetric(aObjSize
);
2249 aRect
.SetPos(aTopLeft
);
2250 aRect
.SetSize(aObjSize
);
2251 mpObj
->SetSnapRect(aRect
);
2256 case OWN_ATTR_MIRRORED
:
2258 sal_Bool bMirror
= sal_Bool();
2259 if(rValue
>>= bMirror
)
2261 SdrGrafObj
* pObj
= dynamic_cast< SdrGrafObj
* >( mpObj
.get() );
2263 pObj
->SetMirrored(bMirror
);
2268 case OWN_ATTR_EDGE_START_OBJ
:
2269 case OWN_ATTR_EDGE_END_OBJ
:
2270 case OWN_ATTR_GLUEID_HEAD
:
2271 case OWN_ATTR_GLUEID_TAIL
:
2272 case OWN_ATTR_EDGE_START_POS
:
2273 case OWN_ATTR_EDGE_END_POS
:
2274 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2276 SdrEdgeObj
* pEdgeObj
= dynamic_cast< SdrEdgeObj
* >(mpObj
.get());
2279 switch(pProperty
->nWID
)
2281 case OWN_ATTR_EDGE_START_OBJ
:
2282 case OWN_ATTR_EDGE_END_OBJ
:
2284 Reference
< drawing::XShape
> xShape
;
2285 if( rValue
>>= xShape
)
2287 SdrObject
* pNode
= GetSdrObjectFromXShape( xShape
);
2290 pEdgeObj
->ConnectToNode( pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
, pNode
);
2291 pEdgeObj
->setGluePointIndex( pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
, -1 );
2298 case OWN_ATTR_EDGE_START_POS
:
2299 case OWN_ATTR_EDGE_END_POS
:
2301 awt::Point aUnoPoint
;
2302 if( rValue
>>= aUnoPoint
)
2304 Point
aPoint( aUnoPoint
.X
, aUnoPoint
.Y
);
2306 // Reintroduction of fix for issue i59051 (#i108851#)
2307 // perform metric change before applying anchor position,
2308 // because the anchor position is in pool metric.
2309 ForceMetricToItemPoolMetric( aPoint
);
2310 if( mpModel
->IsWriter() )
2311 aPoint
+= mpObj
->GetAnchorPos();
2313 pEdgeObj
->SetTailPoint( pProperty
->nWID
== OWN_ATTR_EDGE_START_POS
, aPoint
);
2319 case OWN_ATTR_GLUEID_HEAD
:
2320 case OWN_ATTR_GLUEID_TAIL
:
2323 if( rValue
>>= nId
)
2325 pEdgeObj
->setGluePointIndex( pProperty
->nWID
== OWN_ATTR_GLUEID_HEAD
, nId
);
2330 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2332 drawing::PolyPolygonBezierCoords aPolyPoly
;
2333 if ( rValue
>>= aPolyPoly
)
2335 basegfx::B2DPolyPolygon
aNewPolyPolygon( basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( aPolyPoly
) );
2336 // Reintroduction of fix for issue i59051 (#i108851#)
2337 ForceMetricToItemPoolMetric( aNewPolyPolygon
);
2338 if( mpModel
->IsWriter() )
2340 Point
aPoint( mpObj
->GetAnchorPos() );
2341 aNewPolyPolygon
.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint
.X(), aPoint
.Y()));
2343 pEdgeObj
->SetEdgeTrackPath( aNewPolyPolygon
);
2351 case OWN_ATTR_MEASURE_START_POS
:
2352 case OWN_ATTR_MEASURE_END_POS
:
2354 SdrMeasureObj
* pMeasureObj
= dynamic_cast< SdrMeasureObj
* >(mpObj
.get());
2355 awt::Point aUnoPoint
;
2356 if(pMeasureObj
&& ( rValue
>>= aUnoPoint
) )
2358 Point
aPoint( aUnoPoint
.X
, aUnoPoint
.Y
);
2360 // Reintroduction of fix for issue #i59051# (#i108851#)
2361 ForceMetricToItemPoolMetric( aPoint
);
2362 if( mpModel
->IsWriter() )
2363 aPoint
+= mpObj
->GetAnchorPos();
2365 pMeasureObj
->NbcSetPoint( aPoint
, pProperty
->nWID
== OWN_ATTR_MEASURE_START_POS
? 0L : 1L );
2366 pMeasureObj
->SetChanged();
2367 pMeasureObj
->BroadcastObjectChange();
2372 case OWN_ATTR_FILLBMP_MODE
:
2374 drawing::BitmapMode eMode
;
2375 if(!(rValue
>>= eMode
) )
2377 sal_Int32 nMode
= 0;
2378 if(!(rValue
>>= nMode
))
2381 eMode
= (drawing::BitmapMode
)nMode
;
2383 mpObj
->SetMergedItem( XFillBmpStretchItem( eMode
== drawing::BitmapMode_STRETCH
) );
2384 mpObj
->SetMergedItem( XFillBmpTileItem( eMode
== drawing::BitmapMode_REPEAT
) );
2388 case SDRATTR_LAYERID
:
2390 sal_Int16 nLayerId
= sal_Int16();
2391 if( rValue
>>= nLayerId
)
2393 SdrLayer
* pLayer
= mpModel
->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId
);
2396 mpObj
->SetLayer((unsigned char)nLayerId
);
2403 case SDRATTR_LAYERNAME
:
2405 OUString aLayerName
;
2406 if( rValue
>>= aLayerName
)
2408 const SdrLayer
* pLayer
=mpModel
->GetLayerAdmin().GetLayer(aLayerName
, sal_True
);
2409 if( pLayer
!= NULL
)
2411 mpObj
->SetLayer( pLayer
->GetID() );
2417 case SDRATTR_ROTATEANGLE
:
2419 sal_Int32 nAngle
= 0;
2420 if( rValue
>>= nAngle
)
2422 Point
aRef1(mpObj
->GetSnapRect().Center());
2423 nAngle
-= mpObj
->GetRotateAngle();
2426 double nSin
=sin(nAngle
*nPi180
);
2427 double nCos
=cos(nAngle
*nPi180
);
2428 mpObj
->Rotate(aRef1
,nAngle
,nSin
,nCos
);
2436 case SDRATTR_SHEARANGLE
:
2438 sal_Int32 nShear
= 0;
2439 if( rValue
>>= nShear
)
2441 nShear
-= mpObj
->GetShearAngle();
2444 Point
aRef1(mpObj
->GetSnapRect().Center());
2445 double nTan
=tan(nShear
*nPi180
);
2446 mpObj
->Shear(aRef1
,nShear
,nTan
,sal_False
);
2454 case SDRATTR_OBJMOVEPROTECT
:
2456 sal_Bool bMoveProtect
= sal_Bool();
2457 if( rValue
>>= bMoveProtect
)
2459 mpObj
->SetMoveProtect(bMoveProtect
);
2464 case SDRATTR_OBJECTNAME
:
2467 if( rValue
>>= aName
)
2469 mpObj
->SetName( aName
);
2476 case OWN_ATTR_MISC_OBJ_TITLE
:
2479 if( rValue
>>= aTitle
)
2481 mpObj
->SetTitle( aTitle
);
2486 case OWN_ATTR_MISC_OBJ_DESCRIPTION
:
2488 OUString aDescription
;
2489 if( rValue
>>= aDescription
)
2491 mpObj
->SetDescription( aDescription
);
2497 case SDRATTR_OBJPRINTABLE
:
2499 sal_Bool bPrintable
= sal_Bool();
2500 if( rValue
>>= bPrintable
)
2502 mpObj
->SetPrintable(bPrintable
);
2507 case SDRATTR_OBJVISIBLE
:
2509 sal_Bool bVisible
= sal_Bool();
2510 if( rValue
>>= bVisible
)
2512 mpObj
->SetVisible(bVisible
);
2517 case SDRATTR_OBJSIZEPROTECT
:
2519 sal_Bool bResizeProtect
= sal_Bool();
2520 if( rValue
>>= bResizeProtect
)
2522 mpObj
->SetResizeProtect(bResizeProtect
);
2527 case OWN_ATTR_PAGE_NUMBER
:
2529 sal_Int32 nPageNum
= 0;
2530 if( (rValue
>>= nPageNum
) && ( nPageNum
>= 0 ) && ( nPageNum
<= 0xffff ) )
2532 SdrPageObj
* pPageObj
= dynamic_cast< SdrPageObj
* >(mpObj
.get());
2535 SdrModel
* pModel
= pPageObj
->GetModel();
2536 SdrPage
* pNewPage
= 0L;
2537 const sal_uInt16
nDestinationPageNum((sal_uInt16
)((nPageNum
<< 1L) - 1L));
2541 if(nDestinationPageNum
< pModel
->GetPageCount())
2543 pNewPage
= pModel
->GetPage(nDestinationPageNum
);
2547 pPageObj
->SetReferencedPage(pNewPage
);
2554 case XATTR_FILLBITMAP
:
2555 case XATTR_FILLGRADIENT
:
2556 case XATTR_FILLHATCH
:
2557 case XATTR_FILLFLOATTRANSPARENCE
:
2559 case XATTR_LINESTART
:
2560 case XATTR_LINEDASH
:
2562 if( pProperty
->nMemberId
== MID_NAME
)
2565 if( rValue
>>= aApiName
)
2567 if( SetFillAttribute( pProperty
->nWID
, aApiName
) )
2582 throw lang::IllegalArgumentException();
2585 //----------------------------------------------------------------------
2587 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
)
2589 switch( pProperty
->nWID
)
2591 case OWN_ATTR_CAPTION_POINT
:
2593 Point aVclPoint
= ((SdrCaptionObj
*)mpObj
.get())->GetTailPos();
2595 // #88491# make pos relative to anchor
2596 if( mpModel
->IsWriter() )
2598 aVclPoint
-= mpObj
->GetAnchorPos();
2601 // #88657# metric of pool maybe twips (writer)
2602 ForceMetricTo100th_mm(aVclPoint
);
2604 // #90763# pos is absolute, make it relative to top left
2605 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2606 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2607 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2609 aVclPoint
.X() -= basegfx::fround(aNewHomogenMatrix
.get(0, 2));
2610 aVclPoint
.Y() -= basegfx::fround(aNewHomogenMatrix
.get(1, 2));
2612 awt::Point
aPnt( aVclPoint
.X(), aVclPoint
.Y() );
2617 case OWN_ATTR_TRANSFORMATION
:
2619 basegfx::B2DPolyPolygon aNewPolyPolygon
;
2620 basegfx::B2DHomMatrix aNewHomogenMatrix
;
2621 mpObj
->TRGetBaseGeometry(aNewHomogenMatrix
, aNewPolyPolygon
);
2622 drawing::HomogenMatrix3 aMatrix
;
2624 aMatrix
.Line1
.Column1
= aNewHomogenMatrix
.get(0, 0);
2625 aMatrix
.Line1
.Column2
= aNewHomogenMatrix
.get(0, 1);
2626 aMatrix
.Line1
.Column3
= aNewHomogenMatrix
.get(0, 2);
2627 aMatrix
.Line2
.Column1
= aNewHomogenMatrix
.get(1, 0);
2628 aMatrix
.Line2
.Column2
= aNewHomogenMatrix
.get(1, 1);
2629 aMatrix
.Line2
.Column3
= aNewHomogenMatrix
.get(1, 2);
2630 aMatrix
.Line3
.Column1
= aNewHomogenMatrix
.get(2, 0);
2631 aMatrix
.Line3
.Column2
= aNewHomogenMatrix
.get(2, 1);
2632 aMatrix
.Line3
.Column3
= aNewHomogenMatrix
.get(2, 2);
2639 case OWN_ATTR_ZORDER
:
2641 rValue
<<= (sal_Int32
)mpObj
->GetOrdNum();
2645 case OWN_ATTR_BITMAP
:
2647 rValue
= GetBitmap();
2648 if(!rValue
.hasValue())
2649 throw uno::RuntimeException();
2654 case OWN_ATTR_ISFONTWORK
:
2656 rValue
<<= (sal_Bool
)(mpObj
->ISA(SdrTextObj
) && ((SdrTextObj
*)mpObj
.get())->IsFontwork());
2660 case OWN_ATTR_FRAMERECT
:
2662 Rectangle
aRect( mpObj
->GetSnapRect() );
2663 Point
aTopLeft( aRect
.TopLeft() );
2664 Size
aObjSize( aRect
.GetWidth(), aRect
.GetHeight() );
2665 ForceMetricTo100th_mm(aTopLeft
);
2666 ForceMetricTo100th_mm(aObjSize
);
2667 ::com::sun::star::awt::Rectangle
aUnoRect(
2668 aTopLeft
.X(), aTopLeft
.Y(),
2669 aObjSize
.getWidth(), aObjSize
.getHeight() );
2670 rValue
<<= aUnoRect
;
2674 case OWN_ATTR_BOUNDRECT
:
2676 Rectangle
aRect( mpObj
->GetCurrentBoundRect() );
2677 Point
aTopLeft( aRect
.TopLeft() );
2678 Size
aObjSize( aRect
.GetWidth(), aRect
.GetHeight() );
2679 ForceMetricTo100th_mm(aTopLeft
);
2680 ForceMetricTo100th_mm(aObjSize
);
2681 ::com::sun::star::awt::Rectangle
aUnoRect(
2682 aTopLeft
.X(), aTopLeft
.Y(),
2683 aObjSize
.getWidth(), aObjSize
.getHeight() );
2684 rValue
<<= aUnoRect
;
2688 case OWN_ATTR_LDNAME
:
2690 OUString
aName( mpObj
->GetName() );
2695 case OWN_ATTR_LDBITMAP
:
2698 if( mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_OLE2
)
2700 nId
= RID_UNODRAW_OLE2
;
2702 else if( mpObj
->GetObjInventor() == SdrInventor
&& mpObj
->GetObjIdentifier() == OBJ_GRAF
)
2704 nId
= RID_UNODRAW_GRAPHICS
;
2708 nId
= RID_UNODRAW_OBJECTS
;
2711 BitmapEx
aBmp( SVX_RES(nId
) );
2712 Reference
< awt::XBitmap
> xBmp( VCLUnoHelper::CreateBitmap( aBmp
) );
2718 case OWN_ATTR_MIRRORED
:
2720 sal_Bool bMirror
= sal_False
;
2721 if( mpObj
.is() && mpObj
->ISA(SdrGrafObj
) )
2722 bMirror
= ((SdrGrafObj
*)mpObj
.get())->IsMirrored();
2727 case OWN_ATTR_EDGE_START_OBJ
:
2728 case OWN_ATTR_EDGE_START_POS
:
2729 case OWN_ATTR_EDGE_END_POS
:
2730 case OWN_ATTR_EDGE_END_OBJ
:
2731 case OWN_ATTR_GLUEID_HEAD
:
2732 case OWN_ATTR_GLUEID_TAIL
:
2733 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2735 SdrEdgeObj
* pEdgeObj
= dynamic_cast<SdrEdgeObj
*>(mpObj
.get());
2738 switch(pProperty
->nWID
)
2740 case OWN_ATTR_EDGE_START_OBJ
:
2741 case OWN_ATTR_EDGE_END_OBJ
:
2743 SdrObject
* pNode
= pEdgeObj
->GetConnectedNode(pProperty
->nWID
== OWN_ATTR_EDGE_START_OBJ
);
2746 Reference
< drawing::XShape
> xShape( GetXShapeForSdrObject( pNode
) );
2754 case OWN_ATTR_EDGE_START_POS
:
2755 case OWN_ATTR_EDGE_END_POS
:
2757 Point
aPoint( pEdgeObj
->GetTailPoint( pProperty
->nWID
== OWN_ATTR_EDGE_START_POS
) );
2758 if( mpModel
->IsWriter() )
2759 aPoint
-= mpObj
->GetAnchorPos();
2761 ForceMetricTo100th_mm( aPoint
);
2762 awt::Point
aUnoPoint( aPoint
.X(), aPoint
.Y() );
2764 rValue
<<= aUnoPoint
;
2767 case OWN_ATTR_GLUEID_HEAD
:
2768 case OWN_ATTR_GLUEID_TAIL
:
2770 rValue
<<= (sal_Int32
)pEdgeObj
->getGluePointIndex( pProperty
->nWID
== OWN_ATTR_GLUEID_HEAD
);
2773 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER
:
2775 basegfx::B2DPolyPolygon
aPolyPoly( pEdgeObj
->GetEdgeTrackPath() );
2776 if( mpModel
->IsWriter() )
2778 Point
aPoint( mpObj
->GetAnchorPos() );
2779 aPolyPoly
.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint
.X(), -aPoint
.Y()));
2781 // Reintroduction of fix for issue #i59051# (#i108851#)
2782 ForceMetricTo100th_mm( aPolyPoly
);
2783 drawing::PolyPolygonBezierCoords aRetval
;
2784 basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPoly
, aRetval
);
2793 case OWN_ATTR_MEASURE_START_POS
:
2794 case OWN_ATTR_MEASURE_END_POS
:
2796 SdrMeasureObj
* pMeasureObj
= dynamic_cast<SdrMeasureObj
*>(mpObj
.get());
2799 Point
aPoint( pMeasureObj
->GetPoint( pProperty
->nWID
== OWN_ATTR_MEASURE_START_POS
? 0 : 1 ) );
2800 if( mpModel
->IsWriter() )
2801 aPoint
-= mpObj
->GetAnchorPos();
2803 // Reintroduction of fix for issue #i59051# (#i108851#)
2804 ForceMetricTo100th_mm( aPoint
);
2805 awt::Point
aUnoPoint( aPoint
.X(), aPoint
.Y() );
2807 rValue
<<= aUnoPoint
;
2813 case OWN_ATTR_FILLBMP_MODE
:
2815 const SfxItemSet
& rObjItemSet
= mpObj
->GetMergedItemSet();
2817 XFillBmpStretchItem
* pStretchItem
= (XFillBmpStretchItem
*)&rObjItemSet
.Get(XATTR_FILLBMP_STRETCH
);
2818 XFillBmpTileItem
* pTileItem
= (XFillBmpTileItem
*)&rObjItemSet
.Get(XATTR_FILLBMP_TILE
);
2820 if( pTileItem
&& pTileItem
->GetValue() )
2822 rValue
<<= drawing::BitmapMode_REPEAT
;
2824 else if( pStretchItem
&& pStretchItem
->GetValue() )
2826 rValue
<<= drawing::BitmapMode_STRETCH
;
2830 rValue
<<= drawing::BitmapMode_NO_REPEAT
;
2834 case SDRATTR_LAYERID
:
2835 rValue
<<= (sal_Int16
)mpObj
->GetLayer();
2838 case SDRATTR_LAYERNAME
:
2840 SdrLayer
* pLayer
= mpModel
->GetLayerAdmin().GetLayerPerID(mpObj
->GetLayer());
2843 OUString
aName( pLayer
->GetName() );
2849 case SDRATTR_ROTATEANGLE
:
2850 rValue
<<= (sal_Int32
)mpObj
->GetRotateAngle();
2853 case SDRATTR_SHEARANGLE
:
2854 rValue
<<= (sal_Int32
)mpObj
->GetShearAngle();
2857 case SDRATTR_OBJMOVEPROTECT
:
2858 rValue
= uno::makeAny( (sal_Bool
) mpObj
->IsMoveProtect() );
2861 case SDRATTR_OBJECTNAME
:
2863 OUString
aName( mpObj
->GetName() );
2869 case OWN_ATTR_MISC_OBJ_TITLE
:
2871 OUString
aTitle( mpObj
->GetTitle() );
2876 case OWN_ATTR_MISC_OBJ_DESCRIPTION
:
2878 OUString
aDescription( mpObj
->GetDescription() );
2879 rValue
<<= aDescription
;
2883 case SDRATTR_OBJPRINTABLE
:
2884 rValue
<<= static_cast<sal_Bool
>( mpObj
->IsPrintable() );
2887 case SDRATTR_OBJVISIBLE
:
2888 rValue
<<= static_cast<sal_Bool
>( mpObj
->IsVisible() );
2891 case SDRATTR_OBJSIZEPROTECT
:
2892 rValue
<<= static_cast<sal_Bool
>( mpObj
->IsResizeProtect() );
2895 case OWN_ATTR_PAGE_NUMBER
:
2897 SdrPageObj
* pPageObj
= dynamic_cast<SdrPageObj
*>(mpObj
.get());
2900 SdrPage
* pPage
= pPageObj
->GetReferencedPage();
2901 sal_Int32 nPageNumber
= (pPage
) ? pPage
->GetPageNum() : 0L;
2904 rValue
<<= nPageNumber
;
2909 case OWN_ATTR_UINAME_SINGULAR
:
2912 mpObj
->TakeObjNameSingul( aTmp
);
2913 rValue
<<= OUString( aTmp
);
2917 case OWN_ATTR_UINAME_PLURAL
:
2920 mpObj
->TakeObjNamePlural( aTmp
);
2921 rValue
<<= OUString( aTmp
);
2924 case OWN_ATTR_METAFILE
:
2926 SdrOle2Obj
* pObj
= dynamic_cast<SdrOle2Obj
*>(mpObj
.get());
2929 const Graphic
* pGraphic
= pObj
->GetGraphic();
2932 bool bIsWMF
= false;
2933 if ( pGraphic
->IsLink() )
2935 GfxLink aLnk
= pGraphic
->GetLink();
2936 if ( aLnk
.GetType() == GFX_LINK_TYPE_NATIVE_WMF
)
2939 uno::Sequence
<sal_Int8
> aSeq((sal_Int8
*)aLnk
.GetData(), (sal_Int32
) aLnk
.GetDataSize());
2945 // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
2946 GDIMetaFile
aMtf(pObj
->GetGraphic()->GetGDIMetaFile());
2947 SvMemoryStream
aDestStrm( 65535, 65535 );
2948 ConvertGDIMetaFileToWMF( aMtf
, aDestStrm
, NULL
, sal_False
);
2949 const uno::Sequence
<sal_Int8
> aSeq(
2950 static_cast< const sal_Int8
* >(aDestStrm
.GetData()),
2951 aDestStrm
.GetEndOfData());
2958 rValue
= GetBitmap( sal_True
);
2970 //----------------------------------------------------------------------
2972 bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry
* pProperty
, ::com::sun::star::beans::PropertyState
& rState
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
2974 if( pProperty
->nWID
== OWN_ATTR_FILLBMP_MODE
)
2976 const SfxItemSet
& rSet
= mpObj
->GetMergedItemSet();
2978 if( rSet
.GetItemState( XATTR_FILLBMP_STRETCH
, false ) == SFX_ITEM_SET
||
2979 rSet
.GetItemState( XATTR_FILLBMP_TILE
, false ) == SFX_ITEM_SET
)
2981 rState
= beans::PropertyState_DIRECT_VALUE
;
2985 rState
= beans::PropertyState_AMBIGUOUS_VALUE
;
2988 else if((( pProperty
->nWID
>= OWN_ATTR_VALUE_START
&& pProperty
->nWID
<= OWN_ATTR_VALUE_END
) ||
2989 ( pProperty
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pProperty
->nWID
<= SDRATTR_NOTPERSIST_LAST
)) && ( pProperty
->nWID
!= SDRATTR_TEXTDIRECTION
) )
2991 rState
= beans::PropertyState_DIRECT_VALUE
;
3001 //----------------------------------------------------------------------
3003 bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry
* pProperty
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
3005 if( pProperty
->nWID
== OWN_ATTR_FILLBMP_MODE
)
3007 mpObj
->ClearMergedItem( XATTR_FILLBMP_STRETCH
);
3008 mpObj
->ClearMergedItem( XATTR_FILLBMP_TILE
);
3011 else if((pProperty
->nWID
>= OWN_ATTR_VALUE_START
&& pProperty
->nWID
<= OWN_ATTR_VALUE_END
) ||
3012 ( pProperty
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pProperty
->nWID
<= SDRATTR_NOTPERSIST_LAST
))
3022 //----------------------------------------------------------------------
3024 uno::Sequence
< beans::PropertyState
> SAL_CALL
SvxShape::getPropertyStates( const uno::Sequence
< OUString
>& aPropertyName
)
3025 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
3027 const sal_Int32 nCount
= aPropertyName
.getLength();
3028 const OUString
* pNames
= aPropertyName
.getConstArray();
3030 uno::Sequence
< beans::PropertyState
> aRet( nCount
);
3031 beans::PropertyState
* pState
= aRet
.getArray();
3033 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++ )
3034 pState
[nIdx
] = getPropertyState( pNames
[nIdx
] );
3039 //----------------------------------------------------------------------
3041 void SAL_CALL
SvxShape::setPropertyToDefault( const OUString
& PropertyName
)
3042 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
3044 if( mpImpl
->mpMaster
)
3046 mpImpl
->mpMaster
->setPropertyToDefault( PropertyName
);
3050 _setPropertyToDefault( PropertyName
);
3054 void SAL_CALL
SvxShape::_setPropertyToDefault( const OUString
& PropertyName
)
3055 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
3057 ::SolarMutexGuard aGuard
;
3059 const SfxItemPropertySimpleEntry
* pProperty
= mpPropSet
->getPropertyMapEntry(PropertyName
);
3061 if( !mpObj
.is() || mpModel
== NULL
|| pProperty
== NULL
)
3062 throw beans::UnknownPropertyException();
3064 if( !setPropertyToDefaultImpl( pProperty
) )
3066 mpObj
->ClearMergedItem( pProperty
->nWID
);
3069 mpModel
->SetChanged();
3072 //----------------------------------------------------------------------
3074 uno::Any SAL_CALL
SvxShape::getPropertyDefault( const OUString
& aPropertyName
)
3075 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
3077 if( mpImpl
->mpMaster
)
3079 return mpImpl
->mpMaster
->getPropertyDefault( aPropertyName
);
3083 return _getPropertyDefault( aPropertyName
);
3087 uno::Any SAL_CALL
SvxShape::_getPropertyDefault( const OUString
& aPropertyName
)
3088 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
3090 ::SolarMutexGuard aGuard
;
3092 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
3094 if( !mpObj
.is() || pMap
== NULL
|| mpModel
== NULL
)
3095 throw beans::UnknownPropertyException();
3097 if(( pMap
->nWID
>= OWN_ATTR_VALUE_START
&& pMap
->nWID
<= OWN_ATTR_VALUE_END
) ||
3098 ( pMap
->nWID
>= SDRATTR_NOTPERSIST_FIRST
&& pMap
->nWID
<= SDRATTR_NOTPERSIST_LAST
))
3100 return getPropertyValue( aPropertyName
);
3103 // Default aus ItemPool holen
3104 if(!mpModel
->GetItemPool().IsWhich(pMap
->nWID
))
3105 throw beans::UnknownPropertyException();
3107 SfxItemSet
aSet( mpModel
->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
3108 aSet
.Put(mpModel
->GetItemPool().GetDefaultItem(pMap
->nWID
));
3110 return GetAnyForItem( aSet
, pMap
);
3113 // XMultiPropertyStates
3114 void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException
)
3116 ::SolarMutexGuard aGuard
;
3119 throw lang::DisposedException();
3120 mpObj
->ClearMergedItem(); // nWhich == 0 => all
3122 if(mpObj
->ISA(SdrGrafObj
))
3124 // defaults for graphic objects have changed:
3125 mpObj
->SetMergedItem( XFillStyleItem( XFILL_NONE
) );
3126 mpObj
->SetMergedItem( XLineStyleItem( XLINE_NONE
) );
3129 // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3130 // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3131 // does not load lathe or extrude objects, it is possible to set the items
3133 // For other solution possibilities, see task description.
3134 if(mpObj
->ISA(E3dLatheObj
) || mpObj
->ISA(E3dExtrudeObj
))
3136 mpObj
->SetMergedItem(Svx3DCharacterModeItem(true));
3139 mpModel
->SetChanged();
3142 void SvxShape::setPropertiesToDefault(
3143 const uno::Sequence
<OUString
>& aPropertyNames
)
3144 throw (beans::UnknownPropertyException
, uno::RuntimeException
)
3146 for ( sal_Int32 pos
= 0; pos
< aPropertyNames
.getLength(); ++pos
)
3147 setPropertyToDefault( aPropertyNames
[pos
] );
3150 uno::Sequence
<uno::Any
> SvxShape::getPropertyDefaults(
3151 const uno::Sequence
<OUString
>& aPropertyNames
)
3152 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
,
3153 uno::RuntimeException
)
3155 ::std::vector
<uno::Any
> ret
;
3156 for ( sal_Int32 pos
= 0; pos
< aPropertyNames
.getLength(); ++pos
)
3157 ret
.push_back( getPropertyDefault( aPropertyNames
[pos
] ) );
3158 return uno::Sequence
<uno::Any
>( &ret
[0], ret
.size() );
3161 //----------------------------------------------------------------------
3163 //----------------------------------------------------------------------
3165 //----------------------------------------------------------------------
3166 OUString SAL_CALL
SvxShape::getImplementationName()
3167 throw(uno::RuntimeException
)
3169 static OUString
aServiceName("SvxShape");
3170 return aServiceName
;
3173 #define STAR_NAMESPACE "com.sun.star."
3175 const char* sUNO_service_style_ParagraphProperties
= STAR_NAMESPACE
"style.ParagraphProperties";
3176 const char* sUNO_service_style_ParagraphPropertiesComplex
= STAR_NAMESPACE
"style.ParagraphPropertiesComplex";
3177 const char* sUNO_service_style_ParagraphPropertiesAsian
= STAR_NAMESPACE
"style.ParagraphPropertiesAsian";
3178 const char* sUNO_service_style_CharacterProperties
= STAR_NAMESPACE
"style.CharacterProperties";
3179 const char* sUNO_service_style_CharacterPropertiesComplex
= STAR_NAMESPACE
"style.CharacterPropertiesComplex";
3180 const char* sUNO_service_style_CharacterPropertiesAsian
= STAR_NAMESPACE
"style.CharacterPropertiesAsian";
3182 const char* sUNO_service_drawing_FillProperties
= STAR_NAMESPACE
"drawing.FillProperties";
3183 const char* sUNO_service_drawing_TextProperties
= STAR_NAMESPACE
"drawing.TextProperties";
3184 const char* sUNO_service_drawing_LineProperties
= STAR_NAMESPACE
"drawing.LineProperties";
3185 const char* sUNO_service_drawing_ConnectorProperties
= STAR_NAMESPACE
"drawing.ConnectorProperties";
3186 const char* sUNO_service_drawing_MeasureProperties
= STAR_NAMESPACE
"drawing.MeasureProperties";
3187 const char* sUNO_service_drawing_ShadowProperties
= STAR_NAMESPACE
"drawing.ShadowProperties";
3189 const char* sUNO_service_drawing_RotationDescriptor
= STAR_NAMESPACE
"drawing.RotationDescriptor";
3191 const char* sUNO_service_drawing_Text
= STAR_NAMESPACE
"drawing.Text";
3192 const char* sUNO_service_drawing_GroupShape
= STAR_NAMESPACE
"drawing.GroupShape";
3194 const char* sUNO_service_drawing_CustomShapeProperties
= STAR_NAMESPACE
"drawing.CustomShapeProperties";
3195 const char* sUNO_service_drawing_CustomShape
= STAR_NAMESPACE
"drawing.CustomShape";
3197 const char* sUNO_service_drawing_PolyPolygonDescriptor
= STAR_NAMESPACE
"drawing.PolyPolygonDescriptor";
3198 const char* sUNO_service_drawing_PolyPolygonBezierDescriptor
= STAR_NAMESPACE
"drawing.PolyPolygonBezierDescriptor";
3200 const char* sUNO_service_drawing_LineShape
= STAR_NAMESPACE
"drawing.LineShape";
3201 const char* sUNO_service_drawing_Shape
= STAR_NAMESPACE
"drawing.Shape";
3202 const char* sUNO_service_drawing_RectangleShape
= STAR_NAMESPACE
"drawing.RectangleShape";
3203 const char* sUNO_service_drawing_EllipseShape
= STAR_NAMESPACE
"drawing.EllipseShape";
3204 const char* sUNO_service_drawing_PolyPolygonShape
= STAR_NAMESPACE
"drawing.PolyPolygonShape";
3205 const char* sUNO_service_drawing_PolyLineShape
= STAR_NAMESPACE
"drawing.PolyLineShape";
3206 const char* sUNO_service_drawing_OpenBezierShape
= STAR_NAMESPACE
"drawing.OpenBezierShape";
3207 const char* sUNO_service_drawing_ClosedBezierShape
= STAR_NAMESPACE
"drawing.ClosedBezierShape";
3208 const char* sUNO_service_drawing_TextShape
= STAR_NAMESPACE
"drawing.TextShape";
3209 const char* sUNO_service_drawing_GraphicObjectShape
= STAR_NAMESPACE
"drawing.GraphicObjectShape";
3210 const char* sUNO_service_drawing_OLE2Shape
= STAR_NAMESPACE
"drawing.OLE2Shape";
3211 const char* sUNO_service_drawing_PageShape
= STAR_NAMESPACE
"drawing.PageShape";
3212 const char* sUNO_service_drawing_CaptionShape
= STAR_NAMESPACE
"drawing.CaptionShape";
3213 const char* sUNO_service_drawing_MeasureShape
= STAR_NAMESPACE
"drawing.MeasureShape";
3214 const char* sUNO_service_drawing_FrameShape
= STAR_NAMESPACE
"drawing.FrameShape";
3215 const char* sUNO_service_drawing_ControlShape
= STAR_NAMESPACE
"drawing.ControlShape";
3216 const char* sUNO_service_drawing_ConnectorShape
= STAR_NAMESPACE
"drawing.ConnectorShape";
3217 const char* sUNO_service_drawing_MediaShape
= STAR_NAMESPACE
"drawing.MediaShape";
3220 uno::Sequence
< OUString
> SAL_CALL
SvxShape::getSupportedServiceNames()
3221 throw(uno::RuntimeException
)
3223 if( mpImpl
->mpMaster
)
3225 return mpImpl
->mpMaster
->getSupportedServiceNames();
3229 return _getSupportedServiceNames();
3233 uno::Sequence
< OUString
> SAL_CALL
SvxShape::_getSupportedServiceNames()
3234 throw(uno::RuntimeException
)
3236 ::SolarMutexGuard aGuard
;
3238 if( mpObj
.is() && mpObj
->GetObjInventor() == SdrInventor
)
3240 const sal_uInt16 nIdent
= mpObj
->GetObjIdentifier();
3246 static uno::Sequence
< OUString
> *pSeq
= 0;
3249 static uno::Sequence
< OUString
> SvxShape_GroupServices
;
3251 comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices
, 2,
3252 sUNO_service_drawing_GroupShape
,
3253 sUNO_service_drawing_Shape
);
3255 pSeq
= &SvxShape_GroupServices
;
3260 case OBJ_CUSTOMSHAPE
:
3262 static uno::Sequence
< OUString
> *pSeq
= 0;
3265 static uno::Sequence
< OUString
> SvxShape_CustomShapeServices
;
3267 comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices
, 13,
3268 sUNO_service_drawing_CustomShape
,
3269 sUNO_service_drawing_Shape
,
3270 sUNO_service_drawing_CustomShapeProperties
,
3271 sUNO_service_drawing_FillProperties
,
3272 sUNO_service_drawing_LineProperties
,
3273 sUNO_service_drawing_Text
,
3274 sUNO_service_drawing_TextProperties
,
3275 sUNO_service_style_ParagraphProperties
,
3276 sUNO_service_style_ParagraphPropertiesComplex
,
3277 sUNO_service_style_ParagraphPropertiesAsian
,
3278 sUNO_service_style_CharacterProperties
,
3279 sUNO_service_style_CharacterPropertiesComplex
,
3280 sUNO_service_style_CharacterPropertiesAsian
,
3281 sUNO_service_drawing_ShadowProperties
,
3282 sUNO_service_drawing_RotationDescriptor
);
3283 pSeq
= &SvxShape_CustomShapeServices
;
3289 static uno::Sequence
< OUString
> *pSeq
= 0;
3292 static uno::Sequence
< OUString
> SvxShape_LineServices
;
3294 comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices
,14,
3295 sUNO_service_drawing_LineShape
,
3297 sUNO_service_drawing_Shape
,
3298 sUNO_service_drawing_LineProperties
,
3300 sUNO_service_drawing_Text
,
3301 sUNO_service_drawing_TextProperties
,
3302 sUNO_service_style_ParagraphProperties
,
3303 sUNO_service_style_ParagraphPropertiesComplex
,
3304 sUNO_service_style_ParagraphPropertiesAsian
,
3305 sUNO_service_style_CharacterProperties
,
3306 sUNO_service_style_CharacterPropertiesComplex
,
3307 sUNO_service_style_CharacterPropertiesAsian
,
3309 sUNO_service_drawing_PolyPolygonDescriptor
,
3310 sUNO_service_drawing_ShadowProperties
,
3311 sUNO_service_drawing_RotationDescriptor
);
3313 pSeq
= &SvxShape_LineServices
;
3320 static uno::Sequence
< OUString
> *pSeq
= 0;
3323 static uno::Sequence
< OUString
> SvxShape_RectServices
;
3325 comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices
,14,
3326 sUNO_service_drawing_RectangleShape
,
3328 sUNO_service_drawing_Shape
,
3329 sUNO_service_drawing_FillProperties
,
3330 sUNO_service_drawing_LineProperties
,
3331 sUNO_service_drawing_Text
,
3332 sUNO_service_drawing_TextProperties
,
3333 sUNO_service_style_ParagraphProperties
,
3334 sUNO_service_style_ParagraphPropertiesComplex
,
3335 sUNO_service_style_ParagraphPropertiesAsian
,
3336 sUNO_service_style_CharacterProperties
,
3337 sUNO_service_style_CharacterPropertiesComplex
,
3338 sUNO_service_style_CharacterPropertiesAsian
,
3340 sUNO_service_drawing_ShadowProperties
,
3341 sUNO_service_drawing_RotationDescriptor
);
3342 pSeq
= &SvxShape_RectServices
;
3352 static uno::Sequence
< OUString
> *pSeq
= 0;
3355 static uno::Sequence
< OUString
> SvxShape_CircServices
;
3357 comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices
,14,
3358 sUNO_service_drawing_EllipseShape
,
3360 sUNO_service_drawing_Shape
,
3361 sUNO_service_drawing_FillProperties
,
3362 sUNO_service_drawing_LineProperties
,
3364 sUNO_service_drawing_Text
,
3365 sUNO_service_drawing_TextProperties
,
3366 sUNO_service_style_ParagraphProperties
,
3367 sUNO_service_style_ParagraphPropertiesComplex
,
3368 sUNO_service_style_ParagraphPropertiesAsian
,
3369 sUNO_service_style_CharacterProperties
,
3370 sUNO_service_style_CharacterPropertiesComplex
,
3371 sUNO_service_style_CharacterPropertiesAsian
,
3373 sUNO_service_drawing_ShadowProperties
,
3374 sUNO_service_drawing_RotationDescriptor
);
3376 pSeq
= &SvxShape_CircServices
;
3385 static uno::Sequence
< OUString
> *pSeq
= 0;
3388 static uno::Sequence
< OUString
> SvxShape_PathServices
;
3389 comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices
,14,
3390 sUNO_service_drawing_PolyLineShape
,
3392 sUNO_service_drawing_Shape
,
3393 sUNO_service_drawing_LineProperties
,
3395 sUNO_service_drawing_PolyPolygonDescriptor
,
3397 sUNO_service_drawing_Text
,
3398 sUNO_service_drawing_TextProperties
,
3399 sUNO_service_style_ParagraphProperties
,
3400 sUNO_service_style_ParagraphPropertiesComplex
,
3401 sUNO_service_style_ParagraphPropertiesAsian
,
3402 sUNO_service_style_CharacterProperties
,
3403 sUNO_service_style_CharacterPropertiesComplex
,
3404 sUNO_service_style_CharacterPropertiesAsian
,
3406 sUNO_service_drawing_ShadowProperties
,
3407 sUNO_service_drawing_RotationDescriptor
);
3408 pSeq
= &SvxShape_PathServices
;
3416 static uno::Sequence
< OUString
> *pSeq
= 0;
3419 static uno::Sequence
< OUString
> SvxShape_PolyServices
;
3420 comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices
,15,
3421 sUNO_service_drawing_PolyPolygonShape
,
3423 sUNO_service_drawing_Shape
,
3424 sUNO_service_drawing_LineProperties
,
3425 sUNO_service_drawing_FillProperties
,
3427 sUNO_service_drawing_PolyPolygonDescriptor
,
3429 sUNO_service_drawing_Text
,
3430 sUNO_service_drawing_TextProperties
,
3431 sUNO_service_style_ParagraphProperties
,
3432 sUNO_service_style_ParagraphPropertiesComplex
,
3433 sUNO_service_style_ParagraphPropertiesAsian
,
3434 sUNO_service_style_CharacterProperties
,
3435 sUNO_service_style_CharacterPropertiesComplex
,
3436 sUNO_service_style_CharacterPropertiesAsian
,
3438 sUNO_service_drawing_ShadowProperties
,
3439 sUNO_service_drawing_RotationDescriptor
);
3441 pSeq
= &SvxShape_PolyServices
;
3449 static uno::Sequence
< OUString
> *pSeq
= 0;
3452 static uno::Sequence
< OUString
> SvxShape_FreeLineServices
;
3454 comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices
,15,
3455 sUNO_service_drawing_OpenBezierShape
,
3457 sUNO_service_drawing_Shape
,
3458 sUNO_service_drawing_LineProperties
,
3459 sUNO_service_drawing_FillProperties
,
3461 sUNO_service_drawing_PolyPolygonBezierDescriptor
,
3463 sUNO_service_drawing_Text
,
3464 sUNO_service_drawing_TextProperties
,
3465 sUNO_service_style_ParagraphProperties
,
3466 sUNO_service_style_ParagraphPropertiesComplex
,
3467 sUNO_service_style_ParagraphPropertiesAsian
,
3468 sUNO_service_style_CharacterProperties
,
3469 sUNO_service_style_CharacterPropertiesComplex
,
3470 sUNO_service_style_CharacterPropertiesAsian
,
3472 sUNO_service_drawing_ShadowProperties
,
3473 sUNO_service_drawing_RotationDescriptor
);
3475 pSeq
= &SvxShape_FreeLineServices
;
3484 static uno::Sequence
< OUString
> *pSeq
= 0;
3487 static uno::Sequence
< OUString
> SvxShape_FreeFillServices
;
3488 comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices
,15,
3489 sUNO_service_drawing_ClosedBezierShape
,
3491 sUNO_service_drawing_Shape
,
3492 sUNO_service_drawing_LineProperties
,
3493 sUNO_service_drawing_FillProperties
,
3495 sUNO_service_drawing_PolyPolygonBezierDescriptor
,
3497 sUNO_service_drawing_Text
,
3498 sUNO_service_drawing_TextProperties
,
3499 sUNO_service_style_ParagraphProperties
,
3500 sUNO_service_style_ParagraphPropertiesComplex
,
3501 sUNO_service_style_ParagraphPropertiesAsian
,
3502 sUNO_service_style_CharacterProperties
,
3503 sUNO_service_style_CharacterPropertiesComplex
,
3504 sUNO_service_style_CharacterPropertiesAsian
,
3506 sUNO_service_drawing_ShadowProperties
,
3507 sUNO_service_drawing_RotationDescriptor
);
3509 pSeq
= &SvxShape_FreeFillServices
;
3514 case OBJ_OUTLINETEXT
:
3518 static uno::Sequence
< OUString
> *pSeq
= 0;
3521 static uno::Sequence
< OUString
> SvxShape_TextServices
;
3522 comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices
,14,
3523 sUNO_service_drawing_TextShape
,
3525 sUNO_service_drawing_Shape
,
3526 sUNO_service_drawing_FillProperties
,
3527 sUNO_service_drawing_LineProperties
,
3529 sUNO_service_drawing_Text
,
3530 sUNO_service_drawing_TextProperties
,
3531 sUNO_service_style_ParagraphProperties
,
3532 sUNO_service_style_ParagraphPropertiesComplex
,
3533 sUNO_service_style_ParagraphPropertiesAsian
,
3534 sUNO_service_style_CharacterProperties
,
3535 sUNO_service_style_CharacterPropertiesComplex
,
3536 sUNO_service_style_CharacterPropertiesAsian
,
3538 sUNO_service_drawing_ShadowProperties
,
3539 sUNO_service_drawing_RotationDescriptor
);
3541 pSeq
= &SvxShape_TextServices
;
3548 static uno::Sequence
< OUString
> *pSeq
= 0;
3551 static uno::Sequence
< OUString
> SvxShape_GrafServices
;
3552 comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices
, 12,
3553 sUNO_service_drawing_GraphicObjectShape
,
3555 sUNO_service_drawing_Shape
,
3557 sUNO_service_drawing_Text
,
3558 sUNO_service_drawing_TextProperties
,
3559 sUNO_service_style_ParagraphProperties
,
3560 sUNO_service_style_ParagraphPropertiesComplex
,
3561 sUNO_service_style_ParagraphPropertiesAsian
,
3562 sUNO_service_style_CharacterProperties
,
3563 sUNO_service_style_CharacterPropertiesComplex
,
3564 sUNO_service_style_CharacterPropertiesAsian
,
3566 sUNO_service_drawing_ShadowProperties
,
3567 sUNO_service_drawing_RotationDescriptor
);
3569 pSeq
= &SvxShape_GrafServices
;
3576 static uno::Sequence
< OUString
> *pSeq
= 0;
3579 static uno::Sequence
< OUString
> SvxShape_Ole2Services
;
3581 comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services
, 12,
3582 sUNO_service_drawing_OLE2Shape
,
3583 sUNO_service_drawing_Shape
,
3585 // #i118485# Added Text, Shadow and Rotation
3586 sUNO_service_drawing_Text
,
3587 sUNO_service_drawing_TextProperties
,
3588 sUNO_service_style_ParagraphProperties
,
3589 sUNO_service_style_ParagraphPropertiesComplex
,
3590 sUNO_service_style_ParagraphPropertiesAsian
,
3591 sUNO_service_style_CharacterProperties
,
3592 sUNO_service_style_CharacterPropertiesComplex
,
3593 sUNO_service_style_CharacterPropertiesAsian
,
3595 sUNO_service_drawing_ShadowProperties
,
3596 sUNO_service_drawing_RotationDescriptor
);
3598 pSeq
= &SvxShape_Ole2Services
;
3605 static uno::Sequence
< OUString
> *pSeq
= 0;
3608 static uno::Sequence
< OUString
> SvxShape_CaptionServices
;
3610 comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices
,14,
3611 sUNO_service_drawing_CaptionShape
,
3613 sUNO_service_drawing_Shape
,
3614 sUNO_service_drawing_FillProperties
,
3615 sUNO_service_drawing_LineProperties
,
3617 sUNO_service_drawing_Text
,
3618 sUNO_service_drawing_TextProperties
,
3619 sUNO_service_style_ParagraphProperties
,
3620 sUNO_service_style_ParagraphPropertiesComplex
,
3621 sUNO_service_style_ParagraphPropertiesAsian
,
3622 sUNO_service_style_CharacterProperties
,
3623 sUNO_service_style_CharacterPropertiesComplex
,
3624 sUNO_service_style_CharacterPropertiesAsian
,
3626 sUNO_service_drawing_ShadowProperties
,
3627 sUNO_service_drawing_RotationDescriptor
);
3629 pSeq
= &SvxShape_CaptionServices
;
3637 static uno::Sequence
< OUString
> *pSeq
= 0;
3640 static uno::Sequence
< OUString
> SvxShape_PageServices
;
3642 comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices
, 2,
3643 sUNO_service_drawing_PageShape
,
3644 sUNO_service_drawing_Shape
);
3646 pSeq
= &SvxShape_PageServices
;
3654 static uno::Sequence
< OUString
> *pSeq
= 0;
3657 static uno::Sequence
< OUString
> SvxShape_MeasureServices
;
3658 comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices
,15,
3659 sUNO_service_drawing_MeasureShape
,
3661 sUNO_service_drawing_MeasureProperties
,
3663 sUNO_service_drawing_Shape
,
3664 sUNO_service_drawing_LineProperties
,
3666 sUNO_service_drawing_Text
,
3667 sUNO_service_drawing_TextProperties
,
3668 sUNO_service_style_ParagraphProperties
,
3669 sUNO_service_style_ParagraphPropertiesComplex
,
3670 sUNO_service_style_ParagraphPropertiesAsian
,
3671 sUNO_service_style_CharacterProperties
,
3672 sUNO_service_style_CharacterPropertiesComplex
,
3673 sUNO_service_style_CharacterPropertiesAsian
,
3675 sUNO_service_drawing_PolyPolygonDescriptor
,
3676 sUNO_service_drawing_ShadowProperties
,
3677 sUNO_service_drawing_RotationDescriptor
);
3679 pSeq
= &SvxShape_MeasureServices
;
3687 static uno::Sequence
< OUString
> *pSeq
= 0;
3690 static uno::Sequence
< OUString
> SvxShape_FrameServices
;
3692 comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices
, 2,
3693 sUNO_service_drawing_FrameShape
,
3694 sUNO_service_drawing_Shape
);
3696 pSeq
= &SvxShape_FrameServices
;
3704 static uno::Sequence
< OUString
> *pSeq
= 0;
3707 static uno::Sequence
< OUString
> SvxShape_UnoServices
;
3708 comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices
, 2,
3709 sUNO_service_drawing_ControlShape
,
3710 sUNO_service_drawing_Shape
);
3712 pSeq
= &SvxShape_UnoServices
;
3719 static uno::Sequence
< OUString
> *pSeq
= 0;
3722 static uno::Sequence
< OUString
> SvxShape_EdgeServices
;
3724 comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices
,15,
3725 sUNO_service_drawing_ConnectorShape
,
3726 sUNO_service_drawing_ConnectorProperties
,
3728 sUNO_service_drawing_Shape
,
3729 sUNO_service_drawing_LineProperties
,
3731 sUNO_service_drawing_Text
,
3732 sUNO_service_drawing_TextProperties
,
3733 sUNO_service_style_ParagraphProperties
,
3734 sUNO_service_style_ParagraphPropertiesComplex
,
3735 sUNO_service_style_ParagraphPropertiesAsian
,
3736 sUNO_service_style_CharacterProperties
,
3737 sUNO_service_style_CharacterPropertiesComplex
,
3738 sUNO_service_style_CharacterPropertiesAsian
,
3740 sUNO_service_drawing_PolyPolygonDescriptor
,
3741 sUNO_service_drawing_ShadowProperties
,
3742 sUNO_service_drawing_RotationDescriptor
);
3744 pSeq
= &SvxShape_EdgeServices
;
3750 static uno::Sequence
< OUString
> *pSeq
= 0;
3753 static uno::Sequence
< OUString
> SvxShape_MediaServices
;
3755 comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices
, 2,
3756 sUNO_service_drawing_MediaShape
,
3757 sUNO_service_drawing_Shape
);
3759 pSeq
= &SvxShape_MediaServices
;
3765 else if( mpObj
.is() && mpObj
->GetObjInventor() == FmFormInventor
)
3767 #if OSL_DEBUG_LEVEL > 0
3768 const sal_uInt16 nIdent
= mpObj
->GetObjIdentifier();
3769 OSL_ENSURE( nIdent
== OBJ_UNO
, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
3771 static uno::Sequence
< OUString
> *pSeq
= 0;
3774 static uno::Sequence
< OUString
> SvxShape_UnoServices
;
3775 comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices
, 2,
3776 sUNO_service_drawing_ControlShape
,
3777 sUNO_service_drawing_Shape
);
3779 pSeq
= &SvxShape_UnoServices
;
3783 OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3784 uno::Sequence
< OUString
> aSeq
;
3788 //----------------------------------------------------------------------
3789 sal_Bool SAL_CALL
SvxShape::supportsService( const OUString
& ServiceName
) throw ( uno::RuntimeException
)
3791 Sequence
< OUString
> SupportedServices( getSupportedServiceNames() );
3792 const OUString
* pArray
= SupportedServices
.getConstArray();
3793 const sal_Int32 nCount
= SupportedServices
.getLength();
3795 for( i
= 0; i
< nCount
; i
++ )
3796 if( *pArray
++ == ServiceName
)
3801 //----------------------------------------------------------------------
3803 // XGluePointsSupplier
3804 uno::Reference
< container::XIndexContainer
> SAL_CALL
SvxShape::getGluePoints()
3805 throw(uno::RuntimeException
)
3807 ::SolarMutexGuard aGuard
;
3808 uno::Reference
< container::XIndexContainer
> xGluePoints( mxGluePoints
);
3810 if( mpObj
.is() && !xGluePoints
.is() )
3812 uno::Reference
< container::XIndexContainer
> xNew( SvxUnoGluePointAccess_createInstance( mpObj
.get() ), uno::UNO_QUERY
);
3813 mxGluePoints
= xGluePoints
= xNew
;
3819 //----------------------------------------------------------------------
3822 uno::Reference
< uno::XInterface
> SAL_CALL
SvxShape::getParent( )
3823 throw(uno::RuntimeException
)
3825 ::SolarMutexGuard aGuard
;
3827 if( mpObj
.is() && mpObj
->GetObjList() )
3829 SdrObjList
* pObjList
= mpObj
->GetObjList();
3831 switch( pObjList
->GetListKind() )
3833 case SDROBJLIST_GROUPOBJ
:
3834 if( pObjList
->GetOwnerObj()->ISA( SdrObjGroup
) )
3835 return PTR_CAST( SdrObjGroup
, pObjList
->GetOwnerObj())->getUnoShape();
3836 else if( pObjList
->GetOwnerObj()->ISA( E3dScene
) )
3837 return PTR_CAST( E3dScene
, pObjList
->GetOwnerObj())->getUnoShape();
3839 case SDROBJLIST_DRAWPAGE
:
3840 case SDROBJLIST_MASTERPAGE
:
3841 return PTR_CAST( SdrPage
, pObjList
)->getUnoPage();
3843 OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
3848 uno::Reference
< uno::XInterface
> xParent
;
3852 //----------------------------------------------------------------------
3854 void SAL_CALL
SvxShape::setParent( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& )
3855 throw(lang::NoSupportException
, uno::RuntimeException
)
3857 throw lang::NoSupportException();
3860 //----------------------------------------------------------------------
3862 /** called from the XActionLockable interface methods on initial locking */
3863 void SvxShape::lock()
3867 //----------------------------------------------------------------------
3869 /** called from the XActionLockable interface methods on final unlock */
3870 void SvxShape::unlock()
3874 //----------------------------------------------------------------------
3877 sal_Bool SAL_CALL
SvxShape::isActionLocked( ) throw (::com::sun::star::uno::RuntimeException
)
3879 ::SolarMutexGuard aGuard
;
3881 return mnLockCount
!= 0;
3884 //----------------------------------------------------------------------
3886 void SAL_CALL
SvxShape::addActionLock( ) throw (::com::sun::star::uno::RuntimeException
)
3888 ::SolarMutexGuard aGuard
;
3890 DBG_ASSERT( mnLockCount
< 0xffff, "lock overflow in SvxShape!" );
3893 if( mnLockCount
== 1 )
3897 //----------------------------------------------------------------------
3899 void SAL_CALL
SvxShape::removeActionLock( ) throw (::com::sun::star::uno::RuntimeException
)
3901 ::SolarMutexGuard aGuard
;
3903 DBG_ASSERT( mnLockCount
> 0, "lock underflow in SvxShape!" );
3906 if( mnLockCount
== 0 )
3910 //----------------------------------------------------------------------
3912 void SAL_CALL
SvxShape::setActionLocks( sal_Int16 nLock
) throw (::com::sun::star::uno::RuntimeException
)
3914 ::SolarMutexGuard aGuard
;
3916 if( (mnLockCount
== 0) && (nLock
!= 0) )
3919 if( (mnLockCount
!= 0) && (nLock
== 0) )
3922 mnLockCount
= (sal_uInt16
)nLock
;
3925 //----------------------------------------------------------------------
3927 sal_Int16 SAL_CALL
SvxShape::resetActionLocks( ) throw (::com::sun::star::uno::RuntimeException
)
3929 ::SolarMutexGuard aGuard
;
3931 if( mnLockCount
!= 0 )
3934 sal_Int16 nOldLocks
= (sal_Int16
)mnLockCount
;
3940 //----------------------------------------------------------------------
3942 /** since polygon shapes can change theire kind during editing, we have
3944 Circle shapes also change theire kind, but theire all treated equal
3945 so no update is necessary.
3947 void SvxShape::updateShapeKind()
3949 switch( mpImpl
->mnObjId
)
3961 const sal_uInt32 nId
= mpObj
->GetObjIdentifier();
3963 if( nId
!= mpImpl
->mnObjId
)
3965 mpImpl
->mnObjId
= nId
;
3973 /***********************************************************************
3974 * class SvxShapeText *
3975 ***********************************************************************/
3976 SvxShapeText::SvxShapeText( SdrObject
* pObject
) throw ()
3977 : SvxShape( pObject
, getSvxMapProvider().GetMap(SVXMAP_TEXT
), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT
, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3979 if( pObject
&& pObject
->GetModel() )
3980 SetEditSource( new SvxTextEditSource( pObject
, 0, static_cast< uno::XWeak
* >( this ) ) );
3983 //----------------------------------------------------------------------
3984 SvxShapeText::SvxShapeText( SdrObject
* pObject
, const SfxItemPropertyMapEntry
* pPropertyMap
, const SvxItemPropertySet
* pPropertySet
) throw ()
3985 : SvxShape( pObject
, pPropertyMap
, pPropertySet
), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3987 if( pObject
&& pObject
->GetModel() )
3988 SetEditSource( new SvxTextEditSource( pObject
, 0, static_cast< uno::XWeak
* >( this ) ) );
3991 //----------------------------------------------------------------------
3992 SvxShapeText::~SvxShapeText() throw ()
3994 // check if only this instance is registered at the ranges
3995 DBG_ASSERT( (NULL
== GetEditSource()) || (GetEditSource()->getRanges().size()==1),
3996 "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
3999 void SvxShapeText::Create( SdrObject
* pNewObj
, SvxDrawPage
* pNewPage
)
4001 if( pNewObj
&& (NULL
== GetEditSource()))
4002 SetEditSource( new SvxTextEditSource( pNewObj
, 0, static_cast< uno::XWeak
* >(this) ) );
4003 SvxShape::Create( pNewObj
, pNewPage
);
4007 //----------------------------------------------------------------------
4008 uno::Any SAL_CALL
SvxShapeText::queryInterface( const uno::Type
& rType
)
4009 throw( uno::RuntimeException
)
4011 return SvxShape::queryInterface( rType
);
4014 //----------------------------------------------------------------------
4016 uno::Any SAL_CALL
SvxShapeText::queryAggregation( const uno::Type
& rType
)
4017 throw( uno::RuntimeException
)
4019 uno::Any
aAny( SvxShape::queryAggregation( rType
) );
4020 if( aAny
.hasValue() )
4023 return SvxUnoTextBase::queryAggregation( rType
);
4026 //----------------------------------------------------------------------
4028 void SAL_CALL
SvxShapeText::acquire() throw()
4030 SvxShape::acquire();
4033 //----------------------------------------------------------------------
4034 void SAL_CALL
SvxShapeText::release() throw()
4036 SvxShape::release();
4040 //----------------------------------------------------------------------
4041 OUString SAL_CALL
SvxShapeText::getImplementationName() throw( uno::RuntimeException
)
4043 static OUString
aServiceName("SvxShapeText");
4044 return aServiceName
;
4047 //----------------------------------------------------------------------
4048 uno::Sequence
< OUString
> SAL_CALL
SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException
)
4050 return SvxShape::getSupportedServiceNames();
4053 //----------------------------------------------------------------------
4054 sal_Bool SAL_CALL
SvxShapeText::supportsService( const OUString
& ServiceName
) throw ( uno::RuntimeException
)
4056 return SvxShape::supportsService(ServiceName
);
4060 //----------------------------------------------------------------------
4061 uno::Sequence
< uno::Type
> SAL_CALL
SvxShapeText::getTypes()
4062 throw( uno::RuntimeException
)
4064 return SvxShape::getTypes();
4067 sal_Int64 SAL_CALL
SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw(::com::sun::star::uno::RuntimeException
) \
4069 const sal_Int64 nReturn
= SvxShape::getSomething( rId
);
4073 return SvxUnoTextBase::getSomething( rId
);
4076 //----------------------------------------------------------------------
4077 uno::Sequence
< sal_Int8
> SAL_CALL
SvxShapeText::getImplementationId()
4078 throw( uno::RuntimeException
)
4080 static ::cppu::OImplementationId
* pID
= NULL
;
4084 // Ready for multithreading; get global mutex for first call of this method only! see before
4085 MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
4087 // Control these pointer again ... it can be, that another instance will be faster then these!
4090 // Create a new static ID ...
4091 static ::cppu::OImplementationId
aID( sal_False
) ;
4092 // ... and set his address to static pointer!
4097 return pID
->getImplementationId() ;
4100 //----------------------------------------------------------------------
4102 /** called from the XActionLockable interface methods on initial locking */
4103 void SvxShapeText::lock()
4105 SvxTextEditSource
* pEditSource
= (SvxTextEditSource
*)GetEditSource();
4107 pEditSource
->lock();
4110 //----------------------------------------------------------------------
4112 /** called from the XActionLockable interface methods on final unlock */
4113 void SvxShapeText::unlock()
4115 SvxTextEditSource
* pEditSource
= (SvxTextEditSource
*)GetEditSource();
4117 pEditSource
->unlock();
4120 // ::com::sun::star::text::XTextRange
4121 uno::Reference
< text::XTextRange
> SAL_CALL
SvxShapeText::getStart() throw(uno::RuntimeException
)
4123 ::SolarMutexGuard aGuard
;
4124 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4126 ::GetSelection( maSelection
, pForwarder
);
4127 return SvxUnoTextBase::getStart();
4131 uno::Reference
< text::XTextRange
> SAL_CALL
SvxShapeText::getEnd() throw(uno::RuntimeException
)
4133 ::SolarMutexGuard aGuard
;
4134 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4136 ::GetSelection( maSelection
, pForwarder
);
4137 return SvxUnoTextBase::getEnd();
4140 OUString SAL_CALL
SvxShapeText::getString() throw(uno::RuntimeException
)
4142 ::SolarMutexGuard aGuard
;
4143 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4145 ::GetSelection( maSelection
, pForwarder
);
4146 return SvxUnoTextBase::getString();
4150 void SAL_CALL
SvxShapeText::setString( const OUString
& aString
) throw(uno::RuntimeException
)
4152 ::SolarMutexGuard aGuard
;
4153 SvxTextForwarder
* pForwarder
= mpEditSource
? mpEditSource
->GetTextForwarder() : NULL
;
4155 ::GetSelection( maSelection
, pForwarder
);
4156 SvxUnoTextBase::setString( aString
);
4159 // overide these for special property handling in subcasses. Return true if property is handled
4160 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
)
4163 // since SdrTextObj::SetVerticalWriting exchanges
4164 // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
4165 // we have to set the textdirection here
4167 if( pProperty
->nWID
== SDRATTR_TEXTDIRECTION
)
4169 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( mpObj
.get() );
4172 com::sun::star::text::WritingMode eMode
;
4173 if( rValue
>>= eMode
)
4175 pTextObj
->SetVerticalWriting( eMode
== com::sun::star::text::WritingMode_TB_RL
);
4180 return SvxShape::setPropertyValueImpl( rName
, pProperty
, rValue
);
4183 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
)
4185 if( pProperty
->nWID
== SDRATTR_TEXTDIRECTION
)
4187 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >( mpObj
.get() );
4188 if( pTextObj
&& pTextObj
->IsVerticalWriting() )
4189 rValue
<<= com::sun::star::text::WritingMode_TB_RL
;
4191 rValue
<<= com::sun::star::text::WritingMode_LR_TB
;
4195 return SvxShape::getPropertyValueImpl( rName
, pProperty
, rValue
);
4198 bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry
* pProperty
, ::com::sun::star::beans::PropertyState
& rState
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
4200 return SvxShape::getPropertyStateImpl( pProperty
, rState
);
4203 bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry
* pProperty
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
)
4205 return SvxShape::setPropertyToDefaultImpl( pProperty
);
4208 /***********************************************************************
4209 * class SvxShapeRect *
4210 ***********************************************************************/
4211 DBG_NAME(SvxShapeRect
)
4212 SvxShapeRect::SvxShapeRect( SdrObject
* pObj
) throw()
4213 : SvxShapeText( pObj
, getSvxMapProvider().GetMap(SVXMAP_SHAPE
), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE
, SdrObject::GetGlobalDrawObjectItemPool()))
4215 DBG_CTOR(SvxShapeRect
,NULL
);
4218 SvxShapeRect::~SvxShapeRect() throw()
4220 DBG_DTOR(SvxShapeRect
,NULL
);
4223 uno::Any SAL_CALL
SvxShapeRect::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
)
4225 return SvxShapeText::queryInterface( rType
);
4228 uno::Any SAL_CALL
SvxShapeRect::queryAggregation( const uno::Type
& rType
) throw(uno::RuntimeException
)
4230 return SvxShapeText::queryAggregation( rType
);
4233 void SAL_CALL
SvxShapeRect::acquire() throw()
4235 OWeakAggObject::acquire();
4238 void SAL_CALL
SvxShapeRect::release() throw()
4240 OWeakAggObject::release();
4242 //----------------------------------------------------------------------
4244 //----------------------------------------------------------------------
4245 uno::Sequence
< OUString
> SvxShapeRect::getSupportedServiceNames(void) throw( uno::RuntimeException
)
4247 return SvxShape::getSupportedServiceNames();
4250 /** returns a StarOffice API wrapper for the given SdrObject */
4251 uno::Reference
< drawing::XShape
> GetXShapeForSdrObject( SdrObject
* pObj
) throw ()
4253 uno::Reference
< drawing::XShape
> xShape( pObj
->getUnoShape(), uno::UNO_QUERY
);
4257 /** returns the SdrObject from the given StarOffice API wrapper */
4258 SdrObject
* GetSdrObjectFromXShape( uno::Reference
< drawing::XShape
> xShape
) throw()
4260 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
4261 return pShape
? pShape
->GetSdrObject() : 0;
4264 //----------------------------------------------------------------------
4266 SdrObject
* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xInt
)
4268 SvxShape
* pSvxShape
= SvxShape::getImplementation( xInt
);
4269 return pSvxShape
? pSvxShape
->GetSdrObject() : 0;
4272 uno::Any
SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet
& rPropSet
, const SfxItemPropertySimpleEntry
* pMap
, const SfxItemSet
& rSet
)
4274 if(!pMap
|| !pMap
->nWID
)
4277 // Check is for items that store either metric values if thei are positiv or percentage if thei are negativ.
4278 bool bDontConvertNegativeValues
= ( pMap
->nWID
== XATTR_FILLBMP_SIZEX
|| pMap
->nWID
== XATTR_FILLBMP_SIZEY
);
4279 return rPropSet
.getPropertyValue( pMap
, rSet
, (pMap
->nWID
!= SDRATTR_XMLATTRIBUTES
), bDontConvertNegativeValues
);
4282 void SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet
& rPropSet
, const SfxItemPropertySimpleEntry
* pMap
, const uno::Any
& rVal
, SfxItemSet
& rSet
)
4284 uno::Any
aVal(rVal
);
4285 if(!pMap
|| !pMap
->nWID
)
4288 bool bDontConvertNegativeValues
= ( pMap
->nWID
== XATTR_FILLBMP_SIZEX
|| pMap
->nWID
== XATTR_FILLBMP_SIZEY
);
4289 if( pMap
->nWID
== EE_PARA_LRSPACE
) // n#757419 Don't import negative values
4291 sal_Int32 nVal
= sal_Int32();
4292 if( (aVal
>>= nVal
) && nVal
< 0 )
4293 aVal
<<= ( sal_Int32
) 0;
4295 rPropSet
.setPropertyValue( pMap
, aVal
, rSet
, bDontConvertNegativeValues
);
4298 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */