LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svx/source/unodraw - unoshap2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 531 830 64.0 %
Date: 2013-07-09 Functions: 101 128 78.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/lang/DisposedException.hpp>
      21             : #include <com/sun/star/awt/FontSlant.hpp>
      22             : #include <com/sun/star/style/VerticalAlignment.hpp>
      23             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      24             : #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
      25             : #include <com/sun/star/awt/TextAlign.hpp>
      26             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      27             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      28             : #include <com/sun/star/drawing/PointSequence.hpp>
      29             : #include <com/sun/star/graphic/XGraphic.hpp>
      30             : #include <tools/urlobj.hxx>
      31             : #include <unotools/localfilehelper.hxx>
      32             : #include <vcl/svapp.hxx>
      33             : #include <osl/mutex.hxx>
      34             : #include <vcl/fltcall.hxx>
      35             : #include <vcl/graphicfilter.hxx>
      36             : 
      37             : #include <boost/scoped_ptr.hpp>
      38             : #include <svx/svdpool.hxx>
      39             : 
      40             : #include <editeng/unoprnms.hxx>
      41             : #include <svx/unoshape.hxx>
      42             : #include <svx/unopage.hxx>
      43             : #include <svx/svdobj.hxx>
      44             : #include <svx/svdpage.hxx>
      45             : #include <svx/svdmodel.hxx>
      46             : #include <svx/svdouno.hxx>
      47             : #include "shapeimpl.hxx"
      48             : #include "svx/unoshprp.hxx"
      49             : #include <svx/svdoashp.hxx>
      50             : 
      51             : // #i29181#
      52             : #include "svx/svdviter.hxx"
      53             : #include <svx/svdview.hxx>
      54             : #include <basegfx/matrix/b2dhommatrix.hxx>
      55             : #include <basegfx/polygon/b2dpolygon.hxx>
      56             : #include <basegfx/point/b2dpoint.hxx>
      57             : #include <basegfx/polygon/b2dpolygontools.hxx>
      58             : #include <basegfx/tools/unotools.hxx>
      59             : 
      60             : #include <comphelper/servicehelper.hxx>
      61             : #include <vcl/wmf.hxx>
      62             : 
      63             : using namespace ::osl;
      64             : using namespace ::cppu;
      65             : using namespace ::com::sun::star;
      66             : using namespace ::com::sun::star::uno;
      67             : using namespace ::com::sun::star::lang;
      68             : using namespace ::com::sun::star::container;
      69             : 
      70             : #define QUERYINT( xint ) \
      71             :     if( rType == ::getCppuType((const Reference< xint >*)0) ) \
      72             :         aAny <<= Reference< xint >(this)
      73             : 
      74             : /***********************************************************************
      75             : * class SvxShapeGroup                                                  *
      76             : ***********************************************************************/
      77             : 
      78       30490 : SvxShapeGroup::SvxShapeGroup( SdrObject* pObj, SvxDrawPage* pDrawPage  )  throw() :
      79       91470 :     SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_GROUP), getSvxMapProvider().GetPropertySet(SVXMAP_GROUP, SdrObject::GetGlobalDrawObjectItemPool()) ),
      80       91470 :     mxPage( pDrawPage )
      81             : {
      82       30490 : }
      83             : 
      84             : //----------------------------------------------------------------------
      85       60980 : SvxShapeGroup::~SvxShapeGroup() throw()
      86             : {
      87       60980 : }
      88             : 
      89             : //----------------------------------------------------------------------
      90       18161 : void SvxShapeGroup::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
      91             : {
      92       18161 :     SvxShape::Create( pNewObj, pNewPage );
      93       18161 :     mxPage = pNewPage;
      94       18161 : }
      95             : 
      96             : //----------------------------------------------------------------------
      97      367257 : uno::Any SAL_CALL SvxShapeGroup::queryInterface( const uno::Type & rType )
      98             :     throw(uno::RuntimeException)
      99             : {
     100      367257 :     return SvxShape::queryInterface( rType );
     101             : }
     102             : 
     103      367435 : uno::Any SAL_CALL SvxShapeGroup::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
     104             : {
     105      367435 :     uno::Any aAny;
     106             : 
     107      367435 :     QUERYINT( drawing::XShapeGroup );
     108      346230 :     else QUERYINT( drawing::XShapes );
     109      308675 :     else QUERYINT( container::XIndexAccess );
     110      308650 :     else QUERYINT( container::XElementAccess );
     111             :     else
     112      308650 :         return SvxShape::queryAggregation( rType );
     113             : 
     114       58785 :     return aAny;
     115             : }
     116             : 
     117      974335 : void SAL_CALL SvxShapeGroup::acquire() throw ( )
     118             : {
     119      974335 :     SvxShape::acquire();
     120      974335 : }
     121             : 
     122      974335 : void SAL_CALL SvxShapeGroup::release() throw ( )
     123             : {
     124      974335 :     SvxShape::release();
     125      974335 : }
     126             : 
     127           0 : uno::Sequence< uno::Type > SAL_CALL SvxShapeGroup::getTypes()
     128             :     throw (uno::RuntimeException)
     129             : {
     130           0 :     return SvxShape::getTypes();
     131             : }
     132             : 
     133             : namespace
     134             : {
     135             :     class theSvxShapeGroupImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeGroupImplementationId > {};
     136             : }
     137             : 
     138           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShapeGroup::getImplementationId()
     139             :     throw (uno::RuntimeException)
     140             : {
     141           0 :     return theSvxShapeGroupImplementationId::get().getSeq();
     142             : }
     143             : 
     144             : // ::com::sun::star::drawing::XShape
     145             : 
     146             : //----------------------------------------------------------------------
     147       36334 : OUString SAL_CALL SvxShapeGroup::getShapeType()
     148             :     throw( uno::RuntimeException )
     149             : {
     150       36334 :     return SvxShape::getShapeType();
     151             : }
     152             : 
     153             : //------------------------------------------------------------------1----
     154       19418 : awt::Point SAL_CALL SvxShapeGroup::getPosition() throw(uno::RuntimeException)
     155             : {
     156       19418 :     return SvxShape::getPosition();
     157             : }
     158             : 
     159             : //----------------------------------------------------------------------
     160       20425 : void SAL_CALL SvxShapeGroup::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
     161             : {
     162       20425 :     SvxShape::setPosition(Position);
     163       20425 : }
     164             : 
     165             : //----------------------------------------------------------------------
     166             : 
     167       19950 : awt::Size SAL_CALL SvxShapeGroup::getSize() throw(uno::RuntimeException)
     168             : {
     169       19950 :     return SvxShape::getSize();
     170             : }
     171             : 
     172             : //----------------------------------------------------------------------
     173       34067 : void SAL_CALL SvxShapeGroup::setSize( const awt::Size& rSize )
     174             :     throw(beans::PropertyVetoException, uno::RuntimeException)
     175             : {
     176       34067 :     SvxShape::setSize( rSize );
     177       34067 : }
     178             : 
     179             : // drawing::XShapeGroup
     180             : 
     181             : //----------------------------------------------------------------------
     182           0 : void SAL_CALL SvxShapeGroup::enterGroup(  ) throw(uno::RuntimeException)
     183             : {
     184             :     // Todo
     185             : //  pDrView->EnterMarkedGroup();
     186           0 : }
     187             : 
     188             : //----------------------------------------------------------------------
     189           0 : void SAL_CALL SvxShapeGroup::leaveGroup(  ) throw(uno::RuntimeException)
     190             : {
     191             :     // Todo
     192             : //  pDrView->LeaveOneGroup();
     193           0 : }
     194             : 
     195             : //----------------------------------------------------------------------
     196             : 
     197             : // XShapes
     198       45537 : void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShape )
     199             :     throw( uno::RuntimeException )
     200             : {
     201       45537 :     ::SolarMutexGuard aGuard;
     202             : 
     203       45537 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
     204             : 
     205       45537 :     if( mpObj.is()&& mxPage.is() && pShape )
     206             :     {
     207       45537 :         SdrObject* pSdrShape = pShape->GetSdrObject();
     208       45537 :         if( pSdrShape == NULL )
     209       45537 :             pSdrShape = mxPage->_CreateSdrObject( xShape );
     210             : 
     211       45537 :         if( pSdrShape->IsInserted() )
     212           0 :             pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() );
     213             : 
     214       45537 :         mpObj->GetSubList()->InsertObject( pSdrShape );
     215       45537 :         pSdrShape->SetModel(mpObj->GetModel());
     216             : 
     217             :         // #85922# It makes no sense to set the layer asked
     218             :         // from the group object since these is an iteration
     219             :         // over the contained objects. In consequence, this
     220             :         // statement erases all layer information from the draw
     221             :         // objects. Layers need to be set at draw objects directly
     222             :         // and have nothing to do with grouping at all.
     223             :         // pSdrShape->SetLayer(pObject->GetLayer());
     224             : 
     225             :         // Establish connection between new SdrObject and its wrapper before
     226             :         // inserting the new shape into the group.  There a new wrapper
     227             :         // would be created when this connection would not already exist.
     228       45537 :         pShape->Create( pSdrShape, mxPage.get() );
     229             : 
     230       45537 :         if( mpModel )
     231       45537 :             mpModel->SetChanged();
     232             :     }
     233             :     else
     234             :     {
     235             :         OSL_FAIL("could not add XShape to group shape!");
     236       45537 :     }
     237       45537 : }
     238             : 
     239             : //----------------------------------------------------------------------
     240        9456 : void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xShape )
     241             :     throw( uno::RuntimeException )
     242             : {
     243        9456 :     ::SolarMutexGuard aGuard;
     244             : 
     245        9456 :     SdrObject* pSdrShape = NULL;
     246        9456 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
     247             : 
     248        9456 :     if( pShape )
     249        9456 :         pSdrShape = pShape->GetSdrObject();
     250             : 
     251        9456 :     if( !mpObj.is() || pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get() )
     252           0 :         throw uno::RuntimeException();
     253             : 
     254        9456 :     SdrObjList& rList = *pSdrShape->GetObjList();
     255             : 
     256        9456 :     const sal_uInt32 nObjCount = rList.GetObjCount();
     257        9456 :     sal_uInt32 nObjNum = 0;
     258       29654 :     while( nObjNum < nObjCount )
     259             :     {
     260       20198 :         if(rList.GetObj( nObjNum ) == pSdrShape )
     261        9456 :             break;
     262       10742 :         nObjNum++;
     263             :     }
     264             : 
     265        9456 :     if( nObjNum < nObjCount )
     266             :     {
     267             :         // #i29181#
     268             :         // If the SdrObject which is about to be deleted is in any selection,
     269             :         // deselect it first.
     270        9456 :         SdrViewIter aIter( pSdrShape );
     271             : 
     272        9456 :         for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
     273             :         {
     274           0 :             if(CONTAINER_ENTRY_NOTFOUND != pView->TryToFindMarkedObject(pSdrShape))
     275             :             {
     276           0 :                 pView->MarkObj(pSdrShape, pView->GetSdrPageView(), sal_True, sal_False);
     277             :             }
     278             :         }
     279             : 
     280        9456 :         SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
     281        9456 :         SdrObject::Free( pObject );
     282             :     }
     283             :     else
     284             :     {
     285             :         DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
     286             :     }
     287             : 
     288        9456 :     if( mpModel )
     289        9456 :         mpModel->SetChanged();
     290        9456 : }
     291             : 
     292             : // XIndexAccess
     293             : 
     294             : //----------------------------------------------------------------------
     295       36508 : sal_Int32 SAL_CALL SvxShapeGroup::getCount() throw( uno::RuntimeException )
     296             : {
     297       36508 :     ::SolarMutexGuard aGuard;
     298             : 
     299       36508 :     sal_Int32 nRetval = 0;
     300             : 
     301       36508 :     if(mpObj.is() && mpObj->GetSubList())
     302       36508 :         nRetval = mpObj->GetSubList()->GetObjCount();
     303             :     else
     304           0 :         throw uno::RuntimeException();
     305             : 
     306       36508 :     return nRetval;
     307             : }
     308             : 
     309             : //----------------------------------------------------------------------
     310       42904 : uno::Any SAL_CALL SvxShapeGroup::getByIndex( sal_Int32 Index )
     311             :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
     312             : {
     313       42904 :     ::SolarMutexGuard aGuard;
     314             : 
     315       42904 :     if( !mpObj.is() || mpObj->GetSubList() == NULL )
     316           0 :         throw uno::RuntimeException();
     317             : 
     318       42904 :     if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
     319           0 :         throw lang::IndexOutOfBoundsException();
     320             : 
     321       42904 :     SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
     322             : 
     323       42904 :     if(pDestObj == NULL)
     324           0 :         throw lang::IndexOutOfBoundsException();
     325             : 
     326       85808 :     Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
     327       85808 :     return uno::makeAny( xShape );
     328             : }
     329             : 
     330             : // ::com::sun::star::container::XElementAccess
     331             : 
     332             : //----------------------------------------------------------------------
     333           0 : uno::Type SAL_CALL SvxShapeGroup::getElementType() throw( uno::RuntimeException )
     334             : {
     335           0 :     return ::getCppuType(( const Reference< drawing::XShape >*)0);
     336             : }
     337             : 
     338             : //----------------------------------------------------------------------
     339          11 : sal_Bool SAL_CALL SvxShapeGroup::hasElements() throw( uno::RuntimeException )
     340             : {
     341          11 :     ::SolarMutexGuard aGuard;
     342             : 
     343          11 :     return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
     344             : }
     345             : 
     346             : //----------------------------------------------------------------------
     347             : // ::com::sun::star::lang::XServiceInfo
     348             : 
     349          29 : uno::Sequence< OUString > SAL_CALL SvxShapeGroup::getSupportedServiceNames()
     350             :     throw(uno::RuntimeException)
     351             : {
     352          29 :     return SvxShape::getSupportedServiceNames();
     353             : }
     354             : 
     355             : /***********************************************************************
     356             : *                                                                      *
     357             : ***********************************************************************/
     358             : 
     359           7 : SvxShapeConnector::SvxShapeConnector( SdrObject* pObj )  throw() :
     360           7 :     SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CONNECTOR), getSvxMapProvider().GetPropertySet(SVXMAP_CONNECTOR, SdrObject::GetGlobalDrawObjectItemPool()) )
     361             : {
     362           7 : }
     363             : 
     364             : //----------------------------------------------------------------------
     365          14 : SvxShapeConnector::~SvxShapeConnector() throw()
     366             : {
     367          14 : }
     368             : 
     369             : //----------------------------------------------------------------------
     370             : 
     371          56 : uno::Any SAL_CALL SvxShapeConnector::queryInterface( const uno::Type & rType )
     372             :     throw(uno::RuntimeException)
     373             : {
     374          56 :     return SvxShapeText::queryInterface( rType );
     375             : }
     376             : 
     377          55 : uno::Any SAL_CALL SvxShapeConnector::queryAggregation( const uno::Type & rType )
     378             :     throw(uno::RuntimeException)
     379             : {
     380          55 :     uno::Any aAny;
     381             : 
     382          55 :     QUERYINT( drawing::XConnectorShape );
     383             :     else
     384          55 :         return SvxShapeText::queryAggregation( rType );
     385             : 
     386           0 :     return aAny;
     387             : }
     388             : 
     389         176 : void SAL_CALL SvxShapeConnector::acquire() throw ( )
     390             : {
     391         176 :     SvxShapeText::acquire();
     392         176 : }
     393             : 
     394         176 : void SAL_CALL SvxShapeConnector::release() throw ( )
     395             : {
     396         176 :     SvxShapeText::release();
     397         176 : }
     398             : // XTypeProvider
     399             : 
     400           0 : uno::Sequence< uno::Type > SAL_CALL SvxShapeConnector::getTypes()
     401             :     throw (uno::RuntimeException)
     402             : {
     403           0 :     return SvxShape::getTypes();
     404             : }
     405             : 
     406             : namespace
     407             : {
     408             :     class theSvxShapeConnectorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeConnectorImplementationId > {};
     409             : }
     410             : 
     411           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShapeConnector::getImplementationId()
     412             :     throw (uno::RuntimeException)
     413             : {
     414           0 :     return theSvxShapeConnectorImplementationId::get().getSeq();
     415             : }
     416             : 
     417             : // ::com::sun::star::drawing::XShape
     418             : 
     419             : //----------------------------------------------------------------------
     420           3 : OUString SAL_CALL SvxShapeConnector::getShapeType()
     421             :     throw( uno::RuntimeException )
     422             : {
     423           3 :     return SvxShapeText::getShapeType();
     424             : }
     425             : 
     426             : //------------------------------------------------------------------1----
     427           1 : awt::Point SAL_CALL SvxShapeConnector::getPosition() throw(uno::RuntimeException)
     428             : {
     429           1 :     return SvxShapeText::getPosition();
     430             : }
     431             : 
     432             : //----------------------------------------------------------------------
     433           1 : void SAL_CALL SvxShapeConnector::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
     434             : {
     435           1 :     SvxShapeText::setPosition(Position);
     436           1 : }
     437             : 
     438             : //----------------------------------------------------------------------
     439             : 
     440           1 : awt::Size SAL_CALL SvxShapeConnector::getSize() throw(uno::RuntimeException)
     441             : {
     442           1 :     return SvxShapeText::getSize();
     443             : }
     444             : 
     445             : //----------------------------------------------------------------------
     446           1 : void SAL_CALL SvxShapeConnector::setSize( const awt::Size& rSize )
     447             :     throw(beans::PropertyVetoException, uno::RuntimeException)
     448             : {
     449           1 :     SvxShapeText::setSize( rSize );
     450           1 : }
     451             : 
     452             : //----------------------------------------------------------------------
     453             : 
     454             : // XConnectorShape
     455             : 
     456           0 : void SAL_CALL SvxShapeConnector::connectStart( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType ) throw( uno::RuntimeException )
     457             : {
     458           0 :     ::SolarMutexGuard aGuard;
     459             : 
     460           0 :     Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
     461           0 :     SvxShape* pShape = SvxShape::getImplementation( xRef );
     462             : 
     463           0 :     if( pShape )
     464           0 :         mpObj->ConnectToNode( sal_True, pShape->mpObj.get() );
     465             : 
     466           0 :     if( mpModel )
     467           0 :         mpModel->SetChanged();
     468           0 : }
     469             : 
     470             : //----------------------------------------------------------------------
     471           0 : void SAL_CALL SvxShapeConnector::connectEnd( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType  )
     472             :     throw( uno::RuntimeException )
     473             : {
     474           0 :     ::SolarMutexGuard aGuard;
     475             : 
     476           0 :     Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
     477           0 :     SvxShape* pShape = SvxShape::getImplementation( xRef );
     478             : 
     479           0 :     if( mpObj.is() && pShape )
     480           0 :         mpObj->ConnectToNode( sal_False, pShape->mpObj.get() );
     481             : 
     482           0 :     if( mpModel )
     483           0 :         mpModel->SetChanged();
     484           0 : }
     485             : 
     486             : //----------------------------------------------------------------------
     487           0 : void SAL_CALL SvxShapeConnector::disconnectBegin( const uno::Reference< drawing::XConnectableShape >&  )
     488             :     throw( uno::RuntimeException )
     489             : {
     490           0 :     ::SolarMutexGuard aGuard;
     491             : 
     492           0 :     if(mpObj.is())
     493           0 :         mpObj->DisconnectFromNode( sal_True );
     494             : 
     495           0 :     if( mpModel )
     496           0 :         mpModel->SetChanged();
     497           0 : }
     498             : 
     499             : //----------------------------------------------------------------------
     500           0 : void SAL_CALL SvxShapeConnector::disconnectEnd( const uno::Reference< drawing::XConnectableShape >& )
     501             :     throw( uno::RuntimeException )
     502             : {
     503           0 :     ::SolarMutexGuard aGuard;
     504             : 
     505           0 :     if(mpObj.is())
     506           0 :         mpObj->DisconnectFromNode( sal_False );
     507             : 
     508           0 :     if( mpModel )
     509           0 :         mpModel->SetChanged();
     510           0 : }
     511             : 
     512             : //----------------------------------------------------------------------
     513             : // ::com::sun::star::lang::XServiceInfo
     514             : //----------------------------------------------------------------------
     515           0 : uno::Sequence< OUString > SAL_CALL SvxShapeConnector::getSupportedServiceNames() throw( uno::RuntimeException )
     516             : {
     517           0 :     return SvxShapeText::getSupportedServiceNames();
     518             : }
     519             : 
     520             : /***********************************************************************
     521             : * class SvxShapeControl                                                *
     522             : ***********************************************************************/
     523             : DBG_NAME(SvxShapeControl)
     524             : 
     525         377 : SvxShapeControl::SvxShapeControl( SdrObject* pObj )  throw() :
     526         377 :     SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CONTROL), getSvxMapProvider().GetPropertySet(SVXMAP_CONTROL, SdrObject::GetGlobalDrawObjectItemPool()) )
     527             : {
     528             :     DBG_CTOR(SvxShapeControl,NULL);
     529         377 :     setShapeKind( OBJ_UNO );
     530         377 : }
     531             : 
     532             : //----------------------------------------------------------------------
     533         740 : SvxShapeControl::~SvxShapeControl() throw()
     534             : {
     535             :     DBG_DTOR(SvxShapeControl,NULL);
     536         740 : }
     537             : 
     538             : //----------------------------------------------------------------------
     539        5214 : uno::Any SAL_CALL SvxShapeControl::queryInterface( const uno::Type & rType )
     540             :     throw(uno::RuntimeException)
     541             : {
     542        5214 :     return SvxShapeText::queryInterface( rType );
     543             : }
     544             : 
     545        3981 : uno::Any SAL_CALL SvxShapeControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
     546             : {
     547        3981 :     uno::Any aAny;
     548             : 
     549        3981 :     QUERYINT( drawing::XControlShape );
     550             :     else
     551        3330 :         return SvxShapeText::queryAggregation( rType );
     552             : 
     553         651 :     return aAny;
     554             : }
     555             : 
     556       17286 : void SAL_CALL SvxShapeControl::acquire() throw ( )
     557             : {
     558       17286 :     SvxShapeText::acquire();
     559       17286 : }
     560             : 
     561       17272 : void SAL_CALL SvxShapeControl::release() throw ( )
     562             : {
     563       17272 :     SvxShapeText::release();
     564       17272 : }
     565             : // XTypeProvider
     566             : 
     567           0 : uno::Sequence< uno::Type > SAL_CALL SvxShapeControl::getTypes()
     568             :     throw (uno::RuntimeException)
     569             : {
     570           0 :     return SvxShape::getTypes();
     571             : }
     572             : 
     573             : namespace
     574             : {
     575             :     class theSvxShapeControlImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeControlImplementationId > {};
     576             : }
     577             : 
     578           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShapeControl::getImplementationId()
     579             :     throw (uno::RuntimeException)
     580             : {
     581           0 :     return theSvxShapeControlImplementationId::get().getSeq();
     582             : }
     583             : 
     584             : // ::com::sun::star::drawing::XShape
     585             : 
     586             : //----------------------------------------------------------------------
     587          20 : OUString SAL_CALL SvxShapeControl::getShapeType()
     588             :     throw( uno::RuntimeException )
     589             : {
     590          20 :     return SvxShapeText::getShapeType();
     591             : }
     592             : 
     593             : //------------------------------------------------------------------1----
     594         256 : awt::Point SAL_CALL SvxShapeControl::getPosition() throw(uno::RuntimeException)
     595             : {
     596         256 :     return SvxShapeText::getPosition();
     597             : }
     598             : 
     599             : //----------------------------------------------------------------------
     600         729 : void SAL_CALL SvxShapeControl::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
     601             : {
     602         729 :     SvxShapeText::setPosition(Position);
     603         729 : }
     604             : 
     605             : //----------------------------------------------------------------------
     606             : 
     607           0 : awt::Size SAL_CALL SvxShapeControl::getSize() throw(uno::RuntimeException)
     608             : {
     609           0 :     return SvxShapeText::getSize();
     610             : }
     611             : 
     612             : //----------------------------------------------------------------------
     613         499 : void SAL_CALL SvxShapeControl::setSize( const awt::Size& rSize )
     614             :     throw(beans::PropertyVetoException, uno::RuntimeException)
     615             : {
     616         499 :     SvxShapeText::setSize( rSize );
     617         499 : }
     618             : 
     619             : //----------------------------------------------------------------------
     620             : // XControlShape
     621             : 
     622         591 : Reference< awt::XControlModel > SAL_CALL SvxShapeControl::getControl()
     623             :     throw( uno::RuntimeException )
     624             : {
     625         591 :     ::SolarMutexGuard aGuard;
     626             : 
     627         591 :     Reference< awt::XControlModel > xModel;
     628             : 
     629         591 :     SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
     630         591 :     if( pUnoObj )
     631         590 :         xModel = pUnoObj->GetUnoControlModel();
     632             : 
     633         591 :     return xModel;
     634             : }
     635             : 
     636             : //----------------------------------------------------------------------
     637         300 : void SAL_CALL SvxShapeControl::setControl( const Reference< awt::XControlModel >& xControl )
     638             :     throw( uno::RuntimeException )
     639             : {
     640         300 :     ::SolarMutexGuard aGuard;
     641             : 
     642         300 :     SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
     643         300 :     if( pUnoObj )
     644         300 :         pUnoObj->SetUnoControlModel( xControl );
     645             : 
     646         300 :     if( mpModel )
     647          29 :         mpModel->SetChanged();
     648         300 : }
     649             : 
     650             : // XServiceInfo
     651           0 : uno::Sequence< OUString > SAL_CALL SvxShapeControl::getSupportedServiceNames() throw( uno::RuntimeException )
     652             : {
     653           0 :     return SvxShapeText::getSupportedServiceNames();
     654             : }
     655             : 
     656             : static struct
     657             : {
     658             :     const sal_Char* mpAPIName;
     659             :     sal_uInt16 mnAPINameLen;
     660             : 
     661             :     const sal_Char* mpFormName;
     662             :     sal_uInt16 mnFormNameLen;
     663             : }
     664             : SvxShapeControlPropertyMapping[] =
     665             : {
     666             :     // Warning: The first entry must be FontSlant because the any needs to be converted
     667             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), MAP_CHAR_LEN("FontSlant")  }, //  const sal_Int16 => ::com::sun::star::awt::FontSlant
     668             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), MAP_CHAR_LEN("FontName") },
     669             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME), MAP_CHAR_LEN("FontStyleName") },
     670             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), MAP_CHAR_LEN("FontFamily") },
     671             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), MAP_CHAR_LEN("FontCharset") },
     672             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), MAP_CHAR_LEN("FontHeight") },
     673             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), MAP_CHAR_LEN("FontPitch" ) },
     674             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), MAP_CHAR_LEN("FontWeight" ) },
     675             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), MAP_CHAR_LEN("FontUnderline") },
     676             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), MAP_CHAR_LEN("FontStrikeout") },
     677             :     { MAP_CHAR_LEN("CharKerning"), MAP_CHAR_LEN("FontKerning") },
     678             :     { MAP_CHAR_LEN("CharWordMode"), MAP_CHAR_LEN("FontWordLineMode" ) },
     679             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR),   MAP_CHAR_LEN("TextColor") },
     680             :     { MAP_CHAR_LEN("CharRelief"),   MAP_CHAR_LEN("FontRelief") },
     681             :     { MAP_CHAR_LEN("CharUnderlineColor"),   MAP_CHAR_LEN("TextLineColor") },
     682             :     { MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), MAP_CHAR_LEN("Align") },
     683             :     { MAP_CHAR_LEN("TextVerticalAdjust"), MAP_CHAR_LEN("VerticalAlign") },
     684             :     { MAP_CHAR_LEN("ControlBackground"), MAP_CHAR_LEN("BackgroundColor") },
     685             :     { MAP_CHAR_LEN("ControlSymbolColor"), MAP_CHAR_LEN("SymbolColor") },
     686             :     { MAP_CHAR_LEN("ControlBorder"), MAP_CHAR_LEN("Border") },
     687             :     { MAP_CHAR_LEN("ControlBorderColor"), MAP_CHAR_LEN("BorderColor") },
     688             :     { MAP_CHAR_LEN("ControlTextEmphasis"),  MAP_CHAR_LEN("FontEmphasisMark") },
     689             :     { MAP_CHAR_LEN("ImageScaleMode"),  MAP_CHAR_LEN("ScaleMode") },
     690             :     { MAP_CHAR_LEN("ControlWritingMode"), MAP_CHAR_LEN("WritingMode") },
     691             :     //added for exporting OCX control
     692             :     { MAP_CHAR_LEN("ControlTypeinMSO"), MAP_CHAR_LEN("ControlTypeinMSO") },
     693             :     { MAP_CHAR_LEN("ObjIDinMSO"), MAP_CHAR_LEN("ObjIDinMSO") },
     694             :     { NULL,0, NULL, 0 }
     695             : };
     696             : 
     697             : namespace
     698             : {
     699          73 :     static bool lcl_convertPropertyName( const OUString& rApiName, OUString& rInternalName )
     700             :     {
     701          73 :         sal_uInt16 i = 0;
     702        2044 :         while( SvxShapeControlPropertyMapping[i].mpAPIName )
     703             :         {
     704        1898 :             if( rApiName.reverseCompareToAsciiL( SvxShapeControlPropertyMapping[i].mpAPIName, SvxShapeControlPropertyMapping[i].mnAPINameLen ) == 0 )
     705             :             {
     706          18 :                 rInternalName = OUString( SvxShapeControlPropertyMapping[i].mpFormName, SvxShapeControlPropertyMapping[i].mnFormNameLen, RTL_TEXTENCODING_ASCII_US );
     707             :             }
     708        1898 :             ++i;
     709             :         }
     710          73 :         return !rInternalName.isEmpty();
     711             :     }
     712             : 
     713             :     struct EnumConversionMap
     714             :     {
     715             :         sal_Int16   nAPIValue;
     716             :         sal_Int16   nFormValue;
     717             :     };
     718             : 
     719             :     EnumConversionMap aMapAdjustToAlign[] =
     720             :     {
     721             :         // note that order matters:
     722             :         // lcl_convertTextAlignmentToParaAdjustment and lcl_convertParaAdjustmentToTextAlignment search this map from the _beginning_
     723             :         // and use the first matching entry
     724             :         {style::ParagraphAdjust_LEFT,           (sal_Int16)awt::TextAlign::LEFT},
     725             :         {style::ParagraphAdjust_CENTER,         (sal_Int16)awt::TextAlign::CENTER},
     726             :         {style::ParagraphAdjust_RIGHT,          (sal_Int16)awt::TextAlign::RIGHT},
     727             :         {style::ParagraphAdjust_BLOCK,          (sal_Int16)awt::TextAlign::RIGHT},
     728             :         {style::ParagraphAdjust_STRETCH,        (sal_Int16)awt::TextAlign::LEFT},
     729             :         {-1,-1}
     730             :     };
     731             : 
     732           0 :     static void lcl_mapFormToAPIValue( Any& _rValue, const EnumConversionMap* _pMap )
     733             :     {
     734           0 :         sal_Int16 nValue = sal_Int16();
     735           0 :         OSL_VERIFY( _rValue >>= nValue );
     736             : 
     737           0 :         const EnumConversionMap* pEntry = _pMap;
     738           0 :         while ( pEntry && ( pEntry->nFormValue != -1 ) )
     739             :         {
     740           0 :             if ( nValue == pEntry->nFormValue )
     741             :             {
     742           0 :                 _rValue <<= pEntry->nAPIValue;
     743           0 :                 return;
     744             :             }
     745           0 :             ++pEntry;
     746             :         }
     747             :     }
     748             : 
     749           8 :     static void lcl_mapAPIToFormValue( Any& _rValue, const EnumConversionMap* _pMap )
     750             :     {
     751           8 :         sal_Int32 nValue = 0;
     752           8 :         OSL_VERIFY( _rValue >>= nValue );
     753             : 
     754           8 :         const EnumConversionMap* pEntry = _pMap;
     755          23 :         while ( pEntry && ( pEntry->nAPIValue != -1 ) )
     756             :         {
     757          15 :             if ( nValue == pEntry->nAPIValue )
     758             :             {
     759           8 :                 _rValue <<= pEntry->nFormValue;
     760          16 :                 return;
     761             :             }
     762           7 :             ++pEntry;
     763             :         }
     764             :     }
     765             : 
     766           0 :     static void lcl_convertTextAlignmentToParaAdjustment( Any& rValue )
     767             :     {
     768           0 :         lcl_mapFormToAPIValue( rValue, aMapAdjustToAlign );
     769           0 :     }
     770             : 
     771           8 :     static void lcl_convertParaAdjustmentToTextAlignment( Any& rValue )
     772             :     {
     773           8 :         lcl_mapAPIToFormValue( rValue, aMapAdjustToAlign );
     774           8 :     }
     775             : 
     776           0 :     void convertVerticalAdjustToVerticalAlign( Any& _rValue ) SAL_THROW( ( lang::IllegalArgumentException ) )
     777             :     {
     778           0 :         if ( !_rValue.hasValue() )
     779           0 :             return;
     780             : 
     781           0 :         drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
     782           0 :         style::VerticalAlignment    eAlign  = style::VerticalAlignment_TOP;
     783           0 :         if ( !( _rValue >>= eAdjust ) )
     784           0 :             throw lang::IllegalArgumentException();
     785           0 :         switch ( eAdjust )
     786             :         {
     787           0 :         case drawing::TextVerticalAdjust_TOP:    eAlign = style::VerticalAlignment_TOP; break;
     788           0 :         case drawing::TextVerticalAdjust_BOTTOM: eAlign = style::VerticalAlignment_BOTTOM; break;
     789           0 :         default:                                 eAlign = style::VerticalAlignment_MIDDLE; break;
     790             :         }
     791           0 :         _rValue <<= eAlign;
     792             :     }
     793             : 
     794           0 :     void convertVerticalAlignToVerticalAdjust( Any& _rValue )
     795             :     {
     796           0 :         if ( !_rValue.hasValue() )
     797           0 :             return;
     798           0 :         style::VerticalAlignment    eAlign  = style::VerticalAlignment_TOP;
     799           0 :         drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
     800           0 :         OSL_VERIFY( _rValue >>= eAlign );
     801           0 :         switch ( eAlign )
     802             :         {
     803           0 :         case style::VerticalAlignment_TOP:    eAdjust = drawing::TextVerticalAdjust_TOP; break;
     804           0 :         case style::VerticalAlignment_BOTTOM: eAdjust = drawing::TextVerticalAdjust_BOTTOM; break;
     805           0 :         default:                              eAdjust = drawing::TextVerticalAdjust_CENTER; break;
     806             :         }
     807           0 :         _rValue <<= eAdjust;
     808             :     }
     809             : }
     810             : 
     811          73 : void SAL_CALL SvxShapeControl::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
     812             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
     813             : {
     814          73 :     OUString aFormsName;
     815          73 :     if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
     816             :     {
     817          18 :         uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
     818          18 :         if( xControl.is() )
     819             :         {
     820          18 :             uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
     821          18 :             if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
     822             :             {
     823          18 :                 uno::Any aConvertedValue( aValue );
     824          18 :                 if ( aFormsName == "FontSlant" )
     825             :                 {
     826             :                     awt::FontSlant nSlant;
     827           1 :                     if( !(aValue >>= nSlant ) )
     828           0 :                         throw lang::IllegalArgumentException();
     829           1 :                     aConvertedValue <<= (sal_Int16)nSlant;
     830             :                 }
     831          17 :                 else if ( aFormsName == "Align" )
     832             :                 {
     833           8 :                     lcl_convertParaAdjustmentToTextAlignment( aConvertedValue );
     834             :                 }
     835           9 :                 else if ( aFormsName == "VerticalAlign" )
     836             :                 {
     837           0 :                     convertVerticalAdjustToVerticalAlign( aConvertedValue );
     838             :                 }
     839             : 
     840          18 :                 xControl->setPropertyValue( aFormsName, aConvertedValue );
     841          18 :             }
     842          18 :         }
     843             :     }
     844             :     else
     845             :     {
     846          55 :         SvxShape::setPropertyValue( aPropertyName, aValue );
     847          73 :     }
     848          73 : }
     849             : 
     850           0 : uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyName )
     851             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     852             : {
     853           0 :     OUString aFormsName;
     854           0 :     if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
     855             :     {
     856           0 :         uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
     857             : 
     858           0 :         uno::Any aValue;
     859           0 :         if( xControl.is() )
     860             :         {
     861           0 :             uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
     862           0 :             if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
     863             :             {
     864           0 :                 aValue = xControl->getPropertyValue( aFormsName );
     865           0 :                 if ( aFormsName == "FontSlant" )
     866             :                 {
     867           0 :                     awt::FontSlant eSlant = awt::FontSlant_NONE;
     868           0 :                     sal_Int16 nSlant = sal_Int16();
     869           0 :                     if ( aValue >>= nSlant )
     870             :                     {
     871           0 :                         eSlant = (awt::FontSlant)nSlant;
     872             :                     }
     873             :                     else
     874             :                     {
     875           0 :                         OSL_VERIFY( aValue >>= eSlant );
     876             :                     }
     877           0 :                     aValue <<= eSlant;
     878             :                 }
     879           0 :                 else if ( aFormsName == "Align" )
     880             :                 {
     881           0 :                     lcl_convertTextAlignmentToParaAdjustment( aValue );
     882             :                 }
     883           0 :                 else if ( aFormsName == "VerticalAlign" )
     884             :                 {
     885           0 :                     convertVerticalAlignToVerticalAdjust( aValue );
     886             :                 }
     887           0 :             }
     888             :         }
     889             : 
     890           0 :         return aValue;
     891             :     }
     892             :     else
     893             :     {
     894           0 :         return SvxShape::getPropertyValue( aPropertyName );
     895           0 :     }
     896             : 
     897             : }
     898             : 
     899             : // XPropertyState
     900           0 : beans::PropertyState SAL_CALL SvxShapeControl::getPropertyState( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
     901             : {
     902           0 :     OUString aFormsName;
     903           0 :     if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
     904             :     {
     905           0 :         uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
     906           0 :         uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
     907             : 
     908           0 :         if( xControl.is() && xPropSet.is() )
     909             :         {
     910           0 :             uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
     911           0 :             if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
     912             :             {
     913           0 :                 return xControl->getPropertyState( aFormsName );
     914           0 :             }
     915             :         }
     916             : 
     917           0 :         return beans::PropertyState_DEFAULT_VALUE;
     918             :     }
     919             :     else
     920             :     {
     921           0 :         return SvxShape::getPropertyState( PropertyName );
     922           0 :     }
     923             : }
     924             : 
     925           0 : void SAL_CALL SvxShapeControl::setPropertyToDefault( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
     926             : {
     927           0 :     OUString aFormsName;
     928           0 :     if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
     929             :     {
     930           0 :         uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
     931           0 :         uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
     932             : 
     933           0 :         if( xControl.is() && xPropSet.is() )
     934             :         {
     935           0 :             uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
     936           0 :             if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
     937             :             {
     938           0 :                 xControl->setPropertyToDefault( aFormsName );
     939           0 :             }
     940           0 :         }
     941             :     }
     942             :     else
     943             :     {
     944           0 :         SvxShape::setPropertyToDefault( PropertyName );
     945           0 :     }
     946           0 : }
     947             : 
     948           0 : uno::Any SAL_CALL SvxShapeControl::getPropertyDefault( const OUString& aPropertyName )
     949             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
     950             : {
     951           0 :     OUString aFormsName;
     952           0 :     if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
     953             :     {
     954           0 :         uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
     955             : 
     956           0 :         if( xControl.is() )
     957             :         {
     958           0 :             Any aDefault( xControl->getPropertyDefault( aFormsName ) );
     959           0 :             if ( aFormsName == "FontSlant" )
     960             :             {
     961           0 :                 sal_Int16 nSlant( 0 );
     962           0 :                 aDefault >>= nSlant;
     963           0 :                 aDefault <<= (awt::FontSlant)nSlant;
     964             :             }
     965           0 :             else if ( aFormsName == "Align" )
     966             :             {
     967           0 :                 lcl_convertTextAlignmentToParaAdjustment( aDefault );
     968             :             }
     969           0 :             else if ( aFormsName == "VerticalAlign" )
     970             :             {
     971           0 :                 convertVerticalAlignToVerticalAdjust( aDefault );
     972             :             }
     973           0 :             return aDefault;
     974             :         }
     975             : 
     976           0 :         throw beans::UnknownPropertyException();
     977             :     }
     978             :     else
     979             :     {
     980           0 :         return SvxShape::getPropertyDefault( aPropertyName );
     981           0 :     }
     982             : }
     983             : 
     984             : 
     985             : /***********************************************************************
     986             : * class SvxShapeDimensioning                                           *
     987             : ***********************************************************************/
     988             : 
     989             : //----------------------------------------------------------------------
     990           3 : SvxShapeDimensioning::SvxShapeDimensioning( SdrObject* pObj ) throw()
     991           3 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_DIMENSIONING), getSvxMapProvider().GetPropertySet(SVXMAP_DIMENSIONING, SdrObject::GetGlobalDrawObjectItemPool()) )
     992             : {
     993           3 : }
     994             : 
     995             : //----------------------------------------------------------------------
     996           6 : SvxShapeDimensioning::~SvxShapeDimensioning() throw()
     997             : {
     998           6 : }
     999             : 
    1000             : // ::com::sun::star::lang::XServiceInfo
    1001           0 : uno::Sequence< OUString > SAL_CALL SvxShapeDimensioning::getSupportedServiceNames() throw( uno::RuntimeException )
    1002             : {
    1003           0 :     return SvxShapeText::getSupportedServiceNames();
    1004             : }
    1005             : 
    1006             : /***********************************************************************
    1007             : *                                                                      *
    1008             : ***********************************************************************/
    1009             : 
    1010             : //----------------------------------------------------------------------
    1011          69 : SvxShapeCircle::SvxShapeCircle( SdrObject* pObj ) throw()
    1012          69 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CIRCLE), getSvxMapProvider().GetPropertySet(SVXMAP_CIRCLE, SdrObject::GetGlobalDrawObjectItemPool()) )
    1013             : {
    1014          69 : }
    1015             : 
    1016             : //----------------------------------------------------------------------
    1017         138 : SvxShapeCircle::~SvxShapeCircle() throw()
    1018             : {
    1019         138 : }
    1020             : 
    1021             : // ::com::sun::star::lang::XServiceInfo
    1022             : // XServiceInfo
    1023           5 : uno::Sequence< OUString > SAL_CALL SvxShapeCircle::getSupportedServiceNames() throw( uno::RuntimeException )
    1024             : {
    1025           5 :     return SvxShapeText::getSupportedServiceNames();
    1026             : }
    1027             : 
    1028             : /***********************************************************************
    1029             : *                                                                      *
    1030             : ***********************************************************************/
    1031             : 
    1032             : #include <svx/svdopath.hxx>
    1033             : 
    1034             : //----------------------------------------------------------------------
    1035       18969 : SvxShapePolyPolygon::SvxShapePolyPolygon( SdrObject* pObj , drawing::PolygonKind eNew )
    1036             :  throw( com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
    1037       56907 : : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGON), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGON, SdrObject::GetGlobalDrawObjectItemPool()) )
    1038       56907 : , mePolygonKind( eNew )
    1039             : {
    1040       18969 : }
    1041             : 
    1042             : //----------------------------------------------------------------------
    1043       37936 : SvxShapePolyPolygon::~SvxShapePolyPolygon() throw()
    1044             : {
    1045       37936 : }
    1046             : 
    1047        9285 : basegfx::B2DPolyPolygon SAL_CALL ImplSvxPointSequenceSequenceToB2DPolyPolygon( const drawing::PointSequenceSequence* pOuterSequence) throw()
    1048             : {
    1049        9285 :     basegfx::B2DPolyPolygon aRetval;
    1050             : 
    1051             :     // Zeiger auf innere sequences holen
    1052        9285 :     const drawing::PointSequence* pInnerSequence = pOuterSequence->getConstArray();
    1053        9285 :     const drawing::PointSequence* pInnerSeqEnd   = pInnerSequence + pOuterSequence->getLength();
    1054             : 
    1055       31524 :     for(;pInnerSequence != pInnerSeqEnd; ++pInnerSequence)
    1056             :     {
    1057             :         // Neues Polygon vorbereiten
    1058       22239 :         basegfx::B2DPolygon aNewPolygon;
    1059             : 
    1060             :         // Zeiger auf Arrays holen
    1061       22239 :         const awt::Point* pArray    = pInnerSequence->getConstArray();
    1062       22239 :         const awt::Point* pArrayEnd = pArray + pInnerSequence->getLength();
    1063             : 
    1064       87884 :         for(;pArray != pArrayEnd;++pArray)
    1065             :         {
    1066       65645 :             aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
    1067             :         }
    1068             : 
    1069             :         // check for closed state flag
    1070       22239 :         basegfx::tools::checkClosed(aNewPolygon);
    1071             : 
    1072             :         // Neues Teilpolygon einfuegen
    1073       22239 :         aRetval.append(aNewPolygon);
    1074       22239 :     }
    1075             : 
    1076        9285 :     return aRetval;
    1077             : }
    1078             : 
    1079             : //----------------------------------------------------------------------
    1080             : 
    1081      141719 : bool SvxShapePolyPolygon::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)
    1082             : {
    1083      141719 :     switch( pProperty->nWID )
    1084             :     {
    1085             :     case OWN_ATTR_VALUE_POLYPOLYGON:
    1086             :     {
    1087        9272 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0) ) )
    1088             :         {
    1089        9272 :             basegfx::B2DPolyPolygon aNewPolyPolygon(ImplSvxPointSequenceSequenceToB2DPolyPolygon( (drawing::PointSequenceSequence*)rValue.getValue()));
    1090        9272 :             SetPolygon(aNewPolyPolygon);
    1091        9272 :             return true;
    1092             :         }
    1093           0 :         break;
    1094             :     }
    1095             :     case OWN_ATTR_BASE_GEOMETRY:
    1096             :     {
    1097          13 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0)))
    1098             :         {
    1099          13 :             if( mpObj.is() )
    1100             :             {
    1101          13 :                 basegfx::B2DPolyPolygon aNewPolyPolygon;
    1102          26 :                 basegfx::B2DHomMatrix aNewHomogenMatrix;
    1103             : 
    1104          13 :                 mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1105          13 :                 aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon((drawing::PointSequenceSequence*)rValue.getValue());
    1106          26 :                 mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1107             :             }
    1108          13 :             return true;
    1109             :         }
    1110           0 :         break;
    1111             :     }
    1112             :     case OWN_ATTR_VALUE_POLYGON:
    1113             :     {
    1114           0 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0) ))
    1115             :         {
    1116           0 :             drawing::PointSequence* pSequence = (drawing::PointSequence*)rValue.getValue();
    1117             : 
    1118             :             // Neues Polygon vorbereiten
    1119           0 :             basegfx::B2DPolygon aNewPolygon;
    1120             : 
    1121             :             // Zeiger auf Arrays holen
    1122             :             // Zeiger auf Arrays holen
    1123           0 :             const awt::Point* pArray    = pSequence->getConstArray();
    1124           0 :             const awt::Point* pArrayEnd = pArray + pSequence->getLength();
    1125             : 
    1126           0 :             for(;pArray != pArrayEnd;++pArray)
    1127             :             {
    1128           0 :                 aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
    1129             :             }
    1130             : 
    1131             :             // check for closed state flag
    1132           0 :             basegfx::tools::checkClosed(aNewPolygon);
    1133             : 
    1134             :             // Polygon setzen
    1135           0 :             SetPolygon(basegfx::B2DPolyPolygon(aNewPolygon));
    1136           0 :             return true;
    1137             :         }
    1138           0 :         break;
    1139             :     }
    1140             :     default:
    1141      132434 :         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
    1142             :     }
    1143             : 
    1144           0 :     throw lang::IllegalArgumentException();
    1145             : }
    1146             : 
    1147          20 : void SAL_CALL B2DPolyPolygonToSvxPointSequenceSequence( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PointSequenceSequence& rRetval )
    1148             : {
    1149          20 :     if( (sal_uInt32)rRetval.getLength() != rPolyPoly.count() )
    1150           0 :         rRetval.realloc( rPolyPoly.count() );
    1151             : 
    1152             :     // Zeiger auf aeussere Arrays holen
    1153          20 :     drawing::PointSequence* pOuterSequence = rRetval.getArray();
    1154             : 
    1155          40 :     for(sal_uInt32 a(0L); a < rPolyPoly.count(); a++)
    1156             :     {
    1157             :         // Einzelpolygon holen
    1158          20 :         const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(a));
    1159             : 
    1160             :         // #i75974# take closed stae into account, the API polygon still uses the old closed definition
    1161             :         // with last/first point are identical (cannot hold information about open polygons with identical
    1162             :         // first and last point, though)
    1163          20 :         const sal_uInt32 nPointCount(aPoly.count());
    1164          20 :         const bool bIsClosed(aPoly.isClosed());
    1165             : 
    1166             :         // Platz in Arrays schaffen
    1167          20 :         pOuterSequence->realloc(bIsClosed ? nPointCount + 1 : nPointCount);
    1168             : 
    1169             :         // Pointer auf arrays holen
    1170          20 :         awt::Point* pInnerSequence = pOuterSequence->getArray();
    1171             : 
    1172         124 :         for(sal_uInt32 b(0L); b < nPointCount; b++)
    1173             :         {
    1174         104 :             const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
    1175         104 :             *pInnerSequence = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
    1176         104 :             pInnerSequence++;
    1177         104 :         }
    1178             : 
    1179             :         // #i75974# copy first point
    1180          20 :         if(bIsClosed)
    1181             :         {
    1182           6 :             *pInnerSequence = *pOuterSequence->getArray();
    1183             :         }
    1184             : 
    1185          20 :         pOuterSequence++;
    1186          20 :     }
    1187          20 : }
    1188             : 
    1189             : //----------------------------------------------------------------------
    1190             : 
    1191         578 : bool SvxShapePolyPolygon::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)
    1192             : {
    1193         578 :     switch( pProperty->nWID )
    1194             :     {
    1195             :     case OWN_ATTR_VALUE_POLYPOLYGON:
    1196             :     {
    1197             :         // PolyPolygon in eine struct PolyPolygon packen
    1198          13 :         const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
    1199          26 :         drawing::PointSequenceSequence aRetval( rPolyPoly.count() );
    1200             : 
    1201          13 :         B2DPolyPolygonToSvxPointSequenceSequence( rPolyPoly, aRetval );
    1202             : 
    1203          13 :         rValue <<= aRetval;
    1204          26 :         break;
    1205             :     }
    1206             :     case OWN_ATTR_BASE_GEOMETRY:
    1207             :     {
    1208             :         // pack a PolyPolygon in struct PolyPolygon
    1209           7 :         basegfx::B2DPolyPolygon aNewPolyPolygon;
    1210          14 :         basegfx::B2DHomMatrix aNewHomogenMatrix;
    1211             : 
    1212           7 :         if(mpObj.is())
    1213           7 :             mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1214             : 
    1215          14 :         drawing::PointSequenceSequence aRetval(aNewPolyPolygon.count());
    1216           7 :         B2DPolyPolygonToSvxPointSequenceSequence(aNewPolyPolygon, aRetval);
    1217           7 :         rValue <<= aRetval;
    1218          14 :         break;
    1219             :     }
    1220             :     case OWN_ATTR_VALUE_POLYGON:
    1221             :     {
    1222             :         // PolyPolygon in eine struct PolyPolygon packen
    1223           0 :         const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
    1224             : 
    1225           0 :         sal_Int32 nCount = 0;
    1226           0 :         if( rPolyPoly.count() > 0 )
    1227           0 :             nCount = rPolyPoly.getB2DPolygon(0L).count();
    1228             : 
    1229           0 :         drawing::PointSequence aRetval( nCount );
    1230             : 
    1231           0 :         if( nCount > 0 )
    1232             :         {
    1233             :             // Einzelpolygon holen
    1234           0 :             const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(0L));
    1235             : 
    1236             :             // Pointer auf arrays holen
    1237           0 :             awt::Point* pSequence = aRetval.getArray();
    1238             : 
    1239           0 :             for(sal_Int32 b=0;b<nCount;b++)
    1240             :             {
    1241           0 :                 const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
    1242           0 :                 *pSequence++ = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
    1243           0 :             }
    1244             :         }
    1245             : 
    1246           0 :         rValue <<= aRetval;
    1247           0 :         break;
    1248             :     }
    1249             :     case OWN_ATTR_VALUE_POLYGONKIND:
    1250             :     {
    1251           7 :         rValue <<= GetPolygonKind();
    1252           7 :         break;
    1253             :     }
    1254             :     default:
    1255         551 :         return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
    1256             :     }
    1257             : 
    1258          27 :     return true;
    1259             : }
    1260             : 
    1261             : //----------------------------------------------------------------------
    1262           7 : drawing::PolygonKind SvxShapePolyPolygon::GetPolygonKind() const throw()
    1263             : {
    1264           7 :     return mePolygonKind;
    1265             : }
    1266             : 
    1267             : //----------------------------------------------------------------------
    1268        9272 : void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
    1269             : {
    1270        9272 :     ::SolarMutexGuard aGuard;
    1271             : 
    1272        9272 :     if(mpObj.is())
    1273        9272 :         ((SdrPathObj*)mpObj.get())->SetPathPoly(rNew);
    1274        9272 : }
    1275             : 
    1276             : //----------------------------------------------------------------------
    1277          13 : basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
    1278             : {
    1279          13 :     ::SolarMutexGuard aGuard;
    1280             : 
    1281          13 :     if(mpObj.is())
    1282             :     {
    1283          13 :         return ((SdrPathObj*)mpObj.get())->GetPathPoly();
    1284             :     }
    1285             :     else
    1286             :     {
    1287           0 :         return basegfx::B2DPolyPolygon();
    1288          13 :     }
    1289             : }
    1290             : 
    1291             : // ::com::sun::star::lang::XServiceInfo
    1292         157 : uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygon::getSupportedServiceNames() throw( uno::RuntimeException )
    1293             : {
    1294         157 :     return SvxShapeText::getSupportedServiceNames();
    1295             : }
    1296             : 
    1297             : /***********************************************************************
    1298             : * class SvxShapePolyPolygonBezier                                      *
    1299             : ***********************************************************************/
    1300             : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
    1301             : #include <com/sun/star/drawing/FlagSequence.hpp>
    1302             : //----------------------------------------------------------------------
    1303         304 : SvxShapePolyPolygonBezier::SvxShapePolyPolygonBezier( SdrObject* pObj , drawing::PolygonKind eNew ) throw()
    1304         912 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGONBEZIER), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGONBEZIER, SdrObject::GetGlobalDrawObjectItemPool()) )
    1305         912 : ,   mePolygonKind( eNew )
    1306             : {
    1307         304 : }
    1308             : 
    1309             : //----------------------------------------------------------------------
    1310         608 : SvxShapePolyPolygonBezier::~SvxShapePolyPolygonBezier() throw()
    1311             : {
    1312         608 : }
    1313             : 
    1314             : //----------------------------------------------------------------------
    1315             : 
    1316        2015 : bool SvxShapePolyPolygonBezier::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)
    1317             : {
    1318        2015 :     switch( pProperty->nWID )
    1319             :     {
    1320             :     case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
    1321             :     {
    1322         106 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0) ) )
    1323             :         {
    1324             :             basegfx::B2DPolyPolygon aNewPolyPolygon(
    1325             :                 basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
    1326         106 :                     *(drawing::PolyPolygonBezierCoords*)rValue.getValue()));
    1327         106 :             SetPolygon(aNewPolyPolygon);
    1328         106 :             return true;
    1329             :         }
    1330           0 :         break;
    1331             :     }
    1332             :     case OWN_ATTR_BASE_GEOMETRY:
    1333             :     {
    1334           4 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0)) )
    1335             :         {
    1336           4 :             if( mpObj.is() )
    1337             :             {
    1338           4 :                 basegfx::B2DPolyPolygon aNewPolyPolygon;
    1339           8 :                 basegfx::B2DHomMatrix aNewHomogenMatrix;
    1340             : 
    1341           4 :                 mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1342           8 :                 aNewPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
    1343           8 :                     *(drawing::PolyPolygonBezierCoords*)rValue.getValue());
    1344           8 :                 mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1345             :             }
    1346           4 :             return true;
    1347             :         }
    1348           0 :         break;
    1349             :     }
    1350             :     default:
    1351        1905 :         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
    1352             :     }
    1353             : 
    1354           0 :     throw IllegalArgumentException();
    1355             : }
    1356             : 
    1357             : //----------------------------------------------------------------------
    1358             : 
    1359         325 : bool SvxShapePolyPolygonBezier::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)
    1360             : {
    1361         325 :     switch( pProperty->nWID )
    1362             :     {
    1363             :     case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
    1364             :     {
    1365             :         // PolyPolygon in eine struct PolyPolygon packen
    1366           4 :         const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
    1367           8 :         drawing::PolyPolygonBezierCoords aRetval;
    1368           4 :         basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(rPolyPoly, aRetval);
    1369             : 
    1370           4 :         rValue <<= aRetval;
    1371           8 :         break;
    1372             :     }
    1373             :     case OWN_ATTR_BASE_GEOMETRY:
    1374             :     {
    1375             :         // PolyPolygon in eine struct PolyPolygon packen
    1376           4 :         basegfx::B2DPolyPolygon aNewPolyPolygon;
    1377           8 :         basegfx::B2DHomMatrix aNewHomogenMatrix;
    1378           4 :         mpObj.get()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1379           8 :         drawing::PolyPolygonBezierCoords aRetval;
    1380           4 :         basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(aNewPolyPolygon, aRetval);
    1381             : 
    1382           4 :         rValue <<= aRetval;
    1383           8 :         break;
    1384             :     }
    1385             :     case OWN_ATTR_VALUE_POLYGONKIND:
    1386             :     {
    1387           4 :         rValue <<= GetPolygonKind();
    1388           4 :         break;
    1389             :     }
    1390             :     default:
    1391         313 :         return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
    1392             :     }
    1393          12 :     return true;
    1394             : }
    1395             : 
    1396             : //----------------------------------------------------------------------
    1397           4 : drawing::PolygonKind SvxShapePolyPolygonBezier::GetPolygonKind() const throw()
    1398             : {
    1399           4 :     return mePolygonKind;
    1400             : }
    1401             : 
    1402             : //----------------------------------------------------------------------
    1403         106 : void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
    1404             : {
    1405         106 :     ::SolarMutexGuard aGuard;
    1406             : 
    1407         106 :     if(mpObj.is())
    1408         106 :         static_cast<SdrPathObj*>(mpObj.get())->SetPathPoly(rNew);
    1409         106 : }
    1410             : 
    1411             : //----------------------------------------------------------------------
    1412           4 : basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
    1413             : {
    1414           4 :     ::SolarMutexGuard aGuard;
    1415             : 
    1416           4 :     if(mpObj.is())
    1417             :     {
    1418           4 :         return static_cast<SdrPathObj*>(mpObj.get())->GetPathPoly();
    1419             :     }
    1420             :     else
    1421             :     {
    1422           0 :         return basegfx::B2DPolyPolygon();
    1423           4 :     }
    1424             : }
    1425             : 
    1426             : 
    1427             : // ::com::sun::star::lang::XServiceInfo
    1428          72 : uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygonBezier::getSupportedServiceNames() throw( uno::RuntimeException )
    1429             : {
    1430          72 :     return SvxShapeText::getSupportedServiceNames();
    1431             : }
    1432             : 
    1433             : /***********************************************************************
    1434             : * class SvxGraphicObject                                               *
    1435             : ***********************************************************************/
    1436             : #include <com/sun/star/awt/XBitmap.hpp>
    1437             : #include <vcl/cvtgrf.hxx>
    1438             : #include <svx/svdograf.hxx>
    1439             : #include <sfx2/docfile.hxx>
    1440             : #include <sfx2/app.hxx>
    1441             : #include <sfx2/fcontnr.hxx>
    1442             : 
    1443             : #include <toolkit/helper/vclunohelper.hxx>
    1444             : 
    1445             : //----------------------------------------------------------------------
    1446          76 : SvxGraphicObject::SvxGraphicObject( SdrObject* pObj ) throw()
    1447          76 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_GRAPHICOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_GRAPHICOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
    1448             : {
    1449          76 : }
    1450             : 
    1451             : //----------------------------------------------------------------------
    1452         150 : SvxGraphicObject::~SvxGraphicObject() throw()
    1453             : {
    1454         150 : }
    1455             : 
    1456             : //----------------------------------------------------------------------
    1457             : 
    1458         533 : bool SvxGraphicObject::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)
    1459             : {
    1460         533 :     bool bOk = false;
    1461         533 :     switch( pProperty->nWID )
    1462             :     {
    1463             :     case OWN_ATTR_VALUE_FILLBITMAP:
    1464             :     {
    1465           0 :         if( rValue.getValue() )
    1466             :         {
    1467           0 :             if( rValue.getValueType() == ::getCppuType(( const uno::Sequence< sal_Int8 >*)0) )
    1468             :             {
    1469           0 :                 uno::Sequence<sal_Int8>* pSeq( (uno::Sequence<sal_Int8>*)rValue.getValue() );
    1470           0 :                 SvMemoryStream  aMemStm;
    1471           0 :                 Graphic         aGraphic;
    1472             : 
    1473           0 :                 aMemStm.SetBuffer( (char*)pSeq->getConstArray(), pSeq->getLength(), sal_False, pSeq->getLength() );
    1474             : 
    1475           0 :                 if( GraphicConverter::Import( aMemStm, aGraphic ) == ERRCODE_NONE )
    1476             :                 {
    1477           0 :                     static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic);
    1478           0 :                     bOk = true;
    1479           0 :                 }
    1480             :             }
    1481             :         }
    1482           0 :         else if( (rValue.getValueType() == awt::XBitmap::static_type()) || (rValue.getValueType() == graphic::XGraphic::static_type()))
    1483             :         {
    1484           0 :             Reference< graphic::XGraphic> xGraphic( rValue, UNO_QUERY );
    1485           0 :             if( xGraphic.is() )
    1486             :             {
    1487           0 :                 ((SdrGrafObj*)mpObj.get())->SetGraphic(Graphic(xGraphic));
    1488           0 :                 bOk = true;
    1489             :             }
    1490             :             else
    1491             :             {
    1492             :                 // Bitmap in das Objekt packen
    1493           0 :                 Reference< awt::XBitmap > xBmp( rValue, UNO_QUERY );
    1494           0 :                 if( xBmp.is() )
    1495             :                 {
    1496             :                     // Bitmap einsetzen
    1497           0 :                     Graphic aGraphic(VCLUnoHelper::GetBitmap( xBmp ));
    1498           0 :                     ((SdrGrafObj*)mpObj.get())->SetGraphic(aGraphic);
    1499           0 :                     bOk = true;
    1500           0 :                 }
    1501           0 :             }
    1502             :         }
    1503           0 :         break;
    1504             :     }
    1505             :     case OWN_ATTR_GRAFURL:
    1506             :     {
    1507          55 :         OUString aURL;
    1508          55 :         if( rValue >>= aURL )
    1509             :         {
    1510          55 :             if( aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
    1511             :             {
    1512             :                 // graphic manager url
    1513          45 :                 aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
    1514          45 :                 String aTmpStr(aURL);
    1515          90 :                 OString aUniqueID(OUStringToOString(aTmpStr, RTL_TEXTENCODING_UTF8));
    1516          90 :                 GraphicObject aGrafObj(aUniqueID);
    1517             : 
    1518             :                 // #101808# since loading a graphic can cause a reschedule of the office
    1519             :                 //          it is possible that our shape is removed while where in this
    1520             :                 //          method.
    1521          45 :                 if( mpObj.is() )
    1522             :                 {
    1523          45 :                     static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink();
    1524          45 :                     static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
    1525          45 :                 }
    1526             :             }
    1527          10 :             else if( !aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
    1528             :             {
    1529             :                 // normal link
    1530           0 :                 String              aFilterName;
    1531           0 :                 const SfxFilter*    pSfxFilter = NULL;
    1532           0 :                 SfxMedium           aSfxMedium( aURL, STREAM_READ | STREAM_SHARE_DENYNONE );
    1533             : 
    1534           0 :                 SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pSfxFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
    1535             : 
    1536           0 :                 if( !pSfxFilter )
    1537             :                 {
    1538           0 :                     INetURLObject aURLObj( aURL );
    1539             : 
    1540           0 :                     if( aURLObj.GetProtocol() == INET_PROT_NOT_VALID )
    1541             :                     {
    1542           0 :                         OUString aValidURL;
    1543             : 
    1544           0 :                         if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aURL, aValidURL ) )
    1545           0 :                             aURLObj = INetURLObject( aValidURL );
    1546             :                     }
    1547             : 
    1548           0 :                     if( aURLObj.GetProtocol() != INET_PROT_NOT_VALID )
    1549             :                     {
    1550           0 :                         GraphicFilter &rGrfFilter = GraphicFilter::GetGraphicFilter();
    1551           0 :                         aFilterName = rGrfFilter.GetImportFormatName( rGrfFilter.GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
    1552           0 :                     }
    1553             :                 }
    1554             :                 else
    1555           0 :                     aFilterName = pSfxFilter->GetFilterName();
    1556             : 
    1557             :                 // #101808# since loading a graphic can cause a reschedule of the office
    1558             :                 //          it is possible that our shape is removed while where in this
    1559             :                 //          method.
    1560           0 :                 if( mpObj.is() )
    1561           0 :                     static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicLink( aURL, aFilterName );
    1562             : 
    1563             :             }
    1564          55 :             bOk = true;
    1565             :         }
    1566          55 :         break;
    1567             :     }
    1568             : 
    1569             :     case OWN_ATTR_GRAFSTREAMURL:
    1570             :     {
    1571          10 :         OUString aStreamURL;
    1572             : 
    1573          10 :         if( rValue >>= aStreamURL )
    1574             :         {
    1575          10 :             if( !aStreamURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
    1576           0 :                 aStreamURL = OUString();
    1577             : 
    1578          10 :             if( mpObj.is() )
    1579             :             {
    1580          10 :                 static_cast<SdrGrafObj*>(mpObj.get())->SetGrafStreamURL( aStreamURL );
    1581          10 :                 static_cast<SdrGrafObj*>(mpObj.get())->ForceSwapOut();
    1582             :             }
    1583          10 :             bOk = true;
    1584             :         }
    1585          10 :         break;
    1586             :     }
    1587             : 
    1588             :     case OWN_ATTR_VALUE_GRAPHIC:
    1589             :     {
    1590          15 :         Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
    1591          15 :         if( xGraphic.is() )
    1592             :         {
    1593          15 :             static_cast< SdrGrafObj*>( mpObj.get() )->SetGraphic( xGraphic );
    1594          15 :             bOk = true;
    1595             :         }
    1596          15 :         break;
    1597             :     }
    1598             :     default:
    1599         453 :         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
    1600             :     }
    1601             : 
    1602          80 :     if( !bOk )
    1603           0 :         throw lang::IllegalArgumentException();
    1604             : 
    1605          80 :     if( mpModel )
    1606          80 :         mpModel->SetChanged();
    1607             : 
    1608          80 :     return true;
    1609             : }
    1610             : 
    1611             : //----------------------------------------------------------------------
    1612             : 
    1613         177 : bool SvxGraphicObject::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)
    1614             : {
    1615         177 :     switch( pProperty->nWID )
    1616             :     {
    1617             :     case OWN_ATTR_VALUE_FILLBITMAP:
    1618             :     {
    1619           0 :         sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
    1620           0 :         const Graphic& rGraphic = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic();
    1621             : 
    1622           0 :         if(rGraphic.GetType() != GRAPHIC_GDIMETAFILE)
    1623             :         {
    1624             :             // Objekt in eine Bitmap packen
    1625           0 :             Reference< ::com::sun::star::awt::XBitmap >  xBitmap( VCLUnoHelper::CreateBitmap(static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic().GetBitmapEx()) );
    1626           0 :             rValue <<= xBitmap;
    1627             :         }
    1628             :         else
    1629             :         {
    1630           0 :             SvMemoryStream aDestStrm( 65535, 65535 );
    1631             : 
    1632           0 :             ConvertGDIMetaFileToWMF( rGraphic.GetGDIMetaFile(), aDestStrm, NULL, false );
    1633             :             const uno::Sequence<sal_Int8> aSeq(
    1634           0 :                 static_cast< const sal_Int8* >(aDestStrm.GetData()),
    1635           0 :                 aDestStrm.GetEndOfData());
    1636           0 :             rValue <<= aSeq;
    1637             :         }
    1638           0 :         if ( bSwapped )
    1639           0 :             static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
    1640           0 :         break;
    1641             :     }
    1642             : 
    1643             :     case OWN_ATTR_GRAFURL:
    1644             :     {
    1645          31 :         if( static_cast< SdrGrafObj*>( mpObj.get() )->IsLinkedGraphic() )
    1646             :         {
    1647           0 :             rValue <<= OUString( static_cast< SdrGrafObj*>( mpObj.get() )->GetFileName() );
    1648             :         }
    1649             :         else
    1650             :         {
    1651          31 :             sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
    1652          31 :             const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
    1653          31 :             OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
    1654          31 :             aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
    1655          31 :             rValue <<= aURL;
    1656          31 :             if ( bSwapped )
    1657           0 :                 static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
    1658             :         }
    1659          31 :         break;
    1660             :     }
    1661             : 
    1662             :     case OWN_ATTR_REPLACEMENTGRAFURL:
    1663             :     {
    1664           0 :         const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
    1665             : 
    1666           0 :         if(pGrafObj)
    1667             :         {
    1668           0 :             OUString aURL(UNO_NAME_GRAPHOBJ_URLPREFIX);
    1669           0 :             aURL += OStringToOUString(pGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
    1670           0 :             rValue <<= aURL;
    1671             :         }
    1672             : 
    1673           0 :         break;
    1674             :     }
    1675             : 
    1676             :     case OWN_ATTR_GRAFSTREAMURL:
    1677             :     {
    1678           2 :         const OUString  aStreamURL( ( (SdrGrafObj*) mpObj.get() )->GetGrafStreamURL() );
    1679           2 :         if( !aStreamURL.isEmpty() )
    1680           2 :             rValue <<= aStreamURL;
    1681           2 :         break;
    1682             :     }
    1683             : 
    1684             :     case OWN_ATTR_VALUE_GRAPHIC:
    1685             :     {
    1686           1 :         sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
    1687           1 :         Reference< graphic::XGraphic > xGraphic( static_cast< SdrGrafObj* >( mpObj.get() )->GetGraphic().GetXGraphic() );
    1688           1 :         rValue <<= xGraphic;
    1689           1 :         if ( bSwapped )
    1690           0 :             static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
    1691           1 :         break;
    1692             :     }
    1693             : 
    1694             :     case OWN_ATTR_GRAPHIC_STREAM:
    1695             :     {
    1696           0 :         rValue <<= static_cast< SdrGrafObj* >( mpObj.get() )->getInputStream();
    1697           0 :         break;
    1698             :     }
    1699             :     default:
    1700         143 :         return SvxShapeText::getPropertyValueImpl(rName, pProperty,rValue);
    1701             :     }
    1702             : 
    1703          34 :     return true;
    1704             : }
    1705             : 
    1706             : ///////////////////////////////////////////////////////////////////////
    1707             : 
    1708          10 : SvxShapeCaption::SvxShapeCaption( SdrObject* pObj ) throw()
    1709          10 : : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CAPTION), getSvxMapProvider().GetPropertySet(SVXMAP_CAPTION, SdrObject::GetGlobalDrawObjectItemPool()) )
    1710             : {
    1711          10 : }
    1712             : 
    1713          20 : SvxShapeCaption::~SvxShapeCaption() throw()
    1714             : {
    1715          20 : }
    1716             : 
    1717             : /***********************************************************************
    1718             : * class SvxCustomShape                                                   *
    1719             : ***********************************************************************/
    1720             : 
    1721        5579 : SvxCustomShape::SvxCustomShape( SdrObject* pObj )  throw() :
    1722        5579 :     SvxShapeText( pObj, getSvxMapProvider().GetMap( SVXMAP_CUSTOMSHAPE ), getSvxMapProvider().GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool()) )
    1723             : {
    1724        5579 : }
    1725             : 
    1726             : //----------------------------------------------------------------------
    1727       11152 : SvxCustomShape::~SvxCustomShape() throw()
    1728             : {
    1729       11152 : }
    1730             : 
    1731             : //----------------------------------------------------------------------
    1732             : 
    1733         163 : void SvxCustomShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
    1734             : {
    1735         163 :     SvxShapeText::Create( pNewObj, pNewPage );
    1736         163 : }
    1737             : 
    1738             : //----------------------------------------------------------------------
    1739             : 
    1740       23448 : uno::Any SAL_CALL SvxCustomShape::queryInterface( const uno::Type & rType )
    1741             :     throw(uno::RuntimeException)
    1742             : {
    1743       23448 :     return SvxShapeText::queryInterface( rType );
    1744             : }
    1745             : 
    1746       24082 : uno::Any SAL_CALL SvxCustomShape::queryAggregation( const uno::Type & rType )
    1747             :     throw(uno::RuntimeException)
    1748             : {
    1749       24082 :     ::com::sun::star::uno::Any aReturn = SvxShapeText::queryAggregation( rType );
    1750       24082 :     if ( !aReturn.hasValue() )
    1751         257 :         aReturn = ::cppu::queryInterface(rType, static_cast<drawing::XEnhancedCustomShapeDefaulter*>(this) );
    1752       24082 :     return aReturn;
    1753             : }
    1754             : 
    1755       79942 : void SAL_CALL SvxCustomShape::acquire() throw ( )
    1756             : {
    1757       79942 :     SvxShapeText::acquire();
    1758       79942 : }
    1759             : 
    1760       79917 : void SAL_CALL SvxCustomShape::release() throw ( )
    1761             : {
    1762       79917 :     SvxShapeText::release();
    1763       79917 : }
    1764             : 
    1765             : //----------------------------------------------------------------------
    1766             : 
    1767           0 : uno::Sequence< uno::Type > SAL_CALL SvxCustomShape::getTypes()
    1768             :     throw (uno::RuntimeException)
    1769             : {
    1770           0 :     return SvxShapeText::getTypes();
    1771             : }
    1772             : 
    1773             : namespace
    1774             : {
    1775             :     class theSvxCustomShapeImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxCustomShapeImplementationId > {};
    1776             : }
    1777             : 
    1778           0 : uno::Sequence< sal_Int8 > SAL_CALL SvxCustomShape::getImplementationId()
    1779             :     throw (uno::RuntimeException)
    1780             : {
    1781           0 :     return theSvxCustomShapeImplementationId::get().getSeq();
    1782             : }
    1783             : 
    1784             : // ::com::sun::star::drawing::XShape
    1785             : 
    1786             : //----------------------------------------------------------------------
    1787         599 : OUString SAL_CALL SvxCustomShape::getShapeType()
    1788             :     throw( uno::RuntimeException )
    1789             : {
    1790         599 :     return SvxShape::getShapeType();
    1791             : }
    1792             : 
    1793             : //------------------------------------------------------------------1----
    1794         307 : awt::Point SAL_CALL SvxCustomShape::getPosition() throw(uno::RuntimeException)
    1795             : {
    1796         307 :     ::SolarMutexGuard aGuard;
    1797         307 :     if ( mpModel && mpObj.is() )
    1798             :     {
    1799         179 :         SdrAShapeObjGeoData aCustomShapeGeoData;
    1800         179 :         ((SdrObjCustomShape*)mpObj.get())->SaveGeoData( aCustomShapeGeoData );
    1801             : 
    1802         179 :         sal_Bool bMirroredX = sal_False;
    1803         179 :         sal_Bool bMirroredY = sal_False;
    1804             : 
    1805         179 :         if ( mpObj.is() )
    1806             :         {
    1807         179 :             bMirroredX = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredX() );
    1808         179 :             bMirroredY = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredY() );
    1809             :         }
    1810             :         // get aRect, this is the unrotated snaprect
    1811         179 :         Rectangle aRect(((SdrObjCustomShape*)mpObj.get())->GetLogicRect());
    1812         179 :         Rectangle aRectangle( aRect );
    1813             : 
    1814         179 :         if ( bMirroredX || bMirroredY )
    1815             :         {   // we have to retrieve the unmirrored rect
    1816             : 
    1817           4 :             GeoStat aNewGeo( aCustomShapeGeoData.aGeo );
    1818           4 :             if ( bMirroredX )
    1819             :             {
    1820           4 :                 Polygon aPol( Rect2Poly( aRect, aNewGeo ) );
    1821           4 :                 Rectangle aBoundRect( aPol.GetBoundRect() );
    1822             : 
    1823           4 :                 Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
    1824           4 :                 Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
    1825             :                 sal_uInt16 i;
    1826           4 :                 sal_uInt16 nPntAnz=aPol.GetSize();
    1827          24 :                 for (i=0; i<nPntAnz; i++)
    1828             :                 {
    1829          20 :                     MirrorPoint(aPol[i],aRef1,aRef2);
    1830             :                 }
    1831             :                 // Polygon wenden und etwas schieben
    1832           8 :                 Polygon aPol0(aPol);
    1833           4 :                 aPol[0]=aPol0[1];
    1834           4 :                 aPol[1]=aPol0[0];
    1835           4 :                 aPol[2]=aPol0[3];
    1836           4 :                 aPol[3]=aPol0[2];
    1837           4 :                 aPol[4]=aPol0[1];
    1838           8 :                 Poly2Rect(aPol,aRectangle,aNewGeo);
    1839             :             }
    1840           4 :             if ( bMirroredY )
    1841             :             {
    1842           0 :                 Polygon aPol( Rect2Poly( aRectangle, aNewGeo ) );
    1843           0 :                 Rectangle aBoundRect( aPol.GetBoundRect() );
    1844             : 
    1845           0 :                 Point aRef1( aBoundRect.Left(), ( aBoundRect.Top() + aBoundRect.Bottom() ) >> 1 );
    1846           0 :                 Point aRef2( aRef1.X() + 1000, aRef1.Y() );
    1847             :                 sal_uInt16 i;
    1848           0 :                 sal_uInt16 nPntAnz=aPol.GetSize();
    1849           0 :                 for (i=0; i<nPntAnz; i++)
    1850             :                 {
    1851           0 :                     MirrorPoint(aPol[i],aRef1,aRef2);
    1852             :                 }
    1853             :                 // Polygon wenden und etwas schieben
    1854           0 :                 Polygon aPol0(aPol);
    1855           0 :                 aPol[0]=aPol0[1];
    1856           0 :                 aPol[1]=aPol0[0];
    1857           0 :                 aPol[2]=aPol0[3];
    1858           0 :                 aPol[3]=aPol0[2];
    1859           0 :                 aPol[4]=aPol0[1];
    1860           0 :                 Poly2Rect( aPol, aRectangle, aNewGeo );
    1861             :             }
    1862             :         }
    1863         179 :         Point aPt( aRectangle.TopLeft() );
    1864             : 
    1865         179 :         if( mpModel->IsWriter() )
    1866          24 :             aPt -= mpObj->GetAnchorPos();
    1867             : 
    1868         179 :         ForceMetricTo100th_mm(aPt);
    1869         179 :         return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
    1870             :     }
    1871             :     else
    1872         128 :         return SvxShape::getPosition();
    1873             : }
    1874             : 
    1875             : //----------------------------------------------------------------------
    1876         224 : void SAL_CALL SvxCustomShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
    1877             : {
    1878         224 :     SvxShapeText::setPosition(Position);
    1879         224 : }
    1880             : 
    1881             : //----------------------------------------------------------------------
    1882             : 
    1883         311 : awt::Size SAL_CALL SvxCustomShape::getSize() throw(uno::RuntimeException)
    1884             : {
    1885         311 :     return SvxShapeText::getSize();
    1886             : }
    1887             : 
    1888             : //----------------------------------------------------------------------
    1889         194 : void SAL_CALL SvxCustomShape::setSize( const awt::Size& rSize )
    1890             :     throw(beans::PropertyVetoException, uno::RuntimeException)
    1891             : {
    1892         194 :     SvxShapeText::setSize( rSize );
    1893         194 : }
    1894             : 
    1895             : //----------------------------------------------------------------------
    1896             : 
    1897             : //----------------------------------------------------------------------
    1898        2341 : void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
    1899             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
    1900             : {
    1901        2341 :     ::SolarMutexGuard aGuard;
    1902        2341 :     SdrObject* pObject = mpObj.get();
    1903             : 
    1904        2341 :     bool bCustomShapeGeometry = pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CustomShapeGeometry" ) );
    1905             : 
    1906        2341 :     sal_Bool bMirroredX = sal_False;
    1907        2341 :     sal_Bool bMirroredY = sal_False;
    1908             : 
    1909        2341 :     if ( bCustomShapeGeometry )
    1910             :     {
    1911         146 :         bMirroredX = ( ((SdrObjCustomShape*)pObject)->IsMirroredX() );
    1912         146 :         bMirroredY = ( ((SdrObjCustomShape*)pObject)->IsMirroredY() );
    1913             :     }
    1914             : 
    1915        2341 :     SvxShape::setPropertyValue( aPropertyName, aValue );
    1916             : 
    1917        2338 :     if ( bCustomShapeGeometry )
    1918             :     {
    1919         146 :         ((SdrObjCustomShape*)pObject)->MergeDefaultAttributes(0);
    1920         146 :         Rectangle aRect( pObject->GetSnapRect() );
    1921             : 
    1922             :         // #i38892#
    1923         146 :         bool bNeedsMirrorX = ((SdrObjCustomShape*)pObject)->IsMirroredX() != bMirroredX;
    1924         146 :         bool bNeedsMirrorY = ((SdrObjCustomShape*)pObject)->IsMirroredY() != bMirroredY;
    1925             : 
    1926         146 :         boost::scoped_ptr< SdrGluePointList > pListCopy;
    1927         146 :         if( bNeedsMirrorX || bNeedsMirrorY )
    1928             :         {
    1929           4 :             const SdrGluePointList* pList = pObject->GetGluePointList();
    1930           4 :             if( pList )
    1931           0 :                 pListCopy.reset( new SdrGluePointList(*pList) );
    1932             :         }
    1933             : 
    1934         146 :         if ( bNeedsMirrorX )
    1935             :         {
    1936           4 :             Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
    1937           4 :             Point aBottom( aTop.X(), aTop.Y() + 1000 );
    1938           4 :             pObject->NbcMirror( aTop, aBottom );
    1939             :             // NbcMirroring is flipping the current mirror state,
    1940             :             // so we have to set the correct state again
    1941           4 :             ((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True );
    1942             :         }
    1943         146 :         if ( bNeedsMirrorY )
    1944             :         {
    1945           0 :             Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
    1946           0 :             Point aRight( aLeft.X() + 1000, aLeft.Y() );
    1947           0 :             pObject->NbcMirror( aLeft, aRight );
    1948             :             // NbcMirroring is flipping the current mirror state,
    1949             :             // so we have to set the correct state again
    1950           0 :             ((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True );
    1951             :         }
    1952             : 
    1953         146 :         if( pListCopy )
    1954             :         {
    1955           0 :             SdrGluePointList* pNewList = const_cast< SdrGluePointList* >( pObject->GetGluePointList() );
    1956           0 :             if(pNewList)
    1957           0 :                 *pNewList = *pListCopy;
    1958         146 :         }
    1959        2341 :     }
    1960        2338 : }
    1961             : 
    1962        9606 : bool SvxCustomShape::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)
    1963             : {
    1964        9606 :     switch( pProperty->nWID )
    1965             :     {
    1966             :     case SDRATTR_ROTATEANGLE:
    1967             :     {
    1968          17 :         double fAngle = static_cast<SdrObjCustomShape*>(mpObj.get())->GetObjectRotation();
    1969          17 :         fAngle *= 100;
    1970          17 :         rValue <<= (sal_Int32)fAngle;
    1971          17 :         return true;
    1972             :     }
    1973             :     default:
    1974        9589 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
    1975             :     }
    1976             : }
    1977             : //----------------------------------------------------------------------
    1978             : 
    1979          32 : void SvxCustomShape::createCustomShapeDefaults( const OUString& rValueType ) throw (::com::sun::star::uno::RuntimeException)
    1980             : {
    1981          32 :     ((SdrObjCustomShape*)mpObj.get())->MergeDefaultAttributes( &rValueType );
    1982         290 : }
    1983             : 
    1984             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10