LibreOffice Module xmloff (master)  1
sdxmlexp_impl.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 #pragma once
21 
22 #include <xmloff/xmlexp.hxx>
23 
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/drawing/XDrawPage.hpp>
26 
27 #include <o3tl/sorted_vector.hxx>
28 #include <vector>
29 
30 namespace tools { class Rectangle; }
31 
37 
38 typedef ::std::vector< ImpXMLEXPPageMasterInfo* > ImpXMLEXPPageMasterList;
39 
41 {
54 };
55 
57 
59 {
63 };
64 
66 {
67  OUString maStrText;
68  bool mbFixed;
69  sal_Int32 mnFormat;
70 };
71 
72 class SdXMLExport : public SvXMLExport
73 {
74  css::uno::Reference< css::container::XNameAccess > mxDocStyleFamilies;
75  css::uno::Reference< css::container::XIndexAccess > mxDocMasterPages;
76  css::uno::Reference< css::container::XIndexAccess > mxDocDrawPages;
78  sal_Int32 mnDocDrawPageCount;
79  sal_uInt32 mnObjectCount;
80 
81  // temporary infos
82  std::vector< std::unique_ptr<ImpXMLEXPPageMasterInfo> > mvPageMasterInfoList;
86  std::vector< std::unique_ptr<ImpXMLAutoLayoutInfo> > mvAutoLayoutInfoList;
87 
88  css::uno::Sequence< OUString > maDrawPagesAutoLayoutNames;
89 
90  ::std::vector< OUString > maDrawPagesStyleNames;
91  ::std::vector< OUString > maDrawNotesPagesStyleNames;
92  ::std::vector< OUString > maMasterPagesStyleNames;
94  ::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings;
95  ::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings;
96 
97  ::std::vector< OUString > maHeaderDeclsVector;
98  ::std::vector< OUString > maFooterDeclsVector;
99  ::std::vector< DateTimeDeclImpl > maDateTimeDeclsVector;
100 
102 
106 
107  SdXMLFormatMap maUsedDateStyles; // this is a vector with the used formattings for date fields
108  SdXMLFormatMap maUsedTimeStyles; // this is a vector with the used formattings for time fields
109 
110  bool mbIsDraw;
111 
112  virtual void ExportStyles_(bool bUsed) override;
113  virtual void ExportAutoStyles_() override;
114  virtual void ExportFontDecls_() override;
115  virtual void ExportMasterStyles_() override;
116  virtual void ExportContent_() override;
117  virtual void ExportMeta_() override;
118 
119  ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( const css::uno::Reference< css::drawing::XDrawPage >& xMasterPage );
120  void ImpPrepPageMasterInfos();
122  void ImpPrepAutoLayoutInfos();
123  HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage );
124  ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(std::u16string_view rName);
125 
126  void ImpPrepDrawPageInfos();
127  void ImpPrepMasterPageInfos();
129  OUString ImpCreatePresPageStyleName( const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage, bool bExportBackground = true );
130 
131  bool ImpPrepAutoLayoutInfo(const css::uno::Reference< css::drawing::XDrawPage >& xPage, OUString& rName);
136 
137  void exportFormsElement( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage );
139 
140  // #82003# helper function for recursive object count
141  sal_uInt32 ImpRecursiveObjectCount( const css::uno::Reference< css::drawing::XShapes >& xShapes);
142 
143  OUString getNavigationOrder( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage );
144 
145  void collectAnnotationAutoStyles( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage );
146  void exportAnnotations( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage );
147 
148 protected:
149  virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
150  virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
151  virtual XMLFontAutoStylePool* CreateFontAutoStylePool() override;
152 
153 public:
154  SdXMLExport(
155  const css::uno::Reference< css::uno::XComponentContext >& xContext,
156  OUString const & implementationName,
157  bool bIsDraw, SvXMLExportFlags nExportFlags );
158  virtual ~SdXMLExport() override;
159 
160  void collectAutoStyles() override;
161 
162  // XExporter
163  virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
164 
165  // get factories and mappers
166  XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper.get(); }
167  XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper.get(); }
168 
169  bool IsDraw() const { return mbIsDraw; }
170  bool IsImpress() const { return !mbIsDraw; }
171 
172  virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) override;
173  virtual void exportDataStyles() override;
174  virtual void exportAutoDataStyles() override;
175  virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) const override;
176 };
177 
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ExportMasterStyles_() override
Override this method to export the contents of .
Definition: sdxmlexp.cxx:2221
css::uno::Reference< css::container::XIndexAccess > mxDocDrawPages
ImpXMLEXPPageMasterList mvPageMasterUsageList
XmlPlaceholder
OUString getNavigationOrder(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage)
Definition: sdxmlexp.cxx:2443
void ImpWriteAutoLayoutInfos()
Definition: sdxmlexp.cxx:709
SdXMLExport(const css::uno::Reference< css::uno::XComponentContext > &xContext, OUString const &implementationName, bool bIsDraw, SvXMLExportFlags nExportFlags)
Definition: sdxmlexp.cxx:377
bool ImpPrepAutoLayoutInfo(const css::uno::Reference< css::drawing::XDrawPage > &xPage, OUString &rName)
Definition: sdxmlexp.cxx:650
virtual void ExportStyles_(bool bUsed) override
Override this method to export the content of .
Definition: sdxmlexp.cxx:1990
sal_Int32 mnDocDrawPageCount
XMLPageExportPropertyMapper * GetPresPagePropsMapper() const
virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat=false) const override
Definition: sdxmlexp.cxx:2431
SvXMLExportFlags
Definition: xmlexp.hxx:89
void ImpWriteHeaderFooterDecls()
Definition: sdxmlexp.cxx:1417
bool IsImpress() const
XMLShapeExportPropertyMapper * GetPropertySetMapper() const
::std::vector< OUString > maMasterPagesStyleNames
rtl::Reference< XMLPageExportPropertyMapper > mpPresPagePropsMapper
OUString maHandoutMasterStyleName
bool IsDraw() const
void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const tools::Rectangle &rRect)
Definition: sdxmlexp.cxx:1094
sal_uInt32 ImpRecursiveObjectCount(const css::uno::Reference< css::drawing::XShapes > &xShapes)
Definition: sdxmlexp.cxx:573
void ImpWritePresentationStyles()
Definition: sdxmlexp.cxx:1579
virtual void exportAutoDataStyles() override
Definition: sdxmlexp.cxx:2419
HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage)
Definition: sdxmlexp.cxx:1365
::std::vector< OUString > maHeaderDeclsVector
virtual void ExportContent_() override
Override this method to export the content of .
Definition: sdxmlexp.cxx:1631
ImpXMLEXPPageMasterList mvNotesPageMasterUsageList
::std::vector< OUString > maDrawNotesPagesStyleNames
::std::vector< ImpXMLEXPPageMasterInfo * > ImpXMLEXPPageMasterList
css::uno::Reference< css::container::XNameAccess > mxDocStyleFamilies
void ImpPrepDrawPageInfos()
Definition: sdxmlexp.cxx:1296
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: sdxmlexp.cxx:393
::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings
std::vector< std::unique_ptr< ImpXMLAutoLayoutInfo > > mvAutoLayoutInfoList
ImpXMLEXPPageMasterInfo * ImpGetOrCreatePageMasterInfo(const css::uno::Reference< css::drawing::XDrawPage > &xMasterPage)
Definition: sdxmlexp.cxx:1141
void exportFormsElement(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage)
Definition: sdxmlexp.cxx:2338
void collectAnnotationAutoStyles(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage)
Definition: sdxmlexp.cxx:2476
virtual void GetConfigurationSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
Definition: sdxmlexp.cxx:2380
sal_Int32 mnDocMasterPageCount
o3tl::sorted_vector< sal_Int32 > SdXMLFormatMap
OUString ImpCreatePresPageStyleName(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage, bool bExportBackground=true)
Definition: sdxmlexp.cxx:1492
::std::vector< DateTimeDeclImpl > maDateTimeDeclsVector
css::uno::Reference< css::container::XIndexAccess > mxDocMasterPages
void exportPresentationSettings()
Definition: sdxmlexp.cxx:1810
css::uno::Sequence< OUString > maDrawPagesAutoLayoutNames
HeaderFooterPageSettingsImpl maHandoutPageHeaderFooterSettings
std::vector< std::unique_ptr< ImpXMLEXPPageMasterInfo > > mvPageMasterInfoList
SdXMLFormatMap maUsedDateStyles
virtual void ExportAutoStyles_() override
Override this method to export the contents of .
Definition: sdxmlexp.cxx:2196
::std::vector< OUString > maDrawPagesStyleNames
::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings
void ImpPrepMasterPageInfos()
Definition: sdxmlexp.cxx:1550
sal_uInt32 mnObjectCount
void ImpPrepPageMasterInfos()
Definition: sdxmlexp.cxx:1166
void collectAutoStyles() override
Definition: sdxmlexp.cxx:2025
virtual void ExportMeta_() override
Override this method to export the content of .
Definition: sdxmlexp.cxx:1608
virtual void exportDataStyles() override
Definition: sdxmlexp.cxx:2414
virtual void ExportFontDecls_() override
Override this method to export the font declarations The default implementation will export the conte...
Definition: sdxmlexp.cxx:1625
ImpXMLEXPPageMasterInfo * ImpGetPageMasterInfoByName(std::u16string_view rName)
Definition: sdxmlexp.cxx:1278
virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat=false) override
Definition: sdxmlexp.cxx:2398
virtual XMLFontAutoStylePool * CreateFontAutoStylePool() override
Definition: sdxmlexp.cxx:2736
ImpXMLEXPPageMasterInfo * mpHandoutPageMaster
void ImpPrepAutoLayoutInfos()
Definition: sdxmlexp.cxx:618
void ImplExportHeaderFooterDeclAttributes(const HeaderFooterPageSettingsImpl &aSettings)
Definition: sdxmlexp.cxx:1480
::std::vector< OUString > maFooterDeclsVector
virtual void GetViewSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
Definition: sdxmlexp.cxx:2357
void exportAnnotations(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage)
Definition: sdxmlexp.cxx:2502
rtl::Reference< XMLSdPropHdlFactory > mpSdPropHdlFactory
rtl::Reference< XMLShapeExportPropertyMapper > mpPropertySetMapper
virtual ~SdXMLExport() override
Definition: sdxmlexp.cxx:601
SdXMLFormatMap maUsedTimeStyles
void ImpWritePageMasterInfos()
Definition: sdxmlexp.cxx:1214