LCOV - code coverage report
Current view: top level - svx/source/customshapes - EnhancedCustomShapeEngine.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 152 222 68.5 %
Date: 2014-11-03 Functions: 14 18 77.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             :     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        8052 : EnhancedCustomShapeEngine::EnhancedCustomShapeEngine() :
     109        8052 :     mbForceGroupWithText    ( false )
     110             : {
     111        8052 : }
     112       16104 : EnhancedCustomShapeEngine::~EnhancedCustomShapeEngine()
     113             : {
     114       16104 : }
     115             : 
     116             : // XInterface
     117       71682 : void SAL_CALL EnhancedCustomShapeEngine::acquire() throw()
     118             : {
     119       71682 :     OWeakObject::acquire();
     120       71682 : }
     121       72940 : void SAL_CALL EnhancedCustomShapeEngine::release() throw()
     122             : {
     123       72940 :     OWeakObject::release();
     124       72940 : }
     125             : 
     126             : // XInitialization
     127        8052 : void SAL_CALL EnhancedCustomShapeEngine::initialize( const Sequence< Any >& aArguments )
     128             :     throw ( Exception, RuntimeException, std::exception )
     129             : {
     130             :     sal_Int32 i;
     131        8052 :     Sequence< beans::PropertyValue > aParameter;
     132        8052 :     for ( i = 0; i < aArguments.getLength(); i++ )
     133             :     {
     134        8052 :         if ( aArguments[ i ] >>= aParameter )
     135        8052 :             break;
     136             :     }
     137       16104 :     for ( i = 0; i < aParameter.getLength(); i++ )
     138             :     {
     139        8052 :         const beans::PropertyValue& rProp = aParameter[ i ];
     140        8052 :         if ( rProp.Name == "CustomShape" )
     141        8052 :             rProp.Value >>= mxShape;
     142           0 :         else if ( rProp.Name == "ForceGroupWithText" )
     143           0 :             rProp.Value >>= mbForceGroupWithText;
     144        8052 :     }
     145        8052 : }
     146             : 
     147             : // XServiceInfo
     148           0 : OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
     149             :     throw( RuntimeException, std::exception )
     150             : {
     151           0 :     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           0 : Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames()
     159             :     throw ( RuntimeException, std::exception )
     160             : {
     161           0 :     Sequence< OUString > aRet(1);
     162           0 :     OUString* pArray = aRet.getArray();
     163           0 :     pArray[0] = "com.sun.star.drawing.CustomShapeEngine";
     164           0 :     return aRet;
     165             : }
     166             : 
     167             : // XCustomShapeEngine
     168           0 : SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape )
     169             : {
     170           0 :     bool bHasText = pCustoObj->HasText();
     171           0 :     if ( pRenderedShape || bHasText )
     172             :     {
     173             :         // applying shadow
     174           0 :         const SdrObject* pShadowGeometry = pCustoObj->GetSdrObjectShadowFromCustomShape();
     175           0 :         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           0 :         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(XLINE_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           0 :         if ( pRenderedShape )
     248             :         {
     249           0 :             if ( !pRenderedShape->ISA( SdrObjGroup ) )
     250             :             {
     251           0 :                 SdrObject* pTmp = pRenderedShape;
     252           0 :                 pRenderedShape = new SdrObjGroup();
     253           0 :                 static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
     254             :             }
     255           0 :             pRenderedShape->SetPage( pCustoObj->GetPage() );
     256           0 :             pRenderedShape->SetModel( pCustoObj->GetModel() );
     257             :         }
     258             :     }
     259           0 :     return pRenderedShape;
     260             : }
     261             : 
     262       10156 : void SetTemporary( uno::Reference< drawing::XShape >& xShape )
     263             : {
     264       10156 :     if ( xShape.is() )
     265             :     {
     266        5448 :         SvxShape* pShape = SvxShape::getImplementation( xShape );
     267        5448 :         if ( pShape )
     268        5448 :             pShape->TakeSdrObjectOwnership();
     269             :     }
     270       10156 : }
     271             : 
     272       10156 : Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
     273             :     throw ( RuntimeException, std::exception )
     274             : {
     275       10156 :     Reference< drawing::XShape > xShape;
     276       10156 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     277       10156 :     if ( pSdrObjCustomShape )
     278             :     {
     279             :         // retrieving the TextPath property to check if feature is enabled
     280             :         const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>(
     281       10156 :             pSdrObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
     282       10156 :         bool bTextPathOn = false;
     283       10156 :         const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "TextPath" );
     284       10156 :         if ( pAny )
     285         494 :             *pAny >>= bTextPathOn;
     286             : 
     287       10156 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     288       10156 :         sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
     289       10156 :         bool bPostRotateAngle = aCustomShape2d.IsPostRotate();
     290             : 
     291       10156 :         bool bFlipV = aCustomShape2d.IsFlipVert();
     292       10156 :         bool bFlipH = aCustomShape2d.IsFlipHorz();
     293       10156 :         bool bLineGeometryNeededOnly = bTextPathOn;
     294             : 
     295       10156 :         SdrObject* pRenderedShape = aCustomShape2d.CreateObject( bLineGeometryNeededOnly );
     296       10156 :         if ( pRenderedShape )
     297             :         {
     298        5448 :             if ( bTextPathOn )
     299             :             {
     300         108 :                 SdrObject* pRenderedFontWork = EnhancedCustomShapeFontWork::CreateFontWork( pRenderedShape, pSdrObjCustomShape );
     301         108 :                 if ( pRenderedFontWork )
     302             :                 {
     303         108 :                     SdrObject::Free( pRenderedShape );
     304         108 :                     pRenderedShape = pRenderedFontWork;
     305             :                 }
     306             :             }
     307        5448 :             SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject( pRenderedShape, pSdrObjCustomShape );
     308        5448 :             if ( pRenderedShape3d )
     309             :             {
     310           0 :                 bFlipV = bFlipH = false;
     311           0 :                 nRotateAngle = 0;
     312           0 :                 SdrObject::Free( pRenderedShape );
     313           0 :                 pRenderedShape = pRenderedShape3d;
     314             :             }
     315        5448 :             Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
     316             : 
     317        5448 :             const GeoStat& rGeoStat = static_cast<SdrObjCustomShape*>(pSdrObjCustomShape)->GetGeoStat();
     318        5448 :             if ( rGeoStat.nShearAngle )
     319             :             {
     320           4 :                 long nShearAngle = rGeoStat.nShearAngle;
     321           4 :                 double nTan = rGeoStat.nTan;
     322           4 :                 if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
     323             :                 {
     324           0 :                     nShearAngle = -nShearAngle;
     325           0 :                     nTan = -nTan;
     326             :                 }
     327           4 :                 pRenderedShape->Shear( pSdrObjCustomShape->GetSnapRect().Center(), nShearAngle, nTan, false);
     328             :             }
     329        5448 :             if( !bPostRotateAngle && nRotateAngle )
     330             :             {
     331          76 :                 double a = nRotateAngle * F_PI18000;
     332          76 :                 pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
     333             :             }
     334        5448 :             if ( bFlipV )
     335             :             {
     336         412 :                 Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
     337         412 :                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
     338         412 :                 pRenderedShape->NbcMirror( aLeft, aRight );
     339             :             }
     340        5448 :             if ( bFlipH )
     341             :             {
     342          64 :                 Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
     343          64 :                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
     344          64 :                 pRenderedShape->NbcMirror( aTop, aBottom );
     345             :             }
     346             :             // Specifically for pptx imports
     347        5448 :             if( bPostRotateAngle && nRotateAngle )
     348             :             {
     349         236 :                 double a = nRotateAngle * F_PI18000;
     350         236 :                 pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
     351             :             }
     352        5448 :             pRenderedShape->NbcSetStyleSheet( pSdrObjCustomShape->GetStyleSheet(), true );
     353        5448 :             pRenderedShape->RecalcSnapRect();
     354             :         }
     355             : 
     356       10156 :         if ( mbForceGroupWithText )
     357           0 :             pRenderedShape = ImplForceGroupWithText( static_cast<SdrObjCustomShape*>(pSdrObjCustomShape), pRenderedShape );
     358             : 
     359       10156 :         if ( pRenderedShape )
     360             :         {
     361        5448 :             aCustomShape2d.ApplyGluePoints( pRenderedShape );
     362       10896 :             xShape = SvxDrawPage::CreateShapeByTypeAndInventor( pRenderedShape->GetObjIdentifier(),
     363       16344 :                 pRenderedShape->GetObjInventor(), pRenderedShape, NULL );
     364             :         }
     365       10156 :         SetTemporary( xShape );
     366             :     }
     367       10156 :     return xShape;
     368             : }
     369             : 
     370       27182 : awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
     371             :     throw ( RuntimeException, std::exception )
     372             : {
     373       27182 :     awt::Rectangle aTextRect;
     374       27182 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     375       27182 :     uno::Reference< document::XActionLockable > xLockable( mxShape, uno::UNO_QUERY );
     376       27182 :     if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && xLockable.is() && !xLockable->isActionLocked() )
     377             :     {
     378       21186 :         if ( pSdrObjCustomShape )
     379             :         {
     380       21186 :             EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     381       21186 :             Rectangle aRect( aCustomShape2d.GetTextRect() );
     382       21186 :             aTextRect.X = aRect.Left();
     383       21186 :             aTextRect.Y = aRect.Top();
     384       21186 :             aTextRect.Width = aRect.GetWidth();
     385       21186 :             aTextRect.Height = aRect.GetHeight();
     386             :         }
     387             :     }
     388       27182 :     return aTextRect;
     389             : }
     390             : 
     391          16 : drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
     392             :     throw ( RuntimeException, std::exception )
     393             : {
     394          16 :     drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
     395          16 :     SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
     396          16 :     if ( pSdrObjCustomShape )
     397             :     {
     398          16 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     399          16 :         SdrObject* pObj = aCustomShape2d.CreateLineGeometry();
     400          16 :         if ( pObj )
     401             :         {
     402          16 :             Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
     403          16 :             bool bFlipV = aCustomShape2d.IsFlipVert();
     404          16 :             bool bFlipH = aCustomShape2d.IsFlipHorz();
     405             : 
     406          16 :             const GeoStat& rGeoStat = static_cast<SdrObjCustomShape*>(pSdrObjCustomShape)->GetGeoStat();
     407          16 :             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          16 :             sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
     419          16 :             if( nRotateAngle )
     420             :             {
     421          16 :                 double a = nRotateAngle * F_PI18000;
     422          16 :                 pObj->NbcRotate( aRect.Center(), nRotateAngle, sin( a ), cos( a ) );
     423             :             }
     424          16 :             if ( bFlipH )
     425             :             {
     426           2 :                 Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
     427           2 :                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
     428           2 :                 pObj->NbcMirror( aTop, aBottom );
     429             :             }
     430          16 :             if ( bFlipV )
     431             :             {
     432           2 :                 Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
     433           2 :                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
     434           2 :                 pObj->NbcMirror( aLeft, aRight );
     435             :             }
     436             : 
     437          16 :             basegfx::B2DPolyPolygon aPolyPolygon;
     438          32 :             SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS );
     439             : 
     440          48 :             while ( aIter.IsMore() )
     441             :             {
     442          16 :                 SdrObject* pNewObj = NULL;
     443          16 :                 basegfx::B2DPolyPolygon aPP;
     444          16 :                 const SdrObject* pNext = aIter.Next();
     445             : 
     446          16 :                 if ( pNext->ISA( SdrPathObj ) )
     447             :                 {
     448           4 :                     aPP = static_cast<const SdrPathObj*>(pNext)->GetPathPoly();
     449             :                 }
     450             :                 else
     451             :                 {
     452          12 :                     pNewObj = pNext->ConvertToPolyObj( false, false );
     453          12 :                     SdrPathObj* pPath = PTR_CAST( SdrPathObj, pNewObj );
     454          12 :                     if ( pPath )
     455          12 :                         aPP = pPath->GetPathPoly();
     456             :                 }
     457             : 
     458          16 :                 if ( aPP.count() )
     459          16 :                     aPolyPolygon.append(aPP);
     460             : 
     461          16 :                 SdrObject::Free( pNewObj );
     462          16 :             }
     463          16 :             SdrObject::Free( pObj );
     464             :             basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPolygon,
     465          32 :                                                                   aPolyPolygonBezierCoords );
     466          16 :         }
     467             :     }
     468             : 
     469          16 :     return aPolyPolygonBezierCoords;
     470             : }
     471             : 
     472        2120 : Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShapeEngine::getInteraction()
     473             :     throw ( RuntimeException, std::exception )
     474             : {
     475        2120 :     sal_uInt32 i, nHdlCount = 0;
     476        2120 :     SdrObject* pSdrObjCustomShape = GetSdrObjectFromXShape( mxShape );
     477        2120 :     if ( pSdrObjCustomShape )
     478             :     {
     479        2120 :         EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
     480        2120 :         nHdlCount = aCustomShape2d.GetHdlCount();
     481             :     }
     482        2120 :     Sequence< Reference< drawing::XCustomShapeHandle > > aSeq( nHdlCount );
     483        2250 :     for ( i = 0; i < nHdlCount; i++ )
     484         130 :         aSeq[ i ] = new EnhancedCustomShapeHandle( mxShape, i );
     485        2120 :     return aSeq;
     486             : }
     487             : 
     488             : }
     489             : 
     490             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     491        8052 : com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation(
     492             :     css::uno::XComponentContext *,
     493             :     css::uno::Sequence<css::uno::Any> const &)
     494             : {
     495        8052 :     return cppu::acquire(new EnhancedCustomShapeEngine);
     496         594 : }
     497             : 
     498             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10