xref: /aoo41x/main/xmloff/inc/xmloff/xmlexp.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _XMLOFF_XMLEXP_HXX
29 #define _XMLOFF_XMLEXP_HXX
30 
31 #include "sal/config.h"
32 #include "xmloff/dllapi.h"
33 #include "sal/types.h"
34 
35 #include <com/sun/star/embed/XStorage.hpp>
36 #include <com/sun/star/xml/sax/SAXParseException.hpp>
37 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
38 #include <com/sun/star/xml/sax/SAXException.hpp>
39 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
40 #include <com/sun/star/xml/sax/XAttributeList.hpp>
41 #include <com/sun/star/xml/sax/XLocator.hpp>
42 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
43 #include <com/sun/star/lang/XUnoTunnel.hpp>
44 #include <rtl/ustring.hxx>
45 #include <tools/mapunit.hxx>
46 #include <xmloff/txtparae.hxx>
47 #include <xmloff/formlayerexport.hxx>
48 #include <xmloff/xmlnumfe.hxx>
49 #include <xmloff/xmlaustp.hxx>
50 #include <xmloff/shapeexport.hxx>
51 #include <xmloff/xmltoken.hxx>
52 #include <xmloff/SchXMLExportHelper.hxx>
53 #include <xmloff/XMLFontAutoStylePool.hxx>
54 #include <com/sun/star/document/XFilter.hpp>
55 #include <com/sun/star/lang/XServiceInfo.hpp>
56 #include <com/sun/star/document/XExporter.hpp>
57 #ifndef _COM_SUN_STAR_DRAWING_XGRAPHICOBJECTRESOLVER_HPP_
58 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
59 #endif
60 #ifndef _COM_SUN_STAR_DRAWING_XEMBEDDEDOBJECTRESOLVER_HPP_
61 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
62 #endif
63 #include <com/sun/star/beans/XPropertySet.hpp>
64 #include <com/sun/star/lang/XInitialization.hpp>
65 #include <com/sun/star/lang/XEventListener.hpp>
66 #include <com/sun/star/container/XNamed.hpp>
67 
68 #include <unotools/saveopt.hxx>
69 
70 #include <xmloff/XMLPageExport.hxx>
71 #include <xmloff/ProgressBarHelper.hxx>
72 #include <cppuhelper/implbase6.hxx>
73 
74 #include <list>
75 
76 class SvXMLNamespaceMap;
77 class SvXMLAttributeList;
78 class SvXMLExport_Impl;
79 class SvXMLUnitConverter;
80 class ProgressBarHelper;
81 class XMLEventExport;
82 class XMLSettingsExportHelper;
83 class XMLImageMapExport;
84 class XMLErrors;
85 
86 // --> OD 2006-03-14 #i51726#
87 #include <unotools/moduleoptions.hxx>
88 // <--
89 
90 namespace rtl { class OUString; }
91 namespace com { namespace sun { namespace star {
92 	namespace uno { class XComponentContext; }
93 	namespace frame { class XModel; }
94 	namespace container { class XIndexContainer; }
95 } } }
96 namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
97 
98 #define EXPORT_META                     0x0001
99 #define EXPORT_STYLES                   0x0002
100 #define EXPORT_MASTERSTYLES             0x0004
101 #define EXPORT_AUTOSTYLES               0x0008
102 #define EXPORT_CONTENT                  0x0010
103 #define EXPORT_SCRIPTS                  0x0020
104 #define EXPORT_SETTINGS                 0x0040
105 #define EXPORT_FONTDECLS                0x0080
106 #define EXPORT_EMBEDDED                 0x0100
107 #define EXPORT_NODOCTYPE                0x0200
108 #define EXPORT_PRETTY                   0x0400
109 #define EXPORT_SAVEBACKWARDCOMPATIBLE   0x0800
110 #define EXPORT_OASIS                    0x8000
111 #define EXPORT_ALL                      0x7fff
112 
113 class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6<
114 			 ::com::sun::star::document::XFilter,
115 			 ::com::sun::star::lang::XServiceInfo,
116 			 ::com::sun::star::document::XExporter,
117  			 ::com::sun::star::lang::XInitialization,
118              ::com::sun::star::container::XNamed,
119 			 ::com::sun::star::lang::XUnoTunnel>
120 {
121 	SvXMLExport_Impl			*mpImpl;			// dummy
122 
123 	// #110680#
124 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
125 
126 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
127 	::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > 			mxHandler;		// the handlers
128 	::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > 	mxExtHandler;
129 	::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
130 	::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver;
131 	::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
132 	::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mxStatusIndicator;
133 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxExportInfo;
134  	::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener;
135 
136 	SvXMLAttributeList			*mpAttrList;		// a common attribute list
137 	::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > 			mxAttrList;		// and an interface of it
138 
139 	::rtl::OUString		msOrigFileName;	// the original URL
140 	::rtl::OUString		msPicturesPath;
141 	::rtl::OUString		msGraphicObjectProtocol;
142 	::rtl::OUString		msEmbeddedObjectProtocol;
143 	::rtl::OUString		msObjectsPath;
144     ::rtl::OUString     msFilterName;
145 	SvXMLNamespaceMap			*mpNamespaceMap;	// the namepspace map
146 	SvXMLUnitConverter			*mpUnitConv;		// the unit converter
147 	SvXMLNumFmtExport			*mpNumExport;
148 	ProgressBarHelper			*mpProgressBarHelper;
149 
150 	UniReference< XMLTextParagraphExport > mxTextParagraphExport;
151 	UniReference< XMLShapeExport > mxShapeExport;
152 	UniReference< SvXMLAutoStylePoolP > mxAutoStylePool;
153 	UniReference< SchXMLExportHelper > mxChartExport;
154 	UniReference< XMLPageExport > mxPageExport;
155 	UniReference< XMLFontAutoStylePool > mxFontAutoStylePool;
156 	UniReference< xmloff::OFormLayerXMLExport > mxFormExport;
157 	XMLEventExport* mpEventExport;
158 	XMLImageMapExport* mpImageMapExport;
159 	XMLErrors*	mpXMLErrors;
160 
161 	sal_Bool						mbExtended;		// Does document contain extens.
162 
163 	const enum ::xmloff::token::XMLTokenEnum meClass;
164 	SAL_DLLPRIVATE void _InitCtor();
165 
166 	sal_uInt16	mnExportFlags;
167 	sal_uInt16	mnErrorFlags;
168 	bool  mbEnableExperimentalOdfExport;
169 
170 public:
171 
172 	const ::rtl::OUString				msWS;			// " "
173 
174 private:
175 
176     // --> OD 2006-03-10 #i51726#
177     SvtModuleOptions::EFactory meModelType;
178     SAL_DLLPRIVATE void _DetermineModelType();
179     // <--
180 
181 	SAL_DLLPRIVATE void ImplExportMeta(); // <office:meta>
182 	SAL_DLLPRIVATE void ImplExportSettings(); // <office:settings>
183 	SAL_DLLPRIVATE void ImplExportStyles( sal_Bool bUsed ); // <office:styles>
184 	SAL_DLLPRIVATE void ImplExportAutoStyles( sal_Bool bUsed );
185 	    // <office:automatic-styles>
186 	SAL_DLLPRIVATE void ImplExportMasterStyles( sal_Bool bUsed );
187         // <office:master-styles>
188 	SAL_DLLPRIVATE void ImplExportContent(); // <office:body>
189 	virtual void SetBodyAttributes();
190 	void GetViewSettingsAndViews(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
191 
192 protected:
193 	void setExportFlags( sal_uInt16 nExportFlags ) { mnExportFlags = nExportFlags; }
194 
195 	// Get (modifyable) namespace map
196 	SvXMLNamespaceMap& _GetNamespaceMap() { return *mpNamespaceMap; }
197 
198     // get a new namespave map (used in starmath to have a default namespace)
199     void ResetNamespaceMap();
200 
201 	// This method can be overloaded to export the content of <office:meta>.
202 	// There is a default implementation.
203 	virtual void _ExportMeta();
204 
205 	// This method can be overloaded to export the content of <office:scripts>.
206 	// There is a default implementation.
207 	virtual void _ExportScripts();
208 
209 	// This method can be overloaded to export the font declarations
210 	// The default implementation will export the contents of the
211 	// XMLFontAutoStylePool if it has been created.
212 	virtual void _ExportFontDecls();
213 
214 	// This method should be overloaded to export the content of <style:styles>.
215 	// If bUsed is set, used styles should be exported only.
216 	// Overloaded Methods must call this method !
217 	virtual void _ExportStyles( sal_Bool bUsed ) ;
218 
219 	// This method must be overloaded to export the contents of
220 	// <style:auto-styles>
221 	virtual void _ExportAutoStyles() = 0;
222 
223 	// This method must be overloaded to export the contents of
224 	// <style:master-styles>
225 	virtual void _ExportMasterStyles() = 0;
226 
227 	// This method must be overloaded to export the content of <office:body>.
228 	virtual void _ExportContent() = 0;
229 
230 	void SetExtended( sal_Bool bSet=sal_True ) { mbExtended = bSet; }
231 
232 	// save linked sections? (may be false in global documents)
233 	sal_Bool mbSaveLinkedSections;
234 
235 	virtual XMLTextParagraphExport* CreateTextParagraphExport();
236 	virtual XMLShapeExport* CreateShapeExport();
237 	virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
238 	virtual SchXMLExportHelper* CreateChartExport();
239 	virtual XMLPageExport* CreatePageExport();
240 	virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
241 	virtual xmloff::OFormLayerXMLExport* CreateFormExport();
242 	virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
243 	virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
244 
245     struct SettingsGroup
246     {
247         ::xmloff::token::XMLTokenEnum                                               eGroupName;
248         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >   aSettings;
249 
250         SettingsGroup()
251             :eGroupName( ::xmloff::token::XML_TOKEN_INVALID )
252             ,aSettings()
253         {
254         }
255 
256         SettingsGroup(
257                 const ::xmloff::token::XMLTokenEnum _eGroupName,
258                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rSettings )
259             :eGroupName( _eGroupName )
260             ,aSettings( _rSettings )
261         {
262         }
263     };
264     /** returns the current document settings
265 
266         The default implementation will obtain the view settings by calling GetViewSettingsAndViews, and the
267         configuration settings by calling GetConfigurationSettings, and return them together with the proper XML token.
268 
269         @return
270             the accumulated count of all settings in all groups
271     */
272     virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings );
273 
274 	const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
275 	inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
276 
277 	const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
278 	void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver );
279 
280 	void SetDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &rHandler );
281 
282 public:
283 
284 	// #110680#
285 	//SvXMLExport( MapUnit eDfltUnit,
286     //             const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID,
287     //             sal_uInt16 nExportFlag = EXPORT_ALL );
288 	SvXMLExport(
289 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
290 		MapUnit eDfltUnit,
291 		const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID,
292 		sal_uInt16 nExportFlag = EXPORT_ALL );
293 
294 	// #110680#
295 	//SvXMLExport( const ::rtl::OUString& rFileName,
296 	//			 const ::com::sun::star::uno::Reference<
297 	//			 	::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
298 	//		  	 MapUnit eDfltUnit = MAP_INCH );
299 	SvXMLExport(
300 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
301 		const ::rtl::OUString& rFileName,
302 		const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
303 		MapUnit eDfltUnit = MAP_INCH );
304 
305 	// #110680#
306 	//SvXMLExport( const ::rtl::OUString& rFileName,
307 	//			 const ::com::sun::star::uno::Reference<
308 	//			 	::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
309 	//			 const ::com::sun::star::uno::Reference<
310 	//				::com::sun::star::frame::XModel > &,
311 	//		  	 sal_Int16 eDfltUnit );
312 	SvXMLExport(
313 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
314 		const ::rtl::OUString& rFileName,
315 		const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
316 		const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
317 		sal_Int16 eDfltUnit );
318 
319 	// #110680#
320 	//SvXMLExport( const ::rtl::OUString& rFileName,
321 	//			 const ::com::sun::star::uno::Reference<
322 	//			 	::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
323 	//			 const ::com::sun::star::uno::Reference<
324 	//				::com::sun::star::frame::XModel > &,
325 	//			 const ::com::sun::star::uno::Reference<
326 	//				::com::sun::star::document::XGraphicObjectResolver > &,
327 	//		  	 sal_Int16 eDfltUnit );
328 	SvXMLExport(
329 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
330 		const ::rtl::OUString& rFileName,
331 		const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
332 		const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
333 		const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > &,
334 		sal_Int16 eDfltUnit );
335 
336 	virtual ~SvXMLExport();
337 
338 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
339 	static SvXMLExport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
340 
341 	// XExporter
342 	virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
343 
344 	// XFilter
345     virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw(::com::sun::star::uno::RuntimeException);
346     virtual void SAL_CALL cancel() throw(::com::sun::star::uno::RuntimeException);
347 
348 	// XInitialization
349     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
350 
351     // XNamed
352     virtual ::rtl::OUString SAL_CALL getName(  ) throw (::com::sun::star::uno::RuntimeException);
353     virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
354 
355 	// XServiceInfo
356     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
357     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
358     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
359 
360 	// XUnoTunnel
361     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
362 
363     /** ensures that the given namespace is in scope at the next started
364         element.
365 
366         <p>If the namespace is not yet declared, the necessary attribute will
367         be added, as well.</p>
368 
369         @param i_rNamespace         the namespace to be declared
370         @param i_rPreferredPrefix   (opt.) preferred prefix for the namespace
371 
372         @returns the actual prefix that the namespace is associated with
373       */
374     ::rtl::OUString
375     EnsureNamespace(::rtl::OUString const & i_rNamespace,
376         ::rtl::OUString const & i_rPreferredPrefix
377         = ::rtl::OUString::createFromAscii("gen") );
378 
379 	// Check if common attribute list is empty.
380 #ifndef DBG_UTIL
381 	void CheckAttrList() {}
382 #else
383 	void CheckAttrList();
384 #endif
385 
386 	// Clear common attribute list.
387 	void ClearAttrList();
388 
389 	// Add an attribute to the common attribute list.
390 	void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName,
391 							const sal_Char *pValue );
392 	void AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName,
393 					   const ::rtl::OUString& rValue );
394 	void AddAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rName,
395 					   const ::rtl::OUString& rValue );
396 	void AddAttribute( sal_uInt16 nPrefix,
397                        enum ::xmloff::token::XMLTokenEnum eName,
398 					   const ::rtl::OUString& rValue );
399 	void AddAttribute( sal_uInt16 nPrefix,
400                        enum ::xmloff::token::XMLTokenEnum eName,
401 					   enum ::xmloff::token::XMLTokenEnum eValue );
402     void AddAttribute( const ::rtl::OUString& rQName,
403                        const ::rtl::OUString& rValue );
404     void AddAttribute( const ::rtl::OUString& rQName,
405                        enum ::xmloff::token::XMLTokenEnum eValue );
406     // add several attributes to the common attribute list
407 	void AddAttributeList( const ::com::sun::star::uno::Reference<
408 						   	   ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
409 
410 	// Get common attribute list as implementation or interface.
411 	SvXMLAttributeList &GetAttrList() { return *mpAttrList; }
412 	const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & GetXAttrList() { return mxAttrList; }
413 
414 	// Get document handler. This methods are not const, because the
415 	// reference allowes modifications through the handler.
416 	const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & GetDocHandler() { return mxHandler; }
417 	const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > & GetExtDocHandler()
418 	{
419 		return mxExtHandler;
420 	}
421 
422 	// Get original ::com::sun::star::util::URL.
423 	const ::rtl::OUString& GetOrigFileName() const { return msOrigFileName; }
424 
425 	// Get the relative path for embedded pictures
426 	const ::rtl::OUString& GetPicturesPath() const { return msPicturesPath; }
427 
428 	// Get the relative path for embedded objects
429 	const ::rtl::OUString& GetObjectsPath() const { return msObjectsPath; }
430 
431 	// Get (const) namespace map.
432 	const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
433 
434 	// Get unit converter
435 	const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
436 
437 	SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
438 
439 	// Export the document.
440 	virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
441 
442 	virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
443 	virtual void exportDataStyles();
444 	virtual void exportAutoDataStyles();
445 	virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
446     sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const;
447 
448     virtual void exportAnnotationMeta( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape);
449 
450 	// Get XModel
451 	const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
452 	   		GetModel() const { return mxModel; }
453 	// Get XNumberFormatsSupplier
454 	::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; }
455 	inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
456 	{
457 		mxNumberFormatsSupplier = _xNumberFormatSupplier;
458 		if ( mxNumberFormatsSupplier.is() && mxHandler.is() )
459 			mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
460 	}
461 
462 	// get export helper for text
463 	inline UniReference< XMLTextParagraphExport > GetTextParagraphExport();
464 
465 	// get export helper for shapes
466 	inline UniReference< XMLShapeExport > GetShapeExport();
467 
468 	// get auto style pool
469 	inline UniReference< SvXMLAutoStylePoolP > GetAutoStylePool();
470 
471 	// get Page Export
472 	inline UniReference< XMLPageExport > GetPageExport();
473 
474 	// get chart export helper
475 	inline UniReference< SchXMLExportHelper > GetChartExport();
476 
477 	// get font auto style pool
478 	inline UniReference< XMLFontAutoStylePool > GetFontAutoStylePool();
479 
480 	ProgressBarHelper*	GetProgressBarHelper();
481 
482 	// get Formlayer Export
483 	inline UniReference< xmloff::OFormLayerXMLExport > GetFormExport();
484 	inline bool HasFormExport();
485 
486 	// get XPropertySet with export information
487 	inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getExportInfo() const { return mxExportInfo; }
488 
489 	com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > GetStatusIndicator() { return mxStatusIndicator; }
490 
491 	/// get Event export, with handlers for script types "None" and
492 	/// "StarBasic" already registered; other handlers may be registered, too.
493 	XMLEventExport& GetEventExport();
494 
495 	/// get the export for image maps
496 	XMLImageMapExport& GetImageMapExport();
497 
498 	::rtl::OUString AddEmbeddedGraphicObject(
499 							const ::rtl::OUString& rGraphicObjectURL );
500     sal_Bool AddEmbeddedGraphicObjectAsBase64(
501                             const ::rtl::OUString& rGraphicObjectURL );
502 
503     ::rtl::OUString AddEmbeddedObject(
504 							const ::rtl::OUString& rEmbeddedObjectURL );
505 	sal_Bool AddEmbeddedObjectAsBase64(
506 							const ::rtl::OUString& rEmbeddedObjectURL );
507 
508 	::rtl::OUString EncodeStyleName( const ::rtl::OUString& rName,
509 									 sal_Bool *pEncoded=0 ) const;
510 
511 	// save linked sections?
512 	inline sal_Bool IsSaveLinkedSections() { return mbSaveLinkedSections; }
513 
514 	// get export flags
515 	sal_uInt16 getExportFlags() const { return mnExportFlags; }
516 
517 	sal_Bool ExportEmbeddedOwnObject(
518 		::com::sun::star::uno::Reference<
519 			::com::sun::star::lang::XComponent >& rComp );
520 
521 	rtl::OUString GetRelativeReference(const rtl::OUString& rValue);
522 
523     // methods for accessing the document handler and handling SAX errors
524 	void StartElement(sal_uInt16 nPrefix,
525                         enum ::xmloff::token::XMLTokenEnum eName,
526 					    sal_Bool bIgnWSOutside );
527 	void StartElement(const ::rtl::OUString& rName,
528 					    sal_Bool bIgnWSOutside );
529 	void Characters(const ::rtl::OUString& rChars);
530 	void EndElement(sal_uInt16 nPrefix,
531 						enum ::xmloff::token::XMLTokenEnum eName,
532 						sal_Bool bIgnWSInside );
533 	void EndElement(const ::rtl::OUString& rName,
534 						sal_Bool bIgnWSInside );
535     void IgnorableWhitespace();
536 
537     /**
538      * Record an error condition that occured during export. The
539      * behavior of SetError can be modified using the error flag
540      * constants.
541      */
542 	void SetError(
543         /// error ID, may contain an error flag
544         sal_Int32 nId,
545         /// string parameters for the error message
546         const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams,
547         /// original exception message (if applicable)
548         const ::rtl::OUString& rExceptionMessage,
549         /// error location (if applicable)
550         const ::com::sun::star::uno::Reference<
551             ::com::sun::star::xml::sax::XLocator> & rLocator );
552 
553 	void SetError(
554         sal_Int32 nId,
555         const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams);
556 
557     /** return list of errors */
558 	XMLErrors* GetErrors();
559 
560     /** return current error flags (logical 'or' of all error flags so far) */
561 	sal_uInt16 GetErrorFlags()  { return mnErrorFlags; }
562 
563     virtual void DisposingModel();
564 
565 	::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
566 
567 	// #110680#
568 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
569 
570     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
571     GetComponentContext() const;
572 
573     // --> OD 2006-03-10 #i51726#
574     SvtModuleOptions::EFactory GetModelType() const
575     {
576         return meModelType;
577     }
578     // <--
579 
580     // --> OD 2006-09-27 #i69627#
581     sal_Bool writeOutlineStyleAsNormalListStyle() const;
582     // <--
583    	bool isExperimentalOdfExportEnabled() const { return mbEnableExperimentalOdfExport; }
584 
585 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetTargetStorage();
586 
587 	/// returns the currently configured default version for odf export
588 	SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
589 
590     /// name of stream in package, e.g., "content.xml"
591     ::rtl::OUString GetStreamName() const;
592 
593     // FIXME: this is only for legacy stuff that has not yet been adapted
594     //        to implement XMetadatable; this can write duplicate IDs!
595     /// add xml:id and legacy namespace id
596     void SAL_DLLPRIVATE AddAttributeIdLegacy(
597             sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue);
598 
599     /// add xml:id attribute (for RDF metadata)
600     void AddAttributeXmlId(::com::sun::star::uno::Reference<
601             ::com::sun::star::uno::XInterface> const & i_xIfc);
602 
603     /// add RDFa attributes for a metadatable text content
604     void AddAttributesRDFa( ::com::sun::star::uno::Reference<
605         ::com::sun::star::text::XTextContent> const & i_xTextContent);
606 
607     // --> OD 2008-11-26 #158694#
608     sal_Bool exportTextNumberElement() const;
609     // <--
610 
611     /// set null date from model to unit converter, if not already done
612     sal_Bool SetNullDateOnUnitConverter();
613 };
614 
615 inline UniReference< XMLTextParagraphExport > SvXMLExport::GetTextParagraphExport()
616 {
617 	if( !mxTextParagraphExport.is() )
618 		mxTextParagraphExport = CreateTextParagraphExport();
619 
620 	return mxTextParagraphExport;
621 }
622 
623 inline UniReference< XMLShapeExport > SvXMLExport::GetShapeExport()
624 {
625 	if( !mxShapeExport.is() )
626 		mxShapeExport = CreateShapeExport();
627 
628 	return mxShapeExport;
629 }
630 
631 inline UniReference< SvXMLAutoStylePoolP > SvXMLExport::GetAutoStylePool()
632 {
633 	if( !mxAutoStylePool.is() )
634 		mxAutoStylePool = CreateAutoStylePool();
635 
636 	return mxAutoStylePool;
637 }
638 
639 inline UniReference< SchXMLExportHelper > SvXMLExport::GetChartExport()
640 {
641 	if( !mxChartExport.is() )
642 		mxChartExport = CreateChartExport();
643 
644 	return mxChartExport;
645 }
646 
647 inline UniReference< XMLPageExport > SvXMLExport::GetPageExport()
648 {
649 	if( !mxPageExport.is() )
650 		mxPageExport = CreatePageExport();
651 
652 	return mxPageExport;
653 }
654 
655 inline UniReference< XMLFontAutoStylePool > SvXMLExport::GetFontAutoStylePool()
656 {
657 	if( !mxFontAutoStylePool.is() )
658 		mxFontAutoStylePool = CreateFontAutoStylePool();
659 
660 	return mxFontAutoStylePool;
661 }
662 
663 inline UniReference< xmloff::OFormLayerXMLExport > SvXMLExport::GetFormExport()
664 {
665 	if( !mxFormExport.is() )
666 		mxFormExport = CreateFormExport();
667 
668 	return mxFormExport;
669 }
670 
671 inline bool SvXMLExport::HasFormExport()
672 {
673 	return mxFormExport.is();
674 }
675 
676 inline void SvXMLExport::SetEmbeddedResolver(
677 	com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
678 {
679 	mxEmbeddedResolver = _xEmbeddedResolver;
680 }
681 
682 inline void SvXMLExport::SetGraphicResolver(
683 	com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
684 {
685 	mxGraphicResolver = _xGraphicResolver;
686 }
687 
688 // Helper class to export an element.
689 class XMLOFF_DLLPUBLIC SvXMLElementExport
690 {
691 	SvXMLExport& rExport;
692 	::rtl::OUString aName;
693 	sal_Bool bIgnWS : 1;
694 	sal_Bool bDoSomething : 1;
695 
696 	SAL_DLLPRIVATE void StartElement( SvXMLExport& rExp, sal_uInt16 nPrefix,
697 					   const ::rtl::OUString& rName,
698 					   sal_Bool bIgnWSOutside );
699 
700 public:
701 
702 	// The constructor prints a start tag that has the common attributes
703 	// of the XMLExport instance attached.
704 	SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
705 						const sal_Char *pName,
706 					    sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
707 	SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
708             			const ::rtl::OUString& rName,
709 					    sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
710 	SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
711                         enum ::xmloff::token::XMLTokenEnum eName,
712 					    sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
713     SvXMLElementExport( SvXMLExport& rExp, const ::rtl::OUString& rQName,
714                         sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
715 
716 	// Thes constructors do nothing if bDoSomething is not set
717 	SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething,
718 						sal_uInt16 nPrefix, const sal_Char *pName,
719 					    sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
720 	SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething,
721 						sal_uInt16 nPrefix, const ::rtl::OUString& rName,
722 					    sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
723 	SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething,
724                         sal_uInt16 nPrefix,
725                         enum ::xmloff::token::XMLTokenEnum eName,
726 					    sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
727 
728 	// The destructor prints an end tag.
729 	~SvXMLElementExport();
730 };
731 
732 #endif	//  _XMLOFF_SVXMLEXP_HXX
733 
734