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 .
22 #include <xmloff/xmlexp.hxx>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/drawing/XDrawPage.hpp>
27 #include <o3tl/sorted_vector.hxx>
30 namespace tools
{ class Rectangle
; }
32 class ImpXMLEXPPageMasterInfo
;
33 class ImpXMLAutoLayoutInfo
;
34 class XMLSdPropHdlFactory
;
35 class XMLShapeExportPropertyMapper
;
36 class XMLPageExportPropertyMapper
;
38 typedef ::std::vector
< ImpXMLEXPPageMasterInfo
* > ImpXMLEXPPageMasterList
;
43 XmlPlaceholderOutline
,
44 XmlPlaceholderSubtitle
,
45 XmlPlaceholderGraphic
,
51 XmlPlaceholderHandout
,
52 XmlPlaceholderVerticalTitle
,
53 XmlPlaceholderVerticalOutline
56 typedef o3tl::sorted_vector
<sal_Int32
> SdXMLFormatMap
;
58 struct HeaderFooterPageSettingsImpl
60 OUString maStrHeaderDeclName
;
61 OUString maStrFooterDeclName
;
62 OUString maStrDateTimeDeclName
;
65 struct DateTimeDeclImpl
72 class SdXMLExport
: public SvXMLExport
74 css::uno::Reference
< css::container::XNameAccess
> mxDocStyleFamilies
;
75 css::uno::Reference
< css::container::XIndexAccess
> mxDocMasterPages
;
76 css::uno::Reference
< css::container::XIndexAccess
> mxDocDrawPages
;
77 sal_Int32 mnDocMasterPageCount
;
78 sal_Int32 mnDocDrawPageCount
;
79 sal_uInt32 mnObjectCount
;
82 std::vector
< std::unique_ptr
<ImpXMLEXPPageMasterInfo
> > mvPageMasterInfoList
;
83 ImpXMLEXPPageMasterList mvPageMasterUsageList
;
84 ImpXMLEXPPageMasterList mvNotesPageMasterUsageList
;
85 ImpXMLEXPPageMasterInfo
* mpHandoutPageMaster
;
86 std::vector
< std::unique_ptr
<ImpXMLAutoLayoutInfo
> > mvAutoLayoutInfoList
;
88 css::uno::Sequence
< OUString
> maDrawPagesAutoLayoutNames
;
90 ::std::vector
< OUString
> maDrawPagesStyleNames
;
91 ::std::vector
< OUString
> maDrawNotesPagesStyleNames
;
92 ::std::vector
< OUString
> maMasterPagesStyleNames
;
93 OUString maHandoutMasterStyleName
;
94 ::std::vector
< HeaderFooterPageSettingsImpl
> maDrawPagesHeaderFooterSettings
;
95 ::std::vector
< HeaderFooterPageSettingsImpl
> maDrawNotesPagesHeaderFooterSettings
;
97 ::std::vector
< OUString
> maHeaderDeclsVector
;
98 ::std::vector
< OUString
> maFooterDeclsVector
;
99 ::std::vector
< DateTimeDeclImpl
> maDateTimeDeclsVector
;
101 HeaderFooterPageSettingsImpl maHandoutPageHeaderFooterSettings
;
103 rtl::Reference
<XMLSdPropHdlFactory
> mpSdPropHdlFactory
;
104 rtl::Reference
<XMLShapeExportPropertyMapper
> mpPropertySetMapper
;
105 rtl::Reference
<XMLPageExportPropertyMapper
> mpPresPagePropsMapper
;
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
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
;
119 ImpXMLEXPPageMasterInfo
* ImpGetOrCreatePageMasterInfo( const css::uno::Reference
< css::drawing::XDrawPage
>& xMasterPage
);
120 void ImpPrepPageMasterInfos();
121 void ImpWritePageMasterInfos();
122 void ImpPrepAutoLayoutInfos();
123 HeaderFooterPageSettingsImpl
ImpPrepDrawPageHeaderFooterDecls( const css::uno::Reference
< css::drawing::XDrawPage
>& xDrawPage
);
124 ImpXMLEXPPageMasterInfo
* ImpGetPageMasterInfoByName(std::u16string_view rName
);
126 void ImpPrepDrawPageInfos();
127 void ImpPrepMasterPageInfos();
128 void ImpWritePresentationStyles();
129 OUString
ImpCreatePresPageStyleName( const css::uno::Reference
<css::drawing::XDrawPage
>& xDrawPage
, bool bExportBackground
= true );
131 bool ImpPrepAutoLayoutInfo(const css::uno::Reference
< css::drawing::XDrawPage
>& xPage
, OUString
& rName
);
132 void ImpWriteAutoLayoutInfos();
133 void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl
, const tools::Rectangle
& rRect
);
134 void ImpWriteHeaderFooterDecls();
135 void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl
& aSettings
);
137 void exportFormsElement( const css::uno::Reference
< css::drawing::XDrawPage
>& xDrawPage
);
138 void exportTheme(const css::uno::Reference
<css::drawing::XDrawPage
>& xDrawPage
);
139 void exportPresentationSettings();
141 // #82003# helper function for recursive object count
142 sal_uInt32
ImpRecursiveObjectCount( const css::uno::Reference
< css::drawing::XShapes
>& xShapes
);
144 OUString
getNavigationOrder( const css::uno::Reference
< css::drawing::XDrawPage
>& xDrawPage
);
146 void collectAnnotationAutoStyles( const css::uno::Reference
< css::drawing::XDrawPage
>& xDrawPage
);
147 void exportAnnotations( const css::uno::Reference
< css::drawing::XDrawPage
>& xDrawPage
);
150 virtual void GetViewSettings(css::uno::Sequence
<css::beans::PropertyValue
>& aProps
) override
;
151 virtual void GetConfigurationSettings(css::uno::Sequence
<css::beans::PropertyValue
>& aProps
) override
;
152 virtual XMLFontAutoStylePool
* CreateFontAutoStylePool() override
;
156 const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
157 OUString
const & implementationName
,
158 bool bIsDraw
, SvXMLExportFlags nExportFlags
);
159 virtual ~SdXMLExport() override
;
161 void collectAutoStyles() override
;
164 virtual void SAL_CALL
setSourceDocument( const css::uno::Reference
< css::lang::XComponent
>& xDoc
) override
;
166 // get factories and mappers
167 XMLShapeExportPropertyMapper
* GetPropertySetMapper() const { return mpPropertySetMapper
.get(); }
168 XMLPageExportPropertyMapper
* GetPresPagePropsMapper() const { return mpPresPagePropsMapper
.get(); }
170 bool IsDraw() const { return mbIsDraw
; }
171 bool IsImpress() const { return !mbIsDraw
; }
173 virtual void addDataStyle(const sal_Int32 nNumberFormat
, bool bTimeFormat
= false ) override
;
174 virtual void exportDataStyles() override
;
175 virtual void exportAutoDataStyles() override
;
176 virtual OUString
getDataStyleName(const sal_Int32 nNumberFormat
, bool bTimeFormat
= false ) const override
;
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */