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/uniref.hxx>
26 : #include <xmloff/xmltoken.hxx>
27 : #include <vector>
28 :
29 : class SwDoc;
30 : class SwFmt;
31 : class SwFrmFmt;
32 : class SvXMLUnitConverter;
33 : class SvXMLExportItemMapper;
34 : class SvXMLAutoStylePoolP;
35 : class SwTableLine;
36 : class SwTableLines;
37 : class SwTableBox;
38 : class SwXMLTableColumn_Impl;
39 : class SwXMLTableLines_Impl;
40 : class SwXMLTableColumnsSortByWidth_Impl;
41 : class SwXMLTableFrmFmtsSort_Impl;
42 : class SwXMLTableInfo_Impl;
43 : class SwTableNode;
44 : class XMLPropertySetMapper;
45 : class SwXMLTableLines_Impl;
46 :
47 : typedef ::std::vector< SwXMLTableLines_Impl* > SwXMLTableLinesCache_Impl;
48 :
49 : class SwXMLExport : public SvXMLExport
50 : {
51 : SvXMLUnitConverter* pTwipUnitConv;
52 : SvXMLExportItemMapper* pTableItemMapper;
53 : SwXMLTableLinesCache_Impl* pTableLines;
54 :
55 : SvXMLItemMapEntriesRef xTableItemMap;
56 : SvXMLItemMapEntriesRef xTableRowItemMap;
57 : SvXMLItemMapEntriesRef xTableCellItemMap;
58 : UniReference < XMLPropertySetMapper > xParaPropMapper;
59 :
60 : sal_Bool bBlock : 1; // export text block?
61 : sal_Bool bShowProgress : 1;
62 : sal_Bool bSavedShowChanges : 1;
63 :
64 : SwDoc* doc; // 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 : const OUString& rNamePrefix,
72 : SwXMLTableColumnsSortByWidth_Impl& rExpCols,
73 : SwXMLTableFrmFmtsSort_Impl& rExpRows,
74 : SwXMLTableFrmFmtsSort_Impl& rExpCells,
75 : SwXMLTableInfo_Impl& rTblInfo,
76 : sal_Bool bTop=sal_False );
77 :
78 : void ExportFmt( const SwFmt& rFmt, enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
79 : void ExportTableFmt( const SwFrmFmt& rFmt, sal_uInt32 nAbsWidth );
80 :
81 : void ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol );
82 : void ExportTableBox( const SwTableBox& rBox, sal_uInt16 nColSpan, sal_uInt16 nRowSpan,
83 : SwXMLTableInfo_Impl& rTblInfo );
84 : void ExportTableLine( const SwTableLine& rLine,
85 : const SwXMLTableLines_Impl& rLines,
86 : SwXMLTableInfo_Impl& rTblInfo );
87 : void ExportTableLines( const SwTableLines& rLines,
88 : SwXMLTableInfo_Impl& rTblInfo,
89 : sal_uInt16 nHeaderRows = 0 );
90 :
91 : virtual void _ExportMeta() SAL_OVERRIDE;
92 : virtual void _ExportFontDecls() SAL_OVERRIDE;
93 : virtual void _ExportStyles( bool bUsed ) SAL_OVERRIDE;
94 : virtual void _ExportAutoStyles() SAL_OVERRIDE;
95 : virtual void _ExportMasterStyles() SAL_OVERRIDE;
96 : virtual void SetBodyAttributes() SAL_OVERRIDE;
97 : virtual void _ExportContent() SAL_OVERRIDE;
98 : virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps) SAL_OVERRIDE;
99 : virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps) SAL_OVERRIDE;
100 : virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings ) SAL_OVERRIDE;
101 :
102 : // string constants for table cell export
103 : const OUString sNumberFormat;
104 : const OUString sIsProtected;
105 : const OUString sCell;
106 :
107 : void setBlockMode();
108 : private:
109 : void DeleteTableLines();
110 : protected:
111 :
112 : virtual XMLTextParagraphExport* CreateTextParagraphExport() SAL_OVERRIDE;
113 : virtual SvXMLAutoStylePoolP* CreateAutoStylePool() SAL_OVERRIDE;
114 : virtual XMLPageExport* CreatePageExport() SAL_OVERRIDE;
115 : virtual XMLShapeExport* CreateShapeExport() SAL_OVERRIDE;
116 : virtual XMLFontAutoStylePool* CreateFontAutoStylePool() SAL_OVERRIDE;
117 :
118 : public:
119 : SwXMLExport(
120 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
121 : OUString const & implementationName, sal_uInt16 nExportFlags);
122 :
123 : virtual ~SwXMLExport();
124 :
125 : virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) SAL_OVERRIDE;
126 :
127 : inline const SvXMLUnitConverter& GetTwipUnitConverter() const;
128 :
129 : void ExportTableAutoStyles( const SwTableNode& rTblNd );
130 : void ExportTable( const SwTableNode& rTblNd );
131 :
132 0 : SvXMLExportItemMapper& GetTableItemMapper() { return *pTableItemMapper; }
133 : const UniReference < XMLPropertySetMapper >& GetParaPropMapper()
134 : {
135 : return xParaPropMapper;
136 : }
137 :
138 41 : sal_Bool IsShowProgress() const { return bShowProgress; }
139 0 : void SetShowProgress( sal_Bool b ) { bShowProgress = b; }
140 20 : sal_Bool IsBlockMode() const { return bBlock; }
141 :
142 : // XUnoTunnel
143 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
144 : 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;
145 :
146 : const SwDoc* getDoc() const;
147 : SwDoc* getDoc();
148 : };
149 :
150 0 : inline const SvXMLUnitConverter& SwXMLExport::GetTwipUnitConverter() const
151 : {
152 0 : return *pTwipUnitConv;
153 : }
154 :
155 : #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLEXP_HXX
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|