LCOV - code coverage report
Current view: top level - svx/source/unodraw - unoshape.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1119 1660 67.4 %
Date: 2015-06-13 12:38:46 Functions: 116 142 81.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11