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