update emoji autocorrect entries from po-files
[LibreOffice.git] / include / xmloff / xmlexp.hxx
blobdc47596359bf6fe3c2f36e072c413511ef811c02
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 <com/sun/star/document/XFilter.hpp>
46 #include <com/sun/star/lang/XServiceInfo.hpp>
47 #include <com/sun/star/document/XExporter.hpp>
48 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
49 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
50 #include <com/sun/star/beans/XPropertySet.hpp>
51 #include <com/sun/star/lang/XInitialization.hpp>
52 #include <com/sun/star/lang/XEventListener.hpp>
53 #include <com/sun/star/uno/XComponentContext.hpp>
54 #include <com/sun/star/container/XNamed.hpp>
56 #include <unotools/saveopt.hxx>
58 #include <xmloff/XMLPageExport.hxx>
59 #include <xmloff/ProgressBarHelper.hxx>
60 #include <cppuhelper/implbase6.hxx>
61 #include <tools/fldunit.hxx>
63 #include <list>
64 #include <o3tl/typed_flags_set.hxx>
66 class SvXMLNamespaceMap;
67 class SvXMLAttributeList;
68 class SvXMLExport_Impl;
69 class SvXMLUnitConverter;
70 class ProgressBarHelper;
71 class XMLEventExport;
72 class XMLSettingsExportHelper;
73 class XMLImageMapExport;
74 class XMLErrors;
75 class LanguageTag;
76 enum class SvXMLErrorFlags;
78 // Shapes in Writer cannot be named via context menu (#i51726#)
79 #include <unotools/moduleoptions.hxx>
81 namespace com { namespace sun { namespace star {
82 namespace frame { class XModel; }
83 namespace container { class XIndexContainer; }
84 namespace lang { struct Locale; }
85 } } }
86 namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
88 enum class SvXMLExportFlags {
89 NONE = 0,
90 META = 0x0001,
91 STYLES = 0x0002,
92 MASTERSTYLES = 0x0004,
93 AUTOSTYLES = 0x0008,
94 CONTENT = 0x0010,
95 SCRIPTS = 0x0020,
96 SETTINGS = 0x0040,
97 FONTDECLS = 0x0080,
98 EMBEDDED = 0x0100,
99 NODOCTYPE = 0x0200,
100 PRETTY = 0x0400,
101 SAVEBACKWARDCOMPATIBLE = 0x0800,
102 OASIS = 0x8000,
103 ALL = 0x0fff
105 namespace o3tl
107 template<> struct typed_flags<SvXMLExportFlags> : is_typed_flags<SvXMLExportFlags, 0x8fff> {};
110 class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6<
111 ::com::sun::star::document::XFilter,
112 ::com::sun::star::lang::XServiceInfo,
113 ::com::sun::star::document::XExporter,
114 ::com::sun::star::lang::XInitialization,
115 ::com::sun::star::container::XNamed,
116 ::com::sun::star::lang::XUnoTunnel>
118 SvXMLExport_Impl *mpImpl; // dummy
120 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
121 OUString m_implementationName;
123 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
124 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler; // the handlers
125 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > mxExtHandler;
126 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
127 ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver;
128 ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
129 ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mxStatusIndicator;
130 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxExportInfo;
131 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener;
133 SvXMLAttributeList *mpAttrList; // a common attribute list
134 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > mxAttrList; // and an interface of it
136 OUString msOrigFileName; // the original URL
137 OUString msGraphicObjectProtocol;
138 OUString msEmbeddedObjectProtocol;
139 OUString msFilterName;
140 SvXMLNamespaceMap *mpNamespaceMap; // the namepspace map
141 SvXMLUnitConverter *mpUnitConv; // 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 bool mbExtended; // Does document contain extens.
158 const enum ::xmloff::token::XMLTokenEnum meClass;
159 SAL_DLLPRIVATE void _InitCtor();
161 SvXMLExportFlags mnExportFlags;
162 SvXMLErrorFlags mnErrorFlags;
164 public:
166 const OUString msWS; // " "
168 private:
170 // Shapes in Writer cannot be named via context menu (#i51726#)
171 SvtModuleOptions::EFactory meModelType;
172 SAL_DLLPRIVATE void _DetermineModelType();
174 SAL_DLLPRIVATE void ImplExportMeta(); // <office:meta>
175 SAL_DLLPRIVATE void ImplExportSettings(); // <office:settings>
176 SAL_DLLPRIVATE void ImplExportStyles( bool bUsed ); // <office:styles>
177 SAL_DLLPRIVATE void ImplExportAutoStyles( bool bUsed );
178 // <office:automatic-styles>
179 SAL_DLLPRIVATE void ImplExportMasterStyles( bool bUsed );
180 // <office:master-styles>
181 SAL_DLLPRIVATE void ImplExportContent(); // <office:body>
182 virtual void SetBodyAttributes();
183 void GetViewSettingsAndViews(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
185 protected:
186 void setExportFlags( SvXMLExportFlags nExportFlags ) { mnExportFlags = nExportFlags; }
188 // Get (modifyable) namespace map
189 SvXMLNamespaceMap& _GetNamespaceMap() { return *mpNamespaceMap; }
191 // get a new namespave map (used in starmath to have a default namespace)
192 void ResetNamespaceMap();
194 /// Override this method to export the content of <office:meta>.
195 /// There is a default implementation.
196 virtual void _ExportMeta();
198 /// Override this method to export the content of <office:scripts>.
199 /// There is a default implementation.
200 virtual void _ExportScripts();
202 /// Override this method to export the font declarations
203 /// The default implementation will export the contents of the
204 /// XMLFontAutoStylePool if it has been created.
205 virtual void _ExportFontDecls();
207 /// Override this method to export the content of <style:styles>.
208 /// If bUsed is set, used styles should be exported only.
209 /// Overriding Methods must call this method !
210 virtual void _ExportStyles( bool bUsed );
212 /// Override this method to export the contents of <style:auto-styles>.
213 virtual void _ExportAutoStyles() = 0;
215 /// Override this method to export the contents of <style:master-styles>.
216 virtual void _ExportMasterStyles() = 0;
218 /// Override this method to export the content of <office:body>.
219 virtual void _ExportContent() = 0;
221 OUString GetSourceShellID() const;
222 OUString GetDestinationShellID() const;
224 void SetExtended( bool bSet=true ) { mbExtended = bSet; }
226 // save linked sections? (may be false in global documents)
227 bool mbSaveLinkedSections;
229 virtual XMLTextParagraphExport* CreateTextParagraphExport();
230 virtual XMLShapeExport* CreateShapeExport();
231 virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
232 SchXMLExportHelper* CreateChartExport();
233 virtual XMLPageExport* CreatePageExport();
234 virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
235 xmloff::OFormLayerXMLExport* CreateFormExport();
236 virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
237 virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
239 struct SettingsGroup
241 ::xmloff::token::XMLTokenEnum eGroupName;
242 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSettings;
244 SettingsGroup()
245 :eGroupName( ::xmloff::token::XML_TOKEN_INVALID )
246 ,aSettings()
250 SettingsGroup(
251 const ::xmloff::token::XMLTokenEnum _eGroupName,
252 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rSettings )
253 :eGroupName( _eGroupName )
254 ,aSettings( _rSettings )
258 /** returns the current document settings
260 The default implementation will obtain the view settings by calling GetViewSettingsAndViews, and the
261 configuration settings by calling GetConfigurationSettings, and return them together with the proper XML token.
263 @return
264 the accumulated count of all settings in all groups
266 virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings );
268 const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
269 inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
271 const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
272 void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver );
274 void SetDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &rHandler );
276 public:
278 SvXMLExport(
279 sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
280 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
281 OUString const & implementationName,
282 const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID,
283 SvXMLExportFlags nExportFlag = SvXMLExportFlags::ALL );
285 SvXMLExport(
286 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
287 OUString const & implementationName,
288 const OUString& rFileName,
289 sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
290 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler);
292 SvXMLExport(
293 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
294 OUString const & implementationName,
295 const OUString& rFileName,
296 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
297 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
298 FieldUnit const eDefaultFieldUnit );
300 virtual ~SvXMLExport();
302 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
303 static SvXMLExport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
305 // XExporter
306 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, std::exception) SAL_OVERRIDE;
308 // XFilter
309 virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310 virtual void SAL_CALL cancel() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
312 // XInitialization
313 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, std::exception) SAL_OVERRIDE;
315 // XNamed
316 virtual OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
317 virtual void SAL_CALL setName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
319 // XServiceInfo
320 virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_FINAL SAL_OVERRIDE;
321 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_FINAL SAL_OVERRIDE;
322 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_FINAL SAL_OVERRIDE;
324 // XUnoTunnel
325 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
327 /** ensures that the given namespace is in scope at the next started
328 element.
330 <p>If the namespace is not yet declared, the necessary attribute will
331 be added, as well.</p>
333 @param i_rNamespace the namespace to be declared
334 @param i_rPreferredPrefix (opt.) preferred prefix for the namespace
336 @returns the actual prefix that the namespace is associated with
338 OUString EnsureNamespace(OUString const & i_rNamespace,
339 OUString const & i_rPreferredPrefix = OUString("gen") );
341 // Check if common attribute list is empty.
342 #ifndef DBG_UTIL
343 void CheckAttrList() {}
344 #else
345 void CheckAttrList();
346 #endif
348 // Clear common attribute list.
349 void ClearAttrList();
351 // Add an attribute to the common attribute list.
352 void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName,
353 const sal_Char *pValue );
354 void AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName,
355 const OUString& rValue );
356 void AddAttribute( sal_uInt16 nPrefix, const OUString& rName,
357 const OUString& rValue );
358 void AddAttribute( sal_uInt16 nPrefix,
359 enum ::xmloff::token::XMLTokenEnum eName,
360 const OUString& rValue );
361 void AddAttribute( sal_uInt16 nPrefix,
362 enum ::xmloff::token::XMLTokenEnum eName,
363 enum ::xmloff::token::XMLTokenEnum eValue );
364 void AddAttribute( const OUString& rQName,
365 const OUString& rValue );
366 void AddAttribute( const OUString& rQName,
367 enum ::xmloff::token::XMLTokenEnum eValue );
369 /** Add language tag attributes, deciding which are necessary.
371 @param nPrefix
372 Namespace prefix for *:language, *:script and *:country
374 @param nPrefixRfc
375 Namespace prefix for *:rfc-language-tag
377 @param bWriteEmpty
378 Whether to write empty *:language and *:country attribute
379 values in case of an empty locale (denoting system).
381 @param eClass
382 default, XML_LANGUAGE: XML_SCRIPT, XML_COUNTRY, XML_RFC_LANGUAGE_TAG
383 XML_LANGUAGE_ASIAN: XML_SCRIPT_ASIAN, XML_COUNTRY_ASIAN, XML_RFC_LANGUAGE_TAG_ASIAN
384 also switches nPrefix XML_NAMESPACE_FO to XML_NAMESPACE_STYLE
385 XML_LANGUAGE_COMPLEX: XML_SCRIPT_COMPLEX, XML_COUNTRY_COMPLEX, XML_RFC_LANGUAGE_TAG_COMPLEX
386 also switches nPrefix XML_NAMESPACE_FO to XML_NAMESPACE_STYLE
388 void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc,
389 const ::com::sun::star::lang::Locale& rLocale, bool bWriteEmpty,
390 enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_LANGUAGE );
392 /** Same as AddLanguageTagAttributes() but with LanguageTag parameter
393 instead of Locale.
395 void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc,
396 const LanguageTag& rLanguageTag, bool bWriteEmpty,
397 enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_LANGUAGE );
399 // add several attributes to the common attribute list
400 void AddAttributeList( const ::com::sun::star::uno::Reference<
401 ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
403 // Get common attribute list as implementation or interface.
404 SvXMLAttributeList &GetAttrList() { return *mpAttrList; }
405 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & GetXAttrList() { return mxAttrList; }
407 // Get document handler. This methods are not const, because the
408 // reference allowes modifications through the handler.
409 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & GetDocHandler() { return mxHandler; }
410 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > & GetExtDocHandler()
412 return mxExtHandler;
415 // Get original URL.
416 const OUString& GetOrigFileName() const { return msOrigFileName; }
418 // Get (const) namespace map.
419 const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
421 // Get unit converter
422 const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
424 SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
426 void addChaffWhenEncryptedStorage();
428 // Export the document.
429 virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
431 virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat = false );
432 virtual void exportDataStyles();
433 virtual void exportAutoDataStyles();
434 virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) const;
435 sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const;
437 virtual void exportAnnotationMeta( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape);
439 // Get XModel
440 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
441 GetModel() const { return mxModel; }
442 // Get XNumberFormatsSupplier
443 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; }
444 inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
446 mxNumberFormatsSupplier = _xNumberFormatSupplier;
447 if ( mxNumberFormatsSupplier.is() && mxHandler.is() )
448 mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
451 // get export helper for text
452 inline rtl::Reference< XMLTextParagraphExport > GetTextParagraphExport();
454 // get export helper for shapes
455 inline rtl::Reference< XMLShapeExport > GetShapeExport();
457 // get auto style pool
458 inline rtl::Reference< SvXMLAutoStylePoolP > GetAutoStylePool();
460 // get Page Export
461 inline rtl::Reference< XMLPageExport > GetPageExport();
463 // get chart export helper
464 inline rtl::Reference< SchXMLExportHelper > GetChartExport();
466 // get font auto style pool
467 inline rtl::Reference< XMLFontAutoStylePool > GetFontAutoStylePool();
469 ProgressBarHelper* GetProgressBarHelper();
471 // get Formlayer Export
472 inline rtl::Reference< xmloff::OFormLayerXMLExport > GetFormExport();
473 inline bool HasFormExport();
475 // get XPropertySet with export information
476 inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getExportInfo() const { return mxExportInfo; }
478 com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > GetStatusIndicator() { return mxStatusIndicator; }
480 /// get Event export, with handlers for script types "None" and
481 /// "StarBasic" already registered; other handlers may be registered, too.
482 XMLEventExport& GetEventExport();
484 /// get the export for image maps
485 XMLImageMapExport& GetImageMapExport();
487 OUString AddEmbeddedGraphicObject(
488 const OUString& rGraphicObjectURL );
489 bool AddEmbeddedGraphicObjectAsBase64(
490 const OUString& rGraphicObjectURL );
492 OUString AddEmbeddedObject(
493 const OUString& rEmbeddedObjectURL );
494 bool AddEmbeddedObjectAsBase64(
495 const OUString& rEmbeddedObjectURL );
497 OUString EncodeStyleName( const OUString& rName,
498 bool *pEncoded=0 ) const;
500 // save linked sections?
501 inline bool IsSaveLinkedSections() { return mbSaveLinkedSections; }
503 // get export flags
504 SvXMLExportFlags getExportFlags() const { return mnExportFlags; }
506 bool ExportEmbeddedOwnObject(
507 ::com::sun::star::uno::Reference<
508 ::com::sun::star::lang::XComponent >& rComp );
510 OUString GetRelativeReference(const OUString& rValue);
512 // methods for accessing the document handler and handling SAX errors
513 void StartElement(sal_uInt16 nPrefix,
514 enum ::xmloff::token::XMLTokenEnum eName,
515 bool bIgnWSOutside );
516 void StartElement(const OUString& rName,
517 bool bIgnWSOutside );
518 void Characters(const OUString& rChars);
519 void EndElement(sal_uInt16 nPrefix,
520 enum ::xmloff::token::XMLTokenEnum eName,
521 bool bIgnWSInside );
522 void EndElement(const OUString& rName,
523 bool bIgnWSInside );
524 void IgnorableWhitespace();
527 * Record an error condition that occurred during export. The
528 * behavior of SetError can be modified using the error flag
529 * constants.
531 void SetError(
532 /// error ID, may contain an error flag
533 sal_Int32 nId,
534 /// string parameters for the error message
535 const ::com::sun::star::uno::Sequence< OUString> & rMsgParams,
536 /// original exception message (if applicable)
537 const OUString& rExceptionMessage,
538 /// error location (if applicable)
539 const ::com::sun::star::uno::Reference<
540 ::com::sun::star::xml::sax::XLocator> & rLocator );
542 void SetError(
543 sal_Int32 nId,
544 const ::com::sun::star::uno::Sequence< OUString> & rMsgParams);
546 /** return current error flags (logical 'or' of all error flags so far) */
547 SvXMLErrorFlags GetErrorFlags() { return mnErrorFlags; }
549 virtual void DisposingModel();
551 ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
553 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getComponentContext() { return m_xContext;}
555 // Shapes in Writer cannot be named via context menu (#i51726#)
556 SvtModuleOptions::EFactory GetModelType() const
558 return meModelType;
561 // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
562 bool writeOutlineStyleAsNormalListStyle() const;
564 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetTargetStorage();
566 /// returns the currently configured default version for odf export
567 SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
569 /// returns the deterministic version for odf export
570 SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const;
572 /// name of stream in package, e.g., "content.xml"
573 OUString GetStreamName() const;
575 // FIXME: this is only for legacy stuff that has not yet been adapted
576 // to implement XMetadatable; this can write duplicate IDs!
577 /// add xml:id and legacy namespace id
578 void SAL_DLLPRIVATE AddAttributeIdLegacy(
579 sal_uInt16 const nLegacyPrefix, OUString const& rValue);
581 /// add xml:id attribute (for RDF metadata)
582 void AddAttributeXmlId(::com::sun::star::uno::Reference<
583 ::com::sun::star::uno::XInterface> const & i_xIfc);
585 /// add RDFa attributes for a metadatable text content
586 void AddAttributesRDFa( ::com::sun::star::uno::Reference<
587 ::com::sun::star::text::XTextContent> const & i_xTextContent);
589 bool exportTextNumberElement() const;
591 /// set null date from model to unit converter, if not already done
592 bool SetNullDateOnUnitConverter();
595 inline rtl::Reference< XMLTextParagraphExport > SvXMLExport::GetTextParagraphExport()
597 if( !mxTextParagraphExport.is() )
598 mxTextParagraphExport = CreateTextParagraphExport();
600 return mxTextParagraphExport;
603 inline rtl::Reference< XMLShapeExport > SvXMLExport::GetShapeExport()
605 if( !mxShapeExport.is() )
606 mxShapeExport = CreateShapeExport();
608 return mxShapeExport;
611 inline rtl::Reference< SvXMLAutoStylePoolP > SvXMLExport::GetAutoStylePool()
613 if( !mxAutoStylePool.is() )
614 mxAutoStylePool = CreateAutoStylePool();
616 return mxAutoStylePool;
619 inline rtl::Reference< SchXMLExportHelper > SvXMLExport::GetChartExport()
621 if( !mxChartExport.is() )
622 mxChartExport = CreateChartExport();
624 return mxChartExport;
627 inline rtl::Reference< XMLPageExport > SvXMLExport::GetPageExport()
629 if( !mxPageExport.is() )
630 mxPageExport = CreatePageExport();
632 return mxPageExport;
635 inline rtl::Reference< XMLFontAutoStylePool > SvXMLExport::GetFontAutoStylePool()
637 if( !mxFontAutoStylePool.is() )
638 mxFontAutoStylePool = CreateFontAutoStylePool();
640 return mxFontAutoStylePool;
643 inline rtl::Reference< xmloff::OFormLayerXMLExport > SvXMLExport::GetFormExport()
645 if( !mxFormExport.is() )
646 mxFormExport = CreateFormExport();
648 return mxFormExport;
651 inline bool SvXMLExport::HasFormExport()
653 return mxFormExport.is();
656 inline void SvXMLExport::SetEmbeddedResolver(
657 com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
659 mxEmbeddedResolver = _xEmbeddedResolver;
662 inline void SvXMLExport::SetGraphicResolver(
663 com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
665 mxGraphicResolver = _xGraphicResolver;
668 // Helper class to export an element.
669 class XMLOFF_DLLPUBLIC SvXMLElementExport
671 SvXMLExport& mrExport;
672 OUString maElementName;
673 const bool mbIgnoreWhitespaceInside :1;
674 const bool mbDoSomething :1;
676 SAL_DLLPRIVATE
677 void StartElement(
678 const sal_uInt16 nPrefix,
679 const OUString& rName,
680 const bool bIgnoreWhitespaceOutside );
682 public:
684 // The constructor prints a start tag that has the common attributes
685 // of the XMLExport instance attached.
686 SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
687 const sal_Char *pName,
688 bool bIgnWSOutside, bool bIgnWSInside );
689 SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
690 const OUString& rName,
691 bool bIgnWSOutside, bool bIgnWSInside );
692 SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
693 enum ::xmloff::token::XMLTokenEnum eName,
694 bool bIgnWSOutside, bool bIgnWSInside );
695 SvXMLElementExport( SvXMLExport& rExp, const OUString& rQName,
696 bool bIgnWSOutside, bool bIgnWSInside );
698 // Thes constructors do nothing if bDoSomething is not set
699 SvXMLElementExport( SvXMLExport& rExp, bool bDoSomething,
700 sal_uInt16 nPrefix,
701 enum ::xmloff::token::XMLTokenEnum eName,
702 bool bIgnWSOutside, bool bIgnWSInside );
704 // The destructor prints an end tag.
705 ~SvXMLElementExport();
708 #endif // _XMLOFF_SVXMLEXP_HXX
710 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */