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 : // must be first
21 : #include <canvas/debug.hxx>
22 : #include <vcl/cvtgrf.hxx>
23 : #include <tools/urlobj.hxx>
24 : #include <tools/stream.hxx>
25 : #include <svtools/grfmgr.hxx>
26 : #include <unotools/ucbstreamhelper.hxx>
27 : #include <unotools/streamwrap.hxx>
28 : #include <basegfx/point/b2dpoint.hxx>
29 : #include <basegfx/polygon/b2dpolygon.hxx>
30 : #include <cppcanvas/basegfxfactory.hxx>
31 : #include <cppcanvas/polypolygon.hxx>
32 : #include <com/sun/star/awt/Rectangle.hpp>
33 : #include <com/sun/star/drawing/ColorMode.hpp>
34 : #include <com/sun/star/text/GraphicCrop.hpp>
35 : #include <com/sun/star/container/XNameContainer.hpp>
36 : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
37 : #include <com/sun/star/drawing/PointSequence.hpp>
38 : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
39 : #include <com/sun/star/drawing/XLayerSupplier.hpp>
40 : #include <com/sun/star/drawing/XLayerManager.hpp>
41 : #include <com/sun/star/container/XNameAccess.hpp>
42 : #include <com/sun/star/lang/XComponent.hpp>
43 : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
44 :
45 : #include "drawshapesubsetting.hxx"
46 : #include "drawshape.hxx"
47 : #include "backgroundshape.hxx"
48 : #include "mediashape.hxx"
49 : #include "appletshape.hxx"
50 : #include "shapeimporter.hxx"
51 : #include "slideshowexceptions.hxx"
52 : #include "gdimtftools.hxx"
53 : #include "tools.hxx"
54 : #include "slideshowcontext.hxx"
55 :
56 : #include <boost/shared_ptr.hpp>
57 : #include <boost/scoped_ptr.hpp>
58 :
59 : using namespace com::sun::star;
60 :
61 : namespace slideshow {
62 : namespace internal {
63 :
64 : namespace {
65 :
66 0 : bool importShapeGraphic(
67 : GraphicObject & o_rGraphic,
68 : uno::Reference<beans::XPropertySet> const& xPropSet )
69 : {
70 0 : OUString aURL;
71 0 : if( !getPropertyValue( aURL, xPropSet, "GraphicURL") ||
72 0 : aURL.isEmpty() )
73 : {
74 : // no or empty property - cannot import shape graphic
75 0 : return false;
76 : }
77 :
78 : OUString const aVndUrl(
79 0 : "vnd.sun.star.GraphicObject:" );
80 0 : sal_Int32 nIndex( aURL.indexOf( aVndUrl ) );
81 :
82 0 : if(nIndex != -1)
83 : {
84 : // skip past the end of the "vnd..." prefix
85 0 : nIndex += aVndUrl.getLength();
86 :
87 0 : if(nIndex >= aURL.getLength())
88 : {
89 : OSL_FAIL( "ShapeImporter::importShape(): "
90 : "embedded graphic has no graphic ID" );
91 0 : return false;
92 : }
93 :
94 : // unique ID string found in URL, extract
95 : // to separate string
96 : OUString const aUniqueId(
97 0 : aURL.copy( nIndex, aURL.getLength() - nIndex ) );
98 :
99 : // TODO(T2): Creating a GraphicObject is not
100 : // thread safe (internally calls VCL, and has
101 : // unguarded internal singleton mpGlobalMgr)
102 :
103 : // fetch already loaded graphic from graphic manager.
104 : OString const aOldString(OUStringToOString(aUniqueId,
105 0 : RTL_TEXTENCODING_UTF8));
106 0 : o_rGraphic = GraphicObject( aOldString );
107 :
108 :
109 0 : if( GRAPHIC_DEFAULT == o_rGraphic.GetType()
110 0 : || GRAPHIC_NONE == o_rGraphic.GetType() )
111 : {
112 : // even the GrfMgr does not seem to know this graphic
113 0 : return false;
114 0 : }
115 : }
116 : else
117 : {
118 : // no special string found, graphic must be
119 : // external. Load via GraphicIm porter
120 0 : INetURLObject aTmp( aURL );
121 : boost::scoped_ptr<SvStream> pGraphicStream(
122 : utl::UcbStreamHelper::CreateStream(
123 : aTmp.GetMainURL( INetURLObject::NO_DECODE ),
124 0 : StreamMode::READ ) );
125 0 : if( !pGraphicStream )
126 : {
127 : OSL_FAIL( "ShapeImporter::importShape(): "
128 : "cannot create input stream for graphic" );
129 0 : return false;
130 : }
131 :
132 0 : Graphic aTmpGraphic;
133 0 : if( GraphicConverter::Import(
134 0 : *pGraphicStream, aTmpGraphic ) != ERRCODE_NONE )
135 : {
136 : OSL_FAIL( "ShapeImporter::importShape(): "
137 : "Failed to import shape graphic from given URL" );
138 0 : return false;
139 : }
140 :
141 0 : o_rGraphic = GraphicObject( aTmpGraphic );
142 : }
143 0 : return true;
144 : }
145 :
146 : /** This shape implementation just acts as a dummy for the layermanager.
147 : Its sole role is for hit test detection of group shapes.
148 : */
149 0 : class ShapeOfGroup : public Shape
150 : {
151 : public:
152 : ShapeOfGroup( ShapeSharedPtr const& pGroupShape,
153 : uno::Reference<drawing::XShape> const& xShape,
154 : uno::Reference<beans::XPropertySet> const& xPropSet,
155 : double nPrio );
156 :
157 : // Shape:
158 : virtual uno::Reference<drawing::XShape> getXShape() const SAL_OVERRIDE;
159 : virtual void addViewLayer( ViewLayerSharedPtr const& pNewLayer,
160 : bool bRedrawLayer ) SAL_OVERRIDE;
161 : virtual bool removeViewLayer( ViewLayerSharedPtr const& pNewLayer ) SAL_OVERRIDE;
162 : virtual bool clearAllViewLayers() SAL_OVERRIDE;
163 : virtual bool update() const SAL_OVERRIDE;
164 : virtual bool render() const SAL_OVERRIDE;
165 : virtual bool isContentChanged() const SAL_OVERRIDE;
166 : virtual basegfx::B2DRectangle getBounds() const SAL_OVERRIDE;
167 : virtual basegfx::B2DRectangle getDomBounds() const SAL_OVERRIDE;
168 : virtual basegfx::B2DRectangle getUpdateArea() const SAL_OVERRIDE;
169 : virtual bool isVisible() const SAL_OVERRIDE;
170 : virtual double getPriority() const SAL_OVERRIDE;
171 : virtual bool isBackgroundDetached() const SAL_OVERRIDE;
172 :
173 : private:
174 : ShapeSharedPtr const mpGroupShape;
175 : uno::Reference<drawing::XShape> const mxShape;
176 : double const mnPrio;
177 : basegfx::B2DPoint maPosOffset;
178 : double mnWidth;
179 : double mnHeight;
180 : };
181 :
182 0 : ShapeOfGroup::ShapeOfGroup( ShapeSharedPtr const& pGroupShape,
183 : uno::Reference<drawing::XShape> const& xShape,
184 : uno::Reference<beans::XPropertySet> const& xPropSet,
185 : double nPrio ) :
186 : mpGroupShape(pGroupShape),
187 : mxShape(xShape),
188 0 : mnPrio(nPrio)
189 : {
190 : // read bound rect
191 0 : uno::Any const aTmpRect_( xPropSet->getPropertyValue( "BoundRect" ));
192 0 : awt::Rectangle const aTmpRect( aTmpRect_.get<awt::Rectangle>() );
193 0 : basegfx::B2DRectangle const groupPosSize( pGroupShape->getBounds() );
194 0 : maPosOffset = basegfx::B2DPoint( aTmpRect.X - groupPosSize.getMinX(),
195 0 : aTmpRect.Y - groupPosSize.getMinY() );
196 0 : mnWidth = aTmpRect.Width;
197 0 : mnHeight = aTmpRect.Height;
198 0 : }
199 :
200 0 : uno::Reference<drawing::XShape> ShapeOfGroup::getXShape() const
201 : {
202 0 : return mxShape;
203 : }
204 :
205 0 : void ShapeOfGroup::addViewLayer( ViewLayerSharedPtr const& /*pNewLayer*/,
206 : bool /*bRedrawLayer*/ )
207 : {
208 0 : }
209 :
210 0 : bool ShapeOfGroup::removeViewLayer( ViewLayerSharedPtr const& /*pNewLayer*/ )
211 : {
212 0 : return true;
213 : }
214 :
215 0 : bool ShapeOfGroup::clearAllViewLayers()
216 : {
217 0 : return true;
218 : }
219 :
220 0 : bool ShapeOfGroup::update() const
221 : {
222 0 : return true;
223 : }
224 :
225 0 : bool ShapeOfGroup::render() const
226 : {
227 0 : return true;
228 : }
229 :
230 0 : bool ShapeOfGroup::isContentChanged() const
231 : {
232 0 : return false;
233 : }
234 :
235 0 : basegfx::B2DRectangle ShapeOfGroup::getBounds() const
236 : {
237 0 : basegfx::B2DRectangle const groupPosSize( mpGroupShape->getBounds() );
238 0 : double const posX = (groupPosSize.getMinX() + maPosOffset.getX());
239 0 : double const posY = (groupPosSize.getMinY() + maPosOffset.getY());
240 0 : return basegfx::B2DRectangle( posX, posY, posX + mnWidth, posY + mnHeight );
241 : }
242 :
243 0 : basegfx::B2DRectangle ShapeOfGroup::getDomBounds() const
244 : {
245 0 : return getBounds();
246 : }
247 :
248 0 : basegfx::B2DRectangle ShapeOfGroup::getUpdateArea() const
249 : {
250 0 : return getBounds();
251 : }
252 :
253 0 : bool ShapeOfGroup::isVisible() const
254 : {
255 0 : return mpGroupShape->isVisible();
256 : }
257 :
258 0 : double ShapeOfGroup::getPriority() const
259 : {
260 0 : return mnPrio;
261 : }
262 :
263 0 : bool ShapeOfGroup::isBackgroundDetached() const
264 : {
265 0 : return false;
266 : }
267 :
268 : } // anon namespace
269 :
270 0 : ShapeSharedPtr ShapeImporter::createShape(
271 : uno::Reference<drawing::XShape> const& xCurrShape,
272 : uno::Reference<beans::XPropertySet> const& xPropSet,
273 : OUString const& shapeType ) const
274 : {
275 0 : if( shapeType == "com.sun.star.drawing.MediaShape" || shapeType == "com.sun.star.presentation.MediaShape" )
276 : {
277 : // Media shape (video etc.). This is a special object
278 : return createMediaShape(xCurrShape,
279 : mnAscendingPrio,
280 0 : mrContext);
281 : }
282 0 : else if( shapeType == "com.sun.star.drawing.PluginShape" )
283 : {
284 : // PropertyValues to copy from XShape to plugin
285 : static const char* aPropertyValues[] =
286 : {
287 : "PluginURL",
288 : "PluginMimeType",
289 : "PluginCommands"
290 : };
291 :
292 : // (Netscape)Plugin shape. This is a special object
293 : return createAppletShape( xCurrShape,
294 : mnAscendingPrio,
295 : OUString( "com.sun.star.comp.sfx2.PluginObject" ),
296 : aPropertyValues,
297 : SAL_N_ELEMENTS(aPropertyValues),
298 0 : mrContext );
299 : }
300 0 : else if( shapeType == "com.sun.star.drawing.AppletShape" )
301 : {
302 : // PropertyValues to copy from XShape to applet
303 : static const char* aPropertyValues[] =
304 : {
305 : "AppletCodeBase",
306 : "AppletName",
307 : "AppletCode",
308 : "AppletCommands",
309 : "AppletIsScript"
310 : };
311 :
312 : // (Java)Applet shape. This is a special object
313 : return createAppletShape( xCurrShape,
314 : mnAscendingPrio,
315 : OUString( "com.sun.star.comp.sfx2.AppletObject" ),
316 : aPropertyValues,
317 : SAL_N_ELEMENTS(aPropertyValues),
318 0 : mrContext );
319 : }
320 0 : else if( shapeType == "com.sun.star.drawing.OLE2Shape" || shapeType == "com.sun.star.presentation.OLE2Shape" )
321 : {
322 : // #i46224# Mark OLE shapes as foreign content - scan them for
323 : // unsupported actions, and fallback to bitmap, if necessary
324 : return DrawShape::create( xCurrShape,
325 : mxPage,
326 : mnAscendingPrio,
327 : true,
328 0 : mrContext );
329 : }
330 0 : else if( shapeType == "com.sun.star.drawing.GraphicObjectShape" || shapeType == "com.sun.star.presentation.GraphicObjectShape" )
331 : {
332 0 : GraphicObject aGraphicObject;
333 :
334 : // to get hold of GIF animations, inspect Graphic
335 : // objects more thoroughly (the plain-jane shape
336 : // metafile of course would only contain the first
337 : // animation frame)
338 0 : if( !importShapeGraphic( aGraphicObject, xPropSet ) )
339 0 : return ShapeSharedPtr(); // error loading graphic -
340 : // no placeholders in
341 : // slideshow
342 :
343 0 : if( !aGraphicObject.IsAnimated() )
344 : {
345 : // no animation - simply utilize plain draw shape import
346 :
347 : // import shape as bitmap - either it's a bitmap
348 : // anyway, or it's a metafile, which currently the
349 : // metafile renderer might not display correctly.
350 : return DrawShape::create( xCurrShape,
351 : mxPage,
352 : mnAscendingPrio,
353 : true,
354 0 : mrContext );
355 : }
356 :
357 :
358 : // now extract relevant shape attributes via API
359 :
360 :
361 0 : drawing::ColorMode eColorMode( drawing::ColorMode_STANDARD );
362 0 : sal_Int16 nLuminance(0);
363 0 : sal_Int16 nContrast(0);
364 0 : sal_Int16 nRed(0);
365 0 : sal_Int16 nGreen(0);
366 0 : sal_Int16 nBlue(0);
367 0 : double nGamma(1.0);
368 0 : sal_Int16 nTransparency(0);
369 0 : sal_Int32 nRotation(0);
370 :
371 0 : getPropertyValue( eColorMode, xPropSet, "GraphicColorMode" );
372 0 : getPropertyValue( nLuminance, xPropSet, "AdjustLuminance" );
373 0 : getPropertyValue( nContrast, xPropSet, "AdjustContrast" );
374 0 : getPropertyValue( nRed, xPropSet, "AdjustRed" );
375 0 : getPropertyValue( nGreen, xPropSet, "AdjustGreen" );
376 0 : getPropertyValue( nBlue, xPropSet, "AdjustBlue" );
377 0 : getPropertyValue( nGamma, xPropSet, "Gamma" );
378 0 : getPropertyValue( nTransparency, xPropSet, "Transparency" );
379 0 : getPropertyValue( nRotation, xPropSet, "RotateAngle" );
380 :
381 0 : GraphicAttr aGraphAttrs;
382 0 : aGraphAttrs.SetDrawMode( (GraphicDrawMode)eColorMode );
383 0 : aGraphAttrs.SetLuminance( nLuminance );
384 0 : aGraphAttrs.SetContrast( nContrast );
385 0 : aGraphAttrs.SetChannelR( nRed );
386 0 : aGraphAttrs.SetChannelG( nGreen );
387 0 : aGraphAttrs.SetChannelB( nBlue );
388 0 : aGraphAttrs.SetGamma( nGamma );
389 0 : aGraphAttrs.SetTransparency( static_cast<sal_uInt8>(nTransparency) );
390 0 : aGraphAttrs.SetRotation( static_cast<sal_uInt16>(nRotation*10) );
391 :
392 0 : text::GraphicCrop aGraphCrop;
393 0 : if( getPropertyValue( aGraphCrop, xPropSet, "GraphicCrop" ))
394 : {
395 : aGraphAttrs.SetCrop( aGraphCrop.Left,
396 : aGraphCrop.Top,
397 : aGraphCrop.Right,
398 0 : aGraphCrop.Bottom );
399 : }
400 :
401 : // fetch readily transformed and color-modified
402 : // graphic
403 :
404 :
405 : Graphic aGraphic(
406 : aGraphicObject.GetTransformedGraphic(
407 0 : aGraphicObject.GetPrefSize(),
408 0 : aGraphicObject.GetPrefMapMode(),
409 0 : aGraphAttrs ) );
410 :
411 : return DrawShape::create( xCurrShape,
412 : mxPage,
413 : mnAscendingPrio,
414 : aGraphic,
415 0 : mrContext );
416 : }
417 : else
418 : {
419 : return DrawShape::create( xCurrShape,
420 : mxPage,
421 : mnAscendingPrio,
422 : false,
423 0 : mrContext );
424 : }
425 : }
426 :
427 0 : bool ShapeImporter::isSkip(
428 : uno::Reference<beans::XPropertySet> const& xPropSet,
429 : OUString const& shapeType,
430 : uno::Reference< drawing::XLayer> const& xLayer )
431 : {
432 : // skip empty presentation objects:
433 0 : bool bEmpty = false;
434 0 : if( getPropertyValue( bEmpty,
435 : xPropSet,
436 0 : "IsEmptyPresentationObject") &&
437 : bEmpty )
438 : {
439 0 : return true;
440 : }
441 :
442 : //skip shapes which corresponds to annotations
443 0 : if(xLayer.is())
444 : {
445 0 : OUString layerName;
446 : uno::Reference<beans::XPropertySet> xPropLayerSet(
447 0 : xLayer, uno::UNO_QUERY );
448 0 : const uno::Any& a(xPropLayerSet->getPropertyValue("Name") );
449 0 : bool const bRet = (a >>= layerName);
450 0 : if(bRet)
451 : {
452 0 : if( layerName == "DrawnInSlideshow" )
453 : {
454 : //Transform shapes into PolyPolygons
455 0 : importPolygons(xPropSet);
456 :
457 0 : return true;
458 : }
459 0 : }
460 : }
461 :
462 : // don't export presentation placeholders on masterpage
463 : // they can be non empty when user edits the default texts
464 0 : if(mbConvertingMasterPage)
465 : {
466 0 : if( shapeType == "com.sun.star.presentation.TitleTextShape" || shapeType == "com.sun.star.presentation.OutlinerShape" )
467 : {
468 0 : return true;
469 : }
470 : }
471 0 : return false;
472 : }
473 :
474 :
475 0 : void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xPropSet) {
476 :
477 0 : drawing::PointSequenceSequence aRetval;
478 0 : sal_Int32 nLineColor=0;
479 : double fLineWidth;
480 0 : getPropertyValue( aRetval, xPropSet, "PolyPolygon" );
481 0 : getPropertyValue( nLineColor, xPropSet, "LineColor" );
482 0 : getPropertyValue( fLineWidth, xPropSet, "LineWidth" );
483 :
484 0 : drawing::PointSequence* pOuterSequence = aRetval.getArray();
485 0 : awt::Point* pInnerSequence = pOuterSequence->getArray();
486 :
487 0 : ::basegfx::B2DPolygon aPoly;
488 0 : basegfx::B2DPoint aPoint;
489 0 : for( sal_Int32 nCurrPoly=0; nCurrPoly<pOuterSequence->getLength(); ++nCurrPoly, ++pInnerSequence )
490 : {
491 0 : aPoint.setX((*pInnerSequence).X);
492 0 : aPoint.setY((*pInnerSequence).Y);
493 0 : aPoly.append( aPoint );
494 : }
495 0 : UnoViewVector::const_iterator aIter=(mrContext.mrViewContainer).begin();
496 0 : UnoViewVector::const_iterator aEnd=(mrContext.mrViewContainer).end();
497 0 : while(aIter != aEnd)
498 : {
499 : ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
500 0 : ::cppcanvas::BaseGfxFactory::createPolyPolygon( (*aIter)->getCanvas(),
501 0 : aPoly ) );
502 0 : if( pPolyPoly )
503 : {
504 0 : pPolyPoly->setRGBALineColor( unoColor2RGBColor( nLineColor ).getIntegerColor() );
505 0 : pPolyPoly->setStrokeWidth(fLineWidth);
506 0 : pPolyPoly->draw();
507 0 : maPolygons.push_back(pPolyPoly);
508 : }
509 0 : ++aIter;
510 0 : }
511 0 : }
512 :
513 0 : ShapeSharedPtr ShapeImporter::importBackgroundShape() // throw (ShapeLoadFailedException)
514 : {
515 0 : if( maShapesStack.empty() )
516 0 : throw ShapeLoadFailedException();
517 :
518 0 : XShapesEntry& rTop = maShapesStack.top();
519 : ShapeSharedPtr pBgShape(
520 : createBackgroundShape(mxPage,
521 : uno::Reference<drawing::XDrawPage>(
522 : rTop.mxShapes,
523 : uno::UNO_QUERY_THROW),
524 0 : mrContext) );
525 0 : mnAscendingPrio += 1.0;
526 :
527 0 : return pBgShape;
528 : }
529 :
530 0 : ShapeSharedPtr ShapeImporter::importShape() // throw (ShapeLoadFailedException)
531 : {
532 0 : ShapeSharedPtr pRet;
533 0 : bool bIsGroupShape = false;
534 :
535 0 : while( !maShapesStack.empty() && !pRet )
536 : {
537 0 : XShapesEntry& rTop = maShapesStack.top();
538 0 : if( rTop.mnPos < rTop.mnCount )
539 : {
540 : uno::Reference<drawing::XShape> const xCurrShape(
541 0 : rTop.mxShapes->getByIndex( rTop.mnPos ), uno::UNO_QUERY );
542 0 : ++rTop.mnPos;
543 : uno::Reference<beans::XPropertySet> xPropSet(
544 0 : xCurrShape, uno::UNO_QUERY );
545 0 : if( !xPropSet.is() )
546 : {
547 : // we definitely need the properties of
548 : // the shape here. This will also fail,
549 : // if getByIndex did not return a valid
550 : // shape
551 0 : throw ShapeLoadFailedException();
552 : }
553 :
554 : //Retrieve the layer for the current shape
555 0 : uno::Reference< drawing::XLayer > xDrawnInSlideshow;
556 :
557 0 : uno::Reference< drawing::XLayerSupplier > xLayerSupplier(mxPagesSupplier, uno::UNO_QUERY);
558 0 : if(xLayerSupplier.is())
559 : {
560 0 : uno::Reference< container::XNameAccess > xNameAccess = xLayerSupplier->getLayerManager();
561 :
562 0 : uno::Reference< drawing::XLayerManager > xLayerManager(xNameAccess, uno::UNO_QUERY);
563 :
564 0 : xDrawnInSlideshow = xLayerManager->getLayerForShape(xCurrShape);
565 : }
566 :
567 0 : OUString const shapeType( xCurrShape->getShapeType());
568 :
569 : // is this shape presentation-invisible?
570 0 : if( !isSkip(xPropSet, shapeType, xDrawnInSlideshow) )
571 : {
572 0 : bIsGroupShape = shapeType == "com.sun.star.drawing.GroupShape";
573 :
574 0 : if( rTop.mpGroupShape ) // in group particle mode?
575 : {
576 : pRet.reset( new ShapeOfGroup(
577 : rTop.mpGroupShape /* container shape */,
578 : xCurrShape, xPropSet,
579 0 : mnAscendingPrio ) );
580 : }
581 : else
582 : {
583 0 : pRet = createShape( xCurrShape, xPropSet, shapeType );
584 : }
585 0 : mnAscendingPrio += 1.0;
586 0 : }
587 : }
588 0 : if( rTop.mnPos >= rTop.mnCount )
589 : {
590 : // group or top-level shapes finished:
591 0 : maShapesStack.pop();
592 : }
593 0 : if( bIsGroupShape && pRet )
594 : {
595 : // push new group on the stack: group traversal
596 0 : maShapesStack.push( XShapesEntry( pRet ) );
597 : }
598 : }
599 :
600 0 : return pRet;
601 : }
602 :
603 0 : bool ShapeImporter::isImportDone() const
604 : {
605 0 : return maShapesStack.empty();
606 : }
607 :
608 0 : PolyPolygonVector ShapeImporter::getPolygons()
609 : {
610 0 : return maPolygons;
611 : }
612 :
613 0 : ShapeImporter::ShapeImporter( uno::Reference<drawing::XDrawPage> const& xPage,
614 : uno::Reference<drawing::XDrawPage> const& xActualPage,
615 : uno::Reference<drawing::XDrawPagesSupplier> const& xPagesSupplier,
616 : const SlideShowContext& rContext,
617 : sal_Int32 nOrdNumStart,
618 : bool bConvertingMasterPage ) :
619 : mxPage( xActualPage ),
620 : mxPagesSupplier( xPagesSupplier ),
621 : mrContext( rContext ),
622 : maPolygons(),
623 : maShapesStack(),
624 : mnAscendingPrio( nOrdNumStart ),
625 0 : mbConvertingMasterPage( bConvertingMasterPage )
626 : {
627 : uno::Reference<drawing::XShapes> const xShapes(
628 0 : xPage, uno::UNO_QUERY_THROW );
629 0 : maShapesStack.push( XShapesEntry(xShapes) );
630 0 : }
631 :
632 : } // namespace internal
633 : } // namespace presentation
634 :
635 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|