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

Generated by: LCOV version 1.10