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 _XMLEXP_HXX
21 : #define _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 :
79 : void ExportFmt( const SwFmt& rFmt, enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
80 : void ExportTableFmt( const SwFrmFmt& rFmt, sal_uInt32 nAbsWidth );
81 :
82 : void ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol );
83 : void ExportTableBox( const SwTableBox& rBox, sal_uInt16 nColSpan, sal_uInt16 nRowSpan,
84 : SwXMLTableInfo_Impl& rTblInfo );
85 : void ExportTableLine( const SwTableLine& rLine,
86 : const SwXMLTableLines_Impl& rLines,
87 : SwXMLTableInfo_Impl& rTblInfo );
88 : void ExportTableLines( const SwTableLines& rLines,
89 : SwXMLTableInfo_Impl& rTblInfo,
90 : sal_uInt16 nHeaderRows = 0 );
91 :
92 : virtual void _ExportMeta();
93 : virtual void _ExportFontDecls();
94 : virtual void _ExportStyles( sal_Bool bUsed );
95 : virtual void _ExportAutoStyles();
96 : virtual void _ExportMasterStyles();
97 : virtual void SetBodyAttributes();
98 : virtual void _ExportContent();
99 : virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
100 : virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
101 : virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings );
102 :
103 : // string constants for table cell export
104 : const OUString sNumberFormat;
105 : const OUString sIsProtected;
106 : const OUString sCell;
107 :
108 : void setBlockMode();
109 : private:
110 : void DeleteTableLines();
111 : protected:
112 :
113 : virtual XMLTextParagraphExport* CreateTextParagraphExport();
114 : virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
115 : virtual XMLPageExport* CreatePageExport();
116 : virtual XMLShapeExport* CreateShapeExport();
117 : virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
118 :
119 : public:
120 : SwXMLExport(
121 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
122 : sal_uInt16 nExportFlags = EXPORT_ALL);
123 :
124 : virtual ~SwXMLExport();
125 :
126 : virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
127 :
128 : inline const SvXMLUnitConverter& GetTwipUnitConverter() const;
129 :
130 : void ExportTableAutoStyles( const SwTableNode& rTblNd );
131 : void ExportTable( const SwTableNode& rTblNd );
132 :
133 0 : SvXMLExportItemMapper& GetTableItemMapper() { return *pTableItemMapper; }
134 : const UniReference < XMLPropertySetMapper >& GetParaPropMapper()
135 : {
136 : return xParaPropMapper;
137 : }
138 :
139 31 : sal_Bool IsShowProgress() const { return bShowProgress; }
140 0 : void SetShowProgress( sal_Bool b ) { bShowProgress = b; }
141 15 : sal_Bool IsBlockMode() const { return bBlock; }
142 :
143 : // XUnoTunnel
144 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
145 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
146 :
147 : // XServiceInfo (override parent method)
148 : OUString SAL_CALL getImplementationName()
149 : throw( ::com::sun::star::uno::RuntimeException );
150 :
151 : const SwDoc* getDoc() const;
152 : SwDoc* getDoc();
153 : };
154 :
155 0 : inline const SvXMLUnitConverter& SwXMLExport::GetTwipUnitConverter() const
156 : {
157 0 : return *pTwipUnitConv;
158 : }
159 :
160 :
161 : #endif // _XMLEXP_HXX
162 :
163 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|