LCOV - code coverage report
Current view: top level - svx/source/unodraw - unoshap2.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 841 0.0 %
Date: 2014-04-14 Functions: 0 129 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <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           0 : SvxShapeGroup::SvxShapeGroup( SdrObject* pObj, SvxDrawPage* pDrawPage  )  throw() :
      79           0 :     SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_GROUP), getSvxMapProvider().GetPropertySet(SVXMAP_GROUP, SdrObject::GetGlobalDrawObjectItemPool()) ),
      80           0 :     mxPage( pDrawPage )
      81             : {
      82           0 : }
      83             : 
      84             : 
      85           0 : SvxShapeGroup::~SvxShapeGroup() throw()
      86             : {
      87           0 : }
      88             : 
      89             : 
      90           0 : void SvxShapeGroup::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
      91             : {
      92           0 :     SvxShape::Create( pNewObj, pNewPage );
      93           0 :     mxPage = pNewPage;
      94           0 : }
      95             : 
      96             : 
      97           0 : uno::Any SAL_CALL SvxShapeGroup::queryInterface( const uno::Type & rType )
      98             :     throw(uno::RuntimeException, std::exception)
      99             : {
     100           0 :     return SvxShape::queryInterface( rType );
     101             : }
     102             : 
     103           0 : uno::Any SAL_CALL SvxShapeGroup::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
     104             : {
     105           0 :     uno::Any aAny;
     106             : 
     107           0 :     QUERYINT( drawing::XShapeGroup );
     108           0 :     else QUERYINT( drawing::XShapes );
     109           0 :     else QUERYINT( drawing::XShapes2 );
     110           0 :     else QUERYINT( container::XIndexAccess );
     111           0 :     else QUERYINT( container::XElementAccess );
     112             :     else
     113           0 :         return SvxShape::queryAggregation( rType );
     114             : 
     115           0 :     return aAny;
     116             : }
     117             : 
     118           0 : void SAL_CALL SvxShapeGroup::acquire() throw ( )
     119             : {
     120           0 :     SvxShape::acquire();
     121           0 : }
     122             : 
     123           0 : void SAL_CALL SvxShapeGroup::release() throw ( )
     124             : {
     125           0 :     SvxShape::release();
     126           0 : }
     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           0 : OUString SAL_CALL SvxShapeGroup::getShapeType()
     144             :     throw( uno::RuntimeException, std::exception )
     145             : {
     146           0 :     return SvxShape::getShapeType();
     147             : }
     148             : 
     149             : //------------------------------------------------------------------1----
     150           0 : awt::Point SAL_CALL SvxShapeGroup::getPosition() throw(uno::RuntimeException, std::exception)
     151             : {
     152           0 :     return SvxShape::getPosition();
     153             : }
     154             : 
     155             : 
     156           0 : void SAL_CALL SvxShapeGroup::setPosition( const awt::Point& Position ) throw(uno::RuntimeException, std::exception)
     157             : {
     158           0 :     SvxShape::setPosition(Position);
     159           0 : }
     160             : 
     161             : 
     162             : 
     163           0 : awt::Size SAL_CALL SvxShapeGroup::getSize() throw(uno::RuntimeException, std::exception)
     164             : {
     165           0 :     return SvxShape::getSize();
     166             : }
     167             : 
     168             : 
     169           0 : void SAL_CALL SvxShapeGroup::setSize( const awt::Size& rSize )
     170             :     throw(beans::PropertyVetoException, uno::RuntimeException, std::exception)
     171             : {
     172           0 :     SvxShape::setSize( rSize );
     173           0 : }
     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           0 : void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape, sal_uIntPtr nPos )
     192             : {
     193           0 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
     194             : 
     195           0 :     if( mpObj.is()&& mxPage.is() && pShape )
     196             :     {
     197           0 :         SdrObject* pSdrShape = pShape->GetSdrObject();
     198           0 :         if( pSdrShape == NULL )
     199           0 :             pSdrShape = mxPage->_CreateSdrObject( xShape );
     200             : 
     201           0 :         if( pSdrShape->IsInserted() )
     202           0 :             pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() );
     203             : 
     204           0 :         mpObj->GetSubList()->InsertObject(pSdrShape, nPos);
     205           0 :         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           0 :         pShape->Create( pSdrShape, mxPage.get() );
     219             : 
     220           0 :         if( mpModel )
     221           0 :             mpModel->SetChanged();
     222             :     }
     223             :     else
     224             :     {
     225             :         OSL_FAIL("could not add XShape to group shape!");
     226             :     }
     227           0 : }
     228             : 
     229             : // XShapes
     230           0 : void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShape )
     231             :     throw( uno::RuntimeException, std::exception )
     232             : {
     233           0 :     ::SolarMutexGuard aGuard;
     234             : 
     235             :     // Add to the top of the stack (i.e. bottom of the list) by default.
     236           0 :     addUnoShape(xShape, 0xFFFF);
     237           0 : }
     238             : 
     239             : 
     240           0 : void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xShape )
     241             :     throw( uno::RuntimeException, std::exception )
     242             : {
     243           0 :     ::SolarMutexGuard aGuard;
     244             : 
     245           0 :     SdrObject* pSdrShape = NULL;
     246           0 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
     247             : 
     248           0 :     if( pShape )
     249           0 :         pSdrShape = pShape->GetSdrObject();
     250             : 
     251           0 :     if( !mpObj.is() || pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get() )
     252           0 :         throw uno::RuntimeException();
     253             : 
     254           0 :     SdrObjList& rList = *pSdrShape->GetObjList();
     255             : 
     256           0 :     const sal_uInt32 nObjCount = rList.GetObjCount();
     257           0 :     sal_uInt32 nObjNum = 0;
     258           0 :     while( nObjNum < nObjCount )
     259             :     {
     260           0 :         if(rList.GetObj( nObjNum ) == pSdrShape )
     261           0 :             break;
     262           0 :         nObjNum++;
     263             :     }
     264             : 
     265           0 :     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           0 :         SdrViewIter aIter( pSdrShape );
     271             : 
     272           0 :         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           0 :         SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
     281           0 :         SdrObject::Free( pObject );
     282             :     }
     283             :     else
     284             :     {
     285             :         DBG_ASSERT( false, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
     286             :     }
     287             : 
     288           0 :     if( mpModel )
     289           0 :         mpModel->SetChanged();
     290           0 : }
     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           0 : void SAL_CALL SvxShapeGroup::addBottom( const uno::Reference< drawing::XShape >& xShape )
     302             :     throw( uno::RuntimeException, std::exception )
     303             : {
     304           0 :     SolarMutexGuard aGuard;
     305             : 
     306             :     // Add to the bottom of the stack (i.e. top of the list).
     307           0 :     addUnoShape(xShape, 0);
     308           0 : }
     309             : 
     310             : // XIndexAccess
     311             : 
     312             : 
     313           0 : sal_Int32 SAL_CALL SvxShapeGroup::getCount() throw( uno::RuntimeException, std::exception )
     314             : {
     315           0 :     ::SolarMutexGuard aGuard;
     316             : 
     317           0 :     sal_Int32 nRetval = 0;
     318             : 
     319           0 :     if(mpObj.is() && mpObj->GetSubList())
     320           0 :         nRetval = mpObj->GetSubList()->GetObjCount();
     321             :     else
     322           0 :         throw uno::RuntimeException();
     323             : 
     324           0 :     return nRetval;
     325             : }
     326             : 
     327             : 
     328           0 : uno::Any SAL_CALL SvxShapeGroup::getByIndex( sal_Int32 Index )
     329             :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     330             : {
     331           0 :     ::SolarMutexGuard aGuard;
     332             : 
     333           0 :     if( !mpObj.is() || mpObj->GetSubList() == NULL )
     334           0 :         throw uno::RuntimeException();
     335             : 
     336           0 :     if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
     337           0 :         throw lang::IndexOutOfBoundsException();
     338             : 
     339           0 :     SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
     340             : 
     341           0 :     if(pDestObj == NULL)
     342           0 :         throw lang::IndexOutOfBoundsException();
     343             : 
     344           0 :     Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
     345           0 :     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           0 : sal_Bool SAL_CALL SvxShapeGroup::hasElements() throw( uno::RuntimeException, std::exception )
     358             : {
     359           0 :     ::SolarMutexGuard aGuard;
     360             : 
     361           0 :     return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
     362             : }
     363             : 
     364             : 
     365             : // ::com::sun::star::lang::XServiceInfo
     366             : 
     367           0 : uno::Sequence< OUString > SAL_CALL SvxShapeGroup::getSupportedServiceNames()
     368             :     throw(uno::RuntimeException, std::exception)
     369             : {
     370           0 :     return SvxShape::getSupportedServiceNames();
     371             : }
     372             : 
     373             : /***********************************************************************
     374             : *                                                                      *
     375             : ***********************************************************************/
     376             : 
     377           0 : SvxShapeConnector::SvxShapeConnector( SdrObject* pObj )  throw() :
     378           0 :     SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CONNECTOR), getSvxMapProvider().GetPropertySet(SVXMAP_CONNECTOR, SdrObject::GetGlobalDrawObjectItemPool()) )
     379             : {
     380           0 : }
     381             : 
     382             : 
     383           0 : SvxShapeConnector::~SvxShapeConnector() throw()
     384             : {
     385           0 : }
     386             : 
     387             : 
     388             : 
     389           0 : uno::Any SAL_CALL SvxShapeConnector::queryInterface( const uno::Type & rType )
     390             :     throw(uno::RuntimeException, std::exception)
     391             : {
     392           0 :     return SvxShapeText::queryInterface( rType );
     393             : }
     394             : 
     395           0 : uno::Any SAL_CALL SvxShapeConnector::queryAggregation( const uno::Type & rType )
     396             :     throw(uno::RuntimeException, std::exception)
     397             : {
     398           0 :     uno::Any aAny;
     399             : 
     400           0 :     QUERYINT( drawing::XConnectorShape );
     401             :     else
     402           0 :         return SvxShapeText::queryAggregation( rType );
     403             : 
     404           0 :     return aAny;
     405             : }
     406             : 
     407           0 : void SAL_CALL SvxShapeConnector::acquire() throw ( )
     408             : {
     409           0 :     SvxShapeText::acquire();
     410           0 : }
     411             : 
     412           0 : void SAL_CALL SvxShapeConnector::release() throw ( )
     413             : {
     414           0 :     SvxShapeText::release();
     415           0 : }
     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           0 : OUString SAL_CALL SvxShapeConnector::getShapeType()
     434             :     throw( uno::RuntimeException, std::exception )
     435             : {
     436           0 :     return SvxShapeText::getShapeType();
     437             : }
     438             : 
     439             : //------------------------------------------------------------------1----
     440           0 : awt::Point SAL_CALL SvxShapeConnector::getPosition() throw(uno::RuntimeException, std::exception)
     441             : {
     442           0 :     return SvxShapeText::getPosition();
     443             : }
     444             : 
     445             : 
     446           0 : void SAL_CALL SvxShapeConnector::setPosition( const awt::Point& Position ) throw(uno::RuntimeException, std::exception)
     447             : {
     448           0 :     SvxShapeText::setPosition(Position);
     449           0 : }
     450             : 
     451             : 
     452             : 
     453           0 : awt::Size SAL_CALL SvxShapeConnector::getSize() throw(uno::RuntimeException, std::exception)
     454             : {
     455           0 :     return SvxShapeText::getSize();
     456             : }
     457             : 
     458             : 
     459           0 : void SAL_CALL SvxShapeConnector::setSize( const awt::Size& rSize )
     460             :     throw(beans::PropertyVetoException, uno::RuntimeException, std::exception)
     461             : {
     462           0 :     SvxShapeText::setSize( rSize );
     463           0 : }
     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           0 : SvxShapeControl::SvxShapeControl( SdrObject* pObj )  throw() :
     538           0 :     SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CONTROL), getSvxMapProvider().GetPropertySet(SVXMAP_CONTROL, SdrObject::GetGlobalDrawObjectItemPool()) )
     539             : {
     540           0 :     setShapeKind( OBJ_UNO );
     541           0 : }
     542             : 
     543             : 
     544           0 : SvxShapeControl::~SvxShapeControl() throw()
     545             : {
     546           0 : }
     547             : 
     548             : 
     549           0 : uno::Any SAL_CALL SvxShapeControl::queryInterface( const uno::Type & rType )
     550             :     throw(uno::RuntimeException, std::exception)
     551             : {
     552           0 :     return SvxShapeText::queryInterface( rType );
     553             : }
     554             : 
     555           0 : uno::Any SAL_CALL SvxShapeControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
     556             : {
     557           0 :     uno::Any aAny;
     558             : 
     559           0 :     QUERYINT( drawing::XControlShape );
     560             :     else
     561           0 :         return SvxShapeText::queryAggregation( rType );
     562             : 
     563           0 :     return aAny;
     564             : }
     565             : 
     566           0 : void SAL_CALL SvxShapeControl::acquire() throw ( )
     567             : {
     568           0 :     SvxShapeText::acquire();
     569           0 : }
     570             : 
     571           0 : void SAL_CALL SvxShapeControl::release() throw ( )
     572             : {
     573           0 :     SvxShapeText::release();
     574           0 : }
     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           0 : OUString SAL_CALL SvxShapeControl::getShapeType()
     593             :     throw( uno::RuntimeException, std::exception )
     594             : {
     595           0 :     return SvxShapeText::getShapeType();
     596             : }
     597             : 
     598             : //------------------------------------------------------------------1----
     599           0 : awt::Point SAL_CALL SvxShapeControl::getPosition() throw(uno::RuntimeException, std::exception)
     600             : {
     601           0 :     return SvxShapeText::getPosition();
     602             : }
     603             : 
     604             : 
     605           0 : void SAL_CALL SvxShapeControl::setPosition( const awt::Point& Position ) throw(uno::RuntimeException, std::exception)
     606             : {
     607           0 :     SvxShapeText::setPosition(Position);
     608           0 : }
     609             : 
     610             : 
     611             : 
     612           0 : awt::Size SAL_CALL SvxShapeControl::getSize() throw(uno::RuntimeException, std::exception)
     613             : {
     614           0 :     return SvxShapeText::getSize();
     615             : }
     616             : 
     617             : 
     618           0 : void SAL_CALL SvxShapeControl::setSize( const awt::Size& rSize )
     619             :     throw(beans::PropertyVetoException, uno::RuntimeException, std::exception)
     620             : {
     621           0 :     SvxShapeText::setSize( rSize );
     622           0 : }
     623             : 
     624             : 
     625             : // XControlShape
     626             : 
     627           0 : Reference< awt::XControlModel > SAL_CALL SvxShapeControl::getControl()
     628             :     throw( uno::RuntimeException, std::exception )
     629             : {
     630           0 :     ::SolarMutexGuard aGuard;
     631             : 
     632           0 :     Reference< awt::XControlModel > xModel;
     633             : 
     634           0 :     SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
     635           0 :     if( pUnoObj )
     636           0 :         xModel = pUnoObj->GetUnoControlModel();
     637             : 
     638           0 :     return xModel;
     639             : }
     640             : 
     641             : 
     642           0 : void SAL_CALL SvxShapeControl::setControl( const Reference< awt::XControlModel >& xControl )
     643             :     throw( uno::RuntimeException, std::exception )
     644             : {
     645           0 :     ::SolarMutexGuard aGuard;
     646             : 
     647           0 :     SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
     648           0 :     if( pUnoObj )
     649           0 :         pUnoObj->SetUnoControlModel( xControl );
     650             : 
     651           0 :     if( mpModel )
     652           0 :         mpModel->SetChanged();
     653           0 : }
     654             : 
     655             : // XServiceInfo
     656           0 : uno::Sequence< OUString > SAL_CALL SvxShapeControl::getSupportedServiceNames() throw( uno::RuntimeException, std::exception )
     657             : {
     658           0 :     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           0 :     static bool lcl_convertPropertyName( const OUString& rApiName, OUString& rInternalName )
     705             :     {
     706           0 :         sal_uInt16 i = 0;
     707           0 :         while( SvxShapeControlPropertyMapping[i].mpAPIName )
     708             :         {
     709           0 :             if( rApiName.reverseCompareToAsciiL( SvxShapeControlPropertyMapping[i].mpAPIName, SvxShapeControlPropertyMapping[i].mnAPINameLen ) == 0 )
     710             :             {
     711           0 :                 rInternalName = OUString( SvxShapeControlPropertyMapping[i].mpFormName, SvxShapeControlPropertyMapping[i].mnFormNameLen, RTL_TEXTENCODING_ASCII_US );
     712             :             }
     713           0 :             ++i;
     714             :         }
     715           0 :         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           0 :     static void lcl_mapAPIToFormValue( Any& _rValue, const EnumConversionMap* _pMap )
     755             :     {
     756           0 :         sal_Int32 nValue = 0;
     757           0 :         OSL_VERIFY( _rValue >>= nValue );
     758             : 
     759           0 :         const EnumConversionMap* pEntry = _pMap;
     760           0 :         while ( pEntry && ( pEntry->nAPIValue != -1 ) )
     761             :         {
     762           0 :             if ( nValue == pEntry->nAPIValue )
     763             :             {
     764           0 :                 _rValue <<= pEntry->nFormValue;
     765           0 :                 return;
     766             :             }
     767           0 :             ++pEntry;
     768             :         }
     769             :     }
     770             : 
     771           0 :     static void lcl_convertTextAlignmentToParaAdjustment( Any& rValue )
     772             :     {
     773           0 :         lcl_mapFormToAPIValue( rValue, aMapAdjustToAlign );
     774           0 :     }
     775             : 
     776           0 :     static void lcl_convertParaAdjustmentToTextAlignment( Any& rValue )
     777             :     {
     778           0 :         lcl_mapAPIToFormValue( rValue, aMapAdjustToAlign );
     779           0 :     }
     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           0 : 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           0 :     OUString aFormsName;
     820           0 :     if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
     821             :     {
     822           0 :         uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
     823           0 :         if( xControl.is() )
     824             :         {
     825           0 :             uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
     826           0 :             if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
     827             :             {
     828           0 :                 uno::Any aConvertedValue( aValue );
     829           0 :                 if ( aFormsName == "FontSlant" )
     830             :                 {
     831             :                     awt::FontSlant nSlant;
     832           0 :                     if( !(aValue >>= nSlant ) )
     833           0 :                         throw lang::IllegalArgumentException();
     834           0 :                     aConvertedValue <<= (sal_Int16)nSlant;
     835             :                 }
     836           0 :                 else if ( aFormsName == "Align" )
     837             :                 {
     838           0 :                     lcl_convertParaAdjustmentToTextAlignment( aConvertedValue );
     839             :                 }
     840           0 :                 else if ( aFormsName == "VerticalAlign" )
     841             :                 {
     842           0 :                     convertVerticalAdjustToVerticalAlign( aConvertedValue );
     843             :                 }
     844             : 
     845           0 :                 xControl->setPropertyValue( aFormsName, aConvertedValue );
     846           0 :             }
     847           0 :         }
     848             :     }
     849             :     else
     850             :     {
     851           0 :         SvxShape::setPropertyValue( aPropertyName, aValue );
     852           0 :     }
     853           0 : }
     854             : 
     855           0 : uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyName )
     856             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     857             : {
     858           0 :     OUString aFormsName;
     859           0 :     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           0 :         return SvxShape::getPropertyValue( aPropertyName );
     900           0 :     }
     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           0 : SvxShapeDimensioning::SvxShapeDimensioning( SdrObject* pObj ) throw()
     996           0 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_DIMENSIONING), getSvxMapProvider().GetPropertySet(SVXMAP_DIMENSIONING, SdrObject::GetGlobalDrawObjectItemPool()) )
     997             : {
     998           0 : }
     999             : 
    1000             : 
    1001           0 : SvxShapeDimensioning::~SvxShapeDimensioning() throw()
    1002             : {
    1003           0 : }
    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           0 : SvxShapeCircle::SvxShapeCircle( SdrObject* pObj ) throw()
    1017           0 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CIRCLE), getSvxMapProvider().GetPropertySet(SVXMAP_CIRCLE, SdrObject::GetGlobalDrawObjectItemPool()) )
    1018             : {
    1019           0 : }
    1020             : 
    1021             : 
    1022           0 : SvxShapeCircle::~SvxShapeCircle() throw()
    1023             : {
    1024           0 : }
    1025             : 
    1026             : // ::com::sun::star::lang::XServiceInfo
    1027             : // XServiceInfo
    1028           0 : uno::Sequence< OUString > SAL_CALL SvxShapeCircle::getSupportedServiceNames() throw( uno::RuntimeException, std::exception )
    1029             : {
    1030           0 :     return SvxShapeText::getSupportedServiceNames();
    1031             : }
    1032             : 
    1033             : /***********************************************************************
    1034             : *                                                                      *
    1035             : ***********************************************************************/
    1036             : 
    1037             : #include <svx/svdopath.hxx>
    1038             : 
    1039             : 
    1040           0 : SvxShapePolyPolygon::SvxShapePolyPolygon( SdrObject* pObj , drawing::PolygonKind eNew )
    1041             :  throw( com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
    1042           0 : : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGON), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGON, SdrObject::GetGlobalDrawObjectItemPool()) )
    1043           0 : , mePolygonKind( eNew )
    1044             : {
    1045           0 : }
    1046             : 
    1047             : 
    1048           0 : SvxShapePolyPolygon::~SvxShapePolyPolygon() throw()
    1049             : {
    1050           0 : }
    1051             : 
    1052           0 : basegfx::B2DPolyPolygon SAL_CALL ImplSvxPointSequenceSequenceToB2DPolyPolygon( const drawing::PointSequenceSequence* pOuterSequence) throw()
    1053             : {
    1054           0 :     basegfx::B2DPolyPolygon aRetval;
    1055             : 
    1056             :     // Zeiger auf innere sequences holen
    1057           0 :     const drawing::PointSequence* pInnerSequence = pOuterSequence->getConstArray();
    1058           0 :     const drawing::PointSequence* pInnerSeqEnd   = pInnerSequence + pOuterSequence->getLength();
    1059             : 
    1060           0 :     for(;pInnerSequence != pInnerSeqEnd; ++pInnerSequence)
    1061             :     {
    1062             :         // Neues Polygon vorbereiten
    1063           0 :         basegfx::B2DPolygon aNewPolygon;
    1064             : 
    1065             :         // Zeiger auf Arrays holen
    1066           0 :         const awt::Point* pArray    = pInnerSequence->getConstArray();
    1067           0 :         const awt::Point* pArrayEnd = pArray + pInnerSequence->getLength();
    1068             : 
    1069           0 :         for(;pArray != pArrayEnd;++pArray)
    1070             :         {
    1071           0 :             aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
    1072             :         }
    1073             : 
    1074             :         // check for closed state flag
    1075           0 :         basegfx::tools::checkClosed(aNewPolygon);
    1076             : 
    1077             :         // Neues Teilpolygon einfuegen
    1078           0 :         aRetval.append(aNewPolygon);
    1079           0 :     }
    1080             : 
    1081           0 :     return aRetval;
    1082             : }
    1083             : 
    1084             : 
    1085             : 
    1086           0 : 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           0 :     switch( pProperty->nWID )
    1089             :     {
    1090             :     case OWN_ATTR_VALUE_POLYPOLYGON:
    1091             :     {
    1092           0 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0) ) )
    1093             :         {
    1094           0 :             basegfx::B2DPolyPolygon aNewPolyPolygon(ImplSvxPointSequenceSequenceToB2DPolyPolygon( (drawing::PointSequenceSequence*)rValue.getValue()));
    1095           0 :             SetPolygon(aNewPolyPolygon);
    1096           0 :             return true;
    1097             :         }
    1098           0 :         break;
    1099             :     }
    1100             :     case OWN_ATTR_BASE_GEOMETRY:
    1101             :     {
    1102           0 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0)))
    1103             :         {
    1104           0 :             if( mpObj.is() )
    1105             :             {
    1106           0 :                 basegfx::B2DPolyPolygon aNewPolyPolygon;
    1107           0 :                 basegfx::B2DHomMatrix aNewHomogenMatrix;
    1108             : 
    1109           0 :                 mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1110           0 :                 aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon((drawing::PointSequenceSequence*)rValue.getValue());
    1111           0 :                 mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1112             :             }
    1113           0 :             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           0 :         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
    1147             :     }
    1148             : 
    1149           0 :     throw lang::IllegalArgumentException();
    1150             : }
    1151             : 
    1152           0 : void SAL_CALL B2DPolyPolygonToSvxPointSequenceSequence( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PointSequenceSequence& rRetval )
    1153             : {
    1154           0 :     if( (sal_uInt32)rRetval.getLength() != rPolyPoly.count() )
    1155           0 :         rRetval.realloc( rPolyPoly.count() );
    1156             : 
    1157             :     // Zeiger auf aeussere Arrays holen
    1158           0 :     drawing::PointSequence* pOuterSequence = rRetval.getArray();
    1159             : 
    1160           0 :     for(sal_uInt32 a(0L); a < rPolyPoly.count(); a++)
    1161             :     {
    1162             :         // Einzelpolygon holen
    1163           0 :         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           0 :         const sal_uInt32 nPointCount(aPoly.count());
    1169           0 :         const bool bIsClosed(aPoly.isClosed());
    1170             : 
    1171             :         // Platz in Arrays schaffen
    1172           0 :         pOuterSequence->realloc(bIsClosed ? nPointCount + 1 : nPointCount);
    1173             : 
    1174             :         // Pointer auf arrays holen
    1175           0 :         awt::Point* pInnerSequence = pOuterSequence->getArray();
    1176             : 
    1177           0 :         for(sal_uInt32 b(0L); b < nPointCount; b++)
    1178             :         {
    1179           0 :             const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
    1180           0 :             *pInnerSequence = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
    1181           0 :             pInnerSequence++;
    1182           0 :         }
    1183             : 
    1184             :         // #i75974# copy first point
    1185           0 :         if(bIsClosed)
    1186             :         {
    1187           0 :             *pInnerSequence = *pOuterSequence->getArray();
    1188             :         }
    1189             : 
    1190           0 :         pOuterSequence++;
    1191           0 :     }
    1192           0 : }
    1193             : 
    1194             : 
    1195             : 
    1196           0 : 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           0 :     switch( pProperty->nWID )
    1199             :     {
    1200             :     case OWN_ATTR_VALUE_POLYPOLYGON:
    1201             :     {
    1202             :         // PolyPolygon in eine struct PolyPolygon packen
    1203           0 :         const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
    1204           0 :         drawing::PointSequenceSequence aRetval( rPolyPoly.count() );
    1205             : 
    1206           0 :         B2DPolyPolygonToSvxPointSequenceSequence( rPolyPoly, aRetval );
    1207             : 
    1208           0 :         rValue <<= aRetval;
    1209           0 :         break;
    1210             :     }
    1211             :     case OWN_ATTR_BASE_GEOMETRY:
    1212             :     {
    1213             :         // pack a PolyPolygon in struct PolyPolygon
    1214           0 :         basegfx::B2DPolyPolygon aNewPolyPolygon;
    1215           0 :         basegfx::B2DHomMatrix aNewHomogenMatrix;
    1216             : 
    1217           0 :         if(mpObj.is())
    1218           0 :             mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1219             : 
    1220           0 :         drawing::PointSequenceSequence aRetval(aNewPolyPolygon.count());
    1221           0 :         B2DPolyPolygonToSvxPointSequenceSequence(aNewPolyPolygon, aRetval);
    1222           0 :         rValue <<= aRetval;
    1223           0 :         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           0 :         rValue <<= GetPolygonKind();
    1257           0 :         break;
    1258             :     }
    1259             :     default:
    1260           0 :         return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
    1261             :     }
    1262             : 
    1263           0 :     return true;
    1264             : }
    1265             : 
    1266             : 
    1267           0 : drawing::PolygonKind SvxShapePolyPolygon::GetPolygonKind() const throw()
    1268             : {
    1269           0 :     return mePolygonKind;
    1270             : }
    1271             : 
    1272             : 
    1273           0 : void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
    1274             : {
    1275           0 :     ::SolarMutexGuard aGuard;
    1276             : 
    1277           0 :     if(mpObj.is())
    1278           0 :         ((SdrPathObj*)mpObj.get())->SetPathPoly(rNew);
    1279           0 : }
    1280             : 
    1281             : 
    1282           0 : basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
    1283             : {
    1284           0 :     ::SolarMutexGuard aGuard;
    1285             : 
    1286           0 :     if(mpObj.is())
    1287             :     {
    1288           0 :         return ((SdrPathObj*)mpObj.get())->GetPathPoly();
    1289             :     }
    1290             :     else
    1291             :     {
    1292           0 :         return basegfx::B2DPolyPolygon();
    1293           0 :     }
    1294             : }
    1295             : 
    1296             : // ::com::sun::star::lang::XServiceInfo
    1297           0 : uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygon::getSupportedServiceNames() throw( uno::RuntimeException, std::exception )
    1298             : {
    1299           0 :     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           0 : SvxShapePolyPolygonBezier::SvxShapePolyPolygonBezier( SdrObject* pObj , drawing::PolygonKind eNew ) throw()
    1309           0 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGONBEZIER), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGONBEZIER, SdrObject::GetGlobalDrawObjectItemPool()) )
    1310           0 : ,   mePolygonKind( eNew )
    1311             : {
    1312           0 : }
    1313             : 
    1314             : 
    1315           0 : SvxShapePolyPolygonBezier::~SvxShapePolyPolygonBezier() throw()
    1316             : {
    1317           0 : }
    1318             : 
    1319             : 
    1320             : 
    1321           0 : 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           0 :     switch( pProperty->nWID )
    1324             :     {
    1325             :     case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
    1326             :     {
    1327           0 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0) ) )
    1328             :         {
    1329             :             basegfx::B2DPolyPolygon aNewPolyPolygon(
    1330             :                 basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
    1331           0 :                     *(drawing::PolyPolygonBezierCoords*)rValue.getValue()));
    1332           0 :             SetPolygon(aNewPolyPolygon);
    1333           0 :             return true;
    1334             :         }
    1335           0 :         break;
    1336             :     }
    1337             :     case OWN_ATTR_BASE_GEOMETRY:
    1338             :     {
    1339           0 :         if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0)) )
    1340             :         {
    1341           0 :             if( mpObj.is() )
    1342             :             {
    1343           0 :                 basegfx::B2DPolyPolygon aNewPolyPolygon;
    1344           0 :                 basegfx::B2DHomMatrix aNewHomogenMatrix;
    1345             : 
    1346           0 :                 mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1347           0 :                 aNewPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
    1348           0 :                     *(drawing::PolyPolygonBezierCoords*)rValue.getValue());
    1349           0 :                 mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1350             :             }
    1351           0 :             return true;
    1352             :         }
    1353           0 :         break;
    1354             :     }
    1355             :     default:
    1356           0 :         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
    1357             :     }
    1358             : 
    1359           0 :     throw IllegalArgumentException();
    1360             : }
    1361             : 
    1362             : 
    1363             : 
    1364           0 : 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           0 :     switch( pProperty->nWID )
    1367             :     {
    1368             :     case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
    1369             :     {
    1370             :         // PolyPolygon in eine struct PolyPolygon packen
    1371           0 :         const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
    1372           0 :         drawing::PolyPolygonBezierCoords aRetval;
    1373           0 :         basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(rPolyPoly, aRetval);
    1374             : 
    1375           0 :         rValue <<= aRetval;
    1376           0 :         break;
    1377             :     }
    1378             :     case OWN_ATTR_BASE_GEOMETRY:
    1379             :     {
    1380             :         // PolyPolygon in eine struct PolyPolygon packen
    1381           0 :         basegfx::B2DPolyPolygon aNewPolyPolygon;
    1382           0 :         basegfx::B2DHomMatrix aNewHomogenMatrix;
    1383           0 :         mpObj.get()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
    1384           0 :         drawing::PolyPolygonBezierCoords aRetval;
    1385           0 :         basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(aNewPolyPolygon, aRetval);
    1386             : 
    1387           0 :         rValue <<= aRetval;
    1388           0 :         break;
    1389             :     }
    1390             :     case OWN_ATTR_VALUE_POLYGONKIND:
    1391             :     {
    1392           0 :         rValue <<= GetPolygonKind();
    1393           0 :         break;
    1394             :     }
    1395             :     default:
    1396           0 :         return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
    1397             :     }
    1398           0 :     return true;
    1399             : }
    1400             : 
    1401             : 
    1402           0 : drawing::PolygonKind SvxShapePolyPolygonBezier::GetPolygonKind() const throw()
    1403             : {
    1404           0 :     return mePolygonKind;
    1405             : }
    1406             : 
    1407             : 
    1408           0 : void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
    1409             : {
    1410           0 :     ::SolarMutexGuard aGuard;
    1411             : 
    1412           0 :     if(mpObj.is())
    1413           0 :         static_cast<SdrPathObj*>(mpObj.get())->SetPathPoly(rNew);
    1414           0 : }
    1415             : 
    1416             : 
    1417           0 : basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
    1418             : {
    1419           0 :     ::SolarMutexGuard aGuard;
    1420             : 
    1421           0 :     if(mpObj.is())
    1422             :     {
    1423           0 :         return static_cast<SdrPathObj*>(mpObj.get())->GetPathPoly();
    1424             :     }
    1425             :     else
    1426             :     {
    1427           0 :         return basegfx::B2DPolyPolygon();
    1428           0 :     }
    1429             : }
    1430             : 
    1431             : 
    1432             : // ::com::sun::star::lang::XServiceInfo
    1433           0 : uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygonBezier::getSupportedServiceNames() throw( uno::RuntimeException, std::exception )
    1434             : {
    1435           0 :     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           0 : SvxGraphicObject::SvxGraphicObject( SdrObject* pObj, OUString const & referer ) throw()
    1452           0 : :   SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_GRAPHICOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_GRAPHICOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) ), referer_(referer)
    1453             : {
    1454           0 : }
    1455             : 
    1456             : 
    1457           0 : SvxGraphicObject::~SvxGraphicObject() throw()
    1458             : {
    1459           0 : }
    1460             : 
    1461             : 
    1462             : 
    1463           0 : 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           0 :     bool bOk = false;
    1466           0 :     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           0 :         OUString aURL;
    1513           0 :         if( rValue >>= aURL )
    1514             :         {
    1515           0 :             if( aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
    1516             :             {
    1517             :                 // graphic manager url
    1518           0 :                 aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
    1519           0 :                 OUString aTmpStr(aURL);
    1520           0 :                 OString aUniqueID(OUStringToOString(aTmpStr, RTL_TEXTENCODING_UTF8));
    1521           0 :                 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           0 :                 if( mpObj.is() )
    1527             :                 {
    1528           0 :                     static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink();
    1529           0 :                     static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
    1530           0 :                 }
    1531             :             }
    1532           0 :             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           0 :             bOk = true;
    1570             :         }
    1571           0 :         break;
    1572             :     }
    1573             : 
    1574             :     case OWN_ATTR_GRAFSTREAMURL:
    1575             :     {
    1576           0 :         OUString aStreamURL;
    1577             : 
    1578           0 :         if( rValue >>= aStreamURL )
    1579             :         {
    1580           0 :             if( !aStreamURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
    1581           0 :                 aStreamURL = OUString();
    1582             : 
    1583           0 :             if( mpObj.is() )
    1584             :             {
    1585           0 :                 static_cast<SdrGrafObj*>(mpObj.get())->SetGrafStreamURL( aStreamURL );
    1586           0 :                 static_cast<SdrGrafObj*>(mpObj.get())->ForceSwapOut();
    1587             :             }
    1588           0 :             bOk = true;
    1589             :         }
    1590           0 :         break;
    1591             :     }
    1592             : 
    1593             :     case OWN_ATTR_VALUE_GRAPHIC:
    1594             :     {
    1595           0 :         Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
    1596           0 :         if( xGraphic.is() )
    1597             :         {
    1598           0 :             static_cast< SdrGrafObj*>( mpObj.get() )->SetGraphic( xGraphic );
    1599           0 :             bOk = true;
    1600             :         }
    1601           0 :         break;
    1602             :     }
    1603             :     default:
    1604           0 :         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
    1605             :     }
    1606             : 
    1607           0 :     if( !bOk )
    1608           0 :         throw lang::IllegalArgumentException();
    1609             : 
    1610           0 :     if( mpModel )
    1611           0 :         mpModel->SetChanged();
    1612             : 
    1613           0 :     return true;
    1614             : }
    1615             : 
    1616             : 
    1617             : 
    1618           0 : 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           0 :     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           0 :         if( static_cast< SdrGrafObj*>( mpObj.get() )->IsLinkedGraphic() )
    1651             :         {
    1652           0 :             rValue <<= OUString( static_cast< SdrGrafObj*>( mpObj.get() )->GetFileName() );
    1653             :         }
    1654             :         else
    1655             :         {
    1656           0 :             sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
    1657           0 :             const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
    1658           0 :             OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
    1659           0 :             aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
    1660           0 :             rValue <<= aURL;
    1661           0 :             if ( bSwapped )
    1662           0 :                 static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
    1663             :         }
    1664           0 :         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           0 :         const OUString  aStreamURL( ( (SdrGrafObj*) mpObj.get() )->GetGrafStreamURL() );
    1684           0 :         if( !aStreamURL.isEmpty() )
    1685           0 :             rValue <<= aStreamURL;
    1686           0 :         break;
    1687             :     }
    1688             : 
    1689             :     case OWN_ATTR_VALUE_GRAPHIC:
    1690             :     {
    1691           0 :         sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
    1692           0 :         Reference< graphic::XGraphic > xGraphic( static_cast< SdrGrafObj* >( mpObj.get() )->GetGraphic().GetXGraphic() );
    1693           0 :         rValue <<= xGraphic;
    1694           0 :         if ( bSwapped )
    1695           0 :             static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
    1696           0 :         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           0 :         return SvxShapeText::getPropertyValueImpl(rName, pProperty,rValue);
    1706             :     }
    1707             : 
    1708           0 :     return true;
    1709             : }
    1710             : 
    1711             : 
    1712             : 
    1713           0 : SvxShapeCaption::SvxShapeCaption( SdrObject* pObj ) throw()
    1714           0 : : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CAPTION), getSvxMapProvider().GetPropertySet(SVXMAP_CAPTION, SdrObject::GetGlobalDrawObjectItemPool()) )
    1715             : {
    1716           0 : }
    1717             : 
    1718           0 : SvxShapeCaption::~SvxShapeCaption() throw()
    1719             : {
    1720           0 : }
    1721             : 
    1722             : /***********************************************************************
    1723             : * class SvxCustomShape                                                   *
    1724             : ***********************************************************************/
    1725             : 
    1726           0 : SvxCustomShape::SvxCustomShape( SdrObject* pObj )  throw() :
    1727           0 :     SvxShapeText( pObj, getSvxMapProvider().GetMap( SVXMAP_CUSTOMSHAPE ), getSvxMapProvider().GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool()) )
    1728             : {
    1729           0 : }
    1730             : 
    1731             : 
    1732           0 : SvxCustomShape::~SvxCustomShape() throw()
    1733             : {
    1734           0 : }
    1735             : 
    1736             : 
    1737             : 
    1738           0 : void SvxCustomShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
    1739             : {
    1740           0 :     SvxShapeText::Create( pNewObj, pNewPage );
    1741           0 : }
    1742             : 
    1743             : 
    1744             : 
    1745           0 : uno::Any SAL_CALL SvxCustomShape::queryInterface( const uno::Type & rType )
    1746             :     throw(uno::RuntimeException, std::exception)
    1747             : {
    1748           0 :     return SvxShapeText::queryInterface( rType );
    1749             : }
    1750             : 
    1751           0 : uno::Any SAL_CALL SvxCustomShape::queryAggregation( const uno::Type & rType )
    1752             :     throw(uno::RuntimeException, std::exception)
    1753             : {
    1754           0 :     ::com::sun::star::uno::Any aReturn = SvxShapeText::queryAggregation( rType );
    1755           0 :     if ( !aReturn.hasValue() )
    1756           0 :         aReturn = ::cppu::queryInterface(rType, static_cast<drawing::XEnhancedCustomShapeDefaulter*>(this) );
    1757           0 :     return aReturn;
    1758             : }
    1759             : 
    1760           0 : void SAL_CALL SvxCustomShape::acquire() throw ( )
    1761             : {
    1762           0 :     SvxShapeText::acquire();
    1763           0 : }
    1764             : 
    1765           0 : void SAL_CALL SvxCustomShape::release() throw ( )
    1766             : {
    1767           0 :     SvxShapeText::release();
    1768           0 : }
    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           0 : OUString SAL_CALL SvxCustomShape::getShapeType()
    1788             :     throw( uno::RuntimeException, std::exception )
    1789             : {
    1790           0 :     return SvxShape::getShapeType();
    1791             : }
    1792             : 
    1793             : //------------------------------------------------------------------1----
    1794           0 : awt::Point SAL_CALL SvxCustomShape::getPosition() throw(uno::RuntimeException, std::exception)
    1795             : {
    1796           0 :     ::SolarMutexGuard aGuard;
    1797           0 :     if ( mpModel && mpObj.is() )
    1798             :     {
    1799           0 :         SdrAShapeObjGeoData aCustomShapeGeoData;
    1800           0 :         ((SdrObjCustomShape*)mpObj.get())->SaveGeoData( aCustomShapeGeoData );
    1801             : 
    1802           0 :         sal_Bool bMirroredX = sal_False;
    1803           0 :         sal_Bool bMirroredY = sal_False;
    1804             : 
    1805           0 :         if ( mpObj.is() )
    1806             :         {
    1807           0 :             bMirroredX = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredX() );
    1808           0 :             bMirroredY = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredY() );
    1809             :         }
    1810             :         // get aRect, this is the unrotated snaprect
    1811           0 :         Rectangle aRect(((SdrObjCustomShape*)mpObj.get())->GetLogicRect());
    1812           0 :         Rectangle aRectangle( aRect );
    1813             : 
    1814           0 :         if ( bMirroredX || bMirroredY )
    1815             :         {   // we have to retrieve the unmirrored rect
    1816             : 
    1817           0 :             GeoStat aNewGeo( aCustomShapeGeoData.aGeo );
    1818           0 :             if ( bMirroredX )
    1819             :             {
    1820           0 :                 Polygon aPol( Rect2Poly( aRect, aNewGeo ) );
    1821           0 :                 Rectangle aBoundRect( aPol.GetBoundRect() );
    1822             : 
    1823           0 :                 Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
    1824           0 :                 Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
    1825             :                 sal_uInt16 i;
    1826           0 :                 sal_uInt16 nPntAnz=aPol.GetSize();
    1827           0 :                 for (i=0; i<nPntAnz; i++)
    1828             :                 {
    1829           0 :                     MirrorPoint(aPol[i],aRef1,aRef2);
    1830             :                 }
    1831             :                 // Polygon wenden und etwas schieben
    1832           0 :                 Polygon aPol0(aPol);
    1833           0 :                 aPol[0]=aPol0[1];
    1834           0 :                 aPol[1]=aPol0[0];
    1835           0 :                 aPol[2]=aPol0[3];
    1836           0 :                 aPol[3]=aPol0[2];
    1837           0 :                 aPol[4]=aPol0[1];
    1838           0 :                 Poly2Rect(aPol,aRectangle,aNewGeo);
    1839             :             }
    1840           0 :             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           0 :         Point aPt( aRectangle.TopLeft() );
    1864             : 
    1865           0 :         if( mpModel->IsWriter() )
    1866           0 :             aPt -= mpObj->GetAnchorPos();
    1867             : 
    1868           0 :         ForceMetricTo100th_mm(aPt);
    1869           0 :         return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
    1870             :     }
    1871             :     else
    1872           0 :         return SvxShape::getPosition();
    1873             : }
    1874             : 
    1875             : 
    1876           0 : void SAL_CALL SvxCustomShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException, std::exception)
    1877             : {
    1878           0 :     SvxShapeText::setPosition(Position);
    1879           0 : }
    1880             : 
    1881             : 
    1882             : 
    1883           0 : awt::Size SAL_CALL SvxCustomShape::getSize() throw(uno::RuntimeException, std::exception)
    1884             : {
    1885           0 :     return SvxShapeText::getSize();
    1886             : }
    1887             : 
    1888             : 
    1889           0 : void SAL_CALL SvxCustomShape::setSize( const awt::Size& rSize )
    1890             :     throw(beans::PropertyVetoException, uno::RuntimeException, std::exception)
    1891             : {
    1892           0 :     SvxShapeText::setSize( rSize );
    1893           0 : }
    1894             : 
    1895             : 
    1896             : 
    1897             : 
    1898           0 : 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           0 :     ::SolarMutexGuard aGuard;
    1902           0 :     SdrObject* pObject = mpObj.get();
    1903             : 
    1904           0 :     bool bCustomShapeGeometry = pObject && aPropertyName == "CustomShapeGeometry";
    1905             : 
    1906           0 :     bool bMirroredX = false;
    1907           0 :     bool bMirroredY = false;
    1908             : 
    1909           0 :     if ( bCustomShapeGeometry )
    1910             :     {
    1911           0 :         bMirroredX = ((SdrObjCustomShape*)pObject)->IsMirroredX();
    1912           0 :         bMirroredY = ((SdrObjCustomShape*)pObject)->IsMirroredY();
    1913             :     }
    1914             : 
    1915           0 :     SvxShape::setPropertyValue( aPropertyName, aValue );
    1916             : 
    1917           0 :     if ( bCustomShapeGeometry )
    1918             :     {
    1919           0 :         ((SdrObjCustomShape*)pObject)->MergeDefaultAttributes(0);
    1920           0 :         Rectangle aRect( pObject->GetSnapRect() );
    1921             : 
    1922             :         // #i38892#
    1923           0 :         bool bNeedsMirrorX = ((SdrObjCustomShape*)pObject)->IsMirroredX() != bMirroredX;
    1924           0 :         bool bNeedsMirrorY = ((SdrObjCustomShape*)pObject)->IsMirroredY() != bMirroredY;
    1925             : 
    1926           0 :         boost::scoped_ptr< SdrGluePointList > pListCopy;
    1927           0 :         if( bNeedsMirrorX || bNeedsMirrorY )
    1928             :         {
    1929           0 :             const SdrGluePointList* pList = pObject->GetGluePointList();
    1930           0 :             if( pList )
    1931           0 :                 pListCopy.reset( new SdrGluePointList(*pList) );
    1932             :         }
    1933             : 
    1934           0 :         if ( bNeedsMirrorX )
    1935             :         {
    1936           0 :             Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
    1937           0 :             Point aBottom( aTop.X(), aTop.Y() + 1000 );
    1938           0 :             pObject->NbcMirror( aTop, aBottom );
    1939             :             // NbcMirroring is flipping the current mirror state,
    1940             :             // so we have to set the correct state again
    1941           0 :             ((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True );
    1942             :         }
    1943           0 :         if ( bNeedsMirrorY )
    1944             :         {
    1945           0 :             Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
    1946           0 :             Point aRight( aLeft.X() + 1000, aLeft.Y() );
    1947           0 :             pObject->NbcMirror( aLeft, aRight );
    1948             :             // NbcMirroring is flipping the current mirror state,
    1949             :             // so we have to set the correct state again
    1950           0 :             ((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True );
    1951             :         }
    1952             : 
    1953           0 :         if( pListCopy )
    1954             :         {
    1955           0 :             SdrGluePointList* pNewList = const_cast< SdrGluePointList* >( pObject->GetGluePointList() );
    1956           0 :             if(pNewList)
    1957           0 :                 *pNewList = *pListCopy;
    1958           0 :         }
    1959           0 :     }
    1960           0 : }
    1961             : 
    1962           0 : 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           0 :     switch( pProperty->nWID )
    1965             :     {
    1966             :     case SDRATTR_ROTATEANGLE:
    1967             :     {
    1968           0 :         double fAngle = static_cast<SdrObjCustomShape*>(mpObj.get())->GetObjectRotation();
    1969           0 :         fAngle *= 100;
    1970           0 :         rValue <<= (sal_Int32)fAngle;
    1971           0 :         return true;
    1972             :     }
    1973             :     default:
    1974           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
    1975             :     }
    1976             : }
    1977             : 
    1978             : 
    1979           0 : void SvxCustomShape::createCustomShapeDefaults( const OUString& rValueType ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    1980             : {
    1981           0 :     ((SdrObjCustomShape*)mpObj.get())->MergeDefaultAttributes( &rValueType );
    1982           0 : }
    1983             : 
    1984             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10