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