LCOV - code coverage report
Current view: top level - libreoffice/svx/source/unodraw - unoshape.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 812 1665 48.8 %
Date: 2012-12-27 Functions: 100 143 69.9 %
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 <svtools/fltcall.hxx>
      28             : #include <osl/mutex.hxx>
      29             : #include <editeng/unotext.hxx>
      30             : #include <svx/svdobj.hxx>
      31             : #include <svx/svdoole2.hxx>
      32             : #include "svx/shapepropertynotifier.hxx"
      33             : #include <comphelper/extract.hxx>
      34             : #include <comphelper/scopeguard.hxx>
      35             : #include <comphelper/servicehelper.hxx>
      36             : #include <comphelper/serviceinfohelper.hxx>
      37             : #include <toolkit/unohlp.hxx>
      38             : #include <vcl/gfxlink.hxx>
      39             : #include <vcl/virdev.hxx>
      40             : #include <sfx2/objsh.hxx>
      41             : #include <sfx2/viewsh.hxx>
      42             : #include "svx/svdopage.hxx"
      43             : #include "svx/xflbstit.hxx"
      44             : #include "svx/xflbmtit.hxx"
      45             : #include "svx/xlnstit.hxx"
      46             : #include "svx/xlnedit.hxx"
      47             : #include "svx/svdogrp.hxx"
      48             : #include "svx/scene3d.hxx"
      49             : #include "svx/svdmodel.hxx"
      50             : #include "svx/globl3d.hxx"
      51             : #include "svx/fmglob.hxx"
      52             : #include "svx/unopage.hxx"
      53             : #include "svx/view3d.hxx"
      54             : #include "svx/unoshape.hxx"
      55             : #include "svx/svxids.hrc"
      56             : #include "svx/unoshtxt.hxx"
      57             : #include "svx/svdpage.hxx"
      58             : #include "svx/unoshprp.hxx"
      59             : #include "svx/sxciaitm.hxx" // todo: remove
      60             : #include "svx/svdograf.hxx"
      61             : #include "svx/unoapi.hxx"
      62             : #include "svx/svdomeas.hxx"
      63             : #include "svx/svdpagv.hxx"
      64             : #include "svx/svdpool.hxx"
      65             : #include <tools/shl.hxx>    //
      66             : #include "svx/dialmgr.hxx"      // not nice, we need our own resources some day
      67             : #include "svx/dialogs.hrc"      //
      68             : #include "svx/svdocapt.hxx"
      69             : #include <svx/obj3d.hxx>
      70             : #include <tools/diagnose_ex.h>
      71             : #include "svx/xflftrit.hxx"
      72             : #include "svx/xtable.hxx"
      73             : #include "svx/xbtmpit.hxx"
      74             : #include "svx/xflgrit.hxx"
      75             : #include "svx/xflhtit.hxx"
      76             : #include "svx/xlndsit.hxx"
      77             : #include "svx/svdglob.hxx"
      78             : #include "svx/svdstr.hrc"
      79             : #include "svx/unomaster.hxx"
      80             : #include <editeng/outlobj.hxx>
      81             : #include <basegfx/matrix/b2dhommatrix.hxx>
      82             : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      83             : #include <basegfx/tools/unotools.hxx>
      84             : #include "shapeimpl.hxx"
      85             : #include <sal/log.hxx>
      86             : 
      87             : #include <vector>
      88             : 
      89             : // #i68523#
      90             : #include "svx/lathe3d.hxx"
      91             : #include "svx/extrud3d.hxx"
      92             : 
      93             : #include <boost/bind.hpp>
      94             : #include <svtools/wmf.hxx>
      95             : 
      96             : using ::rtl::OUString;
      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       10256 : 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       10256 :     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       10256 :         ,maPropertyNotifier( _rAntiImpl, _rMutex )
     144             :     {
     145       10256 :     }
     146             : };
     147             : 
     148             : /**********************************************************************/
     149       20512 : class ShapePositionProvider : public PropertyValueProvider
     150             : {
     151             : public:
     152       10256 :     ShapePositionProvider( const SvxShapeImpl& _shapeImpl )
     153       10256 :         :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Position" )
     154             :     {
     155       10256 :     }
     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       20512 : class ShapeSizeProvider : public PropertyValueProvider
     166             : {
     167             : public:
     168       10256 :     ShapeSizeProvider( const SvxShapeImpl& _shapeImpl )
     169       10256 :         :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Size" )
     170             :     {
     171       10256 :     }
     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       10256 : SvxShape::SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet ) throw()
     202             : :   maSize(100,100)
     203       10256 : ,   mpImpl( new SvxShapeImpl( *this, maMutex ) )
     204             : ,   mbIsMultiPropertyCall(false)
     205             : ,   mpPropSet(pPropertySet)
     206             : ,   maPropMapEntries(pEntries)
     207             : ,   mpObj(pObject)
     208             : ,   mpModel(NULL)
     209       20512 : ,   mnLockCount(0)
     210             : {
     211             :     DBG_CTOR(SvxShape,NULL);
     212       10256 :     impl_construct();
     213       10256 : }
     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       20543 : SvxShape::~SvxShape() throw()
     232             : {
     233       10256 :     ::SolarMutexGuard aGuard;
     234             : 
     235             :     DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
     236             : 
     237       10256 :     if ( mpModel )
     238        8870 :         EndListening( *mpModel );
     239             : 
     240       10256 :     if ( mpImpl->mpMaster )
     241         993 :         mpImpl->mpMaster->dispose();
     242             : 
     243       10256 :     if ( mpObj.is() )
     244        8870 :         mpObj->setUnoShape(NULL);
     245             : 
     246       10256 :     if( HasSdrObjectOwnership() && mpObj.is() )
     247             :     {
     248           0 :         mpImpl->mbHasSdrObjectOwnership = false;
     249           0 :         SdrObject* pObject = mpObj.get();
     250           0 :         SdrObject::Free( pObject );
     251             :     }
     252             : 
     253       10256 :     delete mpImpl, mpImpl = NULL;
     254             : 
     255       10256 :     DBG_DTOR(SvxShape,NULL);
     256       10287 : }
     257             : 
     258             : //----------------------------------------------------------------------
     259             : 
     260           0 : void SvxShape::TakeSdrObjectOwnership()
     261             : {
     262           0 :     mpImpl->mbHasSdrObjectOwnership = true;
     263           0 : }
     264             : 
     265             : //----------------------------------------------------------------------
     266             : 
     267       11638 : bool SvxShape::HasSdrObjectOwnership() const
     268             : {
     269       11638 :     if ( !mpImpl->mbHasSdrObjectOwnership )
     270       11638 :         return false;
     271             : 
     272             :     OSL_ENSURE( mpObj.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
     273           0 :     return mpObj.is();
     274             : }
     275             : 
     276             : //----------------------------------------------------------------------
     277             : 
     278       10218 : void SvxShape::setShapeKind( sal_uInt32 nKind )
     279             : {
     280       10218 :     mpImpl->mnObjId = nKind;
     281       10218 : }
     282             : 
     283             : //----------------------------------------------------------------------
     284             : 
     285        1986 : sal_uInt32 SvxShape::getShapeKind() const
     286             : {
     287        1986 :     return mpImpl->mnObjId;
     288             : }
     289             : 
     290             : //----------------------------------------------------------------------
     291             : 
     292        1986 : void SvxShape::setMaster( SvxShapeMaster* pMaster )
     293             : {
     294        1986 :     mpImpl->mpMaster = pMaster;
     295        1986 : }
     296             : 
     297             : //----------------------------------------------------------------------
     298             : 
     299       71188 : uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType ) throw (uno::RuntimeException)
     300             : {
     301       71188 :     if( mpImpl->mpMaster )
     302             :     {
     303        6602 :         uno::Any aAny;
     304        6602 :         if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
     305           0 :             return aAny;
     306             :     }
     307             : 
     308       71188 :     return SvxShape_UnoImplHelper::queryAggregation(rType);
     309             : }
     310             : 
     311             : namespace
     312             : {
     313             :     class theSvxShapeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxShapeUnoTunnelId > {};
     314             : }
     315             : 
     316       40721 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() throw()
     317             : {
     318       40721 :     return theSvxShapeUnoTunnelId::get().getSeq();
     319             : }
     320             : 
     321             : //----------------------------------------------------------------------
     322       28591 : SvxShape* SvxShape::getImplementation( const uno::Reference< uno::XInterface >& xInt )
     323             : {
     324       28591 :     uno::Reference< lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
     325       28591 :     if( xUT.is() )
     326       18983 :         return reinterpret_cast<SvxShape*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxShape::getUnoTunnelId())));
     327             :     else
     328        9608 :         return NULL;
     329             : }
     330             : 
     331             : //----------------------------------------------------------------------
     332       20780 : sal_Int64 SAL_CALL SvxShape::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
     333             : {
     334       20780 :     if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
     335             :     {
     336       19876 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
     337             :     }
     338             :     else
     339             :     {
     340         904 :         return 0;
     341             :     }
     342             : }
     343             : 
     344             : //----------------------------------------------------------------------
     345       19590 : ::svx::PropertyChangeNotifier& SvxShape::getShapePropertyChangeNotifier()
     346             : {
     347       19590 :     return mpImpl->maPropertyNotifier;
     348             : }
     349             : 
     350             : //----------------------------------------------------------------------
     351       10256 : void SvxShape::impl_construct()
     352             : {
     353             :     mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapePosition,
     354       10256 :         ::svx::PPropertyValueProvider( new ShapePositionProvider( *mpImpl ) ) );
     355             :     mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapeSize,
     356       10256 :         ::svx::PPropertyValueProvider( new ShapeSizeProvider( *mpImpl ) ) );
     357             : 
     358       10256 :     if ( mpObj.is() )
     359        6704 :         impl_initFromSdrObject();
     360       10256 : }
     361             : 
     362             : //----------------------------------------------------------------------
     363       10253 : void SvxShape::impl_initFromSdrObject()
     364             : {
     365             :     DBG_TESTSOLARMUTEX();
     366             :     OSL_PRECOND( mpObj.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
     367       10253 :     if ( !mpObj.is() )
     368       10253 :         return;
     369             : 
     370       10253 :     osl_atomic_increment( &m_refCount );
     371             :     {
     372       10253 :         mpObj->setUnoShape(*this);
     373             :     }
     374       10253 :     osl_atomic_decrement( &m_refCount );
     375             : 
     376       10253 :     mpModel = mpObj->GetModel();
     377             : 
     378             :     // #i40944#
     379             :     // Do not simply return when no model but do the type corrections
     380             :     // following below.
     381       10253 :     if(mpModel)
     382             :     {
     383       10244 :         StartListening( *mpModel );
     384             :     }
     385             : 
     386       10253 :     const sal_uInt32 nInventor = mpObj->GetObjInventor();
     387             : 
     388             :     // is it one of ours (svx) ?
     389       10253 :     if( nInventor == SdrInventor || nInventor == E3dInventor || nInventor == FmFormInventor )
     390             :     {
     391       10253 :         if(nInventor == FmFormInventor)
     392             :         {
     393          11 :             mpImpl->mnObjId = OBJ_UNO;
     394             :         }
     395             :         else
     396             :         {
     397       10242 :             mpImpl->mnObjId = mpObj->GetObjIdentifier();
     398       10242 :             if( nInventor == E3dInventor )
     399           0 :                 mpImpl->mnObjId |= E3D_INVENTOR_FLAG;
     400             :         }
     401             : 
     402       10253 :         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        3549 : void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
     419             : {
     420             :     DBG_TESTSOLARMUTEX();
     421             : 
     422             :     OSL_PRECOND( pNewObj, "SvxShape::Create: invalid new object!" );
     423        3549 :     if ( !pNewObj )
     424        3549 :         return;
     425             : 
     426        3549 :     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        3549 :     if ( pCreatedObj != pNewObj )
     432             :     {
     433             :         DBG_ASSERT( pNewObj->GetModel(), "no model for SdrObject?" );
     434             :         // Correct condition (#i52126#)
     435        3549 :         mpImpl->mpCreatedObj = pNewObj;
     436             : 
     437        3549 :         if( mpObj.is() && mpObj->GetModel() )
     438             :         {
     439           1 :             EndListening( *mpObj->GetModel() );
     440             :         }
     441             : 
     442        3549 :         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        3549 :         impl_initFromSdrObject();
     449             : 
     450        3549 :         ObtainSettingsFromPropertySet( *mpPropSet );
     451             : 
     452             :         // save user call
     453        3549 :         SdrObjUserCall* pUser = mpObj->GetUserCall();
     454        3549 :         mpObj->SetUserCall(NULL);
     455             : 
     456        3549 :         setPosition( maPosition );
     457        3549 :         setSize( maSize );
     458             : 
     459             :         // restore user call after we set the initial size
     460        3549 :         mpObj->SetUserCall( pUser );
     461             : 
     462             :         // if this shape was already named, use this name
     463        3549 :         if( !maShapeName.isEmpty() )
     464             :         {
     465          36 :             mpObj->SetName( maShapeName );
     466          36 :             maShapeName = OUString();
     467             :         }
     468             :     }
     469             : }
     470             : 
     471             : //----------------------------------------------------------------------
     472             : 
     473           9 : void SvxShape::ChangeModel( SdrModel* pNewModel )
     474             : {
     475             :     DBG_TESTSOLARMUTEX();
     476           9 :     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           9 :     if( pNewModel )
     486             :     {
     487           9 :         StartListening( *pNewModel );
     488             :     }
     489             : 
     490             :     // HACK #i53696# ChangeModel should be virtual, but it isn't. can't change that for 2.0.1
     491           9 :     SvxShapeText* pShapeText = dynamic_cast< SvxShapeText* >( this );
     492           9 :     if( pShapeText )
     493             :     {
     494           9 :         SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( pShapeText->GetEditSource() );
     495           9 :         if( pTextEditSource )
     496           0 :             pTextEditSource->ChangeModel( pNewModel );
     497             :     }
     498             : 
     499           9 :     mpModel = pNewModel;
     500             : 
     501           9 :     if( mpImpl->mpMaster )
     502           0 :         mpImpl->mpMaster->modelChanged( pNewModel );
     503           9 : }
     504             : 
     505             : //----------------------------------------------------------------------
     506             : 
     507       10938 : void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
     508             : {
     509             :     DBG_TESTSOLARMUTEX();
     510       10938 :     if(mpModel)
     511             :     {
     512       10938 :         SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
     513       10938 :         if(eMapUnit != SFX_MAPUNIT_100TH_MM)
     514             :         {
     515         285 :             switch(eMapUnit)
     516             :             {
     517             :                 case SFX_MAPUNIT_TWIP :
     518             :                 {
     519         285 :                     rPoint.A() = MM_TO_TWIPS(rPoint.A());
     520         285 :                     rPoint.B() = MM_TO_TWIPS(rPoint.B());
     521         285 :                     break;
     522             :                 }
     523             :                 default:
     524             :                 {
     525             :                     OSL_FAIL("AW: Missing unit translation to PoolMetric!");
     526             :                 }
     527             :             }
     528             :         }
     529             :     }
     530       10938 : }
     531             : 
     532             : // Reintroduction of fix for issue i59051 (#i108851#)
     533           0 : void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
     534             : {
     535             :     DBG_TESTSOLARMUTEX();
     536           0 :     if(mpModel)
     537             :     {
     538           0 :         SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
     539           0 :         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           0 : }
     560             : 
     561             : //----------------------------------------------------------------------
     562        6153 : void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
     563             : {
     564             :     DBG_TESTSOLARMUTEX();
     565        6153 :     SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
     566        6153 :     if(mpModel)
     567             :     {
     568        6153 :         eMapUnit = mpModel->GetItemPool().GetMetric(0);
     569        6153 :         if(eMapUnit != SFX_MAPUNIT_100TH_MM)
     570             :         {
     571         130 :             switch(eMapUnit)
     572             :             {
     573             :                 case SFX_MAPUNIT_TWIP :
     574             :                 {
     575         130 :                     rPoint.A() = TWIPS_TO_MM(rPoint.A());
     576         130 :                     rPoint.B() = TWIPS_TO_MM(rPoint.B());
     577         130 :                     break;
     578             :                 }
     579             :                 default:
     580             :                 {
     581             :                     OSL_FAIL("AW: Missing unit translation to 100th mm!");
     582             :                 }
     583             :             }
     584             :         }
     585             :     }
     586        6153 : }
     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          13 : void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
     619             :   SfxItemSet& rSet, uno::Reference< beans::XPropertySet > xSet, const SfxItemPropertyMap* pMap )
     620             : {
     621          13 :     if(rPropSet.AreThereOwnUsrAnys())
     622             :     {
     623          13 :         const SfxItemPropertyMap* pSrc = rPropSet.getPropertyMap();
     624          13 :         PropertyEntryVector_t aSrcPropVector = pSrc->getPropertyEntries();
     625          13 :         PropertyEntryVector_t::const_iterator aSrcIt = aSrcPropVector.begin();
     626        2158 :         while(aSrcIt != aSrcPropVector.end())
     627             :         {
     628        2132 :             if(aSrcIt->nWID)
     629             :             {
     630        2132 :                 uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(aSrcIt->nWID);
     631        2132 :                 if(pUsrAny)
     632             :                 {
     633             :                     // Aequivalenten Eintrag in pDst suchen
     634          37 :                     const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aSrcIt->sName );
     635          37 :                     if(pEntry)
     636             :                     {
     637             :                         // entry found
     638          37 :                         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           9 :                             xSet->setPropertyValue( aSrcIt->sName, *pUsrAny);
     643             :                         }
     644             :                         else
     645             :                         {
     646          28 :                             if(rSet.GetPool()->IsWhich(pEntry->nWID))
     647          28 :                                 rSet.Put(rSet.GetPool()->GetDefaultItem(pEntry->nWID));
     648             :                             // setzen
     649          28 :                             SvxItemPropertySet_setPropertyValue(rPropSet, pEntry, *pUsrAny, rSet);
     650             :                         }
     651             :                     }
     652             :                 }
     653             :             }
     654             : 
     655             :             // next entry
     656        2132 :             ++aSrcIt;
     657             :         }
     658          13 :         const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny();
     659             :     }
     660          13 : }
     661             : 
     662             : 
     663        3549 : void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
     664             : {
     665             :     DBG_TESTSOLARMUTEX();
     666        3549 :     if(mpObj.is() && rPropSet.AreThereOwnUsrAnys() && mpModel)
     667             :     {
     668          13 :         SfxItemSet aSet( mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END);
     669          13 :         Reference< beans::XPropertySet > xShape( (OWeakObject*)this, UNO_QUERY );
     670          13 :         SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, mpPropSet->getPropertyMap() );
     671             : 
     672          13 :         mpObj->SetMergedItemSetAndBroadcast(aSet);
     673             : 
     674          13 :         mpObj->ApplyNotPersistAttr( aSet );
     675             :     }
     676        3549 : }
     677             : 
     678             : //----------------------------------------------------------------------
     679             : 
     680          13 : uno::Any SvxShape::GetBitmap( sal_Bool bMetaFile /* = sal_False */ ) const throw()
     681             : {
     682             :     DBG_TESTSOLARMUTEX();
     683          13 :     uno::Any aAny;
     684             : 
     685          13 :     if( !mpObj.is() || mpModel == NULL || !mpObj->IsInserted() || NULL == mpObj->GetPage() )
     686             :         return aAny;
     687             : 
     688          13 :     VirtualDevice aVDev;
     689          13 :     aVDev.SetMapMode(MapMode(MAP_100TH_MM));
     690             : 
     691          13 :     SdrModel* pModel = mpObj->GetModel();
     692          13 :     SdrPage* pPage = mpObj->GetPage();
     693             : 
     694          13 :     E3dView* pView = new E3dView( pModel, &aVDev );
     695          13 :     pView->hideMarkHandles();
     696          13 :     SdrPageView* pPageView = pView->ShowSdrPage(pPage);
     697             : 
     698          13 :     SdrObject *pTempObj = mpObj.get();
     699          13 :     pView->MarkObj(pTempObj,pPageView);
     700             : 
     701          13 :     Rectangle aRect(pTempObj->GetCurrentBoundRect());
     702          13 :     aRect.Justify();
     703          13 :     Size aSize(aRect.GetSize());
     704             : 
     705          13 :     GDIMetaFile aMtf( pView->GetMarkedObjMetaFile() );
     706          13 :     if( bMetaFile )
     707             :     {
     708           0 :         SvMemoryStream aDestStrm( 65535, 65535 );
     709           0 :         ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_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          13 :         Graphic aGraph(aMtf);
     718          13 :         aGraph.SetPrefSize(aSize);
     719          13 :         aGraph.SetPrefMapMode(MAP_100TH_MM);
     720             : 
     721          13 :         Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
     722          13 :         aAny <<= xBmp;
     723             :     }
     724             : 
     725          13 :     pView->UnmarkAll();
     726          13 :     delete pView;
     727             : 
     728          13 :     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           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
    1028             :     throw (uno::RuntimeException)
    1029             : {
    1030             :     static ::cppu::OImplementationId* pID = NULL ;
    1031             : 
    1032           0 :     if ( pID == NULL )
    1033             :     {
    1034             :         // Ready for multithreading; get global mutex for first call of this method only! see before
    1035           0 :         MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
    1036             : 
    1037             :         // Control these pointer again ... it can be, that another instance will be faster then these!
    1038           0 :         if ( pID == NULL )
    1039             :         {
    1040             :             // Create a new static ID ...
    1041           0 :             static ::cppu::OImplementationId aID( sal_False ) ;
    1042             :             // ... and set his address to static pointer!
    1043           0 :             pID = &aID ;
    1044           0 :         }
    1045             :     }
    1046             : 
    1047           0 :     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       79077 : void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
    1062             : {
    1063             :     DBG_TESTSOLARMUTEX();
    1064       79077 :     if( !mpObj.is() )
    1065             :         return;
    1066             : 
    1067             :     // #i55919# HINT_OBJCHG is only interesting if it's for this object
    1068             : 
    1069       77601 :     const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
    1070      245795 :     if (!pSdrHint || ( /* (pSdrHint->GetKind() != HINT_OBJREMOVED)  && */
    1071       77601 :         (pSdrHint->GetKind() != HINT_MODELCLEARED) &&
    1072             :         // #110094#-9 (pSdrHint->GetKind() != HINT_OBJLISTCLEAR) &&
    1073       90593 :         ((pSdrHint->GetKind() != HINT_OBJCHG || pSdrHint->GetObject() != mpObj.get() ))))
    1074             :         return;
    1075             : 
    1076        1704 :     uno::Reference< uno::XInterface > xSelf( mpObj->getWeakUnoShape() );
    1077        1704 :     if( !xSelf.is() )
    1078             :     {
    1079           0 :         mpObj.reset( NULL );
    1080             :         return;
    1081             :     }
    1082             : 
    1083        1704 :     sal_Bool bClearMe = sal_False;
    1084             : 
    1085        1704 :     switch( pSdrHint->GetKind() )
    1086             :     {
    1087             :         case HINT_OBJCHG:
    1088             :         {
    1089         966 :             updateShapeKind();
    1090         966 :             break;
    1091             :         }
    1092             :         case HINT_MODELCLEARED:
    1093             :         {
    1094         738 :             bClearMe = sal_True;
    1095         738 :             mpModel = NULL;
    1096         738 :             break;
    1097             :         }
    1098             :         default:
    1099           0 :             break;
    1100             :     };
    1101             : 
    1102        1704 :     if( bClearMe )
    1103             :     {
    1104         738 :         if( !HasSdrObjectOwnership() ) {
    1105         738 :             if( mpObj.is() )
    1106         738 :                 mpObj->setUnoShape( NULL );
    1107         738 :             mpObj.reset( NULL );
    1108             :         }
    1109         738 :         if ( !mpImpl->mbDisposing )
    1110         738 :             dispose();
    1111        1704 :     }
    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       22321 : static sal_Bool svx_needLogicRectHack( SdrObject* pObj )
    1123             : {
    1124       22321 :     if( pObj->GetObjInventor() == SdrInventor)
    1125             :     {
    1126       22315 :         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        8620 :             return sal_True;
    1143             :         }
    1144             :     }
    1145       13701 :     return sal_False;
    1146             : }
    1147             : 
    1148             : //----------------------------------------------------------------------
    1149             : 
    1150       17004 : static Rectangle svx_getLogicRectHack( SdrObject* pObj )
    1151             : {
    1152       17004 :     if(svx_needLogicRectHack(pObj))
    1153             :     {
    1154        5538 :         return pObj->GetSnapRect();
    1155             :     }
    1156             :     else
    1157             :     {
    1158       11466 :         return pObj->GetLogicRect();
    1159             :     }
    1160             : }
    1161             : 
    1162             : //----------------------------------------------------------------------
    1163             : 
    1164        5317 : static void svx_setLogicRectHack( SdrObject* pObj, const Rectangle& rRect )
    1165             : {
    1166        5317 :     if(svx_needLogicRectHack(pObj))
    1167             :     {
    1168        3082 :         pObj->SetSnapRect( rRect );
    1169             :     }
    1170             :     else
    1171             :     {
    1172        2235 :         pObj->SetLogicRect( rRect );
    1173             :     }
    1174        5317 : }
    1175             : 
    1176             : //----------------------------------------------------------------------
    1177             : 
    1178        5993 : awt::Point SAL_CALL SvxShape::getPosition() throw(uno::RuntimeException)
    1179             : {
    1180        5993 :     ::SolarMutexGuard aGuard;
    1181             : 
    1182        5993 :     if( mpObj.is() && mpModel)
    1183             :     {
    1184        2570 :         Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
    1185        2570 :         Point aPt( aRect.Left(), aRect.Top() );
    1186             : 
    1187             :         // Position is relativ to anchor, so recalc to absolut position
    1188        2570 :         if( mpModel->IsWriter() )
    1189          53 :             aPt -= mpObj->GetAnchorPos();
    1190             : 
    1191        2570 :         ForceMetricTo100th_mm(aPt);
    1192        2570 :         return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
    1193             :     }
    1194             :     else
    1195             :     {
    1196        3423 :         return maPosition;
    1197        5993 :     }
    1198             : }
    1199             : 
    1200             : //----------------------------------------------------------------------
    1201        5675 : void SAL_CALL SvxShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
    1202             : {
    1203        5675 :     ::SolarMutexGuard aGuard;
    1204             : 
    1205        5675 :     if( mpObj.is() && mpModel )
    1206             :     {
    1207             :         // do NOT move 3D objects, this would change the homogen
    1208             :         // transformation matrix
    1209        5620 :         if(!mpObj->ISA(E3dCompoundObject))
    1210             :         {
    1211        5620 :             Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
    1212        5620 :             Point aLocalPos( Position.X, Position.Y );
    1213        5620 :             ForceMetricToItemPoolMetric(aLocalPos);
    1214             : 
    1215             :             // Position ist absolut, relativ zum Anker stellen
    1216        5620 :             if( mpModel->IsWriter() )
    1217         171 :                 aLocalPos += mpObj->GetAnchorPos();
    1218             : 
    1219        5620 :             long nDX = aLocalPos.X() - aRect.Left();
    1220        5620 :             long nDY = aLocalPos.Y() - aRect.Top();
    1221             : 
    1222        5620 :             mpObj->Move( Size( nDX, nDY ) );
    1223        5620 :             mpModel->SetChanged();
    1224             :         }
    1225             :     }
    1226             : 
    1227        5675 :     maPosition = Position;
    1228        5675 : }
    1229             : 
    1230             : //----------------------------------------------------------------------
    1231        6990 : awt::Size SAL_CALL SvxShape::getSize() throw(uno::RuntimeException)
    1232             : {
    1233        6990 :     ::SolarMutexGuard aGuard;
    1234             : 
    1235        6990 :     if( mpObj.is() && mpModel)
    1236             :     {
    1237        3497 :         Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
    1238        3497 :         Size aObjSize( aRect.getWidth(), aRect.getHeight() );
    1239        3497 :         ForceMetricTo100th_mm(aObjSize);
    1240        3497 :         return ::com::sun::star::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
    1241             :     }
    1242             :     else
    1243        3493 :         return maSize;
    1244             : }
    1245             : 
    1246             : //----------------------------------------------------------------------
    1247        5372 : void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
    1248             :     throw(beans::PropertyVetoException, uno::RuntimeException)
    1249             : {
    1250        5372 :     ::SolarMutexGuard aGuard;
    1251             : 
    1252        5372 :     if( mpObj.is() && mpModel)
    1253             :     {
    1254        5317 :         Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
    1255        5317 :         Size aLocalSize( rSize.Width, rSize.Height );
    1256        5317 :         ForceMetricToItemPoolMetric(aLocalSize);
    1257             : 
    1258        5317 :         if(mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_MEASURE )
    1259             :         {
    1260           0 :             Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
    1261           0 :             Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
    1262           0 :             Point aPt = mpObj->GetSnapRect().TopLeft();
    1263           0 :             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        5317 :             if ( !aLocalSize.Width() )
    1269             :             {
    1270        1160 :                 aRect.Right() = RECT_EMPTY;
    1271             :             }
    1272             :             else
    1273        4157 :                 aRect.setWidth(aLocalSize.Width());
    1274        5317 :             if ( !aLocalSize.Height() )
    1275             :             {
    1276        1159 :                 aRect.Bottom() = RECT_EMPTY;
    1277             :             }
    1278             :             else
    1279        4158 :                 aRect.setHeight(aLocalSize.Height());
    1280             : 
    1281        5317 :             svx_setLogicRectHack( mpObj.get(), aRect );
    1282             :         }
    1283             : 
    1284        5317 :         mpModel->SetChanged();
    1285             :     }
    1286        5372 :     maSize = rSize;
    1287        5372 : }
    1288             : 
    1289             : //----------------------------------------------------------------------
    1290             : 
    1291             : // XNamed
    1292           0 : OUString SAL_CALL SvxShape::getName(  ) throw(::com::sun::star::uno::RuntimeException)
    1293             : {
    1294           0 :     ::SolarMutexGuard aGuard;
    1295           0 :     if( mpObj.is() )
    1296             :     {
    1297           0 :         return mpObj->GetName();
    1298             :     }
    1299             :     else
    1300             :     {
    1301           0 :         return maShapeName;
    1302           0 :     }
    1303             : }
    1304             : 
    1305             : //----------------------------------------------------------------------
    1306             : 
    1307          36 : void SAL_CALL SvxShape::setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException)
    1308             : {
    1309          36 :     ::SolarMutexGuard aGuard;
    1310          36 :     if( mpObj.is() )
    1311             :     {
    1312           0 :         mpObj->SetName( aName );
    1313             :     }
    1314             :     else
    1315             :     {
    1316          36 :         maShapeName = aName;
    1317          36 :     }
    1318          36 : }
    1319             : 
    1320             : // XShapeDescriptor
    1321             : 
    1322             : //----------------------------------------------------------------------
    1323        7222 : OUString SAL_CALL SvxShape::getShapeType() throw(uno::RuntimeException)
    1324             : {
    1325        7222 :     if( !maShapeType.getLength() )
    1326        7158 :         return UHashMap::getNameFromId( mpImpl->mnObjId );
    1327             :     else
    1328          64 :         return maShapeType;
    1329             : }
    1330             : 
    1331             : // XComponent
    1332             : 
    1333             : //----------------------------------------------------------------------
    1334        1404 : void SAL_CALL SvxShape::dispose() throw(uno::RuntimeException)
    1335             : {
    1336        1404 :     ::SolarMutexGuard aGuard;
    1337             : 
    1338        1404 :     if( mpImpl->mbDisposing )
    1339        1404 :         return; // caught a recursion
    1340             : 
    1341        1382 :     mpImpl->mbDisposing = true;
    1342             : 
    1343        1382 :     lang::EventObject aEvt;
    1344        1382 :     aEvt.Source = *(OWeakAggObject*) this;
    1345        1382 :     mpImpl->maDisposeListeners.disposeAndClear(aEvt);
    1346        1382 :     mpImpl->maPropertyNotifier.disposing();
    1347             : 
    1348        1382 :     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        1382 :     if( mpModel )
    1385             :     {
    1386         644 :         EndListening( *mpModel );
    1387         644 :         mpModel = NULL;
    1388        1382 :     }
    1389             : }
    1390             : 
    1391             : //----------------------------------------------------------------------
    1392             : 
    1393           0 : void SAL_CALL SvxShape::addEventListener( const Reference< lang::XEventListener >& xListener )
    1394             :     throw(uno::RuntimeException)
    1395             : {
    1396           0 :     mpImpl->maDisposeListeners.addInterface(xListener);
    1397           0 : }
    1398             : 
    1399             : //----------------------------------------------------------------------
    1400             : 
    1401           0 : void SAL_CALL SvxShape::removeEventListener( const Reference< lang::XEventListener >& aListener ) throw(uno::RuntimeException)
    1402             : {
    1403           0 :    mpImpl->maDisposeListeners.removeInterface(aListener);
    1404           0 : }
    1405             : 
    1406             : // XPropertySet
    1407             : 
    1408             : //----------------------------------------------------------------------
    1409             : 
    1410             : Reference< beans::XPropertySetInfo > SAL_CALL
    1411         889 :     SvxShape::getPropertySetInfo() throw(uno::RuntimeException)
    1412             : {
    1413         889 :     if( mpImpl->mpMaster )
    1414             :     {
    1415         781 :         return mpImpl->mpMaster->getPropertySetInfo();
    1416             :     }
    1417             :     else
    1418             :     {
    1419         108 :         return _getPropertySetInfo();
    1420             :     }
    1421             : }
    1422             : 
    1423             : Reference< beans::XPropertySetInfo > SAL_CALL
    1424         121 :     SvxShape::_getPropertySetInfo() throw(uno::RuntimeException)
    1425             : {
    1426         121 :     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          19 : sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName )
    1462             : {
    1463          19 :     SfxItemSet aSet( mpModel->GetItemPool(),    (sal_uInt16)nWID, (sal_uInt16)nWID );
    1464             : 
    1465          19 :     if( SetFillAttribute( nWID, rName, aSet, mpModel ) )
    1466             :     {
    1467             :         //mpObj->SetItemSetAndBroadcast(aSet);
    1468          19 :         mpObj->SetMergedItemSetAndBroadcast(aSet);
    1469             : 
    1470          19 :         return sal_True;
    1471             :     }
    1472             :     else
    1473             :     {
    1474           0 :         return sal_False;
    1475          19 :     }
    1476             : }
    1477             : 
    1478             : //----------------------------------------------------------------------
    1479             : 
    1480          19 : sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::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          19 :     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           0 :         OUString aStrName = SvxUnogetInternalNameForItem((sal_Int16)nWID, rName);
    1490             : 
    1491           0 :         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->Get(aStrName);
    1501           0 :             if( nPos == -1 )
    1502           0 :                 return sal_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.SetBitmapValue( pEntry->GetXBitmap() );
    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->Get(aStrName);
    1520           0 :             if( nPos == -1 )
    1521           0 :                 return sal_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->Get(aStrName);
    1539           0 :             if( nPos == -1 )
    1540           0 :                 return sal_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->Get(aStrName);
    1559           0 :             if( nPos == -1 )
    1560           0 :                 return sal_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           0 :             XDashListRef pDashList = pModel->GetDashList();
    1585             : 
    1586           0 :             if( !pDashList.is() )
    1587           0 :                 return sal_False;
    1588             : 
    1589           0 :             long nPos = pDashList->Get(aStrName);
    1590           0 :             if( nPos == -1 )
    1591           0 :                 return sal_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          19 :     return sal_True;
    1607             : }
    1608             : 
    1609             : //----------------------------------------------------------------------
    1610             : 
    1611          26 : sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, SfxItemSet& rSet )
    1612             : {
    1613          26 :     OUString aName = SvxUnogetInternalNameForItem((sal_Int16)nWID, rName);
    1614             : 
    1615          26 :     if (aName.isEmpty())
    1616             :     {
    1617           0 :         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           0 :                 rSet.Put(XFillFloatTransparenceItem());
    1635             : 
    1636           0 :                 return sal_True;
    1637             :             }
    1638             :         }
    1639             : 
    1640           0 :         return sal_False;
    1641             :     }
    1642             : 
    1643          26 :     const SfxItemPool* pPool = rSet.GetPool();
    1644             : 
    1645          26 :     const String aSearchName( aName );
    1646          26 :     const sal_uInt32 nCount = pPool->GetItemCount2((sal_uInt16)nWID);
    1647             :     const NameOrIndex* pItem;
    1648             : 
    1649          67 :     for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1650             :     {
    1651          67 :         pItem = (NameOrIndex*)pPool->GetItem2((sal_uInt16)nWID, nSurrogate);
    1652          67 :         if( pItem && ( pItem->GetName() == aSearchName ) )
    1653             :         {
    1654          26 :             rSet.Put( *pItem );
    1655          26 :             return sal_True;
    1656             :         }
    1657             :     }
    1658             : 
    1659           0 :     return sal_False;
    1660             : }
    1661             : 
    1662             : //----------------------------------------------------------------------
    1663             : 
    1664       63372 : 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       63372 :     if( mpImpl->mpMaster )
    1668             :     {
    1669        1522 :         mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
    1670             :     }
    1671             :     else
    1672             :     {
    1673       61850 :         _setPropertyValue( rPropertyName, rVal );
    1674             :     }
    1675       63356 : }
    1676             : 
    1677       63230 : 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       63230 :     ::SolarMutexGuard aGuard;
    1681             : 
    1682       63230 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
    1683             : 
    1684       63230 :     if( mpObj.is() && mpModel )
    1685             :     {
    1686       63186 :         if( pMap == NULL )
    1687          16 :             throw beans::UnknownPropertyException();
    1688             : 
    1689       63170 :         if( (pMap->nFlags & beans::PropertyAttribute::READONLY ) != 0 )
    1690             :             throw beans::PropertyVetoException(
    1691             :                 ( rtl::OUString(
    1692             :                     RTL_CONSTASCII_USTRINGPARAM(
    1693             :                         "Readonly property can't be set: " ) )
    1694           0 :                   + rPropertyName ),
    1695           0 :                 uno::Reference< drawing::XShape >( this ) );
    1696             : 
    1697       63170 :         mpModel->SetChanged();
    1698             : 
    1699       63170 :         if(!setPropertyValueImpl( rPropertyName, pMap, rVal ) )
    1700             :         {
    1701             :             DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
    1702             :             DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
    1703             : 
    1704       57975 :             sal_Bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
    1705             : 
    1706       57975 :             if( pMap->nWID == SDRATTR_ECKENRADIUS )
    1707             :             {
    1708           1 :                 sal_Int32 nCornerRadius = 0;
    1709           1 :                 if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
    1710           0 :                     throw IllegalArgumentException();
    1711             :             }
    1712             : 
    1713             :             SfxItemSet* pSet;
    1714       57975 :             if( mbIsMultiPropertyCall && !bIsNotPersist )
    1715             :             {
    1716      112804 :                 if( mpImpl->mpItemSet == NULL )
    1717             :                 {
    1718        1891 :                     pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone();
    1719             :                 }
    1720             :                 else
    1721             :                 {
    1722       54511 :                     pSet = mpImpl->mpItemSet;
    1723             :                 }
    1724             :             }
    1725             :             else
    1726             :             {
    1727        1573 :                 pSet = new SfxItemSet( mpModel->GetItemPool(),  pMap->nWID, pMap->nWID);
    1728             :             }
    1729             : 
    1730       57975 :             if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
    1731       42260 :                 pSet->Put(mpObj->GetMergedItem(pMap->nWID));
    1732             : 
    1733       57975 :             if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, rVal, *pSet ))
    1734             :             {
    1735       57975 :                 if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
    1736             :                 {
    1737           0 :                     if(bIsNotPersist)
    1738             :                     {
    1739             :                         // Not-Persistant Attribute, hole diese extra
    1740           0 :                         mpObj->TakeNotPersistAttr(*pSet, sal_False);
    1741             :                     }
    1742             :                 }
    1743             : 
    1744       57975 :                 if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
    1745             :                 {
    1746             :                     // Default aus ItemPool holen
    1747           0 :                     if(mpModel->GetItemPool().IsWhich(pMap->nWID))
    1748           0 :                         pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
    1749             :                 }
    1750             : 
    1751       57975 :                 if( pSet->GetItemState( pMap->nWID ) == SFX_ITEM_SET )
    1752             :                 {
    1753       57975 :                     SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rVal, *pSet );
    1754             :                 }
    1755             :             }
    1756             : 
    1757       57975 :             if(bIsNotPersist)
    1758             :             {
    1759             :                 // Not-Persist Attribute extra setzen
    1760           0 :                 mpObj->ApplyNotPersistAttr( *pSet );
    1761           0 :                 delete pSet;
    1762             :             }
    1763             :             else
    1764             :             {
    1765             :                 // if we have a XMultiProperty call then the item set
    1766             :                 // will be set in setPropertyValues later
    1767       57975 :                 if( !mbIsMultiPropertyCall )
    1768             :                 {
    1769        1573 :                     mpObj->SetMergedItemSetAndBroadcast( *pSet );
    1770             : 
    1771        1573 :                     delete pSet;
    1772             :                 }
    1773             :             }
    1774       63214 :             return;
    1775             :         }
    1776             :     }
    1777             :     else
    1778             :     {
    1779             :         // since we have no actual sdr object right now
    1780             :         // remember all properties in a list. These
    1781             :         // properties will be set when the sdr object is
    1782             :         // created
    1783             : 
    1784          44 :         if(pMap && pMap->nWID)
    1785             : // Fixme: We should throw a UnknownPropertyException here.
    1786             : //        But since this class is aggregated from classes
    1787             : //        that support additional properties that we don't
    1788             : //        know here we silently store *all* properties, even
    1789             : //        if they may be not supported after creation
    1790          44 :             mpPropSet->setPropertyValue( pMap, rVal );
    1791       63230 :     }
    1792             : }
    1793             : 
    1794             : //----------------------------------------------------------------------
    1795             : 
    1796        6071 : uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
    1797             :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1798             : {
    1799        6071 :     if ( mpImpl->mpMaster )
    1800        5699 :         return mpImpl->mpMaster->getPropertyValue( PropertyName );
    1801             :     else
    1802         372 :         return _getPropertyValue( PropertyName );
    1803             : }
    1804             : 
    1805             : //----------------------------------------------------------------------
    1806             : 
    1807        5994 : uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
    1808             :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1809             : {
    1810        5994 :     ::SolarMutexGuard aGuard;
    1811             : 
    1812        5994 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
    1813             : 
    1814        5994 :     uno::Any aAny;
    1815        5994 :     if( mpObj.is() && mpModel )
    1816             :     {
    1817        5994 :         if(pMap == NULL )
    1818           1 :             throw beans::UnknownPropertyException();
    1819             : 
    1820        5993 :         if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
    1821             :         {
    1822             :             DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
    1823             :             DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
    1824             : 
    1825        4800 :             SfxItemSet aSet( mpModel->GetItemPool(),    pMap->nWID, pMap->nWID);
    1826        4800 :             aSet.Put(mpObj->GetMergedItem(pMap->nWID));
    1827             : 
    1828        4800 :             if(SvxUnoTextRangeBase::GetPropertyValueHelper(  aSet, pMap, aAny ))
    1829             :                 return aAny;
    1830             : 
    1831        4800 :             if(!aSet.Count())
    1832             :             {
    1833           0 :                 if(pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST)
    1834             :                 {
    1835             :                     // Not-Persistant Attribute, hole diese extra
    1836           0 :                     mpObj->TakeNotPersistAttr(aSet, sal_False);
    1837             :                 }
    1838             :             }
    1839             : 
    1840        4800 :             if(!aSet.Count())
    1841             :             {
    1842             :                 // Default aus ItemPool holen
    1843           0 :                 if(mpModel->GetItemPool().IsWhich(pMap->nWID))
    1844           0 :                     aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
    1845             :             }
    1846             : 
    1847        4800 :             if(aSet.Count())
    1848        4800 :                 aAny = GetAnyForItem( aSet, pMap );
    1849             :         }
    1850             :     }
    1851             :     else
    1852             :     {
    1853             : 
    1854             : // Fixme: we should return default values for OWN_ATTR !
    1855             : 
    1856           0 :         if(pMap && pMap->nWID)
    1857             : //      FixMe: see setPropertyValue
    1858           0 :             aAny = mpPropSet->getPropertyValue( pMap );
    1859             : 
    1860             :     }
    1861        5994 :     return aAny;
    1862             : }
    1863             : 
    1864             : //----------------------------------------------------------------------
    1865             : 
    1866             : // XMultiPropertySet
    1867        1904 : void SAL_CALL SvxShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    1868             : {
    1869        1904 :     ::SolarMutexGuard aSolarGuard;
    1870             : 
    1871        1904 :     const sal_Int32 nCount = aPropertyNames.getLength();
    1872        1904 :     const OUString* pNames = aPropertyNames.getConstArray();
    1873             : 
    1874        1904 :     const uno::Any* pValues = aValues.getConstArray();
    1875             : 
    1876             :     // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
    1877             :     // reseted even when an execption is thrown
    1878        1904 :     const ::comphelper::ScopeGuard aGuard( boost::bind( &SvxShape::endSetPropertyValues, this ) );
    1879             : 
    1880        1904 :     mbIsMultiPropertyCall = sal_True;
    1881             : 
    1882        1904 :     if( mpImpl->mpMaster )
    1883             :     {
    1884        1219 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
    1885             :         {
    1886             :             try
    1887             :             {
    1888         991 :                 setPropertyValue( *pNames, *pValues );
    1889             :             }
    1890          16 :             catch( beans::UnknownPropertyException& e )
    1891             :             {
    1892             :                 (void)e;
    1893             :             }
    1894           0 :             catch( uno::Exception& ex )
    1895             :             {
    1896             :                 (void)ex;
    1897             :             }
    1898             :         }
    1899             :     }
    1900             :     else
    1901             :     {
    1902        1676 :         uno::Reference< beans::XPropertySet > xSet;
    1903        1676 :         queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
    1904             : 
    1905       58015 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
    1906             :         {
    1907             :             try
    1908             :             {
    1909       56339 :                 xSet->setPropertyValue( *pNames, *pValues );
    1910             :             }
    1911           0 :             catch( beans::UnknownPropertyException& e )
    1912             :             {
    1913             :                 (void)e;
    1914             :             }
    1915           0 :             catch( uno::Exception& ex )
    1916             :             {
    1917             :                 (void)ex;
    1918             :             }
    1919        1676 :         }
    1920             :     }
    1921             : 
    1922        1904 :     if( mpImpl->mpItemSet && mpObj.is() )
    1923        1891 :         mpObj->SetMergedItemSetAndBroadcast( *mpImpl->mpItemSet );
    1924        1904 : }
    1925             : 
    1926             : //----------------------------------------------------------------------
    1927             : 
    1928        1904 : void SvxShape::endSetPropertyValues()
    1929             : {
    1930        1904 :     mbIsMultiPropertyCall = sal_False;
    1931        1904 :     if( mpImpl->mpItemSet )
    1932             :     {
    1933        1891 :         delete mpImpl->mpItemSet;
    1934        1891 :         mpImpl->mpItemSet = 0;
    1935             :     }
    1936        1904 : }
    1937             : 
    1938             : //----------------------------------------------------------------------
    1939             : 
    1940           0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL SvxShape::getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException)
    1941             : {
    1942           0 :     const sal_Int32 nCount = aPropertyNames.getLength();
    1943           0 :     const OUString* pNames = aPropertyNames.getConstArray();
    1944             : 
    1945           0 :     uno::Sequence< uno::Any > aRet( nCount );
    1946           0 :     uno::Any* pValue = aRet.getArray();;
    1947             : 
    1948           0 :     if( mpImpl->mpMaster )
    1949             :     {
    1950           0 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
    1951             :         {
    1952             :             try
    1953             :             {
    1954           0 :                 *pValue = getPropertyValue( *pNames );
    1955             :             }
    1956           0 :             catch( uno::Exception& )
    1957             :             {
    1958             :                 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
    1959             :             }
    1960             :         }
    1961             :     }
    1962             :     else
    1963             :     {
    1964           0 :         uno::Reference< beans::XPropertySet > xSet;
    1965           0 :         queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
    1966             : 
    1967           0 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
    1968             :         {
    1969             :             try
    1970             :             {
    1971           0 :                 *pValue = xSet->getPropertyValue( *pNames );
    1972             :             }
    1973           0 :             catch( uno::Exception& )
    1974             :             {
    1975             :                 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
    1976             :             }
    1977           0 :         }
    1978             :     }
    1979             : 
    1980           0 :     return aRet;
    1981             : }
    1982             : 
    1983           0 : void SAL_CALL SvxShape::addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >&  ) throw (::com::sun::star::uno::RuntimeException)
    1984             : {
    1985           0 : }
    1986             : 
    1987           0 : void SAL_CALL SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >&  ) throw (::com::sun::star::uno::RuntimeException)
    1988             : {
    1989           0 : }
    1990             : 
    1991           0 : void SAL_CALL SvxShape::firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >&  ) throw (::com::sun::star::uno::RuntimeException)
    1992             : {
    1993           0 : }
    1994             : 
    1995             : //----------------------------------------------------------------------
    1996             : 
    1997        4800 : uno::Any SvxShape::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap ) const
    1998             : {
    1999             :     DBG_TESTSOLARMUTEX();
    2000        4800 :     uno::Any aAny;
    2001             : 
    2002        4800 :     switch(pMap->nWID)
    2003             :     {
    2004             :     case SDRATTR_CIRCSTARTANGLE:
    2005             :     {
    2006           0 :         const SfxPoolItem* pPoolItem=NULL;
    2007           0 :         if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
    2008             :         {
    2009           0 :             sal_Int32 nAngle = ((SdrCircStartAngleItem*)pPoolItem)->GetValue();
    2010           0 :             aAny <<= nAngle;
    2011             :         }
    2012             :         break;
    2013             :     }
    2014             : 
    2015             :     case SDRATTR_CIRCENDANGLE:
    2016             :     {
    2017           0 :         const SfxPoolItem* pPoolItem=NULL;
    2018           0 :         if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
    2019             :         {
    2020           0 :             sal_Int32 nAngle = ((SdrCircEndAngleItem*)pPoolItem)->GetValue();
    2021           0 :             aAny <<= nAngle;
    2022             :         }
    2023             :         break;
    2024             :     }
    2025             : 
    2026             :     case SDRATTR_CIRCKIND:
    2027             :     {
    2028           0 :         if( mpObj->GetObjInventor() == SdrInventor)
    2029             :         {
    2030             :             drawing::CircleKind eKind;
    2031           0 :             switch(mpObj->GetObjIdentifier())
    2032             :             {
    2033             :             case OBJ_CIRC:          // Kreis, Ellipse
    2034           0 :                 eKind = drawing::CircleKind_FULL;
    2035           0 :                 break;
    2036             :             case OBJ_CCUT:          // Kreisabschnitt
    2037           0 :                 eKind = drawing::CircleKind_CUT;
    2038           0 :                 break;
    2039             :             case OBJ_CARC:          // Kreisbogen
    2040           0 :                 eKind = drawing::CircleKind_ARC;
    2041           0 :                 break;
    2042             :             case OBJ_SECT:          // Kreissektor
    2043           0 :                 eKind = drawing::CircleKind_SECTION;
    2044           0 :                 break;
    2045             :             }
    2046           0 :             aAny <<= eKind;
    2047             :         }
    2048           0 :         break;
    2049             :     }
    2050             :     default:
    2051             :     {
    2052             :         // Hole Wert aus ItemSet
    2053        4800 :         aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pMap, aSet );
    2054             : 
    2055        4800 :         if( *pMap->pType != aAny.getValueType() )
    2056             :         {
    2057             :             // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
    2058         321 :             if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
    2059             :             {
    2060         321 :                 sal_Int32 nValue = 0;
    2061         321 :                 aAny >>= nValue;
    2062         321 :                 aAny <<= (sal_Int16)nValue;
    2063             :             }
    2064             :             else
    2065             :             {
    2066             :                 OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
    2067             :             }
    2068             :         }
    2069             : 
    2070             :     }
    2071             :     }
    2072             : 
    2073        4800 :     return aAny;
    2074             : }
    2075             : 
    2076             : //----------------------------------------------------------------------
    2077             : 
    2078             : // XPropertyState
    2079           1 : beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
    2080             :     throw(beans::UnknownPropertyException, uno::RuntimeException)
    2081             : {
    2082           1 :     if( mpImpl->mpMaster )
    2083             :     {
    2084           0 :         return mpImpl->mpMaster->getPropertyState( PropertyName );
    2085             :     }
    2086             :     else
    2087             :     {
    2088           1 :         return _getPropertyState( PropertyName );
    2089             :     }
    2090             : }
    2091             : 
    2092           1 : beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& PropertyName )
    2093             :     throw(beans::UnknownPropertyException, uno::RuntimeException)
    2094             : {
    2095           1 :     ::SolarMutexGuard aGuard;
    2096             : 
    2097           1 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
    2098             : 
    2099           1 :     if( !mpObj.is() || pMap == NULL )
    2100           0 :         throw beans::UnknownPropertyException();
    2101             : 
    2102             :     beans::PropertyState eState;
    2103           1 :     if( !getPropertyStateImpl( pMap, eState ) )
    2104             :     {
    2105           1 :         const SfxItemSet& rSet = mpObj->GetMergedItemSet();
    2106             : 
    2107           1 :         switch( rSet.GetItemState( pMap->nWID, sal_False ) )
    2108             :         {
    2109             :         case SFX_ITEM_READONLY:
    2110             :         case SFX_ITEM_SET:
    2111           0 :             eState = beans::PropertyState_DIRECT_VALUE;
    2112           0 :             break;
    2113             :         case SFX_ITEM_DEFAULT:
    2114           1 :             eState = beans::PropertyState_DEFAULT_VALUE;
    2115           1 :             break;
    2116             :         default:
    2117           0 :             eState = beans::PropertyState_AMBIGUOUS_VALUE;
    2118           0 :             break;
    2119             :         }
    2120             : 
    2121             :         // if a item is set, this doesn't mean we want it :)
    2122           1 :         if( ( beans::PropertyState_DIRECT_VALUE == eState ) )
    2123             :         {
    2124           0 :             switch( pMap->nWID )
    2125             :             {
    2126             :             // the following items are disabled by changing the
    2127             :             // fill style or the line style. so there is no need
    2128             :             // to export items without names which should be empty
    2129             :             case XATTR_FILLBITMAP:
    2130             :             case XATTR_FILLGRADIENT:
    2131             :             case XATTR_FILLHATCH:
    2132             :             case XATTR_LINEDASH:
    2133             :                 {
    2134           0 :                     NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
    2135           0 :                     if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
    2136           0 :                         eState = beans::PropertyState_DEFAULT_VALUE;
    2137             :                 }
    2138           0 :                 break;
    2139             : 
    2140             :             // #i36115#
    2141             :             // If e.g. the LineStart is on NONE and thus the string has length 0, it still
    2142             :             // may be a hard attribute covering the set LineStart of the parent (Style).
    2143             :             // #i37644#
    2144             :             // same is for fill float transparency
    2145             :             case XATTR_LINEEND:
    2146             :             case XATTR_LINESTART:
    2147             :             case XATTR_FILLFLOATTRANSPARENCE:
    2148             :                 {
    2149           0 :                     NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
    2150           0 :                     if ( pItem == NULL )
    2151           0 :                         eState = beans::PropertyState_DEFAULT_VALUE;
    2152             :                 }
    2153           0 :                 break;
    2154             :             }
    2155             :         }
    2156             :     }
    2157           1 :     return eState;
    2158             : }
    2159             : 
    2160             : //----------------------------------------------------------------------
    2161             : 
    2162       62340 : bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    2163             : {
    2164       62340 :     switch( pProperty->nWID )
    2165             :     {
    2166             :     case OWN_ATTR_CAPTION_POINT:
    2167             :     {
    2168           1 :         awt::Point aPnt;
    2169           1 :         if( rValue >>= aPnt )
    2170             :         {
    2171           1 :             Point aVclPoint( aPnt.X, aPnt.Y );
    2172             : 
    2173             :             // #90763# position is relative to top left, make it absolute
    2174           1 :             basegfx::B2DPolyPolygon aNewPolyPolygon;
    2175           1 :             basegfx::B2DHomMatrix aNewHomogenMatrix;
    2176           1 :             mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    2177             : 
    2178           1 :             aVclPoint.X() += basegfx::fround(aNewHomogenMatrix.get(0, 2));
    2179           1 :             aVclPoint.Y() += basegfx::fround(aNewHomogenMatrix.get(1, 2));
    2180             : 
    2181             :             // #88657# metric of pool maybe twips (writer)
    2182           1 :             ForceMetricToItemPoolMetric(aVclPoint);
    2183             : 
    2184             :             // #88491# position relative to anchor
    2185           1 :             if( mpModel->IsWriter() )
    2186             :             {
    2187           0 :                 aVclPoint += mpObj->GetAnchorPos();
    2188             :             }
    2189             : 
    2190           1 :             ((SdrCaptionObj*)mpObj.get())->SetTailPos(aVclPoint);
    2191             : 
    2192           1 :             return true;
    2193             :         }
    2194             :         break;
    2195             :     }
    2196             :     case OWN_ATTR_TRANSFORMATION:
    2197             :     {
    2198        1400 :         drawing::HomogenMatrix3 aMatrix;
    2199        1400 :         if(rValue >>= aMatrix)
    2200             :         {
    2201        1400 :             basegfx::B2DPolyPolygon aNewPolyPolygon;
    2202        1400 :             basegfx::B2DHomMatrix aNewHomogenMatrix;
    2203             : 
    2204        1400 :             mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    2205             : 
    2206        1400 :             aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
    2207        1400 :             aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
    2208        1400 :             aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
    2209        1400 :             aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
    2210        1400 :             aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
    2211        1400 :             aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
    2212        1400 :             aNewHomogenMatrix.set(2, 0, aMatrix.Line3.Column1);
    2213        1400 :             aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2);
    2214        1400 :             aNewHomogenMatrix.set(2, 2, aMatrix.Line3.Column3);
    2215             : 
    2216        1400 :             mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    2217        1400 :             return true;
    2218             :         }
    2219             :         break;
    2220             :     }
    2221             : 
    2222             :     case OWN_ATTR_ZORDER:
    2223             :     {
    2224         504 :         sal_Int32 nNewOrdNum = 0;
    2225         504 :         if(rValue >>= nNewOrdNum)
    2226             :         {
    2227         504 :             SdrObjList* pObjList = mpObj->GetObjList();
    2228         504 :             if( pObjList )
    2229             :             {
    2230             : #ifdef DBG_UTIL
    2231             :                 SdrObject* pCheck =
    2232             : #endif
    2233         504 :                             pObjList->SetObjectOrdNum( mpObj->GetOrdNum(), (sal_uIntPtr)nNewOrdNum );
    2234             :                 DBG_ASSERT( pCheck == mpObj.get(), "GetOrdNum() failed!" );
    2235             :             }
    2236         504 :             return true;
    2237             :         }
    2238             :         break;
    2239             :     }
    2240             :     case OWN_ATTR_FRAMERECT:
    2241             :     {
    2242           0 :         awt::Rectangle aUnoRect;
    2243           0 :         if(rValue >>= aUnoRect)
    2244             :         {
    2245           0 :             Point aTopLeft( aUnoRect.X, aUnoRect.Y );
    2246           0 :             Size aObjSize( aUnoRect.Width, aUnoRect.Height );
    2247           0 :             ForceMetricToItemPoolMetric(aTopLeft);
    2248           0 :             ForceMetricToItemPoolMetric(aObjSize);
    2249           0 :             Rectangle aRect;
    2250           0 :             aRect.SetPos(aTopLeft);
    2251           0 :             aRect.SetSize(aObjSize);
    2252           0 :             mpObj->SetSnapRect(aRect);
    2253           0 :             return true;
    2254             :         }
    2255             :         break;
    2256             :     }
    2257             :     case OWN_ATTR_MIRRORED:
    2258             :     {
    2259           3 :         sal_Bool bMirror = sal_Bool();
    2260           3 :         if(rValue >>= bMirror )
    2261             :         {
    2262           3 :             SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( mpObj.get() );
    2263           3 :             if( pObj )
    2264           3 :                 pObj->SetMirrored(bMirror);
    2265           3 :             return true;
    2266             :         }
    2267             :         break;
    2268             :     }
    2269             :     case OWN_ATTR_EDGE_START_OBJ:
    2270             :     case OWN_ATTR_EDGE_END_OBJ:
    2271             :     case OWN_ATTR_GLUEID_HEAD:
    2272             :     case OWN_ATTR_GLUEID_TAIL:
    2273             :     case OWN_ATTR_EDGE_START_POS:
    2274             :     case OWN_ATTR_EDGE_END_POS:
    2275             :     case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
    2276             :     {
    2277           0 :         SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(mpObj.get());
    2278           0 :         if(pEdgeObj)
    2279             :         {
    2280           0 :             switch(pProperty->nWID)
    2281             :             {
    2282             :             case OWN_ATTR_EDGE_START_OBJ:
    2283             :             case OWN_ATTR_EDGE_END_OBJ:
    2284             :                 {
    2285           0 :                     Reference< drawing::XShape > xShape;
    2286           0 :                     if( rValue >>= xShape )
    2287             :                     {
    2288           0 :                         SdrObject* pNode = GetSdrObjectFromXShape( xShape );
    2289           0 :                         if( pNode )
    2290             :                         {
    2291           0 :                             pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
    2292           0 :                             pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, -1 );
    2293           0 :                             return true;
    2294             :                         }
    2295             :                     }
    2296           0 :                     break;
    2297             :                 }
    2298             : 
    2299             :             case OWN_ATTR_EDGE_START_POS:
    2300             :             case OWN_ATTR_EDGE_END_POS:
    2301             :                 {
    2302           0 :                     awt::Point aUnoPoint;
    2303           0 :                     if( rValue >>= aUnoPoint )
    2304             :                     {
    2305           0 :                         Point aPoint( aUnoPoint.X, aUnoPoint.Y );
    2306             : 
    2307             :                         // Reintroduction of fix for issue i59051 (#i108851#)
    2308             :                         // perform metric change before applying anchor position,
    2309             :                         // because the anchor position is in pool metric.
    2310           0 :                         ForceMetricToItemPoolMetric( aPoint );
    2311           0 :                         if( mpModel->IsWriter() )
    2312           0 :                             aPoint += mpObj->GetAnchorPos();
    2313             : 
    2314           0 :                         pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
    2315           0 :                         return true;
    2316             :                     }
    2317             :                     break;
    2318             :                 }
    2319             : 
    2320             :             case OWN_ATTR_GLUEID_HEAD:
    2321             :             case OWN_ATTR_GLUEID_TAIL:
    2322             :                 {
    2323           0 :                     sal_Int32 nId = 0;
    2324           0 :                     if( rValue >>= nId )
    2325             :                     {
    2326           0 :                         pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
    2327           0 :                         return true;
    2328             :                     }
    2329             :                     break;
    2330             :                 }
    2331             :             case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
    2332             :                 {
    2333           0 :                     drawing::PolyPolygonBezierCoords aPolyPoly;
    2334           0 :                     if ( rValue >>= aPolyPoly )
    2335             :                     {
    2336           0 :                         basegfx::B2DPolyPolygon aNewPolyPolygon( basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( aPolyPoly ) );
    2337             :                         // Reintroduction of fix for issue i59051 (#i108851#)
    2338           0 :                         ForceMetricToItemPoolMetric( aNewPolyPolygon );
    2339           0 :                         if( mpModel->IsWriter() )
    2340             :                         {
    2341           0 :                             Point aPoint( mpObj->GetAnchorPos() );
    2342           0 :                             aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y()));
    2343             :                         }
    2344           0 :                         pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
    2345           0 :                         return true;
    2346           0 :                     }
    2347             :                 }
    2348             :             }
    2349             :         }
    2350           0 :         break;
    2351             :     }
    2352             :     case OWN_ATTR_MEASURE_START_POS:
    2353             :     case OWN_ATTR_MEASURE_END_POS:
    2354             :     {
    2355           0 :         SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(mpObj.get());
    2356           0 :         awt::Point aUnoPoint;
    2357           0 :         if(pMeasureObj && ( rValue >>= aUnoPoint ) )
    2358             :         {
    2359           0 :             Point aPoint( aUnoPoint.X, aUnoPoint.Y );
    2360             : 
    2361             :             // Reintroduction of fix for issue #i59051# (#i108851#)
    2362           0 :             ForceMetricToItemPoolMetric( aPoint );
    2363           0 :             if( mpModel->IsWriter() )
    2364           0 :                 aPoint += mpObj->GetAnchorPos();
    2365             : 
    2366           0 :             pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0L : 1L );
    2367           0 :             pMeasureObj->SetChanged();
    2368           0 :             pMeasureObj->BroadcastObjectChange();
    2369           0 :             return true;
    2370             :         }
    2371             :         break;
    2372             :     }
    2373             :     case OWN_ATTR_FILLBMP_MODE:
    2374             :         {
    2375             :             drawing::BitmapMode eMode;
    2376         738 :             if(!(rValue >>= eMode) )
    2377             :             {
    2378           0 :                 sal_Int32 nMode = 0;
    2379           0 :                 if(!(rValue >>= nMode))
    2380             :                     break;
    2381             : 
    2382           0 :                 eMode = (drawing::BitmapMode)nMode;
    2383             :             }
    2384         738 :             mpObj->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
    2385         738 :             mpObj->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
    2386         738 :             return true;
    2387             :         }
    2388             : 
    2389             :     case SDRATTR_LAYERID:
    2390             :     {
    2391           0 :         sal_Int16 nLayerId = sal_Int16();
    2392           0 :         if( rValue >>= nLayerId )
    2393             :         {
    2394           0 :             SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId);
    2395           0 :             if( pLayer )
    2396             :             {
    2397           0 :                 mpObj->SetLayer((unsigned char)nLayerId);
    2398           0 :                 return true;
    2399             :             }
    2400             :         }
    2401             :         break;
    2402             :     }
    2403             : 
    2404             :     case SDRATTR_LAYERNAME:
    2405             :     {
    2406         125 :         OUString aLayerName;
    2407         125 :         if( rValue >>= aLayerName )
    2408             :         {
    2409         125 :             const SdrLayer* pLayer=mpModel->GetLayerAdmin().GetLayer(aLayerName, sal_True);
    2410         125 :             if( pLayer != NULL )
    2411             :             {
    2412         125 :                 mpObj->SetLayer( pLayer->GetID() );
    2413         125 :                 return true;
    2414             :             }
    2415             :         }
    2416         125 :         break;
    2417             :     }
    2418             :     case SDRATTR_ROTATEANGLE:
    2419             :     {
    2420           1 :         sal_Int32 nAngle = 0;
    2421           1 :         if( rValue >>= nAngle )
    2422             :         {
    2423           1 :             Point aRef1(mpObj->GetSnapRect().Center());
    2424           1 :             nAngle -= mpObj->GetRotateAngle();
    2425           1 :             if (nAngle!=0)
    2426             :             {
    2427           1 :                 double nSin=sin(nAngle*nPi180);
    2428           1 :                 double nCos=cos(nAngle*nPi180);
    2429           1 :                 mpObj->Rotate(aRef1,nAngle,nSin,nCos);
    2430             :             }
    2431           1 :             return true;
    2432             :         }
    2433             : 
    2434             :         break;
    2435             :     }
    2436             : 
    2437             :     case SDRATTR_SHEARANGLE:
    2438             :     {
    2439           0 :         sal_Int32 nShear = 0;
    2440           0 :         if( rValue >>= nShear )
    2441             :         {
    2442           0 :             nShear -= mpObj->GetShearAngle();
    2443           0 :             if(nShear != 0 )
    2444             :             {
    2445           0 :                 Point aRef1(mpObj->GetSnapRect().Center());
    2446           0 :                 double nTan=tan(nShear*nPi180);
    2447           0 :                 mpObj->Shear(aRef1,nShear,nTan,sal_False);
    2448           0 :                 return true;
    2449             :             }
    2450             :         }
    2451             : 
    2452             :         break;
    2453             :     }
    2454             : 
    2455             :     case SDRATTR_OBJMOVEPROTECT:
    2456             :     {
    2457           8 :         sal_Bool bMoveProtect = sal_Bool();
    2458           8 :         if( rValue >>= bMoveProtect )
    2459             :         {
    2460           8 :             mpObj->SetMoveProtect(bMoveProtect);
    2461           8 :             return true;
    2462             :         }
    2463             :         break;
    2464             :     }
    2465             :     case SDRATTR_OBJECTNAME:
    2466             :     {
    2467        1538 :         OUString aName;
    2468        1538 :         if( rValue >>= aName )
    2469             :         {
    2470        1538 :             mpObj->SetName( aName );
    2471        1538 :             return true;
    2472             :         }
    2473        1538 :         break;
    2474             :     }
    2475             : 
    2476             :     // #i68101#
    2477             :     case OWN_ATTR_MISC_OBJ_TITLE:
    2478             :     {
    2479           0 :         OUString aTitle;
    2480           0 :         if( rValue >>= aTitle )
    2481             :         {
    2482           0 :             mpObj->SetTitle( aTitle );
    2483           0 :             return true;
    2484             :         }
    2485           0 :         break;
    2486             :     }
    2487             :     case OWN_ATTR_MISC_OBJ_DESCRIPTION:
    2488             :     {
    2489           5 :         OUString aDescription;
    2490           5 :         if( rValue >>= aDescription )
    2491             :         {
    2492           5 :             mpObj->SetDescription( aDescription );
    2493           5 :             return true;
    2494             :         }
    2495           5 :         break;
    2496             :     }
    2497             : 
    2498             :     case SDRATTR_OBJPRINTABLE:
    2499             :     {
    2500           0 :         sal_Bool bPrintable = sal_Bool();
    2501           0 :         if( rValue >>= bPrintable )
    2502             :         {
    2503           0 :             mpObj->SetPrintable(bPrintable);
    2504           0 :             return true;
    2505             :         }
    2506             :         break;
    2507             :     }
    2508             :     case SDRATTR_OBJVISIBLE:
    2509             :     {
    2510           0 :         sal_Bool bVisible = sal_Bool();
    2511           0 :         if( rValue >>= bVisible )
    2512             :         {
    2513           0 :             mpObj->SetVisible(bVisible);
    2514           0 :             return true;
    2515             :         }
    2516             :         break;
    2517             :     }
    2518             :     case SDRATTR_OBJSIZEPROTECT:
    2519             :     {
    2520           8 :         sal_Bool bResizeProtect = sal_Bool();
    2521           8 :         if( rValue >>= bResizeProtect )
    2522             :         {
    2523           8 :             mpObj->SetResizeProtect(bResizeProtect);
    2524           8 :             return true;
    2525             :         }
    2526             :         break;
    2527             :     }
    2528             :     case OWN_ATTR_PAGE_NUMBER:
    2529             :     {
    2530          15 :         sal_Int32 nPageNum = 0;
    2531          15 :         if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
    2532             :         {
    2533          15 :             SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(mpObj.get());
    2534          15 :             if( pPageObj )
    2535             :             {
    2536          14 :                 SdrModel* pModel = pPageObj->GetModel();
    2537          14 :                 SdrPage* pNewPage = 0L;
    2538          14 :                 const sal_uInt16 nDestinationPageNum((sal_uInt16)((nPageNum << 1L) - 1L));
    2539             : 
    2540          14 :                 if(pModel)
    2541             :                 {
    2542          14 :                     if(nDestinationPageNum < pModel->GetPageCount())
    2543             :                     {
    2544           8 :                         pNewPage = pModel->GetPage(nDestinationPageNum);
    2545             :                     }
    2546             :                 }
    2547             : 
    2548          14 :                 pPageObj->SetReferencedPage(pNewPage);
    2549             :             }
    2550             : 
    2551          15 :             return true;
    2552             :         }
    2553             :         break;
    2554             :     }
    2555             :     case XATTR_FILLBITMAP:
    2556             :     case XATTR_FILLGRADIENT:
    2557             :     case XATTR_FILLHATCH:
    2558             :     case XATTR_FILLFLOATTRANSPARENCE:
    2559             :     case XATTR_LINEEND:
    2560             :     case XATTR_LINESTART:
    2561             :     case XATTR_LINEDASH:
    2562             :     {
    2563          19 :         if( pProperty->nMemberId == MID_NAME )
    2564             :         {
    2565          19 :             OUString aApiName;
    2566          19 :             if( rValue >>= aApiName )
    2567             :             {
    2568          19 :                 if( SetFillAttribute( pProperty->nWID, aApiName ) )
    2569          19 :                     return true;
    2570             :             }
    2571          19 :             break;
    2572             :         }
    2573             :         else
    2574             :         {
    2575           0 :             return false;
    2576             :         }
    2577             :     }
    2578             :     default:
    2579             :     {
    2580       57975 :         return false;
    2581             :     }
    2582             :     }
    2583           0 :     throw lang::IllegalArgumentException();
    2584             : }
    2585             : 
    2586             : //----------------------------------------------------------------------
    2587             : 
    2588        5922 : bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    2589             : {
    2590        5922 :     switch( pProperty->nWID )
    2591             :     {
    2592             :     case OWN_ATTR_CAPTION_POINT:
    2593             :     {
    2594           0 :         Point aVclPoint = ((SdrCaptionObj*)mpObj.get())->GetTailPos();
    2595             : 
    2596             :         // #88491# make pos relative to anchor
    2597           0 :         if( mpModel->IsWriter() )
    2598             :         {
    2599           0 :             aVclPoint -= mpObj->GetAnchorPos();
    2600             :         }
    2601             : 
    2602             :         // #88657# metric of pool maybe twips (writer)
    2603           0 :         ForceMetricTo100th_mm(aVclPoint);
    2604             : 
    2605             :         // #90763# pos is absolute, make it relative to top left
    2606           0 :         basegfx::B2DPolyPolygon aNewPolyPolygon;
    2607           0 :         basegfx::B2DHomMatrix aNewHomogenMatrix;
    2608           0 :         mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    2609             : 
    2610           0 :         aVclPoint.X() -= basegfx::fround(aNewHomogenMatrix.get(0, 2));
    2611           0 :         aVclPoint.Y() -= basegfx::fround(aNewHomogenMatrix.get(1, 2));
    2612             : 
    2613           0 :         awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
    2614           0 :         rValue <<= aPnt;
    2615           0 :         break;
    2616             :     }
    2617             : 
    2618             :     case OWN_ATTR_TRANSFORMATION:
    2619             :     {
    2620          77 :         basegfx::B2DPolyPolygon aNewPolyPolygon;
    2621          77 :         basegfx::B2DHomMatrix aNewHomogenMatrix;
    2622          77 :         mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    2623          77 :         drawing::HomogenMatrix3 aMatrix;
    2624             : 
    2625          77 :         aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
    2626          77 :         aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
    2627          77 :         aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
    2628          77 :         aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
    2629          77 :         aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
    2630          77 :         aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
    2631          77 :         aMatrix.Line3.Column1 = aNewHomogenMatrix.get(2, 0);
    2632          77 :         aMatrix.Line3.Column2 = aNewHomogenMatrix.get(2, 1);
    2633          77 :         aMatrix.Line3.Column3 = aNewHomogenMatrix.get(2, 2);
    2634             : 
    2635          77 :         rValue <<= aMatrix;
    2636             : 
    2637          77 :         break;
    2638             :     }
    2639             : 
    2640             :     case OWN_ATTR_ZORDER:
    2641             :     {
    2642          90 :         rValue <<= (sal_Int32)mpObj->GetOrdNum();
    2643          90 :         break;
    2644             :     }
    2645             : 
    2646             :     case OWN_ATTR_BITMAP:
    2647             :     {
    2648          13 :         rValue = GetBitmap();
    2649          13 :         if(!rValue.hasValue())
    2650           0 :             throw uno::RuntimeException();
    2651             : 
    2652          13 :         break;
    2653             :     }
    2654             : 
    2655             :     case OWN_ATTR_ISFONTWORK:
    2656             :     {
    2657           1 :         rValue <<= (sal_Bool)(mpObj->ISA(SdrTextObj) && ((SdrTextObj*)mpObj.get())->IsFontwork());
    2658           1 :         break;
    2659             :     }
    2660             : 
    2661             :     case OWN_ATTR_FRAMERECT:
    2662             :     {
    2663           0 :         Rectangle aRect( mpObj->GetSnapRect() );
    2664           0 :         Point aTopLeft( aRect.TopLeft() );
    2665           0 :         Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
    2666           0 :         ForceMetricTo100th_mm(aTopLeft);
    2667           0 :         ForceMetricTo100th_mm(aObjSize);
    2668             :         ::com::sun::star::awt::Rectangle aUnoRect(
    2669           0 :             aTopLeft.X(), aTopLeft.Y(),
    2670           0 :             aObjSize.getWidth(), aObjSize.getHeight() );
    2671           0 :         rValue <<= aUnoRect;
    2672             :         break;
    2673             :     }
    2674             : 
    2675             :     case OWN_ATTR_BOUNDRECT:
    2676             :     {
    2677           4 :         Rectangle aRect( mpObj->GetCurrentBoundRect() );
    2678           4 :         Point aTopLeft( aRect.TopLeft() );
    2679           4 :         Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
    2680           4 :         ForceMetricTo100th_mm(aTopLeft);
    2681           4 :         ForceMetricTo100th_mm(aObjSize);
    2682             :         ::com::sun::star::awt::Rectangle aUnoRect(
    2683           4 :             aTopLeft.X(), aTopLeft.Y(),
    2684           8 :             aObjSize.getWidth(), aObjSize.getHeight() );
    2685           4 :         rValue <<= aUnoRect;
    2686             :         break;
    2687             :     }
    2688             : 
    2689             :     case OWN_ATTR_LDNAME:
    2690             :     {
    2691           0 :         OUString aName( mpObj->GetName() );
    2692           0 :         rValue <<= aName;
    2693           0 :         break;
    2694             :     }
    2695             : 
    2696             :     case OWN_ATTR_LDBITMAP:
    2697             :     {
    2698             :         sal_uInt16 nId;
    2699           0 :         if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_OLE2 )
    2700             :         {
    2701           0 :             nId = RID_UNODRAW_OLE2;
    2702             :         }
    2703           0 :         else if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_GRAF )
    2704             :         {
    2705           0 :             nId = RID_UNODRAW_GRAPHICS;
    2706             :         }
    2707             :         else
    2708             :         {
    2709           0 :             nId = RID_UNODRAW_OBJECTS;
    2710             :         }
    2711             : 
    2712           0 :         BitmapEx aBmp( SVX_RES(nId) );
    2713           0 :         Reference< awt::XBitmap > xBmp( VCLUnoHelper::CreateBitmap( aBmp ) );
    2714             : 
    2715           0 :         rValue <<= xBmp;
    2716           0 :         break;
    2717             :     }
    2718             : 
    2719             :     case OWN_ATTR_MIRRORED:
    2720             :     {
    2721           0 :         sal_Bool bMirror = sal_False;
    2722           0 :         if( mpObj.is() && mpObj->ISA(SdrGrafObj) )
    2723           0 :             bMirror = ((SdrGrafObj*)mpObj.get())->IsMirrored();
    2724             : 
    2725           0 :         rValue <<= bMirror;
    2726             :     }
    2727             : 
    2728             :     case OWN_ATTR_EDGE_START_OBJ:
    2729             :     case OWN_ATTR_EDGE_START_POS:
    2730             :     case OWN_ATTR_EDGE_END_POS:
    2731             :     case OWN_ATTR_EDGE_END_OBJ:
    2732             :     case OWN_ATTR_GLUEID_HEAD:
    2733             :     case OWN_ATTR_GLUEID_TAIL:
    2734             :     case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
    2735             :     {
    2736           0 :         SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(mpObj.get());
    2737           0 :         if(pEdgeObj)
    2738             :         {
    2739           0 :             switch(pProperty->nWID)
    2740             :             {
    2741             :             case OWN_ATTR_EDGE_START_OBJ:
    2742             :             case OWN_ATTR_EDGE_END_OBJ:
    2743             :                 {
    2744           0 :                     SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
    2745           0 :                     if(pNode)
    2746             :                     {
    2747           0 :                         Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
    2748           0 :                         if(xShape.is())
    2749           0 :                             rValue <<= xShape;
    2750             : 
    2751             :                     }
    2752           0 :                     break;
    2753             :                 }
    2754             : 
    2755             :             case OWN_ATTR_EDGE_START_POS:
    2756             :             case OWN_ATTR_EDGE_END_POS:
    2757             :                 {
    2758           0 :                     Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
    2759           0 :                     if( mpModel->IsWriter() )
    2760           0 :                         aPoint -= mpObj->GetAnchorPos();
    2761             : 
    2762           0 :                     ForceMetricTo100th_mm( aPoint );
    2763           0 :                     awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
    2764             : 
    2765           0 :                     rValue <<= aUnoPoint;
    2766             :                     break;
    2767             :                 }
    2768             :             case OWN_ATTR_GLUEID_HEAD:
    2769             :             case OWN_ATTR_GLUEID_TAIL:
    2770             :                 {
    2771           0 :                     rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
    2772           0 :                     break;
    2773             :                 }
    2774             :             case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
    2775             :                 {
    2776           0 :                     basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
    2777           0 :                     if( mpModel->IsWriter() )
    2778             :                     {
    2779           0 :                         Point aPoint( mpObj->GetAnchorPos() );
    2780           0 :                         aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
    2781             :                     }
    2782             :                     // Reintroduction of fix for issue #i59051# (#i108851#)
    2783           0 :                     ForceMetricTo100th_mm( aPolyPoly );
    2784           0 :                     drawing::PolyPolygonBezierCoords aRetval;
    2785           0 :                     basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
    2786           0 :                     rValue <<= aRetval;
    2787           0 :                     break;
    2788             :                 }
    2789             :             }
    2790             :         }
    2791           0 :         break;
    2792             :     }
    2793             : 
    2794             :     case OWN_ATTR_MEASURE_START_POS:
    2795             :     case OWN_ATTR_MEASURE_END_POS:
    2796             :     {
    2797           0 :         SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(mpObj.get());
    2798           0 :         if(pMeasureObj)
    2799             :         {
    2800           0 :             Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
    2801           0 :             if( mpModel->IsWriter() )
    2802           0 :                 aPoint -= mpObj->GetAnchorPos();
    2803             : 
    2804             :             // Reintroduction of fix for issue #i59051# (#i108851#)
    2805           0 :             ForceMetricTo100th_mm( aPoint );
    2806           0 :             awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
    2807             : 
    2808           0 :             rValue <<= aUnoPoint;
    2809             :             break;
    2810             :         }
    2811           0 :         break;
    2812             :     }
    2813             : 
    2814             :     case OWN_ATTR_FILLBMP_MODE:
    2815             :     {
    2816          72 :         const SfxItemSet& rObjItemSet = mpObj->GetMergedItemSet();
    2817             : 
    2818          72 :         XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&rObjItemSet.Get(XATTR_FILLBMP_STRETCH);
    2819          72 :         XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&rObjItemSet.Get(XATTR_FILLBMP_TILE);
    2820             : 
    2821          72 :         if( pTileItem && pTileItem->GetValue() )
    2822             :         {
    2823          72 :             rValue <<= drawing::BitmapMode_REPEAT;
    2824             :         }
    2825           0 :         else if( pStretchItem && pStretchItem->GetValue() )
    2826             :         {
    2827           0 :             rValue <<= drawing::BitmapMode_STRETCH;
    2828             :         }
    2829             :         else
    2830             :         {
    2831           0 :             rValue <<= drawing::BitmapMode_NO_REPEAT;
    2832             :         }
    2833          72 :         break;
    2834             :     }
    2835             :     case SDRATTR_LAYERID:
    2836          77 :         rValue <<= (sal_Int16)mpObj->GetLayer();
    2837          77 :         break;
    2838             : 
    2839             :     case SDRATTR_LAYERNAME:
    2840             :     {
    2841          77 :         SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID(mpObj->GetLayer());
    2842          77 :         if( pLayer )
    2843             :         {
    2844          77 :             OUString aName( pLayer->GetName() );
    2845          77 :             rValue <<= aName;
    2846             :         }
    2847          77 :         break;
    2848             :     }
    2849             : 
    2850             :     case SDRATTR_ROTATEANGLE:
    2851           0 :         rValue <<= mpObj->GetRotateAngle();
    2852           0 :         break;
    2853             : 
    2854             :     case SDRATTR_SHEARANGLE:
    2855           0 :         rValue <<= mpObj->GetShearAngle();
    2856           0 :         break;
    2857             : 
    2858             :     case SDRATTR_OBJMOVEPROTECT:
    2859          77 :         rValue = uno::makeAny( (sal_Bool) mpObj->IsMoveProtect() );
    2860          77 :         break;
    2861             : 
    2862             :     case SDRATTR_OBJECTNAME:
    2863             :     {
    2864         397 :         OUString aName( mpObj->GetName() );
    2865         397 :         rValue <<= aName;
    2866         397 :         break;
    2867             :     }
    2868             : 
    2869             :     // #i68101#
    2870             :     case OWN_ATTR_MISC_OBJ_TITLE:
    2871             :     {
    2872           0 :         OUString aTitle( mpObj->GetTitle() );
    2873           0 :         rValue <<= aTitle;
    2874           0 :         break;
    2875             :     }
    2876             : 
    2877             :     case OWN_ATTR_MISC_OBJ_DESCRIPTION:
    2878             :     {
    2879           4 :         OUString aDescription( mpObj->GetDescription() );
    2880           4 :         rValue <<= aDescription;
    2881           4 :         break;
    2882             :     }
    2883             : 
    2884             :     case SDRATTR_OBJPRINTABLE:
    2885          78 :         rValue <<= static_cast<sal_Bool>( mpObj->IsPrintable() );
    2886          78 :         break;
    2887             : 
    2888             :     case SDRATTR_OBJVISIBLE:
    2889          78 :         rValue <<= static_cast<sal_Bool>( mpObj->IsVisible() );
    2890          78 :         break;
    2891             : 
    2892             :     case SDRATTR_OBJSIZEPROTECT:
    2893          77 :         rValue <<= static_cast<sal_Bool>( mpObj->IsResizeProtect() );
    2894          77 :         break;
    2895             : 
    2896             :     case OWN_ATTR_PAGE_NUMBER:
    2897             :     {
    2898           0 :         SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(mpObj.get());
    2899           0 :         if(pPageObj)
    2900             :         {
    2901           0 :             SdrPage* pPage = pPageObj->GetReferencedPage();
    2902           0 :             sal_Int32 nPageNumber = (pPage) ? pPage->GetPageNum() : 0L;
    2903           0 :             nPageNumber++;
    2904           0 :             nPageNumber >>= 1;
    2905           0 :             rValue <<= nPageNumber;
    2906             :         }
    2907           0 :         break;
    2908             :     }
    2909             : 
    2910             :     case OWN_ATTR_UINAME_SINGULAR:
    2911             :     {
    2912           0 :         String aTmp;
    2913           0 :         mpObj->TakeObjNameSingul( aTmp );
    2914           0 :         rValue <<= OUString( aTmp );
    2915           0 :         break;
    2916             :     }
    2917             : 
    2918             :     case OWN_ATTR_UINAME_PLURAL:
    2919             :     {
    2920           0 :         String aTmp;
    2921           0 :         mpObj->TakeObjNamePlural( aTmp );
    2922           0 :         rValue <<= OUString( aTmp );
    2923           0 :         break;
    2924             :     }
    2925             :     case OWN_ATTR_METAFILE:
    2926             :     {
    2927           0 :         SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
    2928           0 :         if( pObj )
    2929             :         {
    2930           0 :             Graphic* pGraphic = pObj->GetGraphic();
    2931           0 :             if( pGraphic )
    2932             :             {
    2933           0 :                 sal_Bool bIsWMF = sal_False;
    2934           0 :                 if ( pGraphic->IsLink() )
    2935             :                 {
    2936           0 :                     GfxLink aLnk = pGraphic->GetLink();
    2937           0 :                     if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
    2938             :                     {
    2939           0 :                         bIsWMF = sal_True;
    2940           0 :                         uno::Sequence<sal_Int8> aSeq((sal_Int8*)aLnk.GetData(), (sal_Int32) aLnk.GetDataSize());
    2941           0 :                         rValue <<= aSeq;
    2942           0 :                     }
    2943             :                 }
    2944           0 :                 if ( !bIsWMF )
    2945             :                 {
    2946           0 :                     GDIMetaFile aMtf;
    2947           0 :                     if ( pGraphic->GetType() != GRAPHIC_BITMAP )
    2948           0 :                         aMtf = pObj->GetGraphic()->GetGDIMetaFile();
    2949             :                     else
    2950             :                     {
    2951           0 :                         VirtualDevice aVirDev;
    2952           0 :                         aMtf.Record( &aVirDev );
    2953           0 :                         pGraphic->Draw( &aVirDev, Point(),  pGraphic->GetPrefSize() );
    2954           0 :                         aMtf.Stop();
    2955           0 :                         aMtf.SetPrefSize( pGraphic->GetPrefSize() );
    2956           0 :                         aMtf.SetPrefMapMode( pGraphic->GetPrefMapMode() );
    2957             :                     }
    2958           0 :                     SvMemoryStream aDestStrm( 65535, 65535 );
    2959           0 :                     ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
    2960             :                     const uno::Sequence<sal_Int8> aSeq(
    2961           0 :                         static_cast< const sal_Int8* >(aDestStrm.GetData()),
    2962           0 :                         aDestStrm.GetEndOfData());
    2963           0 :                     rValue <<= aSeq;
    2964             :                 }
    2965             :             }
    2966             :         }
    2967             :         else
    2968             :         {
    2969           0 :             rValue = GetBitmap( sal_True );
    2970             :         }
    2971           0 :         break;
    2972             :     }
    2973             : 
    2974             : 
    2975             :     default:
    2976        4800 :         return false;
    2977             :     }
    2978        1122 :     return true;
    2979             : }
    2980             : 
    2981             : //----------------------------------------------------------------------
    2982             : 
    2983           1 : bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
    2984             : {
    2985           1 :     if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
    2986             :     {
    2987           0 :         const SfxItemSet& rSet = mpObj->GetMergedItemSet();
    2988             : 
    2989           0 :         if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
    2990           0 :             rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
    2991             :         {
    2992           0 :             rState = beans::PropertyState_DIRECT_VALUE;
    2993             :         }
    2994             :         else
    2995             :         {
    2996           0 :             rState = beans::PropertyState_AMBIGUOUS_VALUE;
    2997             :         }
    2998             :     }
    2999           1 :     else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
    3000             :        ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
    3001             :     {
    3002           0 :         rState = beans::PropertyState_DIRECT_VALUE;
    3003             :     }
    3004             :     else
    3005             :     {
    3006           1 :         return false;
    3007             :     }
    3008             : 
    3009           0 :     return true;
    3010             : }
    3011             : 
    3012             : //----------------------------------------------------------------------
    3013             : 
    3014           0 : bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
    3015             : {
    3016           0 :     if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
    3017             :     {
    3018           0 :         mpObj->ClearMergedItem( XATTR_FILLBMP_STRETCH );
    3019           0 :         mpObj->ClearMergedItem( XATTR_FILLBMP_TILE );
    3020           0 :         return true;
    3021             :     }
    3022           0 :     else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
    3023             :        ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
    3024             :     {
    3025           0 :         return true;
    3026             :     }
    3027             :     else
    3028             :     {
    3029           0 :         return false;
    3030             :     }
    3031             : }
    3032             : 
    3033             : //----------------------------------------------------------------------
    3034             : 
    3035           0 : uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
    3036             :     throw(beans::UnknownPropertyException, uno::RuntimeException)
    3037             : {
    3038           0 :     const sal_Int32 nCount = aPropertyName.getLength();
    3039           0 :     const OUString* pNames = aPropertyName.getConstArray();
    3040             : 
    3041           0 :     uno::Sequence< beans::PropertyState > aRet( nCount );
    3042           0 :     beans::PropertyState* pState = aRet.getArray();
    3043             : 
    3044           0 :     if( mpImpl->mpMaster )
    3045             :     {
    3046           0 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
    3047           0 :             pState[nIdx] = mpImpl->mpMaster->getPropertyState( pNames[nIdx] );
    3048             :     }
    3049             :     else
    3050             :     {
    3051           0 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
    3052           0 :             pState[nIdx] = _getPropertyState( pNames[nIdx] );
    3053             :     }
    3054             : 
    3055           0 :     return aRet;
    3056             : }
    3057             : 
    3058             : //----------------------------------------------------------------------
    3059             : 
    3060           0 : void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
    3061             :     throw(beans::UnknownPropertyException, uno::RuntimeException)
    3062             : {
    3063           0 :     if( mpImpl->mpMaster )
    3064             :     {
    3065           0 :         mpImpl->mpMaster->setPropertyToDefault( PropertyName );
    3066             :     }
    3067             :     else
    3068             :     {
    3069           0 :         _setPropertyToDefault( PropertyName );
    3070             :     }
    3071           0 : }
    3072             : 
    3073           0 : void SAL_CALL SvxShape::_setPropertyToDefault( const OUString& PropertyName )
    3074             :     throw(beans::UnknownPropertyException, uno::RuntimeException)
    3075             : {
    3076           0 :     ::SolarMutexGuard aGuard;
    3077             : 
    3078           0 :     const SfxItemPropertySimpleEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
    3079             : 
    3080           0 :     if( !mpObj.is() || mpModel == NULL || pProperty == NULL )
    3081           0 :         throw beans::UnknownPropertyException();
    3082             : 
    3083           0 :     if( !setPropertyToDefaultImpl( pProperty ) )
    3084             :     {
    3085           0 :         mpObj->ClearMergedItem( pProperty->nWID );
    3086             :     }
    3087             : 
    3088           0 :     mpModel->SetChanged();
    3089           0 : }
    3090             : 
    3091             : //----------------------------------------------------------------------
    3092             : 
    3093           0 : uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
    3094             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    3095             : {
    3096           0 :     if( mpImpl->mpMaster )
    3097             :     {
    3098           0 :         return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
    3099             :     }
    3100             :     else
    3101             :     {
    3102           0 :         return _getPropertyDefault( aPropertyName );
    3103             :     }
    3104             : }
    3105             : 
    3106           0 : uno::Any SAL_CALL SvxShape::_getPropertyDefault( const OUString& aPropertyName )
    3107             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    3108             : {
    3109           0 :     ::SolarMutexGuard aGuard;
    3110             : 
    3111           0 :     const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
    3112             : 
    3113           0 :     if( !mpObj.is() || pMap == NULL || mpModel == NULL )
    3114           0 :         throw beans::UnknownPropertyException();
    3115             : 
    3116           0 :     if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
    3117             :        ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
    3118             :     {
    3119           0 :         return getPropertyValue( aPropertyName );
    3120             :     }
    3121             : 
    3122             :     // Default aus ItemPool holen
    3123           0 :     if(!mpModel->GetItemPool().IsWhich(pMap->nWID))
    3124           0 :         throw beans::UnknownPropertyException();
    3125             : 
    3126           0 :     SfxItemSet aSet( mpModel->GetItemPool(),    pMap->nWID, pMap->nWID);
    3127           0 :     aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
    3128             : 
    3129           0 :     return GetAnyForItem( aSet, pMap );
    3130             : }
    3131             : 
    3132             : // XMultiPropertyStates
    3133         108 : void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException)
    3134             : {
    3135         108 :     ::SolarMutexGuard aGuard;
    3136             : 
    3137         108 :     if( !mpObj.is() )
    3138           0 :         throw lang::DisposedException();
    3139         108 :     mpObj->ClearMergedItem(); // nWhich == 0 => all
    3140             : 
    3141         108 :     if(mpObj->ISA(SdrGrafObj))
    3142             :     {
    3143             :         // defaults for graphic objects have changed:
    3144           3 :         mpObj->SetMergedItem( XFillStyleItem( XFILL_NONE ) );
    3145           3 :         mpObj->SetMergedItem( XLineStyleItem( XLINE_NONE ) );
    3146             :     }
    3147             : 
    3148             :     // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
    3149             :     // but needs to be sal_True in svx, pool default (false) in sch. Since sch
    3150             :     // does not load lathe or extrude objects, it is possible to set the items
    3151             :     // here.
    3152             :     // For other solution possibilities, see task description.
    3153         108 :     if(mpObj->ISA(E3dLatheObj) || mpObj->ISA(E3dExtrudeObj))
    3154             :     {
    3155           0 :         mpObj->SetMergedItem(Svx3DCharacterModeItem(true));
    3156             :     }
    3157             : 
    3158         108 :     mpModel->SetChanged();
    3159         108 : }
    3160             : 
    3161           0 : void SvxShape::setPropertiesToDefault(
    3162             :     const uno::Sequence<OUString>& aPropertyNames )
    3163             :     throw (beans::UnknownPropertyException, uno::RuntimeException)
    3164             : {
    3165           0 :     for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
    3166           0 :         setPropertyToDefault( aPropertyNames[pos] );
    3167           0 : }
    3168             : 
    3169           0 : uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
    3170             :     const uno::Sequence<OUString>& aPropertyNames )
    3171             :     throw (beans::UnknownPropertyException, lang::WrappedTargetException,
    3172             :            uno::RuntimeException)
    3173             : {
    3174           0 :     ::std::vector<uno::Any> ret;
    3175           0 :     for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
    3176           0 :         ret.push_back( getPropertyDefault( aPropertyNames[pos] ) );
    3177           0 :     return uno::Sequence<uno::Any>( &ret[0], ret.size() );
    3178             : }
    3179             : 
    3180             : //----------------------------------------------------------------------
    3181             : 
    3182             : //----------------------------------------------------------------------
    3183             : // XServiceInfo
    3184             : //----------------------------------------------------------------------
    3185           0 : OUString SAL_CALL SvxShape::getImplementationName()
    3186             :     throw(uno::RuntimeException)
    3187             : {
    3188           0 :     static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShape") );
    3189           0 :     return aServiceName;
    3190             : }
    3191             : 
    3192             : #define STAR_NAMESPACE "com.sun.star."
    3193             : 
    3194             : const char* sUNO_service_style_ParagraphProperties          = STAR_NAMESPACE "style.ParagraphProperties";
    3195             : const char* sUNO_service_style_ParagraphPropertiesComplex   = STAR_NAMESPACE "style.ParagraphPropertiesComplex";
    3196             : const char* sUNO_service_style_ParagraphPropertiesAsian     = STAR_NAMESPACE "style.ParagraphPropertiesAsian";
    3197             : const char* sUNO_service_style_CharacterProperties          = STAR_NAMESPACE "style.CharacterProperties";
    3198             : const char* sUNO_service_style_CharacterPropertiesComplex   = STAR_NAMESPACE "style.CharacterPropertiesComplex";
    3199             : const char* sUNO_service_style_CharacterPropertiesAsian     = STAR_NAMESPACE "style.CharacterPropertiesAsian";
    3200             : 
    3201             : const char* sUNO_service_drawing_FillProperties             = STAR_NAMESPACE "drawing.FillProperties";
    3202             : const char* sUNO_service_drawing_TextProperties             = STAR_NAMESPACE "drawing.TextProperties";
    3203             : const char* sUNO_service_drawing_LineProperties             = STAR_NAMESPACE "drawing.LineProperties";
    3204             : const char* sUNO_service_drawing_ConnectorProperties        = STAR_NAMESPACE "drawing.ConnectorProperties";
    3205             : const char* sUNO_service_drawing_MeasureProperties          = STAR_NAMESPACE "drawing.MeasureProperties";
    3206             : const char* sUNO_service_drawing_ShadowProperties           = STAR_NAMESPACE "drawing.ShadowProperties";
    3207             : 
    3208             : const char* sUNO_service_drawing_RotationDescriptor         = STAR_NAMESPACE "drawing.RotationDescriptor";
    3209             : 
    3210             : const char* sUNO_service_drawing_Text                       = STAR_NAMESPACE "drawing.Text";
    3211             : const char* sUNO_service_drawing_GroupShape                 = STAR_NAMESPACE "drawing.GroupShape";
    3212             : 
    3213             : const char* sUNO_service_drawing_CustomShapeProperties      = STAR_NAMESPACE "drawing.CustomShapeProperties";
    3214             : const char* sUNO_service_drawing_CustomShape                    = STAR_NAMESPACE "drawing.CustomShape";
    3215             : 
    3216             : const char* sUNO_service_drawing_PolyPolygonDescriptor      = STAR_NAMESPACE "drawing.PolyPolygonDescriptor";
    3217             : const char* sUNO_service_drawing_PolyPolygonBezierDescriptor= STAR_NAMESPACE "drawing.PolyPolygonBezierDescriptor";
    3218             : 
    3219             : const char* sUNO_service_drawing_LineShape                  = STAR_NAMESPACE "drawing.LineShape";
    3220             : const char* sUNO_service_drawing_Shape                      = STAR_NAMESPACE "drawing.Shape";
    3221             : const char* sUNO_service_drawing_RectangleShape             = STAR_NAMESPACE "drawing.RectangleShape";
    3222             : const char* sUNO_service_drawing_EllipseShape               = STAR_NAMESPACE "drawing.EllipseShape";
    3223             : const char* sUNO_service_drawing_PolyPolygonShape           = STAR_NAMESPACE "drawing.PolyPolygonShape";
    3224             : const char* sUNO_service_drawing_PolyLineShape              = STAR_NAMESPACE "drawing.PolyLineShape";
    3225             : const char* sUNO_service_drawing_OpenBezierShape            = STAR_NAMESPACE "drawing.OpenBezierShape";
    3226             : const char* sUNO_service_drawing_ClosedBezierShape          = STAR_NAMESPACE "drawing.ClosedBezierShape";
    3227             : const char* sUNO_service_drawing_TextShape                  = STAR_NAMESPACE "drawing.TextShape";
    3228             : const char* sUNO_service_drawing_GraphicObjectShape         = STAR_NAMESPACE "drawing.GraphicObjectShape";
    3229             : const char* sUNO_service_drawing_OLE2Shape                  = STAR_NAMESPACE "drawing.OLE2Shape";
    3230             : const char* sUNO_service_drawing_PageShape                  = STAR_NAMESPACE "drawing.PageShape";
    3231             : const char* sUNO_service_drawing_CaptionShape               = STAR_NAMESPACE "drawing.CaptionShape";
    3232             : const char* sUNO_service_drawing_MeasureShape               = STAR_NAMESPACE "drawing.MeasureShape";
    3233             : const char* sUNO_service_drawing_FrameShape                 = STAR_NAMESPACE "drawing.FrameShape";
    3234             : const char* sUNO_service_drawing_ControlShape               = STAR_NAMESPACE "drawing.ControlShape";
    3235             : const char* sUNO_service_drawing_ConnectorShape             = STAR_NAMESPACE "drawing.ConnectorShape";
    3236             : const char* sUNO_service_drawing_MediaShape                 = STAR_NAMESPACE "drawing.MediaShape";
    3237             : 
    3238             : 
    3239        1351 : uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
    3240             :     throw(uno::RuntimeException)
    3241             : {
    3242        1351 :     if( mpImpl->mpMaster )
    3243             :     {
    3244        1264 :         return mpImpl->mpMaster->getSupportedServiceNames();
    3245             :     }
    3246             :     else
    3247             :     {
    3248          87 :         return _getSupportedServiceNames();
    3249             :     }
    3250             : }
    3251             : 
    3252        1351 : uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames()
    3253             :     throw(uno::RuntimeException)
    3254             : {
    3255        1351 :     ::SolarMutexGuard aGuard;
    3256             : 
    3257        1351 :     if( mpObj.is() && mpObj->GetObjInventor() == SdrInventor)
    3258             :     {
    3259        1351 :         const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
    3260             : 
    3261        1351 :         switch(nIdent)
    3262             :         {
    3263             :         case OBJ_GRUP:
    3264             :             {
    3265             :                 static uno::Sequence< OUString > *pSeq = 0;
    3266           3 :                 if( 0 == pSeq )
    3267             :                 {
    3268           1 :                         static uno::Sequence< OUString > SvxShape_GroupServices;
    3269             : 
    3270             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices, 2,
    3271             :                             sUNO_service_drawing_GroupShape,
    3272           1 :                               sUNO_service_drawing_Shape );
    3273             : 
    3274           1 :                         pSeq = &SvxShape_GroupServices;
    3275             :                 }
    3276             : 
    3277           3 :                 return *pSeq;
    3278             :             }
    3279             :         case OBJ_CUSTOMSHAPE:
    3280             :             {
    3281             :                 static uno::Sequence< OUString > *pSeq = 0;
    3282        1066 :                 if( 0 == pSeq )
    3283             :                 {
    3284           4 :                         static uno::Sequence< OUString > SvxShape_CustomShapeServices;
    3285             : 
    3286             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices, 13,
    3287             :                             sUNO_service_drawing_CustomShape,
    3288             :                               sUNO_service_drawing_Shape,
    3289             :                             sUNO_service_drawing_CustomShapeProperties,
    3290             :                             sUNO_service_drawing_FillProperties,
    3291             :                             sUNO_service_drawing_LineProperties,
    3292             :                             sUNO_service_drawing_Text,
    3293             :                             sUNO_service_drawing_TextProperties,
    3294             :                             sUNO_service_style_ParagraphProperties,
    3295             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3296             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3297             :                             sUNO_service_style_CharacterProperties,
    3298             :                             sUNO_service_style_CharacterPropertiesComplex,
    3299             :                             sUNO_service_style_CharacterPropertiesAsian,
    3300             :                             sUNO_service_drawing_ShadowProperties,
    3301           4 :                             sUNO_service_drawing_RotationDescriptor);
    3302           4 :                         pSeq = &SvxShape_CustomShapeServices;
    3303             :                 }
    3304        1066 :                 return *pSeq;
    3305             :             }
    3306             :         case OBJ_LINE:
    3307             :             {
    3308             :                 static uno::Sequence< OUString > *pSeq = 0;
    3309          73 :                 if( 0 == pSeq )
    3310             :                 {
    3311           3 :                         static uno::Sequence< OUString > SvxShape_LineServices;
    3312             : 
    3313             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices,14,
    3314             :                             sUNO_service_drawing_LineShape,
    3315             : 
    3316             :                             sUNO_service_drawing_Shape,
    3317             :                             sUNO_service_drawing_LineProperties,
    3318             : 
    3319             :                             sUNO_service_drawing_Text,
    3320             :                             sUNO_service_drawing_TextProperties,
    3321             :                             sUNO_service_style_ParagraphProperties,
    3322             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3323             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3324             :                             sUNO_service_style_CharacterProperties,
    3325             :                             sUNO_service_style_CharacterPropertiesComplex,
    3326             :                             sUNO_service_style_CharacterPropertiesAsian,
    3327             : 
    3328             :                             sUNO_service_drawing_PolyPolygonDescriptor,
    3329             :                             sUNO_service_drawing_ShadowProperties,
    3330           3 :                             sUNO_service_drawing_RotationDescriptor);
    3331             : 
    3332           3 :                         pSeq = &SvxShape_LineServices;
    3333             :                 }
    3334          73 :                 return *pSeq;
    3335             :             }
    3336             : 
    3337             :         case OBJ_RECT:
    3338             :             {
    3339             :                 static uno::Sequence< OUString > *pSeq = 0;
    3340          18 :                 if( 0 == pSeq )
    3341             :                 {
    3342           2 :                         static uno::Sequence< OUString > SvxShape_RectServices;
    3343             : 
    3344             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices,14,
    3345             :                             sUNO_service_drawing_RectangleShape,
    3346             : 
    3347             :                             sUNO_service_drawing_Shape,
    3348             :                             sUNO_service_drawing_FillProperties,
    3349             :                             sUNO_service_drawing_LineProperties,
    3350             :                             sUNO_service_drawing_Text,
    3351             :                             sUNO_service_drawing_TextProperties,
    3352             :                             sUNO_service_style_ParagraphProperties,
    3353             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3354             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3355             :                             sUNO_service_style_CharacterProperties,
    3356             :                             sUNO_service_style_CharacterPropertiesComplex,
    3357             :                             sUNO_service_style_CharacterPropertiesAsian,
    3358             : 
    3359             :                             sUNO_service_drawing_ShadowProperties,
    3360           2 :                             sUNO_service_drawing_RotationDescriptor);
    3361           2 :                         pSeq = &SvxShape_RectServices;
    3362             :                 }
    3363          18 :                 return *pSeq;
    3364             :             }
    3365             : 
    3366             :         case OBJ_CIRC:
    3367             :         case OBJ_SECT:
    3368             :         case OBJ_CARC:
    3369             :         case OBJ_CCUT:
    3370             :             {
    3371             :                 static uno::Sequence< OUString > *pSeq = 0;
    3372           0 :                 if( 0 == pSeq )
    3373             :                 {
    3374           0 :                         static uno::Sequence< OUString > SvxShape_CircServices;
    3375             : 
    3376             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices,14,
    3377             :                             sUNO_service_drawing_EllipseShape,
    3378             : 
    3379             :                             sUNO_service_drawing_Shape,
    3380             :                             sUNO_service_drawing_FillProperties,
    3381             :                             sUNO_service_drawing_LineProperties,
    3382             : 
    3383             :                             sUNO_service_drawing_Text,
    3384             :                             sUNO_service_drawing_TextProperties,
    3385             :                             sUNO_service_style_ParagraphProperties,
    3386             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3387             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3388             :                             sUNO_service_style_CharacterProperties,
    3389             :                             sUNO_service_style_CharacterPropertiesComplex,
    3390             :                             sUNO_service_style_CharacterPropertiesAsian,
    3391             : 
    3392             :                             sUNO_service_drawing_ShadowProperties,
    3393           0 :                             sUNO_service_drawing_RotationDescriptor);
    3394             : 
    3395           0 :                         pSeq = &SvxShape_CircServices;
    3396             :                 }
    3397             : 
    3398           0 :                 return *pSeq;
    3399             :             }
    3400             : 
    3401             :         case OBJ_PATHPLIN:
    3402             :         case OBJ_PLIN:
    3403             :             {
    3404             :                 static uno::Sequence< OUString > *pSeq = 0;
    3405          16 :                 if( 0 == pSeq )
    3406             :                 {
    3407           1 :                         static uno::Sequence< OUString > SvxShape_PathServices;
    3408             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices,14,
    3409             :                             sUNO_service_drawing_PolyLineShape,
    3410             : 
    3411             :                             sUNO_service_drawing_Shape,
    3412             :                             sUNO_service_drawing_LineProperties,
    3413             : 
    3414             :                             sUNO_service_drawing_PolyPolygonDescriptor,
    3415             : 
    3416             :                             sUNO_service_drawing_Text,
    3417             :                             sUNO_service_drawing_TextProperties,
    3418             :                             sUNO_service_style_ParagraphProperties,
    3419             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3420             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3421             :                             sUNO_service_style_CharacterProperties,
    3422             :                             sUNO_service_style_CharacterPropertiesComplex,
    3423             :                             sUNO_service_style_CharacterPropertiesAsian,
    3424             : 
    3425             :                             sUNO_service_drawing_ShadowProperties,
    3426           1 :                             sUNO_service_drawing_RotationDescriptor);
    3427           1 :                         pSeq = &SvxShape_PathServices;
    3428             :                 }
    3429          16 :                 return *pSeq;
    3430             :             }
    3431             : 
    3432             :         case OBJ_PATHPOLY:
    3433             :         case OBJ_POLY:
    3434             :             {
    3435             :                 static uno::Sequence< OUString > *pSeq = 0;
    3436          48 :                 if( 0 == pSeq )
    3437             :                 {
    3438           1 :                         static uno::Sequence< OUString > SvxShape_PolyServices;
    3439             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices,15,
    3440             :                             sUNO_service_drawing_PolyPolygonShape,
    3441             : 
    3442             :                             sUNO_service_drawing_Shape,
    3443             :                             sUNO_service_drawing_LineProperties,
    3444             :                             sUNO_service_drawing_FillProperties,
    3445             : 
    3446             :                             sUNO_service_drawing_PolyPolygonDescriptor,
    3447             : 
    3448             :                             sUNO_service_drawing_Text,
    3449             :                             sUNO_service_drawing_TextProperties,
    3450             :                             sUNO_service_style_ParagraphProperties,
    3451             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3452             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3453             :                             sUNO_service_style_CharacterProperties,
    3454             :                             sUNO_service_style_CharacterPropertiesComplex,
    3455             :                             sUNO_service_style_CharacterPropertiesAsian,
    3456             : 
    3457             :                             sUNO_service_drawing_ShadowProperties,
    3458           1 :                             sUNO_service_drawing_RotationDescriptor);
    3459             : 
    3460           1 :                         pSeq = &SvxShape_PolyServices;
    3461             :                 }
    3462          48 :                 return *pSeq;
    3463             :             }
    3464             : 
    3465             :         case OBJ_FREELINE:
    3466             :         case OBJ_PATHLINE:
    3467             :             {
    3468             :                 static uno::Sequence< OUString > *pSeq = 0;
    3469          36 :                 if( 0 == pSeq )
    3470             :                 {
    3471           2 :                         static uno::Sequence< OUString > SvxShape_FreeLineServices;
    3472             : 
    3473             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices,15,
    3474             :                             sUNO_service_drawing_OpenBezierShape,
    3475             : 
    3476             :                             sUNO_service_drawing_Shape,
    3477             :                             sUNO_service_drawing_LineProperties,
    3478             :                             sUNO_service_drawing_FillProperties,
    3479             : 
    3480             :                             sUNO_service_drawing_PolyPolygonBezierDescriptor,
    3481             : 
    3482             :                             sUNO_service_drawing_Text,
    3483             :                             sUNO_service_drawing_TextProperties,
    3484             :                             sUNO_service_style_ParagraphProperties,
    3485             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3486             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3487             :                             sUNO_service_style_CharacterProperties,
    3488             :                             sUNO_service_style_CharacterPropertiesComplex,
    3489             :                             sUNO_service_style_CharacterPropertiesAsian,
    3490             : 
    3491             :                             sUNO_service_drawing_ShadowProperties,
    3492           2 :                             sUNO_service_drawing_RotationDescriptor);
    3493             : 
    3494           2 :                         pSeq = &SvxShape_FreeLineServices;
    3495             :                 }
    3496             : 
    3497          36 :                 return *pSeq;
    3498             :             }
    3499             : 
    3500             :         case OBJ_FREEFILL:
    3501             :         case OBJ_PATHFILL:
    3502             :             {
    3503             :                 static uno::Sequence< OUString > *pSeq = 0;
    3504          32 :                 if( 0 == pSeq )
    3505             :                 {
    3506           1 :                         static uno::Sequence< OUString > SvxShape_FreeFillServices;
    3507             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices,15,
    3508             :                             sUNO_service_drawing_ClosedBezierShape,
    3509             : 
    3510             :                             sUNO_service_drawing_Shape,
    3511             :                             sUNO_service_drawing_LineProperties,
    3512             :                             sUNO_service_drawing_FillProperties,
    3513             : 
    3514             :                             sUNO_service_drawing_PolyPolygonBezierDescriptor,
    3515             : 
    3516             :                             sUNO_service_drawing_Text,
    3517             :                             sUNO_service_drawing_TextProperties,
    3518             :                             sUNO_service_style_ParagraphProperties,
    3519             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3520             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3521             :                             sUNO_service_style_CharacterProperties,
    3522             :                             sUNO_service_style_CharacterPropertiesComplex,
    3523             :                             sUNO_service_style_CharacterPropertiesAsian,
    3524             : 
    3525             :                             sUNO_service_drawing_ShadowProperties,
    3526           1 :                             sUNO_service_drawing_RotationDescriptor);
    3527             : 
    3528           1 :                         pSeq = &SvxShape_FreeFillServices;
    3529             :                 }
    3530          32 :                 return *pSeq;
    3531             :             }
    3532             : 
    3533             :         case OBJ_OUTLINETEXT:
    3534             :         case OBJ_TITLETEXT:
    3535             :         case OBJ_TEXT:
    3536             :             {
    3537             :                 static uno::Sequence< OUString > *pSeq = 0;
    3538           0 :                 if( 0 == pSeq )
    3539             :                 {
    3540           0 :                         static uno::Sequence< OUString > SvxShape_TextServices;
    3541             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices,14,
    3542             :                             sUNO_service_drawing_TextShape,
    3543             : 
    3544             :                             sUNO_service_drawing_Shape,
    3545             :                             sUNO_service_drawing_FillProperties,
    3546             :                             sUNO_service_drawing_LineProperties,
    3547             : 
    3548             :                             sUNO_service_drawing_Text,
    3549             :                             sUNO_service_drawing_TextProperties,
    3550             :                             sUNO_service_style_ParagraphProperties,
    3551             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3552             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3553             :                             sUNO_service_style_CharacterProperties,
    3554             :                             sUNO_service_style_CharacterPropertiesComplex,
    3555             :                             sUNO_service_style_CharacterPropertiesAsian,
    3556             : 
    3557             :                             sUNO_service_drawing_ShadowProperties,
    3558           0 :                             sUNO_service_drawing_RotationDescriptor);
    3559             : 
    3560           0 :                         pSeq = &SvxShape_TextServices;
    3561             :                 }
    3562           0 :                 return *pSeq;
    3563             :             }
    3564             : 
    3565             :         case OBJ_GRAF:
    3566             :             {
    3567             :                 static uno::Sequence< OUString > *pSeq = 0;
    3568          26 :                 if( 0 == pSeq )
    3569             :                 {
    3570           2 :                         static uno::Sequence< OUString > SvxShape_GrafServices;
    3571             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices, 12,
    3572             :                             sUNO_service_drawing_GraphicObjectShape,
    3573             : 
    3574             :                             sUNO_service_drawing_Shape,
    3575             : 
    3576             :                             sUNO_service_drawing_Text,
    3577             :                             sUNO_service_drawing_TextProperties,
    3578             :                             sUNO_service_style_ParagraphProperties,
    3579             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3580             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3581             :                             sUNO_service_style_CharacterProperties,
    3582             :                             sUNO_service_style_CharacterPropertiesComplex,
    3583             :                             sUNO_service_style_CharacterPropertiesAsian,
    3584             : 
    3585             :                             sUNO_service_drawing_ShadowProperties,
    3586           2 :                             sUNO_service_drawing_RotationDescriptor);
    3587             : 
    3588           2 :                         pSeq = &SvxShape_GrafServices;
    3589             :                 }
    3590          26 :                 return *pSeq;
    3591             :             }
    3592             : 
    3593             :         case OBJ_OLE2:
    3594             :             {
    3595             :                 static uno::Sequence< OUString > *pSeq = 0;
    3596           0 :                 if( 0 == pSeq )
    3597             :                 {
    3598           0 :                         static uno::Sequence< OUString > SvxShape_Ole2Services;
    3599             : 
    3600             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services, 12,
    3601             :                             sUNO_service_drawing_OLE2Shape,
    3602             :                             sUNO_service_drawing_Shape,
    3603             : 
    3604             :                             // #i118485# Added Text, Shadow and Rotation
    3605             :                             sUNO_service_drawing_Text,
    3606             :                             sUNO_service_drawing_TextProperties,
    3607             :                             sUNO_service_style_ParagraphProperties,
    3608             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3609             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3610             :                             sUNO_service_style_CharacterProperties,
    3611             :                             sUNO_service_style_CharacterPropertiesComplex,
    3612             :                             sUNO_service_style_CharacterPropertiesAsian,
    3613             : 
    3614             :                             sUNO_service_drawing_ShadowProperties,
    3615           0 :                             sUNO_service_drawing_RotationDescriptor);
    3616             : 
    3617           0 :                         pSeq = &SvxShape_Ole2Services;
    3618             :                 }
    3619           0 :                 return *pSeq;
    3620             :             }
    3621             : 
    3622             :         case OBJ_CAPTION:
    3623             :             {
    3624             :                 static uno::Sequence< OUString > *pSeq = 0;
    3625           1 :                 if( 0 == pSeq )
    3626             :                 {
    3627           1 :                         static uno::Sequence< OUString > SvxShape_CaptionServices;
    3628             : 
    3629             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices,14,
    3630             :                             sUNO_service_drawing_CaptionShape,
    3631             : 
    3632             :                             sUNO_service_drawing_Shape,
    3633             :                             sUNO_service_drawing_FillProperties,
    3634             :                             sUNO_service_drawing_LineProperties,
    3635             : 
    3636             :                             sUNO_service_drawing_Text,
    3637             :                             sUNO_service_drawing_TextProperties,
    3638             :                             sUNO_service_style_ParagraphProperties,
    3639             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3640             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3641             :                             sUNO_service_style_CharacterProperties,
    3642             :                             sUNO_service_style_CharacterPropertiesComplex,
    3643             :                             sUNO_service_style_CharacterPropertiesAsian,
    3644             : 
    3645             :                             sUNO_service_drawing_ShadowProperties,
    3646           1 :                             sUNO_service_drawing_RotationDescriptor);
    3647             : 
    3648           1 :                         pSeq = &SvxShape_CaptionServices;
    3649             :                 }
    3650             : 
    3651           1 :                 return *pSeq;
    3652             :             }
    3653             : 
    3654             :         case OBJ_PAGE:
    3655             :             {
    3656             :                 static uno::Sequence< OUString > *pSeq = 0;
    3657           0 :                 if( 0 == pSeq )
    3658             :                 {
    3659           0 :                         static uno::Sequence< OUString > SvxShape_PageServices;
    3660             : 
    3661             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices, 2,
    3662             :                             sUNO_service_drawing_PageShape,
    3663           0 :                             sUNO_service_drawing_Shape );
    3664             : 
    3665           0 :                         pSeq = &SvxShape_PageServices;
    3666             :                 }
    3667             : 
    3668           0 :                 return *pSeq;
    3669             :             }
    3670             : 
    3671             :         case OBJ_MEASURE:
    3672             :             {
    3673             :                 static uno::Sequence< OUString > *pSeq = 0;
    3674           0 :                 if( 0 == pSeq )
    3675             :                 {
    3676           0 :                         static uno::Sequence< OUString > SvxShape_MeasureServices;
    3677             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices,15,
    3678             :                             sUNO_service_drawing_MeasureShape,
    3679             : 
    3680             :                             sUNO_service_drawing_MeasureProperties,
    3681             : 
    3682             :                             sUNO_service_drawing_Shape,
    3683             :                             sUNO_service_drawing_LineProperties,
    3684             : 
    3685             :                             sUNO_service_drawing_Text,
    3686             :                             sUNO_service_drawing_TextProperties,
    3687             :                             sUNO_service_style_ParagraphProperties,
    3688             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3689             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3690             :                             sUNO_service_style_CharacterProperties,
    3691             :                             sUNO_service_style_CharacterPropertiesComplex,
    3692             :                             sUNO_service_style_CharacterPropertiesAsian,
    3693             : 
    3694             :                             sUNO_service_drawing_PolyPolygonDescriptor,
    3695             :                             sUNO_service_drawing_ShadowProperties,
    3696           0 :                             sUNO_service_drawing_RotationDescriptor);
    3697             : 
    3698           0 :                         pSeq = &SvxShape_MeasureServices;
    3699             :                 }
    3700             : 
    3701           0 :                 return *pSeq;
    3702             :             }
    3703             : 
    3704             :         case OBJ_FRAME:
    3705             :             {
    3706             :                 static uno::Sequence< OUString > *pSeq = 0;
    3707           0 :                 if( 0 == pSeq )
    3708             :                 {
    3709           0 :                         static uno::Sequence< OUString > SvxShape_FrameServices;
    3710             : 
    3711             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices, 2,
    3712             :                             sUNO_service_drawing_FrameShape,
    3713           0 :                             sUNO_service_drawing_Shape );
    3714             : 
    3715           0 :                         pSeq = &SvxShape_FrameServices;
    3716             :                 }
    3717             : 
    3718           0 :                 return *pSeq;
    3719             :             }
    3720             : 
    3721             :         case OBJ_UNO:
    3722             :             {
    3723             :                 static uno::Sequence< OUString > *pSeq = 0;
    3724           0 :                 if( 0 == pSeq )
    3725             :                 {
    3726           0 :                         static uno::Sequence< OUString > SvxShape_UnoServices;
    3727             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
    3728             :                             sUNO_service_drawing_ControlShape,
    3729           0 :                             sUNO_service_drawing_Shape );
    3730             : 
    3731           0 :                         pSeq = &SvxShape_UnoServices;
    3732             :                 }
    3733           0 :                 return *pSeq;
    3734             :             }
    3735             : 
    3736             :         case OBJ_EDGE:
    3737             :             {
    3738             :                 static uno::Sequence< OUString > *pSeq = 0;
    3739           0 :                 if( 0 == pSeq )
    3740             :                 {
    3741           0 :                         static uno::Sequence< OUString > SvxShape_EdgeServices;
    3742             : 
    3743             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices,15,
    3744             :                             sUNO_service_drawing_ConnectorShape,
    3745             :                             sUNO_service_drawing_ConnectorProperties,
    3746             : 
    3747             :                             sUNO_service_drawing_Shape,
    3748             :                             sUNO_service_drawing_LineProperties,
    3749             : 
    3750             :                             sUNO_service_drawing_Text,
    3751             :                             sUNO_service_drawing_TextProperties,
    3752             :                             sUNO_service_style_ParagraphProperties,
    3753             :                             sUNO_service_style_ParagraphPropertiesComplex,
    3754             :                             sUNO_service_style_ParagraphPropertiesAsian,
    3755             :                             sUNO_service_style_CharacterProperties,
    3756             :                             sUNO_service_style_CharacterPropertiesComplex,
    3757             :                             sUNO_service_style_CharacterPropertiesAsian,
    3758             : 
    3759             :                             sUNO_service_drawing_PolyPolygonDescriptor,
    3760             :                             sUNO_service_drawing_ShadowProperties,
    3761           0 :                             sUNO_service_drawing_RotationDescriptor);
    3762             : 
    3763           0 :                         pSeq = &SvxShape_EdgeServices;
    3764             :                 }
    3765           0 :                 return *pSeq;
    3766             :             }
    3767             :         case OBJ_MEDIA:
    3768             :             {
    3769             :                 static uno::Sequence< OUString > *pSeq = 0;
    3770           0 :                 if( 0 == pSeq )
    3771             :                 {
    3772           0 :                         static uno::Sequence< OUString > SvxShape_MediaServices;
    3773             : 
    3774             :                         comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices, 2,
    3775             :                             sUNO_service_drawing_MediaShape,
    3776           0 :                             sUNO_service_drawing_Shape);
    3777             : 
    3778           0 :                         pSeq = &SvxShape_MediaServices;
    3779             :                 }
    3780           0 :                 return *pSeq;
    3781             :             }
    3782             :         }
    3783             :     }
    3784           0 :     else if( mpObj.is() && mpObj->GetObjInventor() == FmFormInventor)
    3785             :     {
    3786             : #if OSL_DEBUG_LEVEL > 0
    3787             :         const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
    3788             :         OSL_ENSURE( nIdent == OBJ_UNO, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
    3789             : #endif
    3790             :         static uno::Sequence< OUString > *pSeq = 0;
    3791           0 :         if( 0 == pSeq )
    3792             :         {
    3793           0 :                 static uno::Sequence< OUString > SvxShape_UnoServices;
    3794             :                 comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
    3795             :                     sUNO_service_drawing_ControlShape,
    3796           0 :                     sUNO_service_drawing_Shape );
    3797             : 
    3798           0 :                 pSeq = &SvxShape_UnoServices;
    3799             :         }
    3800           0 :         return *pSeq;
    3801             :     }
    3802             :     OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
    3803          32 :     uno::Sequence< OUString > aSeq;
    3804          32 :     return aSeq;
    3805             : }
    3806             : 
    3807             : //----------------------------------------------------------------------
    3808        1271 : sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
    3809             : {
    3810        1271 :     Sequence< OUString > SupportedServices( getSupportedServiceNames() );
    3811        1271 :     const ::rtl::OUString * pArray = SupportedServices.getConstArray();
    3812        1271 :     const sal_Int32 nCount = SupportedServices.getLength();
    3813             :     sal_Int32 i;
    3814       14420 :     for( i = 0; i < nCount; i++ )
    3815       13627 :         if( *pArray++ == ServiceName )
    3816         478 :             return sal_True;
    3817         793 :     return sal_False;
    3818             : }
    3819             : 
    3820             : //----------------------------------------------------------------------
    3821             : 
    3822             : // XGluePointsSupplier
    3823           0 : uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
    3824             :     throw(uno::RuntimeException)
    3825             : {
    3826           0 :     ::SolarMutexGuard aGuard;
    3827           0 :     uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
    3828             : 
    3829           0 :     if( mpObj.is() && !xGluePoints.is() )
    3830             :     {
    3831           0 :         uno::Reference< container::XIndexContainer > xNew( SvxUnoGluePointAccess_createInstance( mpObj.get() ), uno::UNO_QUERY );
    3832           0 :         mxGluePoints = xGluePoints = xNew;
    3833             :     }
    3834             : 
    3835           0 :     return xGluePoints;
    3836             : }
    3837             : 
    3838             : //----------------------------------------------------------------------
    3839             : 
    3840             : // XChild
    3841           0 : uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent(  )
    3842             :     throw(uno::RuntimeException)
    3843             : {
    3844           0 :     ::SolarMutexGuard aGuard;
    3845             : 
    3846           0 :     if( mpObj.is() && mpObj->GetObjList() )
    3847             :     {
    3848           0 :         SdrObjList* pObjList = mpObj->GetObjList();
    3849             : 
    3850           0 :         switch( pObjList->GetListKind() )
    3851             :         {
    3852             :         case SDROBJLIST_GROUPOBJ:
    3853           0 :             if( pObjList->GetOwnerObj()->ISA( SdrObjGroup ) )
    3854           0 :                 return PTR_CAST( SdrObjGroup, pObjList->GetOwnerObj())->getUnoShape();
    3855           0 :             else if( pObjList->GetOwnerObj()->ISA( E3dScene ) )
    3856           0 :                 return PTR_CAST( E3dScene, pObjList->GetOwnerObj())->getUnoShape();
    3857           0 :             break;
    3858             :         case SDROBJLIST_DRAWPAGE:
    3859             :         case SDROBJLIST_MASTERPAGE:
    3860           0 :             return PTR_CAST( SdrPage, pObjList )->getUnoPage();
    3861             :         default:
    3862             :             OSL_FAIL( "SvxShape::getParent(  ): unexpected SdrObjListKind" );
    3863           0 :             break;
    3864             :         }
    3865             :     }
    3866             : 
    3867           0 :     uno::Reference< uno::XInterface > xParent;
    3868           0 :     return xParent;
    3869             : }
    3870             : 
    3871             : //----------------------------------------------------------------------
    3872             : 
    3873           0 : void SAL_CALL SvxShape::setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& )
    3874             :     throw(lang::NoSupportException, uno::RuntimeException)
    3875             : {
    3876           0 :     throw lang::NoSupportException();
    3877             : }
    3878             : 
    3879             : //----------------------------------------------------------------------
    3880             : 
    3881             : /** called from the XActionLockable interface methods on initial locking */
    3882          24 : void SvxShape::lock()
    3883             : {
    3884          24 : }
    3885             : 
    3886             : //----------------------------------------------------------------------
    3887             : 
    3888             : /** called from the XActionLockable interface methods on final unlock */
    3889          24 : void SvxShape::unlock()
    3890             : {
    3891          24 : }
    3892             : 
    3893             : //----------------------------------------------------------------------
    3894             : 
    3895             : // XActionLockable
    3896           0 : sal_Bool SAL_CALL SvxShape::isActionLocked(  ) throw (::com::sun::star::uno::RuntimeException)
    3897             : {
    3898           0 :     ::SolarMutexGuard aGuard;
    3899             : 
    3900           0 :     return mnLockCount != 0;
    3901             : }
    3902             : 
    3903             : //----------------------------------------------------------------------
    3904             : 
    3905         176 : void SAL_CALL SvxShape::addActionLock(  ) throw (::com::sun::star::uno::RuntimeException)
    3906             : {
    3907         176 :     ::SolarMutexGuard aGuard;
    3908             : 
    3909             :     DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
    3910         176 :     mnLockCount++;
    3911             : 
    3912         176 :     if( mnLockCount == 1 )
    3913         176 :         lock();
    3914         176 : }
    3915             : 
    3916             : //----------------------------------------------------------------------
    3917             : 
    3918         176 : void SAL_CALL SvxShape::removeActionLock(  ) throw (::com::sun::star::uno::RuntimeException)
    3919             : {
    3920         176 :     ::SolarMutexGuard aGuard;
    3921             : 
    3922             :     DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
    3923         176 :     mnLockCount--;
    3924             : 
    3925         176 :     if( mnLockCount == 0 )
    3926         176 :         unlock();
    3927         176 : }
    3928             : 
    3929             : //----------------------------------------------------------------------
    3930             : 
    3931           0 : void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock ) throw (::com::sun::star::uno::RuntimeException )
    3932             : {
    3933           0 :     ::SolarMutexGuard aGuard;
    3934             : 
    3935           0 :     if( (mnLockCount == 0) && (nLock != 0) )
    3936           0 :         unlock();
    3937             : 
    3938           0 :     if( (mnLockCount != 0) && (nLock == 0) )
    3939           0 :         lock();
    3940             : 
    3941           0 :     mnLockCount = (sal_uInt16)nLock;
    3942           0 : }
    3943             : 
    3944             : //----------------------------------------------------------------------
    3945             : 
    3946           0 : sal_Int16 SAL_CALL SvxShape::resetActionLocks(  ) throw (::com::sun::star::uno::RuntimeException)
    3947             : {
    3948           0 :     ::SolarMutexGuard aGuard;
    3949             : 
    3950           0 :     if( mnLockCount != 0 )
    3951           0 :         unlock();
    3952             : 
    3953           0 :     sal_Int16 nOldLocks = (sal_Int16)mnLockCount;
    3954           0 :     mnLockCount = 0;
    3955             : 
    3956           0 :     return nOldLocks;
    3957             : }
    3958             : 
    3959             : //----------------------------------------------------------------------
    3960             : 
    3961             : /** since polygon shapes can change theire kind during editing, we have
    3962             :     to recheck it here.
    3963             :     Circle shapes also change theire kind, but theire all treated equal
    3964             :     so no update is necessary.
    3965             : */
    3966         966 : void SvxShape::updateShapeKind()
    3967             : {
    3968         966 :     switch( mpImpl->mnObjId )
    3969             :     {
    3970             :         case OBJ_LINE:
    3971             :         case OBJ_POLY:
    3972             :         case OBJ_PLIN:
    3973             :         case OBJ_PATHLINE:
    3974             :         case OBJ_PATHFILL:
    3975             :         case OBJ_FREELINE:
    3976             :         case OBJ_FREEFILL:
    3977             :         case OBJ_PATHPOLY:
    3978             :         case OBJ_PATHPLIN:
    3979             :         {
    3980         428 :             const sal_uInt32 nId = mpObj->GetObjIdentifier();
    3981             : 
    3982         428 :             if( nId != mpImpl->mnObjId )
    3983             :             {
    3984           4 :                 mpImpl->mnObjId = nId;
    3985             : 
    3986             :             }
    3987         428 :             break;
    3988             :         }
    3989             :     };
    3990         966 : }
    3991             : 
    3992             : /***********************************************************************
    3993             : * class SvxShapeText                                                   *
    3994             : ***********************************************************************/
    3995        1145 : SvxShapeText::SvxShapeText( SdrObject* pObject ) throw ()
    3996        1145 : : SvxShape( pObject, getSvxMapProvider().GetMap(SVXMAP_TEXT), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
    3997             : {
    3998        1145 :     if( pObject && pObject->GetModel() )
    3999         200 :         SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< uno::XWeak * >( this ) ) );
    4000        1145 : }
    4001             : 
    4002             : //----------------------------------------------------------------------
    4003        6930 : SvxShapeText::SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ()
    4004        6930 : : SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
    4005             : {
    4006        6930 :     if( pObject && pObject->GetModel() )
    4007        5573 :         SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< uno::XWeak * >( this ) ) );
    4008        6930 : }
    4009             : 
    4010             : //----------------------------------------------------------------------
    4011        9220 : SvxShapeText::~SvxShapeText() throw ()
    4012             : {
    4013             :     // check if only this instance is registered at the ranges
    4014             :     DBG_ASSERT( (NULL == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
    4015             :         "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
    4016        9220 : }
    4017             : 
    4018        2290 : void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
    4019             : {
    4020        2290 :     if( pNewObj && (NULL == GetEditSource()))
    4021        2290 :         SetEditSource( new SvxTextEditSource( pNewObj, 0, static_cast< uno::XWeak* >(this) ) );
    4022        2290 :     SvxShape::Create( pNewObj, pNewPage );
    4023        2290 : }
    4024             : 
    4025             : // XInterface
    4026             : //----------------------------------------------------------------------
    4027       42785 : uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
    4028             :     throw( uno::RuntimeException )
    4029             : {
    4030       42785 :     return SvxShape::queryInterface( rType );
    4031             : }
    4032             : 
    4033             : //----------------------------------------------------------------------
    4034             : 
    4035       44609 : uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
    4036             :     throw( uno::RuntimeException )
    4037             : {
    4038       44609 :     uno::Any aAny( SvxShape::queryAggregation( rType ) );
    4039       44609 :     if( aAny.hasValue() )
    4040       41385 :         return aAny;
    4041             : 
    4042        3224 :     return SvxUnoTextBase::queryAggregation( rType );
    4043             : }
    4044             : 
    4045             : //----------------------------------------------------------------------
    4046             : 
    4047      124451 : void SAL_CALL SvxShapeText::acquire() throw()
    4048             : {
    4049      124451 :     SvxShape::acquire();
    4050      124451 : }
    4051             : 
    4052             : //----------------------------------------------------------------------
    4053      124451 : void SAL_CALL SvxShapeText::release() throw()
    4054             : {
    4055      124451 :     SvxShape::release();
    4056      124451 : }
    4057             : 
    4058             : // XServiceInfo
    4059             : //----------------------------------------------------------------------
    4060           0 : OUString SAL_CALL SvxShapeText::getImplementationName() throw( uno::RuntimeException )
    4061             : {
    4062           0 :     static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShapeText") );
    4063           0 :     return aServiceName;
    4064             : }
    4065             : 
    4066             : //----------------------------------------------------------------------
    4067        1298 : uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException )
    4068             : {
    4069        1298 :     return SvxShape::getSupportedServiceNames();
    4070             : }
    4071             : 
    4072             : //----------------------------------------------------------------------
    4073        1238 : sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
    4074             : {
    4075        1238 :     return SvxShape::supportsService(ServiceName);
    4076             : }
    4077             : 
    4078             :     // XTypeProvider
    4079             : //----------------------------------------------------------------------
    4080           0 : uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
    4081             :     throw( uno::RuntimeException )
    4082             : {
    4083           0 :     return SvxShape::getTypes();
    4084             : }
    4085             : 
    4086       10246 : sal_Int64 SAL_CALL SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
    4087             : {
    4088       10246 :     const sal_Int64 nReturn = SvxShape::getSomething( rId );
    4089       10246 :     if( nReturn )
    4090        9354 :         return nReturn;
    4091             : 
    4092         892 :     return SvxUnoTextBase::getSomething( rId );
    4093             : }
    4094             : 
    4095             : //----------------------------------------------------------------------
    4096           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
    4097             :     throw( uno::RuntimeException )
    4098             : {
    4099             :     static ::cppu::OImplementationId* pID = NULL ;
    4100             : 
    4101           0 :     if ( pID == NULL )
    4102             :     {
    4103             :         // Ready for multithreading; get global mutex for first call of this method only! see before
    4104           0 :         MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
    4105             : 
    4106             :         // Control these pointer again ... it can be, that another instance will be faster then these!
    4107           0 :         if ( pID == NULL )
    4108             :         {
    4109             :             // Create a new static ID ...
    4110           0 :             static ::cppu::OImplementationId aID( sal_False ) ;
    4111             :             // ... and set his address to static pointer!
    4112           0 :             pID = &aID ;
    4113           0 :         }
    4114             :     }
    4115             : 
    4116           0 :     return pID->getImplementationId() ;
    4117             : }
    4118             : 
    4119             : //----------------------------------------------------------------------
    4120             : 
    4121             : /** called from the XActionLockable interface methods on initial locking */
    4122         152 : void SvxShapeText::lock()
    4123             : {
    4124         152 :     SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
    4125         152 :     if( pEditSource )
    4126         152 :         pEditSource->lock();
    4127         152 : }
    4128             : 
    4129             : //----------------------------------------------------------------------
    4130             : 
    4131             : /** called from the XActionLockable interface methods on final unlock */
    4132         152 : void SvxShapeText::unlock()
    4133             : {
    4134         152 :     SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
    4135         152 :     if( pEditSource )
    4136         152 :         pEditSource->unlock();
    4137         152 : }
    4138             : 
    4139             : // ::com::sun::star::text::XTextRange
    4140           0 : uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart() throw(uno::RuntimeException)
    4141             : {
    4142           0 :     ::SolarMutexGuard aGuard;
    4143           0 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    4144           0 :     if( pForwarder )
    4145           0 :         ::GetSelection( maSelection, pForwarder );
    4146           0 :     return SvxUnoTextBase::getStart();
    4147             : 
    4148             : }
    4149             : 
    4150           0 : uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd() throw(uno::RuntimeException)
    4151             : {
    4152           0 :     ::SolarMutexGuard aGuard;
    4153           0 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    4154           0 :     if( pForwarder )
    4155           0 :         ::GetSelection( maSelection, pForwarder );
    4156           0 :     return SvxUnoTextBase::getEnd();
    4157             : }
    4158             : 
    4159          82 : OUString SAL_CALL SvxShapeText::getString() throw(uno::RuntimeException)
    4160             : {
    4161          82 :     ::SolarMutexGuard aGuard;
    4162          82 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    4163          82 :     if( pForwarder )
    4164          82 :         ::GetSelection( maSelection, pForwarder );
    4165          82 :     return SvxUnoTextBase::getString();
    4166             : }
    4167             : 
    4168             : 
    4169         921 : void SAL_CALL SvxShapeText::setString( const OUString& aString ) throw(uno::RuntimeException)
    4170             : {
    4171         921 :     ::SolarMutexGuard aGuard;
    4172         921 :     SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
    4173         921 :     if( pForwarder )
    4174         921 :         ::GetSelection( maSelection, pForwarder );
    4175         921 :     SvxUnoTextBase::setString( aString );
    4176         921 : }
    4177             : 
    4178             : // overide these for special property handling in subcasses. Return true if property is handled
    4179       61589 : bool SvxShapeText::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    4180             : {
    4181             :     // HACK-fix #99090#
    4182             :     // since SdrTextObj::SetVerticalWriting exchanges
    4183             :     // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
    4184             :     // we have to set the textdirection here
    4185             : 
    4186       61589 :     if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
    4187             :     {
    4188          17 :         SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
    4189          17 :         if( pTextObj )
    4190             :         {
    4191             :             com::sun::star::text::WritingMode eMode;
    4192          17 :             if( rValue >>= eMode )
    4193             :             {
    4194          17 :                 pTextObj->SetVerticalWriting( eMode == com::sun::star::text::WritingMode_TB_RL );
    4195             :             }
    4196             :         }
    4197          17 :         return true;
    4198             :     }
    4199       61572 :     return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
    4200             : }
    4201             : 
    4202         844 : bool SvxShapeText::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    4203             : {
    4204         844 :     if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
    4205             :     {
    4206          12 :         SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
    4207          12 :         if( pTextObj && pTextObj->IsVerticalWriting() )
    4208           0 :             rValue <<= com::sun::star::text::WritingMode_TB_RL;
    4209             :         else
    4210          12 :             rValue <<= com::sun::star::text::WritingMode_LR_TB;
    4211          12 :         return true;
    4212             :     }
    4213             : 
    4214         832 :     return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
    4215             : }
    4216             : 
    4217           1 : bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
    4218             : {
    4219           1 :     return SvxShape::getPropertyStateImpl( pProperty, rState );
    4220             : }
    4221             : 
    4222           0 : bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
    4223             : {
    4224           0 :     return SvxShape::setPropertyToDefaultImpl( pProperty );
    4225             : }
    4226             : 
    4227             : /***********************************************************************
    4228             : * class SvxShapeRect                                                   *
    4229             : ***********************************************************************/
    4230             : DBG_NAME(SvxShapeRect)
    4231         837 : SvxShapeRect::SvxShapeRect( SdrObject* pObj ) throw()
    4232         837 : : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_SHAPE), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
    4233             : {
    4234             :     DBG_CTOR(SvxShapeRect,NULL);
    4235         837 : }
    4236             : 
    4237        1674 : SvxShapeRect::~SvxShapeRect() throw()
    4238             : {
    4239             :     DBG_DTOR(SvxShapeRect,NULL);
    4240        1674 : }
    4241             : 
    4242        4820 : uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
    4243             : {
    4244        4820 :     return SvxShapeText::queryInterface( rType );
    4245             : }
    4246             : 
    4247        4966 : uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
    4248             : {
    4249        4966 :     return SvxShapeText::queryAggregation( rType );
    4250             : }
    4251             : 
    4252       13612 : void SAL_CALL SvxShapeRect::acquire() throw()
    4253             : {
    4254       13612 :     OWeakAggObject::acquire();
    4255       13612 : }
    4256             : 
    4257       13612 : void SAL_CALL SvxShapeRect::release() throw()
    4258             : {
    4259       13612 :     OWeakAggObject::release();
    4260       13612 : }
    4261             : //----------------------------------------------------------------------
    4262             : // XServiceInfo
    4263             : //----------------------------------------------------------------------
    4264          18 : uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames(void) throw( uno::RuntimeException )
    4265             : {
    4266          18 :     return SvxShape::getSupportedServiceNames();
    4267             : }
    4268             : 
    4269             : /** returns a StarOffice API wrapper for the given SdrObject */
    4270        4655 : uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw ()
    4271             : {
    4272        4655 :     uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
    4273        4655 :     return xShape;
    4274             : }
    4275             : 
    4276             : /** returns the SdrObject from the given StarOffice API wrapper */
    4277           2 : SdrObject* GetSdrObjectFromXShape( uno::Reference< drawing::XShape > xShape ) throw()
    4278             : {
    4279           2 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
    4280           2 :     return pShape ? pShape->GetSdrObject() : 0;
    4281             : }
    4282             : 
    4283             : //----------------------------------------------------------------------
    4284             : 
    4285           8 : SdrObject* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt )
    4286             : {
    4287           8 :     SvxShape* pSvxShape = SvxShape::getImplementation( xInt );
    4288           8 :     return pSvxShape ? pSvxShape->GetSdrObject() : 0;
    4289             : }
    4290             : 
    4291        4802 : uno::Any SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet )
    4292             : {
    4293        4802 :     if(!pMap || !pMap->nWID)
    4294           0 :         return uno::Any();
    4295             : 
    4296             :     // Check is for items that store either metric values if thei are positiv or percentage if thei are negativ.
    4297        4802 :     bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
    4298        4802 :     return rPropSet.getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
    4299             : }
    4300             : 
    4301       63771 : void SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
    4302             : {
    4303       63771 :     uno::Any aVal(rVal);
    4304       63771 :     if(!pMap || !pMap->nWID)
    4305       63771 :         return;
    4306             : 
    4307       63771 :     bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
    4308       63771 :     if( pMap->nWID == EE_PARA_LRSPACE ) // n#757419 Don't import negative values
    4309             :     {
    4310          33 :         sal_Int32 nVal = sal_Int32();
    4311          33 :         if( (aVal >>= nVal) && nVal < 0 )
    4312           1 :             aVal <<= ( sal_Int32 ) 0;
    4313             :     }
    4314       63771 :     rPropSet.setPropertyValue( pMap, aVal, rSet, bDontConvertNegativeValues );
    4315          63 : }
    4316             : 
    4317             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10