LCOV - code coverage report
Current view: top level - svx/source/customshapes - EnhancedCustomShapeEngine.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 108 222 48.6 %
Date: 2014-04-11 Functions: 11 16 68.8 %
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/uno/Reference.h>
      21             : #include <com/sun/star/uno/RuntimeException.hpp>
      22             : #include <com/sun/star/uno/XComponentContext.hpp>
      23             : #include <com/sun/star/awt/Rectangle.hpp>
      24             : #include <com/sun/star/beans/PropertyValue.hpp>
      25             : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      26             : #include <com/sun/star/lang/XInitialization.hpp>
      27             : #include <com/sun/star/lang/XServiceInfo.hpp>
      28             : #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
      29             : #include <rtl/ref.hxx>
      30             : #include "svx/EnhancedCustomShape2d.hxx"
      31             : #include "EnhancedCustomShape3d.hxx"
      32             : #include "EnhancedCustomShapeFontWork.hxx"
      33             : #include "EnhancedCustomShapeHandle.hxx"
      34             : #include "svx/EnhancedCustomShapeGeometry.hxx"
      35             : #include <svx/unoshape.hxx>
      36             : #include "svx/unopage.hxx"
      37             : #include "svx/unoapi.hxx"
      38             : #include <svx/svdobj.hxx>
      39             : #include <svx/svdoashp.hxx>
      40             : #include <svx/svdogrp.hxx>
      41             : #include <svx/svdorect.hxx>
      42             : #include <editeng/outlobj.hxx>
      43             : #include <editeng/outliner.hxx>
      44             : #include <svx/svdoutl.hxx>
      45             : #include <svl/itemset.hxx>
      46             : #include <svx/svdopath.hxx>
      47             : #include <svx/svdpage.hxx>
      48             : #include <svx/svdmodel.hxx>
      49             : #include "svx/svditer.hxx"
      50             : #include <uno/mapping.hxx>
      51             : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      52             : #include <basegfx/tools/unotools.hxx>
      53             : #include <com/sun/star/document/XActionLockable.hpp>
      54             : #include <cppuhelper/implbase3.hxx>
      55             : #include <cppuhelper/supportsservice.hxx>
      56             : 
      57             : using namespace css;
      58             : using namespace css::uno;
      59             : 
      60             : class SdrObject;
      61             : class SdrObjCustomShape;
      62             : 
      63             : namespace {
      64             : 
      65             : class EnhancedCustomShapeEngine : public cppu::WeakImplHelper3
      66             : <
      67             :     css::lang::XInitialization,
      68             :     css::lang::XServiceInfo,
      69             :     css::drawing::XCustomShapeEngine
      70             : >
      71             : {
      72             :     css::uno::Reference< css::drawing::XShape >      mxShape;
      73             :     sal_Bool                                    mbForceGroupWithText;
      74             : 
      75             :     SdrObject* ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape );
      76             : 
      77             : public:
      78             :                             EnhancedCustomShapeEngine();
      79             :     virtual                 ~EnhancedCustomShapeEngine();
      80             : 
      81             :     // XInterface
      82             :     virtual void SAL_CALL   acquire() throw() SAL_OVERRIDE;
      83             :     virtual void SAL_CALL   release() throw() SAL_OVERRIDE;
      84             : 
      85             :     // XInitialization
      86             :     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
      87             :         throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      88             : 
      89             :     // XServiceInfo
      90             :     virtual OUString SAL_CALL getImplementationName()
      91             :         throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      92             :     virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName )
      93             :         throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      94             :     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
      95             :         throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      96             : 
      97             :     // XCustomShapeEngine
      98             :     virtual css::uno::Reference< css::drawing::XShape > SAL_CALL render()
      99             :         throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     100             :     virtual css::awt::Rectangle SAL_CALL getTextBounds()
     101             :         throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     102             :     virtual css::drawing::PolyPolygonBezierCoords SAL_CALL getLineGeometry()
     103             :         throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     104             :     virtual css::uno::Sequence< css::uno::Reference< css::drawing::XCustomShapeHandle > > SAL_CALL getInteraction()
     105             :         throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     106             : };
     107             : 
     108        2560 : EnhancedCustomShapeEngine::EnhancedCustomShapeEngine() :
     109        2560 :     mbForceGroupWithText    ( sal_False )
     110             : {
     111        2560 : }
     112        5120 : EnhancedCustomShapeEngine::~EnhancedCustomShapeEngine()
     113             : {
     114        5120 : }
     115             : 
     116             : // XInterface -----------------------------------------------------------------
     117             : 
     118       21838 : void SAL_CALL EnhancedCustomShapeEngine::acquire() throw()
     119             : {
     120       21838 :     OWeakObject::acquire();
     121       21838 : }
     122       21866 : void SAL_CALL EnhancedCustomShapeEngine::release() throw()
     123             : {
     124       21866 :     OWeakObject::release();
     125       21866 : }
     126             : 
     127             : // XInitialization ------------------------------------------------------------
     128             : 
     129        2560 : void SAL_CALL EnhancedCustomShapeEngine::initialize( const Sequence< Any >& aArguments )
     130             :     throw ( Exception, RuntimeException, std::exception )
     131             : {
     132             :     sal_Int32 i;
     133        2560 :     Sequence< beans::PropertyValue > aParameter;
     134        2560 :     for ( i = 0; i < aArguments.getLength(); i++ )
     135             :     {
     136        2560 :         if ( aArguments[ i ] >>= aParameter )
     137        2560 :             break;
     138             :     }
     139        5120 :     for ( i = 0; i < aParameter.getLength(); i++ )
     140             :     {
     141        2560 :         const beans::PropertyValue& rProp = aParameter[ i ];
     142        2560 :         if ( rProp.Name == "CustomShape" )
     143        2560 :             rProp.Value >>= mxShape;
     144           0 :         else if ( rProp.Name == "ForceGroupWithText" )
     145           0 :             rProp.Value >>= mbForceGroupWithText;
     146        2560 :     }
     147        2560 : }
     148             : 
     149             : // XServiceInfo ---------------------------------------------------------------
     150           0 : OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
     151             :     throw( RuntimeException, std::exception )
     152             : {
     153           0 :     return OUString( "com.sun.star.drawing.EnhancedCustomShapeEngine" );
     154             : }
     155           0 : sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const OUString& rServiceName )
     156             :     throw( RuntimeException, std::exception )
     157             : {
     158           0 :     return cppu::supportsService(this, rServiceName);
     159             : }
     160           0 : Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames()
     161             :     throw ( RuntimeException, std::exception )
     162             : {
     163           0 :     Sequence< OUString > aRet(1);
     164           0 :     OUString* pArray = aRet.getArray();
     165           0 :     pArray[0] = "com.sun.star.drawing.CustomShapeEngine";
     166           0 :     return aRet;
     167             : }
     168             : 
     169             : // XCustomShapeEngine -----------------------------------------------------------
     170           0 : SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape )
     171             : {
     172           0 :     bool bHasText = pCustoObj->HasText();
     173           0 :     if ( pRenderedShape || bHasText )
     174             :     {
     175             :         // applying shadow
     176           0 :         const SdrObject* pShadowGeometry = pCustoObj->GetSdrObjectShadowFromCustomShape();
     177           0 :         if ( pShadowGeometry )
     178             :         {
     179           0 :             if ( pRenderedShape )
     180             :             {
     181           0 :                 if ( !pRenderedShape->ISA( SdrObjGroup ) )
     182             :                 {
     183           0 :                     SdrObject* pTmp = pRenderedShape;
     184           0 :                     pRenderedShape = new SdrObjGroup();
     185           0 :                     ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
     186             :                 }
     187           0 :                 ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pShadowGeometry->Clone(), 0 );
     188             :             }
     189             :             else
     190           0 :                 pRenderedShape = pShadowGeometry->Clone();
     191             :         }
     192             : 
     193             :         // apply text
     194           0 :         if ( bHasText )
     195             :         {
     196             :             // #i37011# also create a text object and add at rPos + 1
     197             :             SdrObject* pTextObj = SdrObjFactory::MakeNewObject(
     198           0 :                 pCustoObj->GetObjInventor(), OBJ_TEXT, 0L, pCustoObj->GetModel());
     199             : 
     200             :             // Copy text content
     201           0 :             OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject();
     202           0 :             if( pParaObj )
     203           0 :                 pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) );
     204             : 
     205             :             // copy all attributes
     206           0 :             SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() );
     207             : 
     208             :             // clear fill and line style
     209           0 :             aTargetItemSet.Put(XLineStyleItem(XLINE_NONE));
     210           0 :             aTargetItemSet.Put(XFillStyleItem(XFILL_NONE));
     211             : 
     212             :             // get the text bounds and set at text object
     213           0 :             Rectangle aTextBounds = pCustoObj->GetSnapRect();
     214           0 :             SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     215           0 :             if ( pSdrObjCustomShape )
     216             :             {
     217           0 :                 EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     218           0 :                 aTextBounds = aCustomShape2d.GetTextRect();
     219             :             }
     220           0 :             pTextObj->SetSnapRect( aTextBounds );
     221             : 
     222             :             // if rotated, copy GeoStat, too.
     223           0 :             const GeoStat& rSourceGeo = pCustoObj->GetGeoStat();
     224           0 :             if ( rSourceGeo.nDrehWink )
     225             :             {
     226             :                 pTextObj->NbcRotate(
     227           0 :                     pCustoObj->GetSnapRect().Center(), rSourceGeo.nDrehWink,
     228           0 :                     rSourceGeo.nSin, rSourceGeo.nCos);
     229             :             }
     230             : 
     231             :             // set modified ItemSet at text object
     232           0 :             pTextObj->SetMergedItemSet(aTargetItemSet);
     233             : 
     234           0 :             if ( pRenderedShape )
     235             :             {
     236           0 :                 if ( !pRenderedShape->ISA( SdrObjGroup ) )
     237             :                 {
     238           0 :                     SdrObject* pTmp = pRenderedShape;
     239           0 :                     pRenderedShape = new SdrObjGroup();
     240           0 :                     ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
     241             :                 }
     242           0 :                 ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTextObj, CONTAINER_APPEND );
     243             :             }
     244             :             else
     245           0 :                 pRenderedShape = pTextObj;
     246             :         }
     247             : 
     248             :         // force group
     249           0 :         if ( pRenderedShape )
     250             :         {
     251           0 :             if ( !pRenderedShape->ISA( SdrObjGroup ) )
     252             :             {
     253           0 :                 SdrObject* pTmp = pRenderedShape;
     254           0 :                 pRenderedShape = new SdrObjGroup();
     255           0 :                 ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
     256             :             }
     257           0 :             pRenderedShape->SetPage( pCustoObj->GetPage() );
     258           0 :             pRenderedShape->SetModel( pCustoObj->GetModel() );
     259             :         }
     260             :     }
     261           0 :     return pRenderedShape;
     262             : }
     263             : 
     264        3140 : void SetTemporary( uno::Reference< drawing::XShape >& xShape )
     265             : {
     266        3140 :     if ( xShape.is() )
     267             :     {
     268        1171 :         SvxShape* pShape = SvxShape::getImplementation( xShape );
     269        1171 :         if ( pShape )
     270        1171 :             pShape->TakeSdrObjectOwnership();
     271             :     }
     272        3140 : }
     273             : 
     274        3140 : Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
     275             :     throw ( RuntimeException, std::exception )
     276             : {
     277        3140 :     Reference< drawing::XShape > xShape;
     278        3140 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     279        3140 :     if ( pSdrObjCustomShape )
     280             :     {
     281             :         // retrieving the TextPath property to check if feature is enabled
     282             :         SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)
     283        3140 :             pSdrObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
     284        3140 :         sal_Bool bTextPathOn = sal_False;
     285        3140 :         const OUString sTextPath( "TextPath" );
     286        3140 :         uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
     287        3140 :         if ( pAny )
     288         104 :             *pAny >>= bTextPathOn;
     289             : 
     290        6280 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     291        3140 :         sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
     292        3140 :         bool bPostRotateAngle = aCustomShape2d.IsPostRotate();
     293             : 
     294        3140 :         sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
     295        3140 :         sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
     296        3140 :         sal_Bool bLineGeometryNeededOnly = bTextPathOn;
     297             : 
     298        3140 :         SdrObject* pRenderedShape = aCustomShape2d.CreateObject( bLineGeometryNeededOnly );
     299        3140 :         if ( pRenderedShape )
     300             :         {
     301        1171 :             if ( bTextPathOn )
     302             :             {
     303          14 :                 SdrObject* pRenderedFontWork = EnhancedCustomShapeFontWork::CreateFontWork( pRenderedShape, pSdrObjCustomShape );
     304          14 :                 if ( pRenderedFontWork )
     305             :                 {
     306          14 :                     SdrObject::Free( pRenderedShape );
     307          14 :                     pRenderedShape = pRenderedFontWork;
     308             :                 }
     309             :             }
     310        1171 :             SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject( pRenderedShape, pSdrObjCustomShape );
     311        1171 :             if ( pRenderedShape3d )
     312             :             {
     313           0 :                 bFlipV = bFlipH = sal_False;
     314           0 :                 nRotateAngle = 0;
     315           0 :                 SdrObject::Free( pRenderedShape );
     316           0 :                 pRenderedShape = pRenderedShape3d;
     317             :             }
     318        1171 :             Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
     319             : 
     320        1171 :             const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
     321        1171 :             if ( rGeoStat.nShearWink )
     322             :             {
     323           2 :                 long nShearWink = rGeoStat.nShearWink;
     324           2 :                 double nTan = rGeoStat.nTan;
     325           2 :                 if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
     326             :                 {
     327           0 :                     nShearWink = -nShearWink;
     328           0 :                     nTan = -nTan;
     329             :                 }
     330           2 :                 pRenderedShape->Shear( pSdrObjCustomShape->GetSnapRect().Center(), nShearWink, nTan, false);
     331             :             }
     332        1171 :             if( !bPostRotateAngle && nRotateAngle )
     333             :             {
     334          23 :                 double a = nRotateAngle * F_PI18000;
     335          23 :                 pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
     336             :             }
     337        1171 :             if ( bFlipV )
     338             :             {
     339         232 :                 Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
     340         232 :                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
     341         232 :                 pRenderedShape->NbcMirror( aLeft, aRight );
     342             :             }
     343        1171 :             if ( bFlipH )
     344             :             {
     345          30 :                 Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
     346          30 :                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
     347          30 :                 pRenderedShape->NbcMirror( aTop, aBottom );
     348             :             }
     349             :             // Specifically for pptx imports
     350        1171 :             if( bPostRotateAngle && nRotateAngle )
     351             :             {
     352         172 :                 double a = nRotateAngle * F_PI18000;
     353         172 :                 pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
     354             :             }
     355        1171 :             pRenderedShape->NbcSetStyleSheet( pSdrObjCustomShape->GetStyleSheet(), true );
     356        1171 :             pRenderedShape->RecalcSnapRect();
     357             :         }
     358             : 
     359        3140 :         if ( mbForceGroupWithText )
     360           0 :             pRenderedShape = ImplForceGroupWithText( (SdrObjCustomShape*)pSdrObjCustomShape, pRenderedShape );
     361             : 
     362        3140 :         if ( pRenderedShape )
     363             :         {
     364        1171 :             aCustomShape2d.ApplyGluePoints( pRenderedShape );
     365        2342 :             xShape = SvxDrawPage::CreateShapeByTypeAndInventor( pRenderedShape->GetObjIdentifier(),
     366        3513 :                 pRenderedShape->GetObjInventor(), pRenderedShape, NULL );
     367             :         }
     368        6280 :         SetTemporary( xShape );
     369             :     }
     370        3140 :     return xShape;
     371             : }
     372             : 
     373        7972 : awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
     374             :     throw ( RuntimeException, std::exception )
     375             : {
     376        7972 :     awt::Rectangle aTextRect;
     377        7972 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     378        7972 :     uno::Reference< document::XActionLockable > xLockable( mxShape, uno::UNO_QUERY );
     379        7972 :     if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && xLockable.is() && !xLockable->isActionLocked() )
     380             :     {
     381        6412 :         if ( pSdrObjCustomShape )
     382             :         {
     383        6412 :             EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     384        6412 :             Rectangle aRect( aCustomShape2d.GetTextRect() );
     385        6412 :             aTextRect.X = aRect.Left();
     386        6412 :             aTextRect.Y = aRect.Top();
     387        6412 :             aTextRect.Width = aRect.GetWidth();
     388        6412 :             aTextRect.Height = aRect.GetHeight();
     389             :         }
     390             :     }
     391        7972 :     return aTextRect;
     392             : }
     393             : 
     394           0 : drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
     395             :     throw ( RuntimeException, std::exception )
     396             : {
     397           0 :     drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
     398           0 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     399           0 :     if ( pSdrObjCustomShape )
     400             :     {
     401           0 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     402           0 :         SdrObject* pObj = aCustomShape2d.CreateLineGeometry();
     403           0 :         if ( pObj )
     404             :         {
     405           0 :             Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
     406           0 :             sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
     407           0 :             sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
     408             : 
     409           0 :             const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
     410           0 :             if ( rGeoStat.nShearWink )
     411             :             {
     412           0 :                 long nShearWink = rGeoStat.nShearWink;
     413           0 :                 double nTan = rGeoStat.nTan;
     414           0 :                 if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
     415             :                 {
     416           0 :                     nShearWink = -nShearWink;
     417           0 :                     nTan = -nTan;
     418             :                 }
     419           0 :                 pObj->Shear( aRect.Center(), nShearWink, nTan, false);
     420             :             }
     421           0 :             sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
     422           0 :             if( nRotateAngle )
     423             :             {
     424           0 :                 double a = nRotateAngle * F_PI18000;
     425           0 :                 pObj->NbcRotate( aRect.Center(), nRotateAngle, sin( a ), cos( a ) );
     426             :             }
     427           0 :             if ( bFlipH )
     428             :             {
     429           0 :                 Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
     430           0 :                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
     431           0 :                 pObj->NbcMirror( aTop, aBottom );
     432             :             }
     433           0 :             if ( bFlipV )
     434             :             {
     435           0 :                 Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
     436           0 :                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
     437           0 :                 pObj->NbcMirror( aLeft, aRight );
     438             :             }
     439             : 
     440           0 :             basegfx::B2DPolyPolygon aPolyPolygon;
     441           0 :             SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS );
     442             : 
     443           0 :             while ( aIter.IsMore() )
     444             :             {
     445           0 :                 SdrObject* pNewObj = NULL;
     446           0 :                 basegfx::B2DPolyPolygon aPP;
     447           0 :                 const SdrObject* pNext = aIter.Next();
     448             : 
     449           0 :                 if ( pNext->ISA( SdrPathObj ) )
     450             :                 {
     451           0 :                     aPP = ((SdrPathObj*)pNext)->GetPathPoly();
     452             :                 }
     453             :                 else
     454             :                 {
     455           0 :                     pNewObj = pNext->ConvertToPolyObj( false, false );
     456           0 :                     SdrPathObj* pPath = PTR_CAST( SdrPathObj, pNewObj );
     457           0 :                     if ( pPath )
     458           0 :                         aPP = pPath->GetPathPoly();
     459             :                 }
     460             : 
     461           0 :                 if ( aPP.count() )
     462           0 :                     aPolyPolygon.append(aPP);
     463             : 
     464           0 :                 SdrObject::Free( pNewObj );
     465           0 :             }
     466           0 :             SdrObject::Free( pObj );
     467             :             basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPolygon,
     468           0 :                                                                   aPolyPolygonBezierCoords );
     469           0 :         }
     470             :     }
     471             : 
     472           0 :     return aPolyPolygonBezierCoords;
     473             : }
     474             : 
     475         486 : Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShapeEngine::getInteraction()
     476             :     throw ( RuntimeException, std::exception )
     477             : {
     478         486 :     sal_uInt32 i, nHdlCount = 0;
     479         486 :     SdrObject* pSdrObjCustomShape = GetSdrObjectFromXShape( mxShape );
     480         486 :     if ( pSdrObjCustomShape )
     481             :     {
     482         486 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     483         486 :         nHdlCount = aCustomShape2d.GetHdlCount();
     484             :     }
     485         486 :     Sequence< Reference< drawing::XCustomShapeHandle > > aSeq( nHdlCount );
     486         509 :     for ( i = 0; i < nHdlCount; i++ )
     487          23 :         aSeq[ i ] = new EnhancedCustomShapeHandle( mxShape, i );
     488         486 :     return aSeq;
     489             : }
     490             : 
     491             : }
     492             : 
     493             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     494        2560 : com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation(
     495             :     css::uno::XComponentContext *,
     496             :     css::uno::Sequence<css::uno::Any> const &)
     497             : {
     498        2560 :     return cppu::acquire(new EnhancedCustomShapeEngine);
     499             : }
     500             : 
     501             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10