LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svx/source/unodraw - unoshape.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1025 1688 60.7 %
Date: 2013-07-09 Functions: 114 143 79.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10