Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "EnhancedCustomShapeEngine.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 : :
55 : : // ---------------------------
56 : : // - EnhancedCustomShapeEngine -
57 : : // ---------------------------
58 : :
59 : 0 : rtl::OUString EnhancedCustomShapeEngine_getImplementationName()
60 : : throw( NMSP_UNO::RuntimeException )
61 : : {
62 : 0 : return B2UCONST( "com.sun.star.drawing.EnhancedCustomShapeEngine" );
63 : : }
64 : 0 : sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const rtl::OUString& ServiceName )
65 : : throw( NMSP_UNO::RuntimeException )
66 : : {
67 : 0 : return ServiceName == "com.sun.star.drawing.CustomShapeEngine";
68 : : }
69 : 0 : SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames()
70 : : throw( NMSP_UNO::RuntimeException )
71 : : {
72 : 0 : SEQ( rtl::OUString ) aRet(1);
73 [ # # ]: 0 : rtl::OUString* pArray = aRet.getArray();
74 [ # # ]: 0 : pArray[0] = B2UCONST( "com.sun.star.drawing.CustomShapeEngine" );
75 : 0 : return aRet;
76 : : }
77 : :
78 : : // -----------------------------------------------------------------------------
79 : :
80 : 0 : EnhancedCustomShapeEngine::EnhancedCustomShapeEngine( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
81 : : mxFact ( rxMgr ),
82 : 0 : mbForceGroupWithText ( sal_False )
83 : : {
84 : 0 : }
85 : 0 : EnhancedCustomShapeEngine::~EnhancedCustomShapeEngine()
86 : : {
87 [ # # ]: 0 : }
88 : :
89 : : // XInterface -----------------------------------------------------------------
90 : :
91 : 0 : void SAL_CALL EnhancedCustomShapeEngine::acquire() throw()
92 : : {
93 : 0 : OWeakObject::acquire();
94 : 0 : }
95 : 0 : void SAL_CALL EnhancedCustomShapeEngine::release() throw()
96 : : {
97 : 0 : OWeakObject::release();
98 : 0 : }
99 : :
100 : : // XInitialization ------------------------------------------------------------
101 : :
102 : 0 : void SAL_CALL EnhancedCustomShapeEngine::initialize( const SEQ( NMSP_UNO::Any )& aArguments )
103 : : throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException )
104 : : {
105 : : sal_Int32 i;
106 [ # # ]: 0 : SEQ( NMSP_BEANS::PropertyValue ) aParameter;
107 [ # # ]: 0 : for ( i = 0; i < aArguments.getLength(); i++ )
108 : : {
109 [ # # ][ # # ]: 0 : if ( aArguments[ i ] >>= aParameter )
110 : 0 : break;
111 : : }
112 [ # # ]: 0 : for ( i = 0; i < aParameter.getLength(); i++ )
113 : : {
114 [ # # ]: 0 : const NMSP_BEANS::PropertyValue& rProp = aParameter[ i ];
115 [ # # ]: 0 : if ( rProp.Name == "CustomShape" )
116 [ # # ]: 0 : rProp.Value >>= mxShape;
117 [ # # ]: 0 : else if ( rProp.Name == "ForceGroupWithText" )
118 : 0 : rProp.Value >>= mbForceGroupWithText;
119 [ # # ]: 0 : }
120 : 0 : }
121 : :
122 : : // XServiceInfo ---------------------------------------------------------------
123 : :
124 : 0 : rtl::OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
125 : : throw( NMSP_UNO::RuntimeException )
126 : : {
127 : 0 : return EnhancedCustomShapeEngine_getImplementationName();
128 : : }
129 : 0 : sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const rtl::OUString& rServiceName )
130 : : throw( NMSP_UNO::RuntimeException )
131 : : {
132 : 0 : return EnhancedCustomShapeEngine_supportsService( rServiceName );
133 : : }
134 : 0 : SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames()
135 : : throw ( NMSP_UNO::RuntimeException )
136 : : {
137 : 0 : return EnhancedCustomShapeEngine_getSupportedServiceNames();
138 : : }
139 : :
140 : : // XCustomShapeEngine -----------------------------------------------------------
141 : :
142 : 0 : SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape )
143 : : {
144 : 0 : bool bHasText = pCustoObj->HasText();
145 [ # # ][ # # ]: 0 : if ( pRenderedShape || bHasText )
146 : : {
147 : : // applying shadow
148 : 0 : const SdrObject* pShadowGeometry = pCustoObj->GetSdrObjectShadowFromCustomShape();
149 [ # # ]: 0 : if ( pShadowGeometry )
150 : : {
151 [ # # ]: 0 : if ( pRenderedShape )
152 : : {
153 [ # # ]: 0 : if ( !pRenderedShape->ISA( SdrObjGroup ) )
154 : : {
155 : 0 : SdrObject* pTmp = pRenderedShape;
156 [ # # ]: 0 : pRenderedShape = new SdrObjGroup();
157 : 0 : ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
158 : : }
159 : 0 : ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pShadowGeometry->Clone(), 0 );
160 : : }
161 : : else
162 : 0 : pRenderedShape = pShadowGeometry->Clone();
163 : : }
164 : :
165 : : // apply text
166 [ # # ]: 0 : if ( bHasText )
167 : : {
168 : : // #i37011# also create a text object and add at rPos + 1
169 : : SdrTextObj* pTextObj = (SdrTextObj*)SdrObjFactory::MakeNewObject(
170 [ # # ][ # # ]: 0 : pCustoObj->GetObjInventor(), OBJ_TEXT, 0L, pCustoObj->GetModel());
[ # # ]
171 : :
172 : : // Copy text content
173 [ # # ]: 0 : OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject();
174 [ # # ]: 0 : if( pParaObj )
175 [ # # ][ # # ]: 0 : pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) );
[ # # ]
176 : :
177 : : // copy all attributes
178 [ # # ][ # # ]: 0 : SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() );
179 : :
180 : : // clear fill and line style
181 [ # # ][ # # ]: 0 : aTargetItemSet.Put(XLineStyleItem(XLINE_NONE));
[ # # ]
182 [ # # ][ # # ]: 0 : aTargetItemSet.Put(XFillStyleItem(XFILL_NONE));
[ # # ]
183 : :
184 : : // get the text bounds and set at text object
185 [ # # ]: 0 : Rectangle aTextBounds = pCustoObj->GetSnapRect();
186 : 0 : SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
187 [ # # ]: 0 : if ( pSdrObjCustomShape )
188 : : {
189 [ # # ]: 0 : EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
190 [ # # ][ # # ]: 0 : aTextBounds = aCustomShape2d.GetTextRect();
191 : : }
192 [ # # ]: 0 : pTextObj->SetSnapRect( aTextBounds );
193 : :
194 : : // if rotated, copy GeoStat, too.
195 : 0 : const GeoStat& rSourceGeo = pCustoObj->GetGeoStat();
196 [ # # ]: 0 : if ( rSourceGeo.nDrehWink )
197 : : {
198 : : pTextObj->NbcRotate(
199 [ # # ]: 0 : pCustoObj->GetSnapRect().Center(), rSourceGeo.nDrehWink,
200 [ # # ][ # # ]: 0 : rSourceGeo.nSin, rSourceGeo.nCos);
201 : : }
202 : :
203 : : // set modified ItemSet at text object
204 [ # # ]: 0 : pTextObj->SetMergedItemSet(aTargetItemSet);
205 : :
206 [ # # ]: 0 : if ( pRenderedShape )
207 : : {
208 [ # # ][ # # ]: 0 : if ( !pRenderedShape->ISA( SdrObjGroup ) )
[ # # ]
209 : : {
210 : 0 : SdrObject* pTmp = pRenderedShape;
211 [ # # ][ # # ]: 0 : pRenderedShape = new SdrObjGroup();
212 [ # # ][ # # ]: 0 : ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
213 : : }
214 [ # # ][ # # ]: 0 : ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTextObj, LIST_APPEND );
215 : : }
216 : : else
217 [ # # ]: 0 : pRenderedShape = pTextObj;
218 : : }
219 : :
220 : : // force group
221 [ # # ]: 0 : if ( pRenderedShape )
222 : : {
223 [ # # ]: 0 : if ( !pRenderedShape->ISA( SdrObjGroup ) )
224 : : {
225 : 0 : SdrObject* pTmp = pRenderedShape;
226 [ # # ]: 0 : pRenderedShape = new SdrObjGroup();
227 : 0 : ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
228 : : }
229 : 0 : pRenderedShape->SetPage( pCustoObj->GetPage() );
230 : 0 : pRenderedShape->SetModel( pCustoObj->GetModel() );
231 : : }
232 : : }
233 : 0 : return pRenderedShape;
234 : : }
235 : :
236 : 0 : void SetTemporary( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape )
237 : : {
238 [ # # ]: 0 : if ( xShape.is() )
239 : : {
240 : 0 : SvxShape* pShape = SvxShape::getImplementation( xShape );
241 [ # # ]: 0 : if ( pShape )
242 : 0 : pShape->TakeSdrObjectOwnership();
243 : : }
244 : 0 : }
245 : :
246 : 0 : REF( com::sun::star::drawing::XShape ) SAL_CALL EnhancedCustomShapeEngine::render()
247 : : throw ( NMSP_UNO::RuntimeException )
248 : : {
249 : 0 : REF( com::sun::star::drawing::XShape ) xShape;
250 : 0 : SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
251 [ # # ]: 0 : if ( pSdrObjCustomShape )
252 : : {
253 : : // retrieving the TextPath property to check if feature is enabled
254 : : SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)
255 [ # # ]: 0 : pSdrObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
256 : 0 : sal_Bool bTextPathOn = sal_False;
257 [ # # ]: 0 : const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
258 [ # # ]: 0 : com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
259 [ # # ]: 0 : if ( pAny )
260 : 0 : *pAny >>= bTextPathOn;
261 : :
262 [ # # ]: 0 : EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
263 : 0 : sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
264 [ # # ]: 0 : bool bPostRotateAngle = aCustomShape2d.IsPostRotate();
265 : :
266 : 0 : sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
267 : 0 : sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
268 : 0 : sal_Bool bLineGeometryNeededOnly = bTextPathOn;
269 : :
270 [ # # ]: 0 : SdrObject* pRenderedShape = aCustomShape2d.CreateObject( bLineGeometryNeededOnly );
271 [ # # ]: 0 : if ( pRenderedShape )
272 : : {
273 [ # # ]: 0 : if ( bTextPathOn )
274 : : {
275 [ # # ]: 0 : SdrObject* pRenderedFontWork = EnhancedCustomShapeFontWork::CreateFontWork( pRenderedShape, pSdrObjCustomShape );
276 [ # # ]: 0 : if ( pRenderedFontWork )
277 : : {
278 [ # # ]: 0 : SdrObject::Free( pRenderedShape );
279 : 0 : pRenderedShape = pRenderedFontWork;
280 : : }
281 : : }
282 [ # # ]: 0 : SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject( pRenderedShape, pSdrObjCustomShape );
283 [ # # ]: 0 : if ( pRenderedShape3d )
284 : : {
285 : 0 : bFlipV = bFlipH = sal_False;
286 : 0 : nRotateAngle = 0;
287 [ # # ]: 0 : SdrObject::Free( pRenderedShape );
288 : 0 : pRenderedShape = pRenderedShape3d;
289 : : }
290 [ # # ]: 0 : Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
291 : :
292 : 0 : const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
293 [ # # ]: 0 : if ( rGeoStat.nShearWink )
294 : : {
295 : 0 : long nShearWink = rGeoStat.nShearWink;
296 : 0 : double nTan = rGeoStat.nTan;
297 [ # # ][ # # ]: 0 : if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
[ # # ][ # # ]
298 : : {
299 : 0 : nShearWink = -nShearWink;
300 : 0 : nTan = -nTan;
301 : : }
302 [ # # ][ # # ]: 0 : pRenderedShape->Shear( pSdrObjCustomShape->GetSnapRect().Center(), nShearWink, nTan, sal_False);
[ # # ]
303 : : }
304 [ # # ][ # # ]: 0 : if( !bPostRotateAngle && nRotateAngle )
305 : : {
306 : 0 : double a = nRotateAngle * F_PI18000;
307 [ # # ][ # # ]: 0 : pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
[ # # ]
308 : : }
309 [ # # ]: 0 : if ( bFlipV )
310 : : {
311 : 0 : Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
312 : 0 : Point aRight( aLeft.X() + 1000, aLeft.Y() );
313 [ # # ]: 0 : pRenderedShape->NbcMirror( aLeft, aRight );
314 : : }
315 [ # # ]: 0 : if ( bFlipH )
316 : : {
317 : 0 : Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
318 : 0 : Point aBottom( aTop.X(), aTop.Y() + 1000 );
319 [ # # ]: 0 : pRenderedShape->NbcMirror( aTop, aBottom );
320 : : }
321 : : // Specifically for pptx imports
322 [ # # ][ # # ]: 0 : if( bPostRotateAngle && nRotateAngle )
323 : : {
324 : 0 : double a = nRotateAngle * F_PI18000;
325 [ # # ][ # # ]: 0 : pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
[ # # ]
326 : : }
327 [ # # ][ # # ]: 0 : pRenderedShape->NbcSetStyleSheet( pSdrObjCustomShape->GetStyleSheet(), sal_True );
328 [ # # ]: 0 : pRenderedShape->RecalcSnapRect();
329 : : }
330 : :
331 [ # # ]: 0 : if ( mbForceGroupWithText )
332 [ # # ]: 0 : pRenderedShape = ImplForceGroupWithText( (SdrObjCustomShape*)pSdrObjCustomShape, pRenderedShape );
333 : :
334 [ # # ]: 0 : if ( pRenderedShape )
335 : : {
336 [ # # ]: 0 : aCustomShape2d.ApplyGluePoints( pRenderedShape );
337 [ # # ]: 0 : xShape = SvxDrawPage::CreateShapeByTypeAndInventor( pRenderedShape->GetObjIdentifier(),
338 [ # # ][ # # ]: 0 : pRenderedShape->GetObjInventor(), pRenderedShape, NULL );
[ # # ]
339 : : }
340 [ # # ][ # # ]: 0 : SetTemporary( xShape );
341 : : }
342 : 0 : return xShape;
343 : : }
344 : :
345 : 0 : com::sun::star::awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
346 : : throw ( NMSP_UNO::RuntimeException )
347 : : {
348 : 0 : com::sun::star::awt::Rectangle aTextRect;
349 : 0 : SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
350 [ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::document::XActionLockable > xLockable( mxShape, ::com::sun::star::uno::UNO_QUERY );
351 [ # # ][ # # ]: 0 : if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && xLockable.is() && !xLockable->isActionLocked() )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
352 : : {
353 [ # # ]: 0 : if ( pSdrObjCustomShape )
354 : : {
355 [ # # ]: 0 : EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
356 [ # # ]: 0 : Rectangle aRect( aCustomShape2d.GetTextRect() );
357 : 0 : aTextRect.X = aRect.Left();
358 : 0 : aTextRect.Y = aRect.Top();
359 [ # # ]: 0 : aTextRect.Width = aRect.GetWidth();
360 [ # # ][ # # ]: 0 : aTextRect.Height = aRect.GetHeight();
361 : : }
362 : : }
363 : 0 : return aTextRect;
364 : : }
365 : :
366 : 0 : com::sun::star::drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
367 : : throw ( NMSP_UNO::RuntimeException )
368 : : {
369 : 0 : com::sun::star::drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
370 : 0 : SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
371 [ # # ]: 0 : if ( pSdrObjCustomShape )
372 : : {
373 [ # # ]: 0 : EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
374 [ # # ]: 0 : SdrObject* pObj = aCustomShape2d.CreateLineGeometry();
375 [ # # ]: 0 : if ( pObj )
376 : : {
377 [ # # ]: 0 : Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
378 : 0 : sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
379 : 0 : sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
380 : :
381 : 0 : const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
382 [ # # ]: 0 : if ( rGeoStat.nShearWink )
383 : : {
384 : 0 : long nShearWink = rGeoStat.nShearWink;
385 : 0 : double nTan = rGeoStat.nTan;
386 [ # # ][ # # ]: 0 : if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
[ # # ][ # # ]
387 : : {
388 : 0 : nShearWink = -nShearWink;
389 : 0 : nTan = -nTan;
390 : : }
391 [ # # ][ # # ]: 0 : pObj->Shear( aRect.Center(), nShearWink, nTan, sal_False);
392 : : }
393 : 0 : sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
394 [ # # ]: 0 : if( nRotateAngle )
395 : : {
396 : 0 : double a = nRotateAngle * F_PI18000;
397 [ # # ][ # # ]: 0 : pObj->NbcRotate( aRect.Center(), nRotateAngle, sin( a ), cos( a ) );
398 : : }
399 [ # # ]: 0 : if ( bFlipH )
400 : : {
401 : 0 : Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
402 : 0 : Point aBottom( aTop.X(), aTop.Y() + 1000 );
403 [ # # ]: 0 : pObj->NbcMirror( aTop, aBottom );
404 : : }
405 [ # # ]: 0 : if ( bFlipV )
406 : : {
407 : 0 : Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
408 : 0 : Point aRight( aLeft.X() + 1000, aLeft.Y() );
409 [ # # ]: 0 : pObj->NbcMirror( aLeft, aRight );
410 : : }
411 : :
412 [ # # ]: 0 : basegfx::B2DPolyPolygon aPolyPolygon;
413 [ # # ]: 0 : SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS );
414 : :
415 [ # # ]: 0 : while ( aIter.IsMore() )
416 : : {
417 : 0 : SdrObject* pNewObj = NULL;
418 [ # # ]: 0 : basegfx::B2DPolyPolygon aPP;
419 [ # # ]: 0 : const SdrObject* pNext = aIter.Next();
420 : :
421 [ # # ][ # # ]: 0 : if ( pNext->ISA( SdrPathObj ) )
[ # # ]
422 : : {
423 [ # # ]: 0 : aPP = ((SdrPathObj*)pNext)->GetPathPoly();
424 : : }
425 : : else
426 : : {
427 [ # # ]: 0 : pNewObj = pNext->ConvertToPolyObj( sal_False, sal_False );
428 [ # # ][ # # ]: 0 : SdrPathObj* pPath = PTR_CAST( SdrPathObj, pNewObj );
[ # # ][ # # ]
429 [ # # ]: 0 : if ( pPath )
430 [ # # ]: 0 : aPP = pPath->GetPathPoly();
431 : : }
432 : :
433 [ # # ][ # # ]: 0 : if ( aPP.count() )
434 [ # # ]: 0 : aPolyPolygon.append(aPP);
435 : :
436 [ # # ]: 0 : SdrObject::Free( pNewObj );
437 [ # # ]: 0 : }
438 [ # # ]: 0 : SdrObject::Free( pObj );
439 : : basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPolygon,
440 [ # # ][ # # ]: 0 : aPolyPolygonBezierCoords );
441 [ # # ]: 0 : }
442 : : }
443 : :
444 : 0 : return aPolyPolygonBezierCoords;
445 : : }
446 : :
447 : 0 : SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) SAL_CALL EnhancedCustomShapeEngine::getInteraction()
448 : : throw ( NMSP_UNO::RuntimeException )
449 : : {
450 : 0 : sal_uInt32 i, nHdlCount = 0;
451 : 0 : SdrObject* pSdrObjCustomShape = GetSdrObjectFromXShape( mxShape );
452 [ # # ]: 0 : if ( pSdrObjCustomShape )
453 : : {
454 [ # # ]: 0 : EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
455 [ # # ][ # # ]: 0 : nHdlCount = aCustomShape2d.GetHdlCount();
456 : : }
457 : 0 : SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) aSeq( nHdlCount );
458 [ # # ]: 0 : for ( i = 0; i < nHdlCount; i++ )
459 [ # # ][ # # ]: 0 : aSeq[ i ] = new EnhancedCustomShapeHandle( mxShape, i );
[ # # ][ # # ]
460 : 0 : return aSeq;
461 : : }
462 : :
463 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|