update dev300-m58
[ooovba.git] / slideshow / source / inc / shapeimporter.hxx
bloba657fe75c683556ee691500793f1832c1ce9e903
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: shapeimporter.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_SLIDESHOW_SHAPEIMPORTER_HXX
31 #define INCLUDED_SLIDESHOW_SHAPEIMPORTER_HXX
33 #include <com/sun/star/drawing/XDrawPage.hpp>
34 #include <com/sun/star/drawing/XShapes.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include "shape.hxx"
39 #include <stack>
41 namespace slideshow {
42 namespace internal {
44 struct SlideShowContext;
46 /** This class imports all shapes from a given XShapes object
48 class ShapeImporter
50 public:
51 /** Create shape importer.
53 @param xPage
54 Page containing the shapes
56 @param xActualPage
57 Actual page that's imported - if xPage is a master
58 page, this argument must refer to the using, i.e the
59 page that embeds this specific masterpage. Otherwise,
60 this argument is probably equal to xPage.
62 @param nOrdNumStart
63 Each shape receives a z order number, in order of
64 import (which relies on the fact that the API returns
65 the shapes in draw order - which it does,
66 currently). Since we might mix several pages on screen
67 (e.g. master page and foreground page), this value can
68 be used as an offset to distinguish those pages.
70 @param bConvertingMasterPage
71 When true, then the master page is imported. Otherwise, this
72 object imports the draw page.
74 ShapeImporter( const ::com::sun::star::uno::Reference<
75 ::com::sun::star::drawing::XDrawPage >& xPage,
76 const ::com::sun::star::uno::Reference<
77 ::com::sun::star::drawing::XDrawPage >& xActualPage,
78 const SlideShowContext& rContext,
79 sal_Int32 nOrdNumStart,
80 bool bConvertingMasterPage );
82 /** This method imports the presentation background shape
84 ShapeSharedPtr importBackgroundShape(); // throw (ShapeLoadFailedException)
86 /** This method imports presentation-visible shapes (and skips all others).
88 @return the generated Shape, or NULL for no more shapes.
90 ShapeSharedPtr importShape(); // throw (ConversionFailedException)
92 /** Test whether import is done.
94 @return true, if all shapes are imported via the
95 importShape() call.
97 bool isImportDone() const;
99 private:
100 bool isSkip( ::com::sun::star::uno::Reference<
101 ::com::sun::star::beans::XPropertySet> const& xPropSet,
102 ::rtl::OUString const& shapeType ) const;
104 ShapeSharedPtr createShape(
105 ::com::sun::star::uno::Reference<
106 ::com::sun::star::drawing::XShape> const& xCurrShape,
107 ::com::sun::star::uno::Reference<
108 ::com::sun::star::beans::XPropertySet> const& xPropSet,
109 ::rtl::OUString const& shapeType ) const;
111 struct XShapesEntry
113 ShapeSharedPtr const mpGroupShape;
114 ::com::sun::star::uno::Reference<
115 ::com::sun::star::drawing::XShapes> const mxShapes;
116 sal_Int32 const mnCount;
117 sal_Int32 mnPos;
119 explicit XShapesEntry( ShapeSharedPtr const& pGroupShape )
120 : mpGroupShape(pGroupShape),
121 mxShapes( pGroupShape->getXShape(),
122 ::com::sun::star::uno::UNO_QUERY_THROW ),
123 mnCount(mxShapes->getCount()), mnPos(0) {}
124 explicit XShapesEntry( ::com::sun::star::uno::Reference<
125 ::com::sun::star::drawing::XShapes> const& xShapes )
126 : mpGroupShape(), mxShapes(xShapes),
127 mnCount(xShapes->getCount()), mnPos(0) {}
129 typedef ::std::stack<XShapesEntry> XShapesStack;
131 ::com::sun::star::uno::Reference<
132 ::com::sun::star::drawing::XDrawPage> mxPage;
133 const SlideShowContext& mrContext;
135 XShapesStack maShapesStack;
137 double mnAscendingPrio;
138 bool mbConvertingMasterPage;
141 } // namespace internal
142 } // namespace presentation
144 #endif