LibreOffice Module sw (master)  1
xmlexp.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_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 
27 #include <string_view>
28 #include <vector>
29 
30 class SwDoc;
31 class SwFormat;
32 class SwFrameFormat;
33 class SvXMLUnitConverter;
36 class SwTableLine;
37 class SwTableLines;
38 class SwTableBox;
44 class SwTableNode;
47 
48 typedef std::vector< SwXMLTableLines_Impl* > SwXMLTableLinesCache_Impl;
49 
50 class SwXMLExport : public SvXMLExport
51 {
52  std::unique_ptr<SvXMLUnitConverter> m_pTwipUnitConverter;
53  std::unique_ptr<SvXMLExportItemMapper> m_pTableItemMapper;
54  std::unique_ptr<SwXMLTableLinesCache_Impl> m_pTableLines;
55 
59 
60  bool m_bBlock : 1; // export text block?
61  bool m_bShowProgress : 1;
63 
64  SwDoc* m_pDoc; // cached for getDoc()
65 
66  void InitItemExport();
67  void FinitItemExport();
68  void ExportTableLinesAutoStyles( const SwTableLines& rLines,
69  sal_uInt32 nAbsWidth,
70  sal_uInt32 nBaseWidth,
71  std::u16string_view rNamePrefix,
75  SwXMLTableInfo_Impl& rTableInfo,
76  bool bTop=false );
77 
78  void ExportFormat( const SwFormat& rFormat, enum ::xmloff::token::XMLTokenEnum eClass );
79  void ExportTableFormat( const SwFrameFormat& rFormat, sal_uInt32 nAbsWidth );
80 
82  void ExportTableBox( const SwTableBox& rBox, sal_uInt32 nColSpan, sal_uInt32 nRowSpan,
83  SwXMLTableInfo_Impl& rTableInfo );
84  void ExportTableLine( const SwTableLine& rLine,
85  const SwXMLTableLines_Impl& rLines,
86  SwXMLTableInfo_Impl& rTableInfo );
87  void ExportTableLines( const SwTableLines& rLines,
88  SwXMLTableInfo_Impl& rTableInfo,
89  sal_uInt32 nHeaderRows = 0 );
90 
91  virtual void ExportMeta_() override;
92  virtual void ExportFontDecls_() override;
93  virtual void ExportStyles_( bool bUsed ) override;
94  virtual void ExportAutoStyles_() override;
95  virtual void ExportMasterStyles_() override;
96  virtual void SetBodyAttributes() override;
97  virtual void ExportContent_() override;
98  virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
99  virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
100  virtual sal_Int32 GetDocumentSpecificSettings( std::vector< SettingsGroup >& _out_rSettings ) override;
101 
102 private:
103  void DeleteTableLines();
104 protected:
105 
107  virtual SvXMLAutoStylePoolP* CreateAutoStylePool() override;
108  virtual XMLPageExport* CreatePageExport() override;
109  virtual XMLShapeExport* CreateShapeExport() override;
110  virtual XMLFontAutoStylePool* CreateFontAutoStylePool() override;
111 
112 public:
113  SwXMLExport(
114  const css::uno::Reference< css::uno::XComponentContext >& rContext,
115  OUString const & implementationName, SvXMLExportFlags nExportFlags);
116 
117  virtual ~SwXMLExport() override;
118 
119  void collectAutoStyles() override;
120 
121  virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override;
122 
123  inline const SvXMLUnitConverter& GetTwipUnitConverter() const;
124 
125  void ExportTableAutoStyles( const SwTableNode& rTableNd );
126  void ExportTable( const SwTableNode& rTableNd );
127 
128  bool IsShowProgress() const { return m_bShowProgress; }
129  void SetShowProgress( bool b ) { m_bShowProgress = b; }
130 
131  // XUnoTunnel
132  static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept;
133  virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
134 
135  const SwDoc* getDoc() const;
136  SwDoc* getDoc();
137 };
138 
140 {
141  return *m_pTwipUnitConverter;
142 }
143 
144 #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
145 
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bBlock
Definition: xmlexp.hxx:60
void ExportTableAutoStyles(const SwTableNode &rTableNd)
Definition: xmltble.cxx:746
signed char sal_Int8
SvXMLItemMapEntriesRef m_xTableRowItemMap
Definition: xmlexp.hxx:57
SvXMLExportFlags
std::vector< SwXMLTableLines_Impl * > SwXMLTableLinesCache_Impl
Definition: xmlexp.hxx:46
Definition: doc.hxx:187
SwTableLine is one table row in the document model.
Definition: swtable.hxx:351
SwXMLExport(const css::uno::Reference< css::uno::XComponentContext > &rContext, OUString const &implementationName, SvXMLExportFlags nExportFlags)
Definition: xmlexp.cxx:81
void InitItemExport()
Definition: xmliteme.cxx:225
virtual void GetConfigurationSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
Definition: xmlexp.cxx:385
SvXMLItemMapEntriesRef m_xTableItemMap
Definition: xmlexp.hxx:56
SvXMLItemMapEntriesRef m_xTableCellItemMap
Definition: xmlexp.hxx:58
virtual void ExportMasterStyles_() override
Definition: xmlfmte.cxx:256
virtual XMLShapeExport * CreateShapeExport() override
Definition: xmlexp.cxx:309
void ExportTableLinesAutoStyles(const SwTableLines &rLines, sal_uInt32 nAbsWidth, sal_uInt32 nBaseWidth, std::u16string_view rNamePrefix, SwXMLTableColumnsSortByWidth_Impl &rExpCols, SwXMLTableFrameFormatsSort_Impl &rExpRows, SwXMLTableFrameFormatsSort_Impl &rExpCells, SwXMLTableInfo_Impl &rTableInfo, bool bTop=false)
Definition: xmltble.cxx:585
bool m_bSavedShowChanges
Definition: xmlexp.hxx:62
bool m_bShowProgress
Definition: xmlexp.hxx:61
void DeleteTableLines()
Definition: xmltble.cxx:1272
virtual void ExportMeta_() override
Definition: xmlmeta.cxx:164
void FinitItemExport()
Definition: xmliteme.cxx:238
Base class for various Writer styles.
Definition: format.hxx:46
void ExportFormat(const SwFormat &rFormat, enum::xmloff::token::XMLTokenEnum eClass)
Definition: xmlfmte.cxx:49
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: xmlexp.cxx:484
Style of a layout element.
Definition: frmfmt.hxx:58
bool IsShowProgress() const
Definition: xmlexp.hxx:128
const SwDoc * getDoc() const
Definition: xmlexp.cxx:515
void ExportTableColumnStyle(const SwXMLTableColumn_Impl &rCol)
Definition: xmltble.cxx:543
std::unique_ptr< SvXMLUnitConverter > m_pTwipUnitConverter
Definition: xmlexp.hxx:52
virtual void ExportStyles_(bool bUsed) override
Definition: xmlfmte.cxx:158
virtual sal_Int32 GetDocumentSpecificSettings(std::vector< SettingsGroup > &_out_rSettings) override
Definition: xmlexp.cxx:396
const SvXMLUnitConverter & GetTwipUnitConverter() const
Definition: xmlexp.hxx:139
virtual SvXMLAutoStylePoolP * CreateAutoStylePool() override
Definition: xmlfmte.cxx:346
void ExportTableLines(const SwTableLines &rLines, SwXMLTableInfo_Impl &rTableInfo, sal_uInt32 nHeaderRows=0)
Definition: xmltble.cxx:1004
void ExportTableFormat(const SwFrameFormat &rFormat, sal_uInt32 nAbsWidth)
Definition: xmliteme.cxx:244
virtual ErrCode exportDoc(enum::xmloff::token::XMLTokenEnum eClass=::xmloff::token::XML_TOKEN_INVALID) override
Definition: xmlexp.cxx:94
virtual XMLTextParagraphExport * CreateTextParagraphExport() override
Definition: xmlexp.cxx:304
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept
Definition: xmlexp.cxx:478
void ExportTable(const SwTableNode &rTableNd)
Definition: xmltble.cxx:1117
void ExportTableLine(const SwTableLine &rLine, const SwXMLTableLines_Impl &rLines, SwXMLTableInfo_Impl &rTableInfo)
Definition: xmltble.cxx:916
virtual void ExportFontDecls_() override
Definition: xmlexp.cxx:328
virtual void ExportContent_() override
Definition: xmlexp.cxx:427
void collectAutoStyles() override
Definition: xmlfmte.cxx:175
virtual void SetBodyAttributes() override
Definition: xmlexp.cxx:413
virtual ~SwXMLExport() override
Definition: xmlexp.cxx:322
virtual void ExportAutoStyles_() override
Definition: xmlfmte.cxx:221
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
virtual void GetViewSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
Definition: xmlexp.cxx:334
void ExportTableBox(const SwTableBox &rBox, sal_uInt32 nColSpan, sal_uInt32 nRowSpan, SwXMLTableInfo_Impl &rTableInfo)
Definition: xmltble.cxx:784
SwDoc * m_pDoc
Definition: xmlexp.hxx:64
void SetShowProgress(bool b)
Definition: xmlexp.hxx:129
virtual XMLPageExport * CreatePageExport() override
Definition: xmlfmte.cxx:251
virtual XMLFontAutoStylePool * CreateFontAutoStylePool() override
Definition: xmlfonte.cxx:73
std::unique_ptr< SvXMLExportItemMapper > m_pTableItemMapper
Definition: xmlexp.hxx:53
std::unique_ptr< SwXMLTableLinesCache_Impl > m_pTableLines
Definition: xmlexp.hxx:54