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_SW_SOURCE_FILTER_XML_XMLEXP_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
22
23 #include <xmloff/xmlexp.hxx>
24 #include "xmlitmap.hxx"
25 #include <xmloff/xmltoken.hxx>
26 #include <vector>
27
28 class SwDoc;
29 class SwFormat;
30 class SwFrameFormat;
31 class SvXMLUnitConverter;
32 class SvXMLExportItemMapper;
33 class SvXMLAutoStylePoolP;
34 class SwTableLine;
35 class SwTableLines;
36 class SwTableBox;
37 class SwXMLTableColumn_Impl;
38 class SwXMLTableLines_Impl;
39 class SwXMLTableColumnsSortByWidth_Impl;
40 class SwXMLTableFrameFormatsSort_Impl;
41 class SwXMLTableInfo_Impl;
42 class SwTableNode;
43 class XMLPropertySetMapper;
44 class SwXMLTableLines_Impl;
45
46 typedef std::vector< SwXMLTableLines_Impl* > SwXMLTableLinesCache_Impl;
47
48 class SwXMLExport : public SvXMLExport
49 {
50 std::unique_ptr<SvXMLUnitConverter> m_pTwipUnitConverter;
51 std::unique_ptr<SvXMLExportItemMapper> m_pTableItemMapper;
52 std::unique_ptr<SwXMLTableLinesCache_Impl> m_pTableLines;
53
54 SvXMLItemMapEntriesRef m_xTableItemMap;
55 SvXMLItemMapEntriesRef m_xTableRowItemMap;
56 SvXMLItemMapEntriesRef m_xTableCellItemMap;
57
58 bool m_bBlock : 1; // export text block?
59 bool m_bShowProgress : 1;
60 bool m_bSavedShowChanges : 1;
61
62 SwDoc* m_pDoc; // cached for getDoc()
63
64 void InitItemExport();
65 void FinitItemExport();
66 void ExportTableLinesAutoStyles( const SwTableLines& rLines,
67 sal_uInt32 nAbsWidth,
68 sal_uInt32 nBaseWidth,
69 const OUString& rNamePrefix,
70 SwXMLTableColumnsSortByWidth_Impl& rExpCols,
71 SwXMLTableFrameFormatsSort_Impl& rExpRows,
72 SwXMLTableFrameFormatsSort_Impl& rExpCells,
73 SwXMLTableInfo_Impl& rTableInfo,
74 bool bTop=false );
75
76 void ExportFormat( const SwFormat& rFormat, enum ::xmloff::token::XMLTokenEnum eClass );
77 void ExportTableFormat( const SwFrameFormat& rFormat, sal_uInt32 nAbsWidth );
78
79 void ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol );
80 void ExportTableBox( const SwTableBox& rBox, sal_uInt32 nColSpan, sal_uInt32 nRowSpan,
81 SwXMLTableInfo_Impl& rTableInfo );
82 void ExportTableLine( const SwTableLine& rLine,
83 const SwXMLTableLines_Impl& rLines,
84 SwXMLTableInfo_Impl& rTableInfo );
85 void ExportTableLines( const SwTableLines& rLines,
86 SwXMLTableInfo_Impl& rTableInfo,
87 sal_uInt32 nHeaderRows = 0 );
88
89 virtual void ExportMeta_() override;
90 virtual void ExportFontDecls_() override;
91 virtual void ExportStyles_( bool bUsed ) override;
92 virtual void ExportAutoStyles_() override;
93 virtual void ExportMasterStyles_() override;
94 virtual void SetBodyAttributes() override;
95 virtual void ExportContent_() override;
96 virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
97 virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
98 virtual sal_Int32 GetDocumentSpecificSettings( std::vector< SettingsGroup >& _out_rSettings ) override;
99
100 private:
101 void DeleteTableLines();
102 protected:
103
104 virtual XMLTextParagraphExport* CreateTextParagraphExport() override;
105 virtual SvXMLAutoStylePoolP* CreateAutoStylePool() override;
106 virtual XMLPageExport* CreatePageExport() override;
107 virtual XMLShapeExport* CreateShapeExport() override;
108 virtual XMLFontAutoStylePool* CreateFontAutoStylePool() override;
109
110 public:
111 SwXMLExport(
112 const css::uno::Reference< css::uno::XComponentContext >& rContext,
113 OUString const & implementationName, SvXMLExportFlags nExportFlags);
114
115 virtual ~SwXMLExport() override;
116
117 void collectAutoStyles() override;
118
119 virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override;
120
121 inline const SvXMLUnitConverter& GetTwipUnitConverter() const;
122
123 void ExportTableAutoStyles( const SwTableNode& rTableNd );
124 void ExportTable( const SwTableNode& rTableNd );
125
IsShowProgress() const126 bool IsShowProgress() const { return m_bShowProgress; }
SetShowProgress(bool b)127 void SetShowProgress( bool b ) { m_bShowProgress = b; }
128
129 // XUnoTunnel
130 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
131 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
132
133 const SwDoc* getDoc() const;
134 SwDoc* getDoc();
135 };
136
GetTwipUnitConverter() const137 inline const SvXMLUnitConverter& SwXMLExport::GetTwipUnitConverter() const
138 {
139 return *m_pTwipUnitConverter;
140 }
141
142 #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
143
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
145