Line data Source code
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 : SvXMLUnitConverter* pTwipUnitConv;
51 : SvXMLExportItemMapper* pTableItemMapper;
52 : SwXMLTableLinesCache_Impl* pTableLines;
53 :
54 : SvXMLItemMapEntriesRef xTableItemMap;
55 : SvXMLItemMapEntriesRef xTableRowItemMap;
56 : SvXMLItemMapEntriesRef xTableCellItemMap;
57 : rtl::Reference < XMLPropertySetMapper > xParaPropMapper;
58 :
59 : bool bBlock : 1; // export text block?
60 : bool bShowProgress : 1;
61 : bool bSavedShowChanges : 1;
62 :
63 : SwDoc* doc; // cached for getDoc()
64 :
65 : void _InitItemExport();
66 : void _FinitItemExport();
67 : void ExportTableLinesAutoStyles( const SwTableLines& rLines,
68 : sal_uInt32 nAbsWidth,
69 : sal_uInt32 nBaseWidth,
70 : const OUString& rNamePrefix,
71 : SwXMLTableColumnsSortByWidth_Impl& rExpCols,
72 : SwXMLTableFrameFormatsSort_Impl& rExpRows,
73 : SwXMLTableFrameFormatsSort_Impl& rExpCells,
74 : SwXMLTableInfo_Impl& rTableInfo,
75 : bool bTop=false );
76 :
77 : void ExportFormat( const SwFormat& rFormat, enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
78 : void ExportTableFormat( const SwFrameFormat& rFormat, sal_uInt32 nAbsWidth );
79 :
80 : void ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol );
81 : void ExportTableBox( const SwTableBox& rBox, sal_uInt32 nColSpan, sal_uInt32 nRowSpan,
82 : SwXMLTableInfo_Impl& rTableInfo );
83 : void ExportTableLine( const SwTableLine& rLine,
84 : const SwXMLTableLines_Impl& rLines,
85 : SwXMLTableInfo_Impl& rTableInfo );
86 : void ExportTableLines( const SwTableLines& rLines,
87 : SwXMLTableInfo_Impl& rTableInfo,
88 : sal_uInt32 nHeaderRows = 0 );
89 :
90 : virtual void _ExportMeta() SAL_OVERRIDE;
91 : virtual void _ExportFontDecls() SAL_OVERRIDE;
92 : virtual void _ExportStyles( bool bUsed ) SAL_OVERRIDE;
93 : virtual void _ExportAutoStyles() SAL_OVERRIDE;
94 : virtual void _ExportMasterStyles() SAL_OVERRIDE;
95 : virtual void SetBodyAttributes() SAL_OVERRIDE;
96 : virtual void _ExportContent() SAL_OVERRIDE;
97 : virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps) SAL_OVERRIDE;
98 : virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps) SAL_OVERRIDE;
99 : virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings ) SAL_OVERRIDE;
100 :
101 : // string constants for table cell export
102 : const OUString sNumberFormat;
103 : const OUString sIsProtected;
104 : const OUString sCell;
105 :
106 : void setBlockMode();
107 : private:
108 : void DeleteTableLines();
109 : protected:
110 :
111 : virtual XMLTextParagraphExport* CreateTextParagraphExport() SAL_OVERRIDE;
112 : virtual SvXMLAutoStylePoolP* CreateAutoStylePool() SAL_OVERRIDE;
113 : virtual XMLPageExport* CreatePageExport() SAL_OVERRIDE;
114 : virtual XMLShapeExport* CreateShapeExport() SAL_OVERRIDE;
115 : virtual XMLFontAutoStylePool* CreateFontAutoStylePool() SAL_OVERRIDE;
116 :
117 : public:
118 : SwXMLExport(
119 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rContext,
120 : OUString const & implementationName, SvXMLExportFlags nExportFlags);
121 :
122 : virtual ~SwXMLExport();
123 :
124 : virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) SAL_OVERRIDE;
125 :
126 : inline const SvXMLUnitConverter& GetTwipUnitConverter() const;
127 :
128 : void ExportTableAutoStyles( const SwTableNode& rTableNd );
129 : void ExportTable( const SwTableNode& rTableNd );
130 :
131 116 : SvXMLExportItemMapper& GetTableItemMapper() { return *pTableItemMapper; }
132 : const rtl::Reference < XMLPropertySetMapper >& GetParaPropMapper()
133 : {
134 : return xParaPropMapper;
135 : }
136 :
137 335 : bool IsShowProgress() const { return bShowProgress; }
138 52 : void SetShowProgress( bool b ) { bShowProgress = b; }
139 68 : bool IsBlockMode() const { return bBlock; }
140 :
141 : // XUnoTunnel
142 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
143 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 :
145 : const SwDoc* getDoc() const;
146 : SwDoc* getDoc();
147 : };
148 :
149 121 : inline const SvXMLUnitConverter& SwXMLExport::GetTwipUnitConverter() const
150 : {
151 121 : return *pTwipUnitConv;
152 : }
153 :
154 : #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
155 :
156 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|