xref: /AOO41X/main/sw/source/filter/xml/xmlexp.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _XMLEXP_HXX
25 #define _XMLEXP_HXX
26 
27 #include <xmloff/xmlexp.hxx>
28 #include "xmlitmap.hxx"
29 #include <xmloff/uniref.hxx>
30 #include <xmloff/xmltoken.hxx>
31 
32 class SwPaM;
33 class SwFmt;
34 class SwFrmFmt;
35 class SvXMLUnitConverter;
36 class SvXMLExportItemMapper;
37 class SvXMLAutoStylePoolP;
38 class SwTableLine;
39 class SwTableLines;
40 class SwTableBox;
41 class SwXMLTableColumn_Impl;
42 class SwXMLTableLines_Impl;
43 class SwXMLTableLinesCache_Impl;
44 class SwXMLTableColumnsSortByWidth_Impl;
45 class SwXMLTableFrmFmtsSort_Impl;
46 class SwXMLTableInfo_Impl;
47 class SwTableNode;
48 class XMLPropertySetMapper;
49 
50 class SwXMLExport : public SvXMLExport
51 {
52     friend class SwXMLExpContext;
53 
54 #ifdef XML_CORE_API
55     SwPaM                       *pCurPaM;       // the current PaM
56     SwPaM                       *pOrigPaM;      // the original PaM
57 #endif
58 
59     SvXMLUnitConverter          *pTwipUnitConv;
60 
61     SvXMLExportItemMapper       *pTableItemMapper;
62     SwXMLTableLinesCache_Impl   *pTableLines;
63 
64     SvXMLItemMapEntriesRef      xTableItemMap;
65     SvXMLItemMapEntriesRef      xTableRowItemMap;
66     SvXMLItemMapEntriesRef      xTableCellItemMap;
67     UniReference < XMLPropertySetMapper > xParaPropMapper;
68 
69     sal_Bool                    bExportWholeDoc : 1;// export whole document?
70     sal_Bool                    bBlock : 1;         // export text block?
71     sal_Bool                    bExportFirstTableOnly : 1;
72     sal_Bool                    bShowProgress : 1;
73     sal_Bool                    bSavedShowChanges : 1;
74 
75     void _InitItemExport();
76     void _FinitItemExport();
77     void ExportTableLinesAutoStyles( const SwTableLines& rLines,
78                                  sal_uInt32 nAbsWidth,
79                                  sal_uInt32 nBaseWidth,
80                                  const ::rtl::OUString& rNamePrefix,
81                                  SwXMLTableColumnsSortByWidth_Impl& rExpCols,
82                                  SwXMLTableFrmFmtsSort_Impl& rExpRows,
83                                  SwXMLTableFrmFmtsSort_Impl& rExpCells,
84                                  SwXMLTableInfo_Impl& rTblInfo,
85                                  sal_Bool bTop=sal_False );
86 
87 
88     void ExportFmt( const SwFmt& rFmt,  enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
89     void ExportTableFmt( const SwFrmFmt& rFmt, sal_uInt32 nAbsWidth );
90 
91     void ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol );
92     void ExportTableBox( const SwTableBox& rBox, sal_uInt16 nColSpan, sal_uInt16 nRowSpan,
93                          SwXMLTableInfo_Impl& rTblInfo );
94     void ExportTableLine( const SwTableLine& rLine,
95                           const SwXMLTableLines_Impl& rLines,
96                           SwXMLTableInfo_Impl& rTblInfo );
97     void ExportTableLines( const SwTableLines& rLines,
98                            SwXMLTableInfo_Impl& rTblInfo,
99                            sal_uInt16 nHeaderRows = 0 );
100 
101     virtual void _ExportMeta();
102     virtual void _ExportFontDecls();
103     virtual void _ExportStyles( sal_Bool bUsed );
104     virtual void _ExportAutoStyles();
105     virtual void _ExportMasterStyles();
106     virtual void SetBodyAttributes();
107     virtual void _ExportContent();
108     virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
109     virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
110     virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings );
111 
112 #ifdef XML_CORE_API
113     void SetCurPaM( SwPaM& rPaM, sal_Bool bWhole, sal_Bool bTabOnly );
114 #endif
115 
116     // string constants for table cell export
117     const ::rtl::OUString sNumberFormat;
118     const ::rtl::OUString sIsProtected;
119     const ::rtl::OUString sCell;
120 
121     void setBlockMode();
122 
123 protected:
124 
125     virtual XMLTextParagraphExport* CreateTextParagraphExport();
126     virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
127     virtual XMLPageExport* CreatePageExport();
128     virtual XMLShapeExport* CreateShapeExport();
129     virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
130 
131 public:
132 
133     // #110680#
134     SwXMLExport(
135         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
136         sal_uInt16 nExportFlags = EXPORT_ALL);
137 
138 #ifdef XML_CORE_API
139     // #110680#
140     SwXMLExport(
141         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
142         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
143         SwPaM& rPaM,
144         const ::rtl::OUString& rFileName,
145         const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
146         const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > &,
147         sal_Bool bExpWholeDoc,
148         sal_Bool bExpFirstTableOnly,
149         sal_Bool bShowProgr );
150 #endif
151     virtual ~SwXMLExport();
152 
153     virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
154 
155     inline const SvXMLUnitConverter& GetTwipUnitConverter() const;
156 
157     void ExportTableAutoStyles( const SwTableNode& rTblNd );
158     void ExportTable( const SwTableNode& rTblNd );
159 
GetTableItemMapper()160     SvXMLExportItemMapper& GetTableItemMapper() { return *pTableItemMapper; }
GetParaPropMapper()161     const UniReference < XMLPropertySetMapper >& GetParaPropMapper()
162     {
163         return xParaPropMapper;
164     }
165 
IsShowProgress() const166     sal_Bool IsShowProgress() const { return bShowProgress; }
SetShowProgress(sal_Bool b)167     void SetShowProgress( sal_Bool b ) { bShowProgress = b; }
IsBlockMode() const168     sal_Bool IsBlockMode() const { return bBlock; }
169 
170     // XUnoTunnel
171     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
172     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
173 
174     // XServiceInfo (override parent method)
175     ::rtl::OUString SAL_CALL getImplementationName()
176         throw( ::com::sun::star::uno::RuntimeException );
177 };
178 
GetTwipUnitConverter() const179 inline const SvXMLUnitConverter& SwXMLExport::GetTwipUnitConverter() const
180 {
181     return *pTwipUnitConv;
182 }
183 
184 
185 #endif  //  _XMLEXP_HXX
186 
187