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