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

Generated by: LCOV version 1.10