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 .
20 #ifndef INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
23 #include <xmloff/xmlexp.hxx>
24 #include "xmlitmap.hxx"
25 #include <xmloff/xmltoken.hxx>
28 #include <string_view>
34 class SvXMLUnitConverter
;
35 class SvXMLExportItemMapper
;
36 class SvXMLAutoStylePoolP
;
40 class SwXMLTableColumn_Impl
;
41 class SwXMLTableLines_Impl
;
42 class SwXMLTableColumnsSortByWidth_Impl
;
43 class SwXMLTableFrameFormatsSort_Impl
;
44 class SwXMLTableInfo_Impl
;
46 class XMLPropertySetMapper
;
47 class SwXMLTableLines_Impl
;
49 typedef std::vector
< SwXMLTableLines_Impl
* > SwXMLTableLinesCache_Impl
;
51 class SwXMLExport
: public SvXMLExport
53 std::unique_ptr
<SvXMLUnitConverter
> m_pTwipUnitConverter
;
54 std::unique_ptr
<SvXMLExportItemMapper
> m_pTableItemMapper
;
55 std::unique_ptr
<SwXMLTableLinesCache_Impl
> m_pTableLines
;
57 SvXMLItemMapEntriesRef m_xTableItemMap
;
58 SvXMLItemMapEntriesRef m_xTableRowItemMap
;
59 SvXMLItemMapEntriesRef m_xTableCellItemMap
;
61 bool m_bBlock
: 1; // export text block?
62 bool m_bShowProgress
: 1;
63 bool m_bSavedShowChanges
: 1;
65 SwDoc
* m_pDoc
; // cached for getDoc()
67 void InitItemExport();
68 void FinitItemExport();
69 void ExportTableLinesAutoStyles( const SwTableLines
& rLines
,
71 sal_uInt32 nBaseWidth
,
72 std::u16string_view rNamePrefix
,
73 SwXMLTableColumnsSortByWidth_Impl
& rExpCols
,
74 SwXMLTableFrameFormatsSort_Impl
& rExpRows
,
75 SwXMLTableFrameFormatsSort_Impl
& rExpCells
,
76 SwXMLTableInfo_Impl
& rTableInfo
,
79 void ExportFormat(const SwFormat
& rFormat
, enum ::xmloff::token::XMLTokenEnum eClass
,
80 ::std::optional
<OUString
> const oStyleName
);
81 void ExportTableFormat( const SwFrameFormat
& rFormat
, sal_uInt32 nAbsWidth
);
83 void ExportTableColumnStyle( const SwXMLTableColumn_Impl
& rCol
);
84 void ExportTableBox( const SwTableBox
& rBox
, sal_uInt32 nColSpan
, sal_uInt32 nRowSpan
,
85 SwXMLTableInfo_Impl
& rTableInfo
);
86 void ExportTableLine( const SwTableLine
& rLine
,
87 const SwXMLTableLines_Impl
& rLines
,
88 SwXMLTableInfo_Impl
& rTableInfo
);
89 void ExportTableLines( const SwTableLines
& rLines
,
90 SwXMLTableInfo_Impl
& rTableInfo
,
91 sal_uInt32 nHeaderRows
= 0 );
95 virtual void ExportMeta_() override
;
96 virtual void ExportFontDecls_() override
;
97 virtual void ExportStyles_( bool bUsed
) override
;
98 virtual void ExportAutoStyles_() override
;
99 virtual void ExportMasterStyles_() override
;
100 virtual void SetBodyAttributes() override
;
101 virtual void ExportContent_() override
;
102 virtual void GetViewSettings(css::uno::Sequence
<css::beans::PropertyValue
>& aProps
) override
;
103 virtual void GetConfigurationSettings(css::uno::Sequence
<css::beans::PropertyValue
>& aProps
) override
;
104 virtual sal_Int32
GetDocumentSpecificSettings( std::vector
< SettingsGroup
>& _out_rSettings
) override
;
107 void DeleteTableLines();
110 virtual XMLTextParagraphExport
* CreateTextParagraphExport() override
;
111 virtual SvXMLAutoStylePoolP
* CreateAutoStylePool() override
;
112 virtual XMLPageExport
* CreatePageExport() override
;
113 virtual XMLShapeExport
* CreateShapeExport() override
;
114 virtual XMLFontAutoStylePool
* CreateFontAutoStylePool() override
;
118 const css::uno::Reference
< css::uno::XComponentContext
>& rContext
,
119 OUString
const & implementationName
, SvXMLExportFlags nExportFlags
);
121 virtual ~SwXMLExport() override
;
123 void collectAutoStyles() override
;
125 virtual ErrCode
exportDoc( enum ::xmloff::token::XMLTokenEnum eClass
= ::xmloff::token::XML_TOKEN_INVALID
) override
;
127 inline const SvXMLUnitConverter
& GetTwipUnitConverter() const;
129 void ExportTableAutoStyles( const SwTableNode
& rTableNd
);
130 void ExportTable( const SwTableNode
& rTableNd
);
132 bool IsShowProgress() const { return m_bShowProgress
; }
133 void SetShowProgress( bool b
) { m_bShowProgress
= b
; }
135 const SwDoc
* getDoc() const;
139 inline const SvXMLUnitConverter
& SwXMLExport::GetTwipUnitConverter() const
141 return *m_pTwipUnitConverter
;
144 #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */