LCOV - code coverage report
Current view: top level - svx/source/customshapes - EnhancedCustomShapeEngine.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 176 222 79.3 %
Date: 2015-06-13 12:38:46 Functions: 17 18 94.4 %
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             :     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        4573 : EnhancedCustomShapeEngine::EnhancedCustomShapeEngine() :
     109        4573 :     mbForceGroupWithText    ( false )
     110             : {
     111        4573 : }
     112        9140 : EnhancedCustomShapeEngine::~EnhancedCustomShapeEngine()
     113             : {
     114        9140 : }
     115             : 
     116             : // XInterface
     117       40228 : void SAL_CALL EnhancedCustomShapeEngine::acquire() throw()
     118             : {
     119       40228 :     OWeakObject::acquire();
     120       40228 : }
     121       40920 : void SAL_CALL EnhancedCustomShapeEngine::release() throw()
     122             : {
     123       40920 :     OWeakObject::release();
     124       40920 : }
     125             : 
     126             : // XInitialization
     127        4572 : void SAL_CALL EnhancedCustomShapeEngine::initialize( const Sequence< Any >& aArguments )
     128             :     throw ( Exception, RuntimeException, std::exception )
     129             : {
     130             :     sal_Int32 i;
     131        4572 :     Sequence< beans::PropertyValue > aParameter;
     132        4572 :     for ( i = 0; i < aArguments.getLength(); i++ )
     133             :     {
     134        4572 :         if ( aArguments[ i ] >>= aParameter )
     135        4572 :             break;
     136             :     }
     137        9153 :     for ( i = 0; i < aParameter.getLength(); i++ )
     138             :     {
     139        4581 :         const beans::PropertyValue& rProp = aParameter[ i ];
     140        4581 :         if ( rProp.Name == "CustomShape" )
     141        4572 :             rProp.Value >>= mxShape;
     142           9 :         else if ( rProp.Name == "ForceGroupWithText" )
     143           9 :             rProp.Value >>= mbForceGroupWithText;
     144        4572 :     }
     145        4572 : }
     146             : 
     147             : // XServiceInfo
     148           1 : OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
     149             :     throw( RuntimeException, std::exception )
     150             : {
     151           1 :     return OUString( "com.sun.star.drawing.EnhancedCustomShapeEngine" );
     152             : }
     153           0 : sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const OUString& rServiceName )
     154             :     throw( RuntimeException, std::exception )
     155             : {
     156           0 :     return cppu::supportsService(this, rServiceName);
     157             : }
     158           1 : Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames()
     159             :     throw ( RuntimeException, std::exception )
     160             : {
     161           1 :     Sequence< OUString > aRet(1);
     162           1 :     OUString* pArray = aRet.getArray();
     163           1 :     pArray[0] = "com.sun.star.drawing.CustomShapeEngine";
     164           1 :     return aRet;
     165             : }
     166             : 
     167             : // XCustomShapeEngine
     168           2 : SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape )
     169             : {
     170           2 :     bool bHasText = pCustoObj->HasText();
     171           2 :     if ( pRenderedShape || bHasText )
     172             :     {
     173             :         // applying shadow
     174           2 :         const SdrObject* pShadowGeometry = pCustoObj->GetSdrObjectShadowFromCustomShape();
     175           2 :         if ( pShadowGeometry )
     176             :         {
     177           0 :             if ( pRenderedShape )
     178             :             {
     179           0 :                 if ( !pRenderedShape->ISA( SdrObjGroup ) )
     180             :                 {
     181           0 :                     SdrObject* pTmp = pRenderedShape;
     182           0 :                     pRenderedShape = new SdrObjGroup();
     183           0 :                     static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
     184             :                 }
     185           0 :                 static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pShadowGeometry->Clone(), 0 );
     186             :             }
     187             :             else
     188           0 :                 pRenderedShape = pShadowGeometry->Clone();
     189             :         }
     190             : 
     191             :         // apply text
     192           2 :         if ( bHasText )
     193             :         {
     194             :             // #i37011# also create a text object and add at rPos + 1
     195             :             SdrObject* pTextObj = SdrObjFactory::MakeNewObject(
     196           0 :                 pCustoObj->GetObjInventor(), OBJ_TEXT, 0L, pCustoObj->GetModel());
     197             : 
     198             :             // Copy text content
     199           0 :             OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject();
     200           0 :             if( pParaObj )
     201           0 :                 pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) );
     202             : 
     203             :             // copy all attributes
     204           0 :             SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() );
     205             : 
     206             :             // clear fill and line style
     207           0 :             aTargetItemSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
     208           0 :             aTargetItemSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
     209             : 
     210             :             // get the text bounds and set at text object
     211           0 :             Rectangle aTextBounds = pCustoObj->GetSnapRect();
     212           0 :             SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     213           0 :             if ( pSdrObjCustomShape )
     214             :             {
     215           0 :                 EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     216           0 :                 aTextBounds = aCustomShape2d.GetTextRect();
     217             :             }
     218           0 :             pTextObj->SetSnapRect( aTextBounds );
     219             : 
     220             :             // if rotated, copy GeoStat, too.
     221           0 :             const GeoStat& rSourceGeo = pCustoObj->GetGeoStat();
     222           0 :             if ( rSourceGeo.nRotationAngle )
     223             :             {
     224             :                 pTextObj->NbcRotate(
     225           0 :                     pCustoObj->GetSnapRect().Center(), rSourceGeo.nRotationAngle,
     226           0 :                     rSourceGeo.nSin, rSourceGeo.nCos);
     227             :             }
     228             : 
     229             :             // set modified ItemSet at text object
     230           0 :             pTextObj->SetMergedItemSet(aTargetItemSet);
     231             : 
     232           0 :             if ( pRenderedShape )
     233             :             {
     234           0 :                 if ( !pRenderedShape->ISA( SdrObjGroup ) )
     235             :                 {
     236           0 :                     SdrObject* pTmp = pRenderedShape;
     237           0 :                     pRenderedShape = new SdrObjGroup();
     238           0 :                     static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
     239             :                 }
     240           0 :                 static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTextObj );
     241             :             }
     242             :             else
     243           0 :                 pRenderedShape = pTextObj;
     244             :         }
     245             : 
     246             :         // force group
     247           2 :         if ( pRenderedShape )
     248             :         {
     249           2 :             if ( !pRenderedShape->ISA( SdrObjGroup ) )
     250             :             {
     251           2 :                 SdrObject* pTmp = pRenderedShape;
     252           2 :                 pRenderedShape = new SdrObjGroup();
     253           2 :                 static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
     254             :             }
     255           2 :             pRenderedShape->SetPage( pCustoObj->GetPage() );
     256           2 :             pRenderedShape->SetModel( pCustoObj->GetModel() );
     257             :         }
     258             :     }
     259           2 :     return pRenderedShape;
     260             : }
     261             : 
     262        5397 : void SetTemporary( uno::Reference< drawing::XShape >& xShape )
     263             : {
     264        5397 :     if ( xShape.is() )
     265             :     {
     266        2911 :         SvxShape* pShape = SvxShape::getImplementation( xShape );
     267        2911 :         if ( pShape )
     268        2911 :             pShape->TakeSdrObjectOwnership();
     269             :     }
     270        5397 : }
     271             : 
     272        5404 : Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
     273             :     throw ( RuntimeException, std::exception )
     274             : {
     275        5404 :     Reference< drawing::XShape > xShape;
     276        5404 :     SdrObject* pSdrObjCustomShape( PTR_CAST( SdrObjCustomShape, GetSdrObjectFromXShape( mxShape ) ) );
     277        5404 :     if ( pSdrObjCustomShape )
     278             :     {
     279             :         // retrieving the TextPath property to check if feature is enabled
     280             :         const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>(
     281        5397 :             pSdrObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
     282        5397 :         bool bTextPathOn = false;
     283        5397 :         const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "TextPath" );
     284        5397 :         if ( pAny )
     285         247 :             *pAny >>= bTextPathOn;
     286             : 
     287        5397 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     288        5397 :         sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
     289        5397 :         bool bPostRotateAngle = aCustomShape2d.IsPostRotate();
     290             : 
     291        5397 :         bool bFlipV = aCustomShape2d.IsFlipVert();
     292        5397 :         bool bFlipH = aCustomShape2d.IsFlipHorz();
     293        5397 :         bool bLineGeometryNeededOnly = bTextPathOn;
     294             : 
     295        5397 :         SdrObject* pRenderedShape = aCustomShape2d.CreateObject( bLineGeometryNeededOnly );
     296        5397 :         if ( pRenderedShape )
     297             :         {
     298        2911 :             if ( bTextPathOn )
     299             :             {
     300          54 :                 SdrObject* pRenderedFontWork = EnhancedCustomShapeFontWork::CreateFontWork( pRenderedShape, pSdrObjCustomShape );
     301          54 :                 if ( pRenderedFontWork )
     302             :                 {
     303          54 :                     SdrObject::Free( pRenderedShape );
     304          54 :                     pRenderedShape = pRenderedFontWork;
     305             :                 }
     306             :             }
     307        2911 :             SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject( pRenderedShape, pSdrObjCustomShape );
     308        2911 :             if ( pRenderedShape3d )
     309             :             {
     310           0 :                 bFlipV = bFlipH = false;
     311           0 :                 nRotateAngle = 0;
     312           0 :                 SdrObject::Free( pRenderedShape );
     313           0 :                 pRenderedShape = pRenderedShape3d;
     314             :             }
     315        2911 :             Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
     316             : 
     317        2911 :             const GeoStat& rGeoStat = static_cast<SdrObjCustomShape*>(pSdrObjCustomShape)->GetGeoStat();
     318        2911 :             if ( rGeoStat.nShearAngle )
     319             :             {
     320           2 :                 long nShearAngle = rGeoStat.nShearAngle;
     321           2 :                 double nTan = rGeoStat.nTan;
     322           2 :                 if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
     323             :                 {
     324           0 :                     nShearAngle = -nShearAngle;
     325           0 :                     nTan = -nTan;
     326             :                 }
     327           2 :                 pRenderedShape->Shear( pSdrObjCustomShape->GetSnapRect().Center(), nShearAngle, nTan, false);
     328             :             }
     329        2911 :             if( !bPostRotateAngle && nRotateAngle )
     330             :             {
     331          43 :                 double a = nRotateAngle * F_PI18000;
     332          43 :                 pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
     333             :             }
     334        2911 :             if ( bFlipV )
     335             :             {
     336         209 :                 Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
     337         209 :                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
     338         209 :                 pRenderedShape->NbcMirror( aLeft, aRight );
     339             :             }
     340        2911 :             if ( bFlipH )
     341             :             {
     342          32 :                 Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
     343          32 :                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
     344          32 :                 pRenderedShape->NbcMirror( aTop, aBottom );
     345             :             }
     346             :             // Specifically for pptx imports
     347        2911 :             if( bPostRotateAngle && nRotateAngle )
     348             :             {
     349         119 :                 double a = nRotateAngle * F_PI18000;
     350         119 :                 pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
     351             :             }
     352        2911 :             pRenderedShape->NbcSetStyleSheet( pSdrObjCustomShape->GetStyleSheet(), true );
     353        2911 :             pRenderedShape->RecalcSnapRect();
     354             :         }
     355             : 
     356        5397 :         if ( mbForceGroupWithText )
     357           2 :             pRenderedShape = ImplForceGroupWithText( static_cast<SdrObjCustomShape*>(pSdrObjCustomShape), pRenderedShape );
     358             : 
     359        5397 :         if ( pRenderedShape )
     360             :         {
     361        2911 :             aCustomShape2d.ApplyGluePoints( pRenderedShape );
     362        5822 :             xShape = SvxDrawPage::CreateShapeByTypeAndInventor( pRenderedShape->GetObjIdentifier(),
     363        8733 :                 pRenderedShape->GetObjInventor(), pRenderedShape, NULL );
     364             :         }
     365        5397 :         SetTemporary( xShape );
     366             :     }
     367        5404 :     return xShape;
     368             : }
     369             : 
     370       15290 : awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
     371             :     throw ( RuntimeException, std::exception )
     372             : {
     373       15290 :     awt::Rectangle aTextRect;
     374       15290 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     375       15290 :     uno::Reference< document::XActionLockable > xLockable( mxShape, uno::UNO_QUERY );
     376       15290 :     if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && xLockable.is() && !xLockable->isActionLocked() )
     377             :     {
     378       11952 :         if ( pSdrObjCustomShape )
     379             :         {
     380       11952 :             EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     381       11952 :             Rectangle aRect( aCustomShape2d.GetTextRect() );
     382       11952 :             aTextRect.X = aRect.Left();
     383       11952 :             aTextRect.Y = aRect.Top();
     384       11952 :             aTextRect.Width = aRect.GetWidth();
     385       11952 :             aTextRect.Height = aRect.GetHeight();
     386             :         }
     387             :     }
     388       15290 :     return aTextRect;
     389             : }
     390             : 
     391           8 : drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
     392             :     throw ( RuntimeException, std::exception )
     393             : {
     394           8 :     drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
     395           8 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     396           8 :     if ( pSdrObjCustomShape )
     397             :     {
     398           8 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     399           8 :         SdrObject* pObj = aCustomShape2d.CreateLineGeometry();
     400           8 :         if ( pObj )
     401             :         {
     402           8 :             Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
     403           8 :             bool bFlipV = aCustomShape2d.IsFlipVert();
     404           8 :             bool bFlipH = aCustomShape2d.IsFlipHorz();
     405             : 
     406           8 :             const GeoStat& rGeoStat = static_cast<SdrObjCustomShape*>(pSdrObjCustomShape)->GetGeoStat();
     407           8 :             if ( rGeoStat.nShearAngle )
     408             :             {
     409           0 :                 long nShearAngle = rGeoStat.nShearAngle;
     410           0 :                 double nTan = rGeoStat.nTan;
     411           0 :                 if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
     412             :                 {
     413           0 :                     nShearAngle = -nShearAngle;
     414           0 :                     nTan = -nTan;
     415             :                 }
     416           0 :                 pObj->Shear( aRect.Center(), nShearAngle, nTan, false);
     417             :             }
     418           8 :             sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
     419           8 :             if( nRotateAngle )
     420             :             {
     421           8 :                 double a = nRotateAngle * F_PI18000;
     422           8 :                 pObj->NbcRotate( aRect.Center(), nRotateAngle, sin( a ), cos( a ) );
     423             :             }
     424           8 :             if ( bFlipH )
     425             :             {
     426           1 :                 Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
     427           1 :                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
     428           1 :                 pObj->NbcMirror( aTop, aBottom );
     429             :             }
     430           8 :             if ( bFlipV )
     431             :             {
     432           1 :                 Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
     433           1 :                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
     434           1 :                 pObj->NbcMirror( aLeft, aRight );
     435             :             }
     436             : 
     437           8 :             basegfx::B2DPolyPolygon aPolyPolygon;
     438          16 :             SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS );
     439             : 
     440          24 :             while ( aIter.IsMore() )
     441             :             {
     442           8 :                 SdrObject* pNewObj = NULL;
     443           8 :                 basegfx::B2DPolyPolygon aPP;
     444           8 :                 const SdrObject* pNext = aIter.Next();
     445             : 
     446           8 :                 if ( pNext->ISA( SdrPathObj ) )
     447             :                 {
     448           2 :                     aPP = static_cast<const SdrPathObj*>(pNext)->GetPathPoly();
     449             :                 }
     450             :                 else
     451             :                 {
     452           6 :                     pNewObj = pNext->ConvertToPolyObj( false, false );
     453           6 :                     SdrPathObj* pPath = PTR_CAST( SdrPathObj, pNewObj );
     454           6 :                     if ( pPath )
     455           6 :                         aPP = pPath->GetPathPoly();
     456             :                 }
     457             : 
     458           8 :                 if ( aPP.count() )
     459           8 :                     aPolyPolygon.append(aPP);
     460             : 
     461           8 :                 SdrObject::Free( pNewObj );
     462           8 :             }
     463           8 :             SdrObject::Free( pObj );
     464             :             basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPolygon,
     465          16 :                                                                   aPolyPolygonBezierCoords );
     466           8 :         }
     467             :     }
     468             : 
     469           8 :     return aPolyPolygonBezierCoords;
     470             : }
     471             : 
     472        1253 : Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShapeEngine::getInteraction()
     473             :     throw ( RuntimeException, std::exception )
     474             : {
     475        1253 :     sal_uInt32 i, nHdlCount = 0;
     476        1253 :     SdrObject* pSdrObjCustomShape = GetSdrObjectFromXShape( mxShape );
     477        1253 :     if ( pSdrObjCustomShape )
     478             :     {
     479        1253 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     480        1253 :         nHdlCount = aCustomShape2d.GetHdlCount();
     481             :     }
     482        1253 :     Sequence< Reference< drawing::XCustomShapeHandle > > aSeq( nHdlCount );
     483        1339 :     for ( i = 0; i < nHdlCount; i++ )
     484          86 :         aSeq[ i ] = new EnhancedCustomShapeHandle( mxShape, i );
     485        1253 :     return aSeq;
     486             : }
     487             : 
     488             : }
     489             : 
     490             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     491        4573 : com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation(
     492             :     css::uno::XComponentContext *,
     493             :     css::uno::Sequence<css::uno::Any> const &)
     494             : {
     495        4573 :     return cppu::acquire(new EnhancedCustomShapeEngine);
     496         390 : }
     497             : 
     498             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11