LibreOffice Module xmloff (master) 1
shapeimport.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_XMLOFF_SHAPEIMPORT_HXX
21#define INCLUDED_XMLOFF_SHAPEIMPORT_HXX
22
23#include <sal/config.h>
24#include <xmloff/dllapi.h>
25#include <com/sun/star/drawing/HomogenMatrix.hpp>
26#include <com/sun/star/drawing/ProjectionMode.hpp>
27#include <com/sun/star/drawing/ShadeMode.hpp>
29#include <xmloff/xmlictxt.hxx>
30#include <sax/fastattribs.hxx>
31
33#include <vector>
34#include <memory>
35
36namespace com::sun::star::beans { class XPropertySet; }
37namespace com::sun::star::drawing { class XShape; }
38namespace com::sun::star::drawing { class XShapes; }
39namespace com::sun::star::frame { class XModel; }
40namespace com::sun::star::xml::sax { class XAttributeList; }
41
42class SvXMLImport;
43class SvXMLTokenMap;
47class XMLTableImport;
48
49// dr3d:3dlight context
50
52{
53 // local parameters which need to be read
54 sal_Int32 maDiffuseColor;
58
59public:
61 SvXMLImport& rImport,
62 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
63 virtual ~SdXML3DLightContext() override;
64
65 sal_Int32 GetDiffuseColor() const { return maDiffuseColor; }
66 const ::basegfx::B3DVector& GetDirection() const { return maDirection; }
67 bool GetEnabled() const { return mbEnabled; }
68};
69
70
72{
73protected:
75
76 // list for local light contexts
77 ::std::vector< rtl::Reference< SdXML3DLightContext > >
79
80 // local parameters which need to be read
81 css::drawing::HomogenMatrix mxHomMat;
83
84 css::drawing::ProjectionMode mxPrjMode;
85 sal_Int32 mnDistance;
86 sal_Int32 mnFocalLength;
87 sal_Int32 mnShadowSlant;
88 css::drawing::ShadeMode mxShadeMode;
89 sal_Int32 maAmbientColor;
91
96
97public:
99
101 SvXMLImportContext * create3DLightContext( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
102
105
107 void setSceneAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
108};
109
110
112{
113protected:
114 css::uno::Reference< css::drawing::XShape > mxShape;
116 OUString msHyperlink;
117
118public:
119 SvXMLShapeContext( SvXMLImport& rImp, bool bTemporaryShape ) : SvXMLImportContext( rImp ), mbTemporaryShape(bTemporaryShape) {}
120
121
122 const css::uno::Reference< css::drawing::XShape >& getShape() const { return mxShape; }
123
124 void setHyperlink( const OUString& rHyperlink );
125};
126
127
131
133{
134 std::unique_ptr<XMLShapeImportHelperImpl> mpImpl;
135
136 std::shared_ptr<XMLShapeImportPageContextImpl> mpPageContext;
137
138 // PropertySetMappers and factory
142
143 // contexts for Style and AutoStyle import
146
148
149protected:
151
152public:
154 const css::uno::Reference< css::frame::XModel>& rModel,
155 SvXMLImportPropertyMapper *pExtMapper=nullptr );
156
157 virtual ~XMLShapeImportHelper() override;
158
159 static SvXMLShapeContext* CreateGroupChildContext(
160 SvXMLImport& rImport, sal_Int32 nElement,
161 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
162 css::uno::Reference< css::drawing::XShapes > const & rShapes,
163 bool bTemporaryShape = false);
164
166 SvXMLImport& rImport, sal_Int32 nElement,
167 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
168 css::uno::Reference< css::drawing::XShapes > const & rShapes,
169 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xFrameAttrList);
170 static css::uno::Reference< css::xml::sax::XFastContextHandler > CreateFrameChildContext(
171 SvXMLImportContext *pThisContext, sal_Int32 nElement,
172 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
173
174 static SvXMLShapeContext* Create3DSceneChildContext(
175 SvXMLImport& rImport, sal_Int32 nElement,
176 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
177 css::uno::Reference< css::drawing::XShapes > const & rShapes);
178
179 // Styles and AutoStyles contexts
180 SvXMLStylesContext* GetStylesContext() const { return mxStylesContext.get(); }
181 void SetStylesContext(SvXMLStylesContext* pNew);
182 SvXMLStylesContext* GetAutoStylesContext() const { return mxAutoStylesContext.get(); }
183 void SetAutoStylesContext(SvXMLStylesContext* pNew);
184
185 // get factories and mappers
186 SvXMLImportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper.get(); }
187 SvXMLImportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper.get(); }
188
189 // this function is called whenever the implementation classes like to add this new
190 // shape to the given XShapes.
191 virtual void addShape(
192 css::uno::Reference< css::drawing::XShape >& rShape,
193 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
194 css::uno::Reference< css::drawing::XShapes >& rShapes);
195
196 // this function is called whenever the implementation classes have finished importing
197 // a shape to the given XShapes. The shape is already inserted into its XShapes and
198 // all properties and styles are set.
199 virtual void finishShape(
200 css::uno::Reference< css::drawing::XShape >& rShape,
201 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
202 css::uno::Reference< css::drawing::XShapes >& rShapes);
203
204 // tdf#127791 help function for group shape events
205 void addShapeEvents(SdXMLEventContextData& rData);
206
207 // helper functions processing groups after their component shapes are collected
208 // e.g. for z-order sorting or adding events to the group
209 void pushGroupForPostProcessing( css::uno::Reference< css::drawing::XShapes >& rShapes );
210 void popGroupAndPostProcess();
211
212 void shapeWithZIndexAdded( css::uno::Reference< css::drawing::XShape > const & rShape,
213 sal_Int32 nZIndex );
216 void shapeRemoved(const css::uno::Reference<css::drawing::XShape>& rShape);
217
218 void addShapeConnection( css::uno::Reference< css::drawing::XShape > const & rConnectorShape,
219 bool bStart,
220 const OUString& rDestShapeId,
221 sal_Int32 nDestGlueId );
222
225 void addGluePointMapping( css::uno::Reference< css::drawing::XShape > const & xShape,
226 sal_Int32 nSourceId, sal_Int32 nDestinnationId );
227
229 void moveGluePointMapping( const css::uno::Reference< css::drawing::XShape >& xShape, const sal_Int32 n );
230
233 sal_Int32 getGluePointId( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nSourceId );
234
237 void startPage( css::uno::Reference< css::drawing::XShapes > const & rShapes );
238
241 void endPage( css::uno::Reference< css::drawing::XShapes > const & rShapes );
242
243 void restoreConnections();
244
246 static SvXMLImportPropertyMapper* CreateShapePropMapper(
247 const css::uno::Reference< css::frame::XModel>& rModel, SvXMLImport& rImport );
248
250 void enableHandleProgressBar();
251 bool IsHandleProgressBarEnabled() const;
252
254 bool IsPresentationShapesSupported() const;
255
256 XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory.get(); }
257
258 const rtl::Reference< XMLTableImport >& GetShapeTableImport();
259};
260
261#endif // INCLUDED_XMLOFF_SHAPEIMPORT_HXX
262
263/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdXML3DLightContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximp3dscene.cxx:40
sal_Int32 maDiffuseColor
Definition: shapeimport.hxx:54
::basegfx::B3DVector maDirection
Definition: shapeimport.hxx:55
virtual ~SdXML3DLightContext() override
Definition: ximp3dscene.cxx:89
const ::basegfx::B3DVector & GetDirection() const
Definition: shapeimport.hxx:66
sal_Int32 GetDiffuseColor() const
Definition: shapeimport.hxx:65
bool GetEnabled() const
Definition: shapeimport.hxx:67
void processSceneAttribute(const sax_fastparser::FastAttributeList::FastAttributeIter &aIter)
this should be called for each scene attribute
void setSceneAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
this sets the scene attributes at this propertyset
css::drawing::ShadeMode mxShadeMode
Definition: shapeimport.hxx:88
SdXML3DSceneAttributesHelper(SvXMLImport &rImporter)
::basegfx::B3DVector maVRP
Definition: shapeimport.hxx:92
css::drawing::ProjectionMode mxPrjMode
Definition: shapeimport.hxx:84
SvXMLImportContext * create3DLightContext(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
creates a 3d light context and adds it to the internal list for later processing
css::drawing::HomogenMatrix mxHomMat
Definition: shapeimport.hxx:81
::std::vector< rtl::Reference< SdXML3DLightContext > > maList
Definition: shapeimport.hxx:78
::basegfx::B3DVector maVUP
Definition: shapeimport.hxx:94
::basegfx::B3DVector maVPN
Definition: shapeimport.hxx:93
This class deliberately does not support XWeak, to improve performance when loading large documents.
Definition: xmlictxt.hxx:48
SvXMLShapeContext(SvXMLImport &rImp, bool bTemporaryShape)
void setHyperlink(const OUString &rHyperlink)
css::uno::Reference< css::drawing::XShape > mxShape
const css::uno::Reference< css::drawing::XShape > & getShape() const
rtl::Reference< SvXMLImportPropertyMapper > mpPresPagePropsMapper
XMLSdPropHdlFactory * GetSdPropHdlFactory() const
SvXMLImportPropertyMapper * GetPropertySetMapper() const
SvXMLStylesContext * GetAutoStylesContext() const
SvXMLImport & mrImporter
SvXMLImportPropertyMapper * GetPresPagePropsMapper() const
rtl::Reference< SvXMLImportPropertyMapper > mpPropertySetMapper
static css::uno::Reference< css::xml::sax::XFastContextHandler > CreateFrameChildContext(SvXMLImportContext *pThisContext, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
rtl::Reference< SvXMLStylesContext > mxAutoStylesContext
rtl::Reference< XMLTableImport > mxShapeTableImport
rtl::Reference< XMLSdPropHdlFactory > mpSdPropHdlFactory
static SvXMLShapeContext * CreateFrameChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xFrameAttrList)
std::shared_ptr< XMLShapeImportPageContextImpl > mpPageContext
std::unique_ptr< XMLShapeImportHelperImpl > mpImpl
rtl::Reference< SvXMLStylesContext > mxStylesContext
SvXMLStylesContext * GetStylesContext() const
#define XMLOFF_DLLPUBLIC
Definition: dllapi.h:29
class SAL_NO_VTABLE XPropertySet
this class is to enable adding members to the XMLShapeImportHelper without getting incompatible
Definition: shapeimport.cxx:93
this struct is created for each startPage() call and stores information that is needed during import ...
Definition: shapeimport.cxx:83