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 std::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 css::uno::Reference
< css::drawing::XDrawPage
>& xPage
,
71 const css::uno::Reference
< css::drawing::XDrawPage
>& xActualPage
,
72 const css::uno::Reference
< css::drawing::XDrawPagesSupplier
>& xPagesSupplier
,
73 const SlideShowContext
& rContext
,
74 sal_Int32 nOrdNumStart
,
75 bool bConvertingMasterPage
);
77 /** This method imports the presentation background shape
79 ShapeSharedPtr
importBackgroundShape(); // throw (ShapeLoadFailedException)
81 /** This method imports presentation-visible shapes (and skips all others).
83 @return the generated Shape, or NULL for no more shapes.
85 ShapeSharedPtr
importShape(); // throw (ConversionFailedException)
87 /** Test whether import is done.
89 @return true, if all shapes are imported via the
92 bool isImportDone() const;
93 const PolyPolygonVector
& getPolygons();
95 double getImportedShapesCount() { return mnAscendingPrio
; }
97 bool isSkip( css::uno::Reference
<css::beans::XPropertySet
> const& xPropSet
,
98 OUString
const& shapeType
,
99 css::uno::Reference
<css::drawing::XLayer
> const& xLayer
);
101 ShapeSharedPtr
createShape(
102 css::uno::Reference
<css::drawing::XShape
> const& xCurrShape
,
103 css::uno::Reference
<css::beans::XPropertySet
> const& xPropSet
,
104 OUString
const& shapeType
) const;
106 void importPolygons(css::uno::Reference
< css::beans::XPropertySet
> const& xPropSet
) ;
110 ShapeSharedPtr
const mpGroupShape
;
111 css::uno::Reference
<css::drawing::XShapes
> const mxShapes
;
112 sal_Int32
const mnCount
;
115 explicit XShapesEntry( ShapeSharedPtr
const& pGroupShape
)
116 : mpGroupShape(pGroupShape
),
117 mxShapes( pGroupShape
->getXShape(),
118 css::uno::UNO_QUERY_THROW
),
119 mnCount(mxShapes
->getCount()), mnPos(0) {}
120 explicit XShapesEntry( css::uno::Reference
<
121 css::drawing::XShapes
> const& xShapes
)
122 : mpGroupShape(), mxShapes(xShapes
),
123 mnCount(xShapes
->getCount()), mnPos(0) {}
125 typedef ::std::stack
<XShapesEntry
> XShapesStack
;
127 css::uno::Reference
<css::drawing::XDrawPage
> mxPage
;
128 css::uno::Reference
<css::drawing::XDrawPagesSupplier
> mxPagesSupplier
;
129 const SlideShowContext
& mrContext
;
130 PolyPolygonVector maPolygons
;
131 XShapesStack maShapesStack
;
132 double mnAscendingPrio
;
133 bool mbConvertingMasterPage
;
136 } // namespace internal
137 } // namespace presentation
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */