Bump version to 6.4-15
[LibreOffice.git] / include / xmloff / xmlimp.hxx
blob6d0dda96596af1b90d9f87dccea8949bb232ceda
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_XMLIMP_HXX
21 #define INCLUDED_XMLOFF_XMLIMP_HXX
23 #include <sal/config.h>
25 #include <set>
26 #include <stack>
28 #include <xmloff/dllapi.h>
29 #include <sal/types.h>
30 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
31 #include <com/sun/star/xml/sax/XFastParser.hpp>
32 #include <com/sun/star/lang/XUnoTunnel.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/document/XImporter.hpp>
36 #include <com/sun/star/document/XFilter.hpp>
37 #include <xmloff/txtimp.hxx>
38 #include <xmloff/shapeimport.hxx>
39 #include <xmloff/SchXMLImportHelper.hxx>
40 #include <cppuhelper/implbase.hxx>
41 #include <xmloff/formlayerimport.hxx>
42 #include <sax/fastattribs.hxx>
43 #include <rtl/ustring.hxx>
44 #include <unordered_map>
46 #include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
47 #include <o3tl/typed_flags_set.hxx>
48 #include <memory>
50 namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
51 namespace com { namespace sun { namespace star { namespace beans { struct NamedValue; } } } }
52 namespace com { namespace sun { namespace star { namespace document { class XEmbeddedObjectResolver; } } } }
53 namespace com { namespace sun { namespace star { namespace document { class XGraphicStorageHandler; } } } }
54 namespace com { namespace sun { namespace star { namespace embed { class XStorage; } } } }
55 namespace com { namespace sun { namespace star { namespace graphic { class XGraphic; } } } }
56 namespace com { namespace sun { namespace star { namespace task { class XStatusIndicator; } } } }
57 namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
58 namespace com { namespace sun { namespace star { namespace util { class XNumberFormatsSupplier; } } } }
59 namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XAttributeList; } } } } }
60 namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XFastAttributeList; } } } } }
61 namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XFastContextHandler; } } } } }
62 namespace comphelper { class AttributeList; }
64 class ProgressBarHelper;
66 #define NAMESPACE_TOKEN( prefixToken ) ( ( sal_Int32( prefixToken + 1 ) ) << NMSP_SHIFT )
67 #define XML_ELEMENT( prefix, name ) ( NAMESPACE_TOKEN( XML_NAMESPACE_##prefix ) | name )
69 const size_t NMSP_SHIFT = 16;
70 const sal_Int32 TOKEN_MASK = 0xffff;
71 const sal_Int32 NMSP_MASK = 0xffff0000;
73 namespace com { namespace sun { namespace star {
74 namespace frame { class XModel; }
75 namespace io { class XOutputStream; }
76 namespace rdf { class XMetadatable; }
77 } } }
78 namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
80 class SvXMLNamespaceMap;
81 class SvXMLImport_Impl;
82 class SvXMLUnitConverter;
83 class SvXMLNumFmtHelper;
84 class XMLFontStylesContext;
85 class XMLEventImportHelper;
86 class XMLErrors;
87 class StyleMap;
88 enum class SvXMLErrorFlags;
90 namespace xmloff {
91 class RDFaImportHelper;
93 namespace xmloff::token {
94 class FastTokenHandler;
97 enum class SvXMLImportFlags {
98 NONE = 0x0000,
99 META = 0x0001,
100 STYLES = 0x0002,
101 MASTERSTYLES = 0x0004,
102 AUTOSTYLES = 0x0008,
103 CONTENT = 0x0010,
104 SCRIPTS = 0x0020,
105 SETTINGS = 0x0040,
106 FONTDECLS = 0x0080,
107 EMBEDDED = 0x0100,
108 ALL = 0xffff
110 namespace o3tl
112 template<> struct typed_flags<SvXMLImportFlags> : is_typed_flags<SvXMLImportFlags, 0xffff> {};
115 class SvXMLImportFastNamespaceHandler final : public ::cppu::WeakImplHelper< css::xml::sax::XFastNamespaceHandler >
117 private:
118 struct NamespaceDefine
120 OUString m_aPrefix;
121 OUString m_aNamespaceURI;
123 NamespaceDefine( const OUString& rPrefix, const OUString& rNamespaceURI ) : m_aPrefix( rPrefix ), m_aNamespaceURI( rNamespaceURI ) {}
125 std::vector< std::unique_ptr< NamespaceDefine > > m_aNamespaceDefines;
127 public:
128 SvXMLImportFastNamespaceHandler();
129 void addNSDeclAttributes( rtl::Reference < comphelper::AttributeList > const & rAttrList );
131 //XFastNamespaceHandler
132 virtual void SAL_CALL registerNamespace( const OUString& rNamespacePrefix, const OUString& rNamespaceURI ) override;
133 virtual OUString SAL_CALL getNamespaceURI( const OUString& rNamespacePrefix ) override;
136 class XMLOFF_DLLPUBLIC SvXMLLegacyToFastDocHandler final : public ::cppu::WeakImplHelper<
137 css::xml::sax::XDocumentHandler,
138 css::document::XImporter >
140 private:
141 rtl::Reference< SvXMLImport > mrImport;
142 rtl::Reference< sax_fastparser::FastAttributeList > mxFastAttributes;
144 public:
145 SvXMLLegacyToFastDocHandler( const rtl::Reference< SvXMLImport > & rImport );
147 // XImporter
148 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
150 // css::xml::sax::XDocumentHandler
151 virtual void SAL_CALL startDocument() override;
152 virtual void SAL_CALL endDocument() override;
153 virtual void SAL_CALL startElement(const OUString& aName,
154 const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override;
155 virtual void SAL_CALL endElement(const OUString& aName) override;
156 virtual void SAL_CALL characters(const OUString& aChars) override;
157 virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override;
158 virtual void SAL_CALL processingInstruction(const OUString& aTarget,
159 const OUString& aData) override;
160 virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override;
163 class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
164 css::xml::sax::XExtendedDocumentHandler,
165 css::xml::sax::XFastDocumentHandler,
166 css::lang::XServiceInfo,
167 css::lang::XInitialization,
168 css::document::XImporter,
169 css::document::XFilter,
170 css::lang::XUnoTunnel,
171 css::xml::sax::XFastParser>
173 friend class SvXMLImportContext;
174 friend class SvXMLLegacyToFastDocHandler;
176 css::uno::Reference< css::xml::sax::XLocator > mxLocator;
177 css::uno::Reference< css::frame::XModel > mxModel;
178 css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
179 css::uno::Reference< css::document::XGraphicStorageHandler > mxGraphicStorageHandler;
180 css::uno::Reference< css::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
181 css::uno::Reference< css::beans::XPropertySet > mxImportInfo;
183 rtl::Reference< XMLTextImportHelper > mxTextImport;
184 rtl::Reference< XMLShapeImportHelper > mxShapeImport;
185 rtl::Reference< SchXMLImportHelper > mxChartImport;
186 rtl::Reference< ::xmloff::OFormLayerXMLImport > mxFormImport;
188 SvXMLImportContextRef mxFontDecls;
189 SvXMLImportContextRef mxStyles;
190 SvXMLImportContextRef mxAutoStyles;
191 SvXMLImportContextRef mxMasterStyles;
193 css::uno::Reference< css::container::XNameContainer > mxGradientHelper;
194 css::uno::Reference< css::container::XNameContainer > mxHatchHelper;
195 css::uno::Reference< css::container::XNameContainer > mxBitmapHelper;
196 css::uno::Reference< css::container::XNameContainer > mxTransGradientHelper;
197 css::uno::Reference< css::container::XNameContainer > mxMarkerHelper;
198 css::uno::Reference< css::container::XNameContainer > mxDashHelper;
199 css::uno::Reference< css::container::XNameContainer > mxNumberStyles;
200 css::uno::Reference< css::lang::XEventListener > mxEventListener;
202 std::unique_ptr<SvXMLImport_Impl> mpImpl; // dummy
204 std::unique_ptr<SvXMLNamespaceMap> mpNamespaceMap;
205 std::unique_ptr<SvXMLUnitConverter> mpUnitConv;
206 std::stack<SvXMLImportContextRef> maContexts;
207 std::stack<css::uno::Reference<css::xml::sax::XFastContextHandler>>
208 maFastContexts;
209 std::unique_ptr<SvXMLNumFmtHelper> mpNumImport;
210 std::unique_ptr<ProgressBarHelper> mpProgressBarHelper;
211 std::unique_ptr<XMLEventImportHelper> mpEventImportHelper;
212 std::unique_ptr<XMLErrors> mpXMLErrors;
213 rtl::Reference<StyleMap> mpStyleMap;
215 SAL_DLLPRIVATE void InitCtor_();
217 SvXMLImportFlags const mnImportFlags;
218 std::set< OUString > embeddedFontUrlsKnown;
219 bool isFastContext;
220 css::uno::Reference< css::xml::sax::XFastParser > mxParser;
221 rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
222 rtl::Reference < comphelper::AttributeList > maAttrList;
223 rtl::Reference < comphelper::AttributeList > maNamespaceAttrList;
224 css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler;
225 static rtl::Reference< xmloff::token::FastTokenHandler > xTokenHandler;
226 static std::unordered_map< sal_Int32, std::pair< OUString, OUString > > aNamespaceMap;
227 static std::unordered_map< OUString, OUString > aNamespaceURIPrefixMap;
228 static bool bIsNSMapsInitialized;
230 static void initializeNamespaceMaps();
231 void registerNamespaces();
232 std::unique_ptr<SvXMLNamespaceMap> processNSAttributes(
233 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
234 void Characters(const OUString& aChars);
236 css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
238 protected:
239 bool mbIsFormsSupported;
240 bool mbIsTableShapeSupported;
241 bool mbNotifyMacroEventRead;
243 // Create top-level element context.
244 // This method is called after the namespace map has been updated, but
245 // before a context for the current element has been pushed.
246 // This base class implementation returns a context that ignores everything.
247 virtual SvXMLImportContext *CreateDocumentContext(sal_uInt16 nPrefix,
248 const OUString& rLocalName,
249 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList );
250 virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element,
251 const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList );
253 virtual XMLTextImportHelper* CreateTextImport();
254 void ClearTextImport() { mxTextImport = nullptr; }
255 virtual XMLShapeImportHelper* CreateShapeImport();
256 bool HasShapeImport() const { return mxShapeImport.is(); }
257 void ClearShapeImport() { mxShapeImport = nullptr; }
259 static SchXMLImportHelper* CreateChartImport();
260 ::xmloff::OFormLayerXMLImport* CreateFormImport();
262 void SetFontDecls( XMLFontStylesContext *pFontDecls );
263 void SetStyles( SvXMLStylesContext *pStyles );
264 void SetAutoStyles( SvXMLStylesContext *pAutoStyles );
265 void SetMasterStyles( SvXMLStylesContext *pMasterStyles );
267 bool IsODFVersionConsistent( const OUString& aODFVersion );
269 const css::uno::Reference< css::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
270 inline void SetEmbeddedResolver( css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver );
272 const css::uno::Reference<css::document::XGraphicStorageHandler> & GetGraphicStorageHandler() const
274 return mxGraphicStorageHandler;
276 void SetGraphicStorageHandler(css::uno::Reference<css::document::XGraphicStorageHandler> const & rxGraphicStorageHandler);
278 void CreateNumberFormatsSupplier_();
279 void CreateDataStylesImport_();
281 public:
282 // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
283 SvXMLImport(
284 const css::uno::Reference< css::uno::XComponentContext >& xContext,
285 OUString const & implementationName,
286 SvXMLImportFlags nImportFlags = SvXMLImportFlags::ALL );
288 void cleanup() throw();
290 virtual ~SvXMLImport() throw() override;
292 // css::xml::sax::XDocumentHandler
293 virtual void SAL_CALL startDocument() override;
294 virtual void SAL_CALL endDocument() override;
295 virtual void SAL_CALL startElement(const OUString& aName,
296 const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override;
297 virtual void SAL_CALL endElement(const OUString& aName) override;
298 virtual void SAL_CALL characters(const OUString& aChars) override;
299 virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override;
300 virtual void SAL_CALL processingInstruction(const OUString& aTarget,
301 const OUString& aData) override;
302 virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override;
304 // ::css::xml::sax::XFastContextHandler
305 virtual void SAL_CALL startFastElement(sal_Int32 Element,
306 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
307 virtual void SAL_CALL startUnknownElement(const OUString & Namespace,
308 const OUString & Name,
309 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
310 virtual void SAL_CALL endFastElement(sal_Int32 Element) override;
311 virtual void SAL_CALL endUnknownElement(const OUString & Namespace,
312 const OUString & Name) override;
313 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
314 createFastChildContext(sal_Int32 Element,
315 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
316 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
317 createUnknownChildContext(const OUString & Namespace, const OUString & Name,
318 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
320 // css::xml::sax::XExtendedDocumentHandler
321 virtual void SAL_CALL startCDATA() override;
322 virtual void SAL_CALL endCDATA() override;
323 virtual void SAL_CALL comment(const OUString& sComment) override;
324 virtual void SAL_CALL allowLineBreak() override;
325 virtual void SAL_CALL unknown(const OUString& sString) override;
327 // XFastParser
328 virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& aInputSource ) override;
329 virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
330 virtual void SAL_CALL setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override;
331 virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override;
332 virtual OUString SAL_CALL getNamespaceURL( const OUString& rPrefix ) override;
333 virtual void SAL_CALL setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override;
334 virtual void SAL_CALL setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override;
335 virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) override;
336 virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override;
338 // XImporter
339 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
341 // XFilter
342 virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
343 virtual void SAL_CALL cancel( ) override;
345 // XInitialization
346 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
348 // XUnoTunnel
349 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() throw();
350 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
352 // XServiceInfo
353 virtual OUString SAL_CALL getImplementationName( ) final override;
354 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override;
355 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) final override;
357 // may be called by certain subclasses that handle document meta-data
358 // override to provide customized handling of document statistics
359 // the base class implementation initializes the progress bar and should
360 // be called by overriding methods
361 virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > & i_rStats);
363 // get import helper for text
364 inline rtl::Reference< XMLTextImportHelper > const & GetTextImport();
365 bool HasTextImport() const { return mxTextImport.is(); }
366 inline SvXMLNumFmtHelper* GetDataStylesImport();
368 // get import helper for shapes
369 inline rtl::Reference< XMLShapeImportHelper > const & GetShapeImport();
371 // get import helper for charts
372 inline rtl::Reference< SchXMLImportHelper > const & GetChartImport();
374 // get import helper for form layer
375 inline rtl::Reference< ::xmloff::OFormLayerXMLImport > const & GetFormImport();
377 // get XPropertySet with import information
378 const css::uno::Reference< css::beans::XPropertySet >& getImportInfo() const { return mxImportInfo; }
380 // get import helper for events
381 XMLEventImportHelper& GetEventImport();
383 static const OUString & getNameFromToken( sal_Int32 nToken );
384 static OUString getPrefixAndNameFromToken( sal_Int32 nToken );
385 static OUString getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap);
386 static OUString getNamespaceURIFromToken( sal_Int32 nToken );
387 static OUString getNamespacePrefixFromURI( const OUString& rURI );
389 SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
390 const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
391 const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
392 SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
393 const css::uno::Reference< css::xml::sax::XLocator > & GetLocator() const { return mxLocator; }
394 const css::uno::Reference< css::frame::XModel > &
395 GetModel() const { return mxModel; }
397 const css::uno::Reference< css::container::XNameContainer > & GetGradientHelper();
398 const css::uno::Reference< css::container::XNameContainer > & GetHatchHelper();
399 const css::uno::Reference< css::container::XNameContainer > & GetBitmapHelper();
400 const css::uno::Reference< css::container::XNameContainer > & GetTransGradientHelper();
401 const css::uno::Reference< css::container::XNameContainer > & GetMarkerHelper();
402 const css::uno::Reference< css::container::XNameContainer > & GetDashHelper();
403 inline css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier();
404 void SetNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
406 mxNumberFormatsSupplier = _xNumberFormatSupplier;
409 css::uno::Reference<css::graphic::XGraphic> loadGraphicByURL(OUString const & rURL);
410 css::uno::Reference<css::graphic::XGraphic> loadGraphicFromBase64(css::uno::Reference<css::io::XOutputStream> const & rxOutputStream);
412 css::uno::Reference< css::io::XOutputStream > GetStreamForGraphicObjectURLFromBase64() const;
414 bool IsPackageURL( const OUString& rURL ) const;
415 OUString ResolveEmbeddedObjectURL( const OUString& rURL,
416 const OUString& rClassId );
417 css::uno::Reference< css::io::XOutputStream >
418 GetStreamForEmbeddedObjectURLFromBase64() const;
419 OUString ResolveEmbeddedObjectURLFromBase64();
421 // get source storage we're importing from (if available)
422 css::uno::Reference< css::embed::XStorage > const &
423 GetSourceStorage() const;
425 void AddStyleDisplayName( sal_uInt16 nFamily,
426 const OUString& rName,
427 const OUString& rDisplayName );
428 OUString GetStyleDisplayName( sal_uInt16 nFamily,
429 const OUString& rName ) const;
431 ProgressBarHelper* GetProgressBarHelper();
433 void AddNumberStyle(sal_Int32 nKey, const OUString& sName);
435 virtual void SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& aViewProps);
436 virtual void SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps);
437 virtual void SetDocumentSpecificSettings(const OUString& _rSettingsGroupName,
438 const css::uno::Sequence<css::beans::PropertyValue>& _rSettings);
440 XMLFontStylesContext *GetFontDecls();
441 SvXMLStylesContext *GetStyles();
442 SvXMLStylesContext *GetAutoStyles();
443 const XMLFontStylesContext *GetFontDecls() const;
444 const SvXMLStylesContext *GetStyles() const;
445 const SvXMLStylesContext *GetAutoStyles() const;
447 SvXMLImportFlags getImportFlags() const { return mnImportFlags; }
448 bool IsFormsSupported() const { return mbIsFormsSupported; }
449 OUString GetAbsoluteReference(const OUString& rValue) const;
451 sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
452 sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
454 bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }
456 OUString const & GetODFVersion() const;
457 bool IsOOoXML() const; // legacy non-ODF format?
460 * Record an error condition that occurred during import. The
461 * behavior of SetError can be modified using the error flag
462 * constants.
464 void SetError(
465 /// error ID, may contain an error flag
466 sal_Int32 nId,
467 /// string parameters for the error message
468 const css::uno::Sequence< OUString > & rMsgParams,
469 /// original exception message (if applicable)
470 const OUString& rExceptionMessage,
471 /// error location (if applicable)
472 const css::uno::Reference< css::xml::sax::XLocator> & rLocator );
474 void SetError(
475 sal_Int32 nId,
476 const css::uno::Sequence< OUString> & rMsgParams);
478 void SetError( sal_Int32 nId );
479 void SetError( sal_Int32 nId, const OUString& rMsg1 );
480 void SetError( sal_Int32 nId, const OUString& rMsg1,
481 const OUString& rMsg2 );
483 virtual void DisposingModel();
485 ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
487 css::uno::Reference< css::uno::XComponentContext > const &
488 GetComponentContext() const;
490 // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#)
491 bool IsShapePositionInHoriL2R() const;
493 bool IsTextDocInOOoFileFormat() const;
495 OUString GetBaseURL() const;
496 OUString GetDocumentBase() const;
498 /// set the XmlId attribute of given UNO object (for RDF metadata)
499 void SetXmlId(css::uno::Reference<
500 css::uno::XInterface> const & i_xIfc,
501 OUString const & i_rXmlId);
503 /// Add a RDFa statement; parameters are XML attribute values
504 void AddRDFa( const css::uno::Reference< css::rdf::XMetadatable>& i_xObject,
505 OUString const & i_rAbout,
506 OUString const & i_rProperty,
507 OUString const & i_rContent,
508 OUString const & i_rDatatype);
510 /// do not dllexport this; only for advanced cases (bookmark-start)
511 SAL_DLLPRIVATE ::xmloff::RDFaImportHelper & GetRDFaImportHelper();
513 // #i31958# XForms helper method
514 // (to be implemented by applications supporting XForms)
515 virtual void initXForms();
517 /** returns the upd and build id (f.e. "680m124$Build-8964" gives rMaster = 680 and rBuild = 8964)
518 from the metafile.
519 this only works if the meta.xml was already imported and the
520 import propertyset contains the string property "BuildId".
521 If false is returned the build ids are not available (yet).
523 bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const;
525 static const OUString aDefaultNamespace;
526 static const OUString aNamespaceSeparator;
528 static const sal_uInt16 OOo_1x = 10;
529 static const sal_uInt16 OOo_2x = 20;
530 static const sal_uInt16 OOo_30x = 30;
531 static const sal_uInt16 OOo_31x = 31;
532 static const sal_uInt16 OOo_32x = 32;
533 static const sal_uInt16 OOo_33x = 33;
534 static const sal_uInt16 OOo_34x = 34;
535 // for AOO, no release overlaps with OOo, so continue OOo version numbers
536 static const sal_uInt16 AOO_40x = 40;
537 // @ATTENTION: it's not usually ok to use the "4x" "wildcard" in an "=="
538 // comparison, since that will match unreleased versions too; it is also
539 // risky to use it in "<" comparison, because it requires checking and
540 // possibly adapting all such uses when a new value for a more specific
541 // version is added.
542 static const sal_uInt16 AOO_4x = 41;
543 static const sal_uInt16 LO_flag = 0x100;
544 static const sal_uInt16 LO_3x = 30 | LO_flag;
545 static const sal_uInt16 LO_41x = 41 | LO_flag;
546 static const sal_uInt16 LO_42x = 42 | LO_flag;
547 static const sal_uInt16 LO_43x = 43 | LO_flag;
548 static const sal_uInt16 LO_44x = 44 | LO_flag;
549 static const sal_uInt16 LO_5x = 50 | LO_flag;
550 /// @ATTENTION: when adding a new value more specific than "6x", grep for
551 /// all current uses and adapt them!!!
552 static const sal_uInt16 LO_6x = 60 | LO_flag;
553 static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
555 /** depending on whether the generator version indicates LO, compare
556 against either the given LO or given OOo version */
557 bool isGeneratorVersionOlderThan(
558 sal_uInt16 const nOOoVersion, sal_uInt16 const nLOVersion);
560 /** this checks the build ID and returns
562 * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter)
563 * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8
564 * OOo_30x for files created with OpenOffice.org 3.0/3.0.1 or StarOffice 9/9 PU01
565 * OOo_31x for files created with OpenOffice.org 3.1/3.1.1 or StarOffice 9 PU02/9 PU03
566 * OOo_32x for files created with OpenOffice.org 3.2/3.2.1 or StarOffice 9 PU04 or Oracle Open Office 3.2.1
567 * OOo_33x for files created with OpenOffice.org 3.3 (and minors) or Oracle Open Office 3.3 (and minors)
568 * OOo_34x for files created with OpenOffice.org 3.4 Beta or Oracle Open Office 3.4 Beta
569 * ProductVersionUnknown for files not created with OpenOffice.org, StarOffice or Oracle Open Office
571 sal_uInt16 getGeneratorVersion() const;
574 Returns true if the embedded font document URL has already been processed.
575 Otherwise returns false and consequent calls with the same URL will return true.
577 bool embeddedFontAlreadyProcessed( const OUString& url );
579 virtual void NotifyEmbeddedFontRead() {};
580 // something referencing a macro/script was imported
581 void NotifyMacroEventRead();
583 bool needFixPositionAfterZ() const;
586 inline rtl::Reference< XMLTextImportHelper > const & SvXMLImport::GetTextImport()
588 if( !mxTextImport.is() )
589 mxTextImport = CreateTextImport();
591 return mxTextImport;
594 inline rtl::Reference< XMLShapeImportHelper > const & SvXMLImport::GetShapeImport()
596 if( !mxShapeImport.is() )
597 mxShapeImport = CreateShapeImport();
599 return mxShapeImport;
602 inline rtl::Reference< SchXMLImportHelper > const & SvXMLImport::GetChartImport()
604 if( !mxChartImport.is() )
605 mxChartImport = CreateChartImport();
607 return mxChartImport;
610 inline rtl::Reference< ::xmloff::OFormLayerXMLImport > const & SvXMLImport::GetFormImport()
612 if( !mxFormImport.is() )
613 mxFormImport = CreateFormImport();
615 return mxFormImport;
618 inline void SvXMLImport::SetEmbeddedResolver(
619 css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver )
621 mxEmbeddedResolver = _xEmbeddedResolver;
624 inline void SvXMLImport::SetGraphicStorageHandler(
625 css::uno::Reference<css::document::XGraphicStorageHandler> const & rxGraphicStorageHandler)
627 mxGraphicStorageHandler = rxGraphicStorageHandler;
630 inline css::uno::Reference< css::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier()
632 if ( ! mxNumberFormatsSupplier.is() && mxModel.is() )
633 CreateNumberFormatsSupplier_();
635 return mxNumberFormatsSupplier;
638 inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport()
640 if ( !mpNumImport )
641 CreateDataStylesImport_();
643 return mpNumImport.get();
647 #endif // INCLUDED_XMLOFF_XMLIMP_HXX
649 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */