Bump version to 24.04.3.4
[LibreOffice.git] / slideshow / source / inc / shapeimporter.hxx
blob37598aa476bf4e5bbcb18b3d40130863503c9b72
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/XDrawPagesSupplier.hpp>
24 #include <com/sun/star/drawing/XShapes.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/drawing/XLayer.hpp>
28 #include <cppcanvas/canvasgraphic.hxx>
30 #include "unoview.hxx"
32 #include "shape.hxx"
34 #include <stack>
36 namespace slideshow::internal {
38 struct SlideShowContext;
40 typedef std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector;
41 typedef std::shared_ptr< UnoView > UnoViewSharedPtr;
42 typedef std::vector< UnoViewSharedPtr > UnoViewVector;
44 /** This class imports all shapes from a given XShapes object
46 class ShapeImporter
48 public:
49 /** Create shape importer.
51 @param xPage
52 Page containing the shapes
54 @param xActualPage
55 Actual page that's imported - if xPage is a master
56 page, this argument must refer to the using, i.e the
57 page that embeds this specific masterpage. Otherwise,
58 this argument is probably equal to xPage.
60 @param nOrdNumStart
61 Each shape receives a z order number, in order of
62 import (which relies on the fact that the API returns
63 the shapes in draw order - which it does,
64 currently). Since we might mix several pages on screen
65 (e.g. master page and foreground page), this value can
66 be used as an offset to distinguish those pages.
68 @param bConvertingMasterPage
69 When true, then the master page is imported. Otherwise, this
70 object imports the draw page.
72 ShapeImporter( const css::uno::Reference< css::drawing::XDrawPage >& xPage,
73 css::uno::Reference< css::drawing::XDrawPage > xActualPage,
74 css::uno::Reference< css::drawing::XDrawPagesSupplier> xPagesSupplier,
75 const SlideShowContext& rContext,
76 sal_Int32 nOrdNumStart,
77 bool bConvertingMasterPage );
79 /** This method imports the presentation background shape
81 ShapeSharedPtr importBackgroundShape(); // throw (ShapeLoadFailedException)
83 /** This method imports presentation-visible shapes (and skips all others).
85 @return the generated Shape, or NULL for no more shapes.
87 ShapeSharedPtr importShape(); // throw (ConversionFailedException)
89 /** Test whether import is done.
91 @return true, if all shapes are imported via the
92 importShape() call.
94 bool isImportDone() const;
95 const PolyPolygonVector& getPolygons() const;
97 double getImportedShapesCount() const{ return mnAscendingPrio; }
98 private:
99 bool isSkip( css::uno::Reference<css::beans::XPropertySet> const& xPropSet,
100 std::u16string_view shapeType,
101 css::uno::Reference<css::drawing::XLayer> const& xLayer);
103 ShapeSharedPtr createShape(
104 css::uno::Reference<css::drawing::XShape> const& xCurrShape,
105 css::uno::Reference<css::beans::XPropertySet> const& xPropSet,
106 std::u16string_view shapeType ) const;
108 void importPolygons(css::uno::Reference< css::beans::XPropertySet > const& xPropSet) ;
110 struct XShapesEntry
112 ShapeSharedPtr const mpGroupShape;
113 css::uno::Reference<css::drawing::XShapes> const mxShapes;
114 sal_Int32 const mnCount;
115 sal_Int32 mnPos;
117 explicit XShapesEntry( ShapeSharedPtr const& pGroupShape )
118 : mpGroupShape(pGroupShape),
119 mxShapes( pGroupShape->getXShape(),
120 css::uno::UNO_QUERY_THROW ),
121 mnCount(mxShapes->getCount()), mnPos(0) {}
122 explicit XShapesEntry( css::uno::Reference<
123 css::drawing::XShapes> const& xShapes )
124 : mpGroupShape(), mxShapes(xShapes),
125 mnCount(xShapes->getCount()), mnPos(0) {}
128 css::uno::Reference<css::drawing::XDrawPage> mxPage;
129 css::uno::Reference<css::drawing::XDrawPagesSupplier> mxPagesSupplier;
130 const SlideShowContext& mrContext;
131 PolyPolygonVector maPolygons;
132 ::std::stack<XShapesEntry> maShapesStack;
133 double mnAscendingPrio;
134 bool mbConvertingMasterPage;
137 } // namespace presentation::internal
139 #endif
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */