1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEIMPORTER_HXX
20 #define INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEIMPORTER_HXX
22 #include <com/sun/star/drawing/XDrawPage.hpp>
23 #include <com/sun/star/drawing/XShapes.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/drawing/XLayer.hpp>
26 #include "unoviewcontainer.hxx"
27 #include "unoview.hxx"
36 struct SlideShowContext
;
38 typedef ::std::vector
< ::cppcanvas::PolyPolygonSharedPtr
> PolyPolygonVector
;
39 typedef ::boost::shared_ptr
< UnoView
> UnoViewSharedPtr
;
40 typedef ::std::vector
< UnoViewSharedPtr
> UnoViewVector
;
42 /** This class imports all shapes from a given XShapes object
47 /** Create shape importer.
50 Page containing the shapes
53 Actual page that's imported - if xPage is a master
54 page, this argument must refer to the using, i.e the
55 page that embeds this specific masterpage. Otherwise,
56 this argument is probably equal to xPage.
59 Each shape receives a z order number, in order of
60 import (which relies on the fact that the API returns
61 the shapes in draw order - which it does,
62 currently). Since we might mix several pages on screen
63 (e.g. master page and foreground page), this value can
64 be used as an offset to distinguish those pages.
66 @param bConvertingMasterPage
67 When true, then the master page is imported. Otherwise, this
68 object imports the draw page.
70 ShapeImporter( const ::com::sun::star::uno::Reference
<
71 ::com::sun::star::drawing::XDrawPage
>& xPage
,
72 const ::com::sun::star::uno::Reference
<
73 ::com::sun::star::drawing::XDrawPage
>& xActualPage
,
74 const ::com::sun::star::uno::Reference
<
75 ::com::sun::star::drawing::XDrawPagesSupplier
>& xPagesSupplier
,
76 const SlideShowContext
& rContext
,
77 sal_Int32 nOrdNumStart
,
78 bool bConvertingMasterPage
);
80 /** This method imports the presentation background shape
82 ShapeSharedPtr
importBackgroundShape(); // throw (ShapeLoadFailedException)
84 /** This method imports presentation-visible shapes (and skips all others).
86 @return the generated Shape, or NULL for no more shapes.
88 ShapeSharedPtr
importShape(); // throw (ConversionFailedException)
90 /** Test whether import is done.
92 @return true, if all shapes are imported via the
95 bool isImportDone() const;
96 PolyPolygonVector
getPolygons();
98 double getImportedShapesCount() { return mnAscendingPrio
; }
100 bool isSkip( ::com::sun::star::uno::Reference
<
101 ::com::sun::star::beans::XPropertySet
> const& xPropSet
,
102 OUString
const& shapeType
,
103 ::com::sun::star::uno::Reference
<
104 ::com::sun::star::drawing::XLayer
> const& xLayer
);
106 ShapeSharedPtr
createShape(
107 ::com::sun::star::uno::Reference
<
108 ::com::sun::star::drawing::XShape
> const& xCurrShape
,
109 ::com::sun::star::uno::Reference
<
110 ::com::sun::star::beans::XPropertySet
> const& xPropSet
,
111 OUString
const& shapeType
) const;
113 void importPolygons(::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> const& xPropSet
) ;
117 ShapeSharedPtr
const mpGroupShape
;
118 ::com::sun::star::uno::Reference
<
119 ::com::sun::star::drawing::XShapes
> const mxShapes
;
120 sal_Int32
const mnCount
;
123 explicit XShapesEntry( ShapeSharedPtr
const& pGroupShape
)
124 : mpGroupShape(pGroupShape
),
125 mxShapes( pGroupShape
->getXShape(),
126 ::com::sun::star::uno::UNO_QUERY_THROW
),
127 mnCount(mxShapes
->getCount()), mnPos(0) {}
128 explicit XShapesEntry( ::com::sun::star::uno::Reference
<
129 ::com::sun::star::drawing::XShapes
> const& xShapes
)
130 : mpGroupShape(), mxShapes(xShapes
),
131 mnCount(xShapes
->getCount()), mnPos(0) {}
133 typedef ::std::stack
<XShapesEntry
> XShapesStack
;
135 ::com::sun::star::uno::Reference
<
136 ::com::sun::star::drawing::XDrawPage
> mxPage
;
137 ::com::sun::star::uno::Reference
<
138 ::com::sun::star::drawing::XDrawPagesSupplier
> mxPagesSupplier
;
139 const SlideShowContext
& mrContext
;
140 PolyPolygonVector maPolygons
;
141 XShapesStack maShapesStack
;
142 double mnAscendingPrio
;
143 bool mbConvertingMasterPage
;
146 } // namespace internal
147 } // namespace presentation
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */