Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / xmloff / xmlexp.hxx
blobcb134c747193e0300f5f8f14f257990499a32c58
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_XMLOFF_XMLEXP_HXX
21 #define INCLUDED_XMLOFF_XMLEXP_HXX
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <sal/types.h>
27 #include <com/sun/star/embed/XStorage.hpp>
28 #include <com/sun/star/xml/sax/SAXParseException.hpp>
29 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
30 #include <com/sun/star/xml/sax/SAXException.hpp>
31 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
32 #include <com/sun/star/xml/sax/XAttributeList.hpp>
33 #include <com/sun/star/xml/sax/XLocator.hpp>
34 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
35 #include <com/sun/star/lang/XUnoTunnel.hpp>
36 #include <rtl/ustring.hxx>
37 #include <xmloff/txtparae.hxx>
38 #include <xmloff/formlayerexport.hxx>
39 #include <xmloff/xmlnumfe.hxx>
40 #include <xmloff/xmlaustp.hxx>
41 #include <xmloff/shapeexport.hxx>
42 #include <xmloff/xmltoken.hxx>
43 #include <xmloff/SchXMLExportHelper.hxx>
44 #include <xmloff/XMLFontAutoStylePool.hxx>
45 #include <xmloff/xmluconv.hxx>
46 #include <com/sun/star/document/XFilter.hpp>
47 #include <com/sun/star/lang/XServiceInfo.hpp>
48 #include <com/sun/star/document/XExporter.hpp>
49 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
50 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
51 #include <com/sun/star/beans/XPropertySet.hpp>
52 #include <com/sun/star/lang/XInitialization.hpp>
53 #include <com/sun/star/lang/XEventListener.hpp>
54 #include <com/sun/star/uno/XComponentContext.hpp>
55 #include <com/sun/star/container/XNamed.hpp>
57 #include <unotools/saveopt.hxx>
59 #include <xmloff/XMLPageExport.hxx>
60 #include <xmloff/ProgressBarHelper.hxx>
61 #include <cppuhelper/implbase.hxx>
62 #include <tools/fldunit.hxx>
64 #include <list>
65 #include <memory>
66 #include <o3tl/typed_flags_set.hxx>
68 class SvXMLNamespaceMap;
69 class SvXMLAttributeList;
70 class SvXMLExport_Impl;
71 class SvXMLUnitConverter;
72 class ProgressBarHelper;
73 class XMLEventExport;
74 class XMLSettingsExportHelper;
75 class XMLImageMapExport;
76 class XMLErrors;
77 class LanguageTag;
78 enum class SvXMLErrorFlags;
80 // Shapes in Writer cannot be named via context menu (#i51726#)
81 #include <unotools/moduleoptions.hxx>
83 namespace com { namespace sun { namespace star {
84 namespace frame { class XModel; }
85 namespace container { class XIndexContainer; }
86 namespace lang { struct Locale; }
87 } } }
88 namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
90 enum class SvXMLExportFlags {
91 NONE = 0,
92 META = 0x0001,
93 STYLES = 0x0002,
94 MASTERSTYLES = 0x0004,
95 AUTOSTYLES = 0x0008,
96 CONTENT = 0x0010,
97 SCRIPTS = 0x0020,
98 SETTINGS = 0x0040,
99 FONTDECLS = 0x0080,
100 EMBEDDED = 0x0100,
101 PRETTY = 0x0400,
102 SAVEBACKWARDCOMPATIBLE = 0x0800,
103 OASIS = 0x8000,
104 ALL = 0x0dff
106 namespace o3tl
108 template<> struct typed_flags<SvXMLExportFlags> : is_typed_flags<SvXMLExportFlags, 0x8dff> {};
111 class XMLOFF_DLLPUBLIC SvXMLExport : public cppu::WeakImplHelper<
112 css::document::XFilter,
113 css::lang::XServiceInfo,
114 css::document::XExporter,
115 css::lang::XInitialization,
116 css::container::XNamed,
117 css::lang::XUnoTunnel>
119 std::unique_ptr<SvXMLExport_Impl> mpImpl; // dummy
121 css::uno::Reference< css::uno::XComponentContext > m_xContext;
122 OUString m_implementationName;
124 css::uno::Reference< css::frame::XModel > mxModel;
125 css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler; // the handlers
126 css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > mxExtHandler;
127 css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
128 css::uno::Reference< css::document::XGraphicObjectResolver > mxGraphicResolver;
129 css::uno::Reference< css::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
130 css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
131 css::uno::Reference< css::beans::XPropertySet > mxExportInfo;
132 css::uno::Reference< css::lang::XEventListener > mxEventListener;
134 rtl::Reference<SvXMLAttributeList> mxAttrList; // a common attribute list
136 OUString msOrigFileName; // the original URL
137 OUString msGraphicObjectProtocol;
138 OUString msEmbeddedObjectProtocol;
139 OUString msFilterName;
140 SvXMLNamespaceMap *mpNamespaceMap; // the namepspace map
141 SvXMLUnitConverter maUnitConv; // the unit converter
142 SvXMLNumFmtExport *mpNumExport;
143 ProgressBarHelper *mpProgressBarHelper;
145 rtl::Reference< XMLTextParagraphExport > mxTextParagraphExport;
146 rtl::Reference< XMLShapeExport > mxShapeExport;
147 rtl::Reference< SvXMLAutoStylePoolP > mxAutoStylePool;
148 rtl::Reference< SchXMLExportHelper > mxChartExport;
149 rtl::Reference< XMLPageExport > mxPageExport;
150 rtl::Reference< XMLFontAutoStylePool > mxFontAutoStylePool;
151 rtl::Reference< xmloff::OFormLayerXMLExport > mxFormExport;
152 XMLEventExport* mpEventExport;
153 XMLImageMapExport* mpImageMapExport;
154 XMLErrors* mpXMLErrors;
156 const enum ::xmloff::token::XMLTokenEnum meClass;
157 SAL_DLLPRIVATE void InitCtor_();
159 SvXMLExportFlags mnExportFlags;
160 SvXMLErrorFlags mnErrorFlags;
162 const OUString msWS; // " "
164 // Shapes in Writer cannot be named via context menu (#i51726#)
165 SvtModuleOptions::EFactory meModelType;
166 SAL_DLLPRIVATE void DetermineModelType_();
168 SAL_DLLPRIVATE void ImplExportMeta(); // <office:meta>
169 SAL_DLLPRIVATE void ImplExportSettings(); // <office:settings>
170 SAL_DLLPRIVATE void ImplExportStyles(); // <office:styles>
171 SAL_DLLPRIVATE void ImplExportAutoStyles();
172 // <office:automatic-styles>
173 SAL_DLLPRIVATE void ImplExportMasterStyles();
174 // <office:master-styles>
175 SAL_DLLPRIVATE void ImplExportContent(); // <office:body>
176 virtual void SetBodyAttributes();
177 void GetViewSettingsAndViews(css::uno::Sequence<css::beans::PropertyValue>& rProps);
179 protected:
180 void setExportFlags( SvXMLExportFlags nExportFlags ) { mnExportFlags = nExportFlags; }
182 // Get (modifyable) namespace map
183 SvXMLNamespaceMap& GetNamespaceMap_() { return *mpNamespaceMap; }
185 // get a new namespave map (used in starmath to have a default namespace)
186 void ResetNamespaceMap();
188 /// Override this method to export the content of <office:meta>.
189 /// There is a default implementation.
190 virtual void ExportMeta_();
192 /// Override this method to export the content of <office:scripts>.
193 /// There is a default implementation.
194 virtual void ExportScripts_();
196 /// Override this method to export the font declarations
197 /// The default implementation will export the contents of the
198 /// XMLFontAutoStylePool if it has been created.
199 virtual void ExportFontDecls_();
201 /// Override this method to export the content of <style:styles>.
202 /// If bUsed is set, used styles should be exported only.
203 /// Overriding Methods must call this method !
204 virtual void ExportStyles_( bool bUsed );
206 /// Override this method to export the contents of <style:auto-styles>.
207 virtual void ExportAutoStyles_() = 0;
209 /// Override this method to export the contents of <style:master-styles>.
210 virtual void ExportMasterStyles_() = 0;
212 /// Override this method to export the content of <office:body>.
213 virtual void ExportContent_() = 0;
215 OUString GetSourceShellID() const;
216 OUString GetDestinationShellID() const;
218 // save linked sections? (may be false in global documents)
219 bool mbSaveLinkedSections;
221 virtual XMLTextParagraphExport* CreateTextParagraphExport();
222 virtual XMLShapeExport* CreateShapeExport();
223 virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
224 SchXMLExportHelper* CreateChartExport();
225 virtual XMLPageExport* CreatePageExport();
226 virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
227 xmloff::OFormLayerXMLExport* CreateFormExport();
228 virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps);
229 virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps);
231 struct SettingsGroup
233 ::xmloff::token::XMLTokenEnum eGroupName;
234 css::uno::Sequence< css::beans::PropertyValue > aSettings;
236 SettingsGroup(
237 const ::xmloff::token::XMLTokenEnum _eGroupName,
238 const css::uno::Sequence< css::beans::PropertyValue >& _rSettings )
239 :eGroupName( _eGroupName )
240 ,aSettings( _rSettings )
244 /** returns the current document settings
246 The default implementation will obtain the view settings by calling GetViewSettingsAndViews, and the
247 configuration settings by calling GetConfigurationSettings, and return them together with the proper XML token.
249 @return
250 the accumulated count of all settings in all groups
252 virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings );
254 const css::uno::Reference< css::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
255 inline void SetEmbeddedResolver( css::uno::Reference< css::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
257 const css::uno::Reference< css::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
258 void SetGraphicResolver( css::uno::Reference< css::document::XGraphicObjectResolver >& _xGraphicResolver );
260 void SetDocHandler( const css::uno::Reference< css::xml::sax::XDocumentHandler > &rHandler );
262 public:
264 SvXMLExport(
265 sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
266 const css::uno::Reference< css::uno::XComponentContext >& xContext,
267 OUString const & implementationName,
268 const enum ::xmloff::token::XMLTokenEnum eClass,
269 SvXMLExportFlags nExportFlag );
271 SvXMLExport(
272 const css::uno::Reference< css::uno::XComponentContext >& xContext,
273 OUString const & implementationName,
274 const OUString& rFileName,
275 sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
276 const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler);
278 SvXMLExport(
279 const css::uno::Reference< css::uno::XComponentContext >& xContext,
280 OUString const & implementationName,
281 const OUString& rFileName,
282 const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler,
283 const css::uno::Reference< css::frame::XModel > &,
284 FieldUnit const eDefaultFieldUnit );
286 virtual ~SvXMLExport() override;
288 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
289 static SvXMLExport* getImplementation( const css::uno::Reference< css::uno::XInterface >& ) throw();
291 // XExporter
292 virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
294 // XFilter
295 virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
296 virtual void SAL_CALL cancel() override;
298 // XInitialization
299 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
301 // XNamed
302 virtual OUString SAL_CALL getName( ) override;
303 virtual void SAL_CALL setName( const OUString& aName ) override;
305 // XServiceInfo
306 virtual OUString SAL_CALL getImplementationName( ) final override;
307 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override;
308 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) final override;
310 // XUnoTunnel
311 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
313 /** ensures that the given namespace is in scope at the next started
314 element.
316 <p>If the namespace is not yet declared, the necessary attribute will
317 be added, as well.</p>
319 @param i_rNamespace the namespace to be declared
321 @returns the actual prefix that the namespace is associated with
323 OUString EnsureNamespace(OUString const & i_rNamespace );
325 // Check if common attribute list is empty.
326 #ifndef DBG_UTIL
327 void CheckAttrList() { (void) this; /* avoid loplugin:staticmethods */ }
328 #else
329 void CheckAttrList();
330 #endif
332 // Clear common attribute list.
333 void ClearAttrList();
335 // Add an attribute to the common attribute list.
336 void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName,
337 const sal_Char *pValue );
338 void AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName,
339 const OUString& rValue );
340 void AddAttribute( sal_uInt16 nPrefix, const OUString& rName,
341 const OUString& rValue );
342 void AddAttribute( sal_uInt16 nPrefix,
343 enum ::xmloff::token::XMLTokenEnum eName,
344 const OUString& rValue );
345 void AddAttribute( sal_uInt16 nPrefix,
346 enum ::xmloff::token::XMLTokenEnum eName,
347 enum ::xmloff::token::XMLTokenEnum eValue );
348 void AddAttribute( const OUString& rQName,
349 const OUString& rValue );
350 void AddAttribute( const OUString& rQName,
351 enum ::xmloff::token::XMLTokenEnum eValue );
353 /** Add language tag attributes, deciding which are necessary.
355 @param nPrefix
356 Namespace prefix for *:language, *:script and *:country
358 @param nPrefixRfc
359 Namespace prefix for *:rfc-language-tag
361 @param bWriteEmpty
362 Whether to write empty *:language and *:country attribute
363 values in case of an empty locale (denoting system).
365 void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc,
366 const css::lang::Locale& rLocale, bool bWriteEmpty);
368 /** Same as AddLanguageTagAttributes() but with LanguageTag parameter
369 instead of Locale.
371 void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc,
372 const LanguageTag& rLanguageTag, bool bWriteEmpty );
374 // add several attributes to the common attribute list
375 void AddAttributeList( const css::uno::Reference<
376 css::xml::sax::XAttributeList >& xAttrList );
378 // Get common attribute list as implementation or interface.
379 SvXMLAttributeList &GetAttrList() { return *mxAttrList.get(); }
380 css::uno::Reference< css::xml::sax::XAttributeList > GetXAttrList() { return mxAttrList.get(); }
382 // Get document handler. This methods are not const, because the
383 // reference allowes modifications through the handler.
384 const css::uno::Reference< css::xml::sax::XDocumentHandler > & GetDocHandler() { return mxHandler; }
386 // Get original URL.
387 const OUString& GetOrigFileName() const { return msOrigFileName; }
389 // Get (const) namespace map.
390 const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
392 // Get unit converter
393 const SvXMLUnitConverter& GetMM100UnitConverter() const { return maUnitConv; }
395 SvXMLUnitConverter& GetMM100UnitConverter() { return maUnitConv; }
397 void addChaffWhenEncryptedStorage();
399 // Export the document.
400 virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
402 virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat = false );
403 virtual void exportDataStyles();
404 virtual void exportAutoDataStyles();
405 virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) const;
406 sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const;
408 virtual void exportAnnotationMeta( const css::uno::Reference < css::drawing::XShape >& xShape);
410 // Get XModel
411 const css::uno::Reference< css::frame::XModel > &
412 GetModel() const { return mxModel; }
413 // Get XNumberFormatsSupplier
414 css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; }
415 void SetNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
417 mxNumberFormatsSupplier = _xNumberFormatSupplier;
418 if ( mxNumberFormatsSupplier.is() && mxHandler.is() )
419 mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
422 // get export helper for text
423 inline rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport();
425 // get export helper for shapes
426 inline rtl::Reference< XMLShapeExport > const & GetShapeExport();
428 // get auto style pool
429 inline rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool();
431 // get Page Export
432 inline rtl::Reference< XMLPageExport > const & GetPageExport();
434 // get chart export helper
435 inline rtl::Reference< SchXMLExportHelper > const & GetChartExport();
437 // get font auto style pool
438 inline rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool();
440 ProgressBarHelper* GetProgressBarHelper();
442 // get Formlayer Export
443 inline rtl::Reference< xmloff::OFormLayerXMLExport > const & GetFormExport();
444 inline bool HasFormExport();
446 // get XPropertySet with export information
447 const css::uno::Reference< css::beans::XPropertySet >& getExportInfo() const { return mxExportInfo; }
449 const css::uno::Reference< css::task::XStatusIndicator >& GetStatusIndicator() { return mxStatusIndicator; }
451 /// get Event export, with handlers for script types "None" and
452 /// "StarBasic" already registered; other handlers may be registered, too.
453 XMLEventExport& GetEventExport();
455 /// get the export for image maps
456 XMLImageMapExport& GetImageMapExport();
458 OUString AddEmbeddedGraphicObject(
459 const OUString& rGraphicObjectURL );
460 bool AddEmbeddedGraphicObjectAsBase64(
461 const OUString& rGraphicObjectURL );
463 OUString AddEmbeddedObject(
464 const OUString& rEmbeddedObjectURL );
465 bool AddEmbeddedObjectAsBase64(
466 const OUString& rEmbeddedObjectURL );
468 OUString EncodeStyleName( const OUString& rName,
469 bool *pEncoded=nullptr ) const;
471 // save linked sections?
472 bool IsSaveLinkedSections() { return mbSaveLinkedSections; }
474 // get export flags
475 SvXMLExportFlags getExportFlags() const { return mnExportFlags; }
477 void ExportEmbeddedOwnObject(
478 css::uno::Reference<css::lang::XComponent >& rComp );
480 OUString GetRelativeReference(const OUString& rValue);
482 // methods for accessing the document handler and handling SAX errors
483 void StartElement(sal_uInt16 nPrefix,
484 enum ::xmloff::token::XMLTokenEnum eName,
485 bool bIgnWSOutside );
486 void StartElement(const OUString& rName,
487 bool bIgnWSOutside );
488 void Characters(const OUString& rChars);
489 void EndElement(sal_uInt16 nPrefix,
490 enum ::xmloff::token::XMLTokenEnum eName,
491 bool bIgnWSInside );
492 void EndElement(const OUString& rName,
493 bool bIgnWSInside );
494 void IgnorableWhitespace();
497 * Record an error condition that occurred during export. The
498 * behavior of SetError can be modified using the error flag
499 * constants.
501 void SetError(
502 /// error ID, may contain an error flag
503 sal_Int32 nId,
504 /// string parameters for the error message
505 const css::uno::Sequence< OUString> & rMsgParams,
506 /// original exception message (if applicable)
507 const OUString& rExceptionMessage,
508 /// error location (if applicable)
509 const css::uno::Reference<css::xml::sax::XLocator> & rLocator );
511 void SetError(
512 sal_Int32 nId,
513 const css::uno::Sequence< OUString> & rMsgParams);
515 virtual void DisposingModel();
517 ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
519 const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() { return m_xContext;}
521 // Shapes in Writer cannot be named via context menu (#i51726#)
522 SvtModuleOptions::EFactory GetModelType() const
524 return meModelType;
527 // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
528 bool writeOutlineStyleAsNormalListStyle() const;
530 css::uno::Reference< css::embed::XStorage > GetTargetStorage();
532 /// returns the currently configured default version for odf export
533 SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
535 /// returns the deterministic version for odf export
536 SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const;
538 // FIXME: this is only for legacy stuff that has not yet been adapted
539 // to implement XMetadatable; this can write duplicate IDs!
540 /// add xml:id and legacy namespace id
541 void SAL_DLLPRIVATE AddAttributeIdLegacy(
542 sal_uInt16 const nLegacyPrefix, OUString const& rValue);
544 /// add xml:id attribute (for RDF metadata)
545 void AddAttributeXmlId(css::uno::Reference<css::uno::XInterface> const & i_xIfc);
547 /// add RDFa attributes for a metadatable text content
548 void AddAttributesRDFa( css::uno::Reference<css::text::XTextContent> const & i_xTextContent);
550 bool exportTextNumberElement() const;
552 /// set null date from model to unit converter, if not already done
553 bool SetNullDateOnUnitConverter();
556 inline rtl::Reference< XMLTextParagraphExport > const & SvXMLExport::GetTextParagraphExport()
558 if( !mxTextParagraphExport.is() )
559 mxTextParagraphExport = CreateTextParagraphExport();
561 return mxTextParagraphExport;
564 inline rtl::Reference< XMLShapeExport > const & SvXMLExport::GetShapeExport()
566 if( !mxShapeExport.is() )
567 mxShapeExport = CreateShapeExport();
569 return mxShapeExport;
572 inline rtl::Reference< SvXMLAutoStylePoolP > const & SvXMLExport::GetAutoStylePool()
574 if( !mxAutoStylePool.is() )
575 mxAutoStylePool = CreateAutoStylePool();
577 return mxAutoStylePool;
580 inline rtl::Reference< SchXMLExportHelper > const & SvXMLExport::GetChartExport()
582 if( !mxChartExport.is() )
583 mxChartExport = CreateChartExport();
585 return mxChartExport;
588 inline rtl::Reference< XMLPageExport > const & SvXMLExport::GetPageExport()
590 if( !mxPageExport.is() )
591 mxPageExport = CreatePageExport();
593 return mxPageExport;
596 inline rtl::Reference< XMLFontAutoStylePool > const & SvXMLExport::GetFontAutoStylePool()
598 if( !mxFontAutoStylePool.is() )
599 mxFontAutoStylePool = CreateFontAutoStylePool();
601 return mxFontAutoStylePool;
604 inline rtl::Reference< xmloff::OFormLayerXMLExport > const & SvXMLExport::GetFormExport()
606 if( !mxFormExport.is() )
607 mxFormExport = CreateFormExport();
609 return mxFormExport;
612 inline bool SvXMLExport::HasFormExport()
614 return mxFormExport.is();
617 inline void SvXMLExport::SetEmbeddedResolver(
618 css::uno::Reference< css::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
620 mxEmbeddedResolver = _xEmbeddedResolver;
623 inline void SvXMLExport::SetGraphicResolver(
624 css::uno::Reference< css::document::XGraphicObjectResolver >& _xGraphicResolver )
626 mxGraphicResolver = _xGraphicResolver;
629 // Helper class to export an element.
630 class XMLOFF_DLLPUBLIC SvXMLElementExport
632 SvXMLExport& mrExport;
633 OUString maElementName;
634 const bool mbIgnoreWhitespaceInside :1;
635 const bool mbDoSomething :1;
637 SAL_DLLPRIVATE
638 void StartElement(
639 const sal_uInt16 nPrefix,
640 const OUString& rName,
641 const bool bIgnoreWhitespaceOutside );
643 public:
645 // The constructor prints a start tag that has the common attributes
646 // of the XMLExport instance attached.
647 SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
648 const sal_Char *pName,
649 bool bIgnWSOutside, bool bIgnWSInside );
650 SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
651 const OUString& rName,
652 bool bIgnWSOutside, bool bIgnWSInside );
653 SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
654 enum ::xmloff::token::XMLTokenEnum eName,
655 bool bIgnWSOutside, bool bIgnWSInside );
656 SvXMLElementExport( SvXMLExport& rExp, const OUString& rQName,
657 bool bIgnWSOutside, bool bIgnWSInside );
659 // These constructors do nothing if bDoSomething is not set
660 SvXMLElementExport( SvXMLExport& rExp, bool bDoSomething,
661 sal_uInt16 nPrefix,
662 enum ::xmloff::token::XMLTokenEnum eName,
663 bool bIgnWSOutside, bool bIgnWSInside );
665 // The destructor prints an end tag.
666 ~SvXMLElementExport();
669 #endif // _XMLOFF_SVXMLEXP_HXX
671 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */