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_XMLIMP_HXX
21 : #define _XMLOFF_XMLIMP_HXX
22 :
23 : #include "sal/config.h"
24 : #include "xmloff/dllapi.h"
25 : #include "sal/types.h"
26 : #include <com/sun/star/embed/XStorage.hpp>
27 : #include <com/sun/star/xml/sax/SAXParseException.hpp>
28 : #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
29 : #include <com/sun/star/xml/sax/SAXException.hpp>
30 : #include <com/sun/star/xml/sax/XAttributeList.hpp>
31 : #include <com/sun/star/xml/sax/XLocator.hpp>
32 : #include <com/sun/star/lang/XUnoTunnel.hpp>
33 : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
34 : #include <com/sun/star/container/XNameContainer.hpp>
35 : #include <com/sun/star/lang/XInitialization.hpp>
36 : #include <com/sun/star/lang/XServiceInfo.hpp>
37 : #include <com/sun/star/document/XImporter.hpp>
38 : #include <com/sun/star/document/XFilter.hpp>
39 : #include <com/sun/star/document/XGraphicObjectResolver.hpp>
40 : #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
41 : #include <com/sun/star/beans/XPropertySet.hpp>
42 : #include <com/sun/star/uno/XComponentContext.hpp>
43 : #include <cppuhelper/weak.hxx>
44 : #include <xmloff/txtimp.hxx>
45 : #include <xmloff/shapeimport.hxx>
46 : #include <xmloff/SchXMLImportHelper.hxx>
47 : #include <xmloff/ProgressBarHelper.hxx>
48 : #include <cppuhelper/implbase6.hxx>
49 : #include <xmloff/formlayerimport.hxx>
50 :
51 : #include <com/sun/star/beans/NamedValue.hpp>
52 :
53 : namespace com { namespace sun { namespace star {
54 : namespace frame { class XModel; }
55 : namespace io { class XOutputStream; }
56 : namespace rdf { class XMetadatable; }
57 : } } }
58 : namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
59 :
60 : class SvXMLNamespaceMap;
61 : class SvXMLImportContext;
62 : class SvXMLImportContexts_Impl;
63 : class SvXMLImport_Impl;
64 : class SvXMLUnitConverter;
65 : class SvXMLNumFmtHelper;
66 : class XMLFontStylesContext;
67 : class XMLEventImportHelper;
68 : class XMLErrors;
69 : class StyleMap;
70 :
71 : namespace xmloff {
72 : class RDFaImportHelper;
73 : }
74 :
75 : #define IMPORT_META 0x0001
76 : #define IMPORT_STYLES 0x0002
77 : #define IMPORT_MASTERSTYLES 0x0004
78 : #define IMPORT_AUTOSTYLES 0x0008
79 : #define IMPORT_CONTENT 0x0010
80 : #define IMPORT_SCRIPTS 0x0020
81 : #define IMPORT_SETTINGS 0x0040
82 : #define IMPORT_FONTDECLS 0x0080
83 : #define IMPORT_EMBEDDED 0x0100
84 : #define IMPORT_OOO_NAMESPACES 0x0100
85 : #define IMPORT_ALL 0xffff
86 :
87 :
88 :
89 : class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper6<
90 : ::com::sun::star::xml::sax::XExtendedDocumentHandler,
91 : ::com::sun::star::lang::XServiceInfo,
92 : ::com::sun::star::lang::XInitialization,
93 : ::com::sun::star::document::XImporter,
94 : ::com::sun::star::document::XFilter,
95 : ::com::sun::star::lang::XUnoTunnel>
96 : {
97 : friend class SvXMLImportContext;
98 :
99 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > mxLocator;
100 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
101 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
102 : ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver;
103 : ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
104 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxImportInfo;
105 :
106 : UniReference< XMLTextImportHelper > mxTextImport;
107 : UniReference< XMLShapeImportHelper > mxShapeImport;
108 : UniReference< SchXMLImportHelper > mxChartImport;
109 : UniReference< ::xmloff::OFormLayerXMLImport > mxFormImport;
110 :
111 : SvXMLImportContextRef mxFontDecls;
112 : SvXMLImportContextRef mxStyles;
113 : SvXMLImportContextRef mxAutoStyles;
114 : SvXMLImportContextRef mxMasterStyles;
115 :
116 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxGradientHelper;
117 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxHatchHelper;
118 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxBitmapHelper;
119 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxTransGradientHelper;
120 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxMarkerHelper;
121 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxDashHelper;
122 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxNumberStyles;
123 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener;
124 :
125 : SvXMLImport_Impl *mpImpl; // dummy
126 :
127 : SvXMLNamespaceMap *mpNamespaceMap;
128 : SvXMLUnitConverter *mpUnitConv;
129 : SvXMLImportContexts_Impl *mpContexts;
130 : SvXMLNumFmtHelper *mpNumImport;
131 : ProgressBarHelper *mpProgressBarHelper;
132 : XMLEventImportHelper *mpEventImportHelper;
133 : XMLErrors *mpXMLErrors;
134 : StyleMap *mpStyleMap;
135 : OUString msPackageProtocol;
136 :
137 : SAL_DLLPRIVATE void _InitCtor();
138 :
139 : sal_uInt16 mnImportFlags;
140 : sal_uInt16 mnErrorFlags;
141 : std::set< OUString > embeddedFontUrlsKnown;
142 :
143 : protected:
144 :
145 : ::com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
146 : sal_Bool mbIsFormsSupported;
147 : bool mbIsTableShapeSupported;
148 : bool mbIsGraphicLoadOnDemandSupported;
149 :
150 : // This method is called after the namespace map has been updated, but
151 : // before a context for the current element has been pushed.
152 : virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
153 : const OUString& rLocalName,
154 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
155 :
156 : virtual XMLTextImportHelper* CreateTextImport();
157 207 : inline void ClearTextImport() { mxTextImport = 0; }
158 : virtual XMLShapeImportHelper* CreateShapeImport();
159 207 : inline sal_Bool HasShapeImport() const { return mxShapeImport.is(); }
160 103 : inline void ClearShapeImport() { mxShapeImport = 0; }
161 :
162 : virtual SchXMLImportHelper* CreateChartImport();
163 : virtual ::xmloff::OFormLayerXMLImport* CreateFormImport();
164 :
165 : void SetFontDecls( XMLFontStylesContext *pFontDecls );
166 : void SetStyles( SvXMLStylesContext *pStyles );
167 : void SetAutoStyles( SvXMLStylesContext *pAutoStyles );
168 : void SetMasterStyles( SvXMLStylesContext *pMasterStyles );
169 :
170 : sal_Bool IsODFVersionConsistent( const OUString& aODFVersion );
171 :
172 104 : const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
173 : inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
174 :
175 104 : const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
176 : void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver );
177 :
178 :
179 : void _CreateNumberFormatsSupplier();
180 : void _CreateDataStylesImport();
181 :
182 : public:
183 : // #110680#
184 : // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
185 : SvXMLImport(
186 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
187 : sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
188 :
189 : virtual ~SvXMLImport() throw();
190 :
191 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
192 :
193 : // ::com::sun::star::xml::sax::XDocumentHandler
194 : virtual void SAL_CALL startDocument(void)
195 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
196 : virtual void SAL_CALL endDocument(void)
197 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
198 : virtual void SAL_CALL startElement(const OUString& aName,
199 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
200 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
201 : virtual void SAL_CALL endElement(const OUString& aName)
202 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
203 : virtual void SAL_CALL characters(const OUString& aChars)
204 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
205 : virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces)
206 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
207 : virtual void SAL_CALL processingInstruction(const OUString& aTarget,
208 : const OUString& aData)
209 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
210 : virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
211 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
212 :
213 : // ::com::sun::star::xml::sax::XExtendedDocumentHandler
214 : virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
215 : virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException );
216 : virtual void SAL_CALL comment(const OUString& sComment)
217 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
218 : virtual void SAL_CALL allowLineBreak(void)
219 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
220 : virtual void SAL_CALL unknown(const OUString& sString)
221 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
222 :
223 : // XImporter
224 : virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
225 :
226 : // XFilter
227 : virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException);
228 : virtual void SAL_CALL cancel( ) throw (::com::sun::star::uno::RuntimeException);
229 :
230 : // XInitialization
231 : 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);
232 :
233 : // XUnoTunnel
234 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
235 :
236 : // XServiceInfo
237 : virtual OUString SAL_CALL getImplementationName( )
238 : throw(::com::sun::star::uno::RuntimeException);
239 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
240 : throw(::com::sun::star::uno::RuntimeException);
241 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
242 : throw(::com::sun::star::uno::RuntimeException);
243 :
244 : // may be called by certain subclasses that handle document meta-data
245 : // override to provide customized handling of document statistics
246 : // the base class implementation initializes the progress bar and should
247 : // be called by overriding methods
248 : virtual void SetStatistics(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > & i_rStats);
249 :
250 : // get import helper for text
251 : inline UniReference< XMLTextImportHelper > GetTextImport();
252 515 : sal_Bool HasTextImport() const { return mxTextImport.is(); }
253 : inline SvXMLNumFmtHelper* GetDataStylesImport();
254 :
255 : // get import helper for shapes
256 : inline UniReference< XMLShapeImportHelper > GetShapeImport();
257 :
258 : // get import helper for charts
259 : inline UniReference< SchXMLImportHelper > GetChartImport();
260 :
261 : // get import helper for form layer
262 : inline UniReference< ::xmloff::OFormLayerXMLImport > GetFormImport();
263 :
264 : // get XPropertySet with import information
265 962 : inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getImportInfo() const { return mxImportInfo; }
266 :
267 : // get import helper for events
268 : XMLEventImportHelper& GetEventImport();
269 :
270 138825 : SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
271 482 : const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
272 : const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
273 15170 : SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
274 320 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & GetLocator() const { return mxLocator; }
275 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
276 11751 : GetModel() const { return mxModel; }
277 :
278 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetGradientHelper();
279 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetHatchHelper();
280 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetBitmapHelper();
281 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetTransGradientHelper();
282 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetMarkerHelper();
283 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetDashHelper();
284 : inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier();
285 9 : inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
286 : {
287 9 : mxNumberFormatsSupplier = _xNumberFormatSupplier;
288 9 : }
289 :
290 : // Convert a local packe URL into either a graphic manager or a
291 : // internal package URL. The later one happens only if bLoadURL is true
292 : OUString ResolveGraphicObjectURL( const OUString& rURL, sal_Bool bLoadOnDemand );
293 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
294 : GetStreamForGraphicObjectURLFromBase64();
295 : OUString ResolveGraphicObjectURLFromBase64(
296 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOut );
297 :
298 : sal_Bool IsPackageURL( const OUString& rURL ) const;
299 : OUString ResolveEmbeddedObjectURL( const OUString& rURL,
300 : const OUString& rClassId );
301 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
302 : GetStreamForEmbeddedObjectURLFromBase64();
303 : OUString ResolveEmbeddedObjectURLFromBase64();
304 :
305 : // get source storage we're importing from (if available)
306 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
307 : GetSourceStorage();
308 :
309 : void AddStyleDisplayName( sal_uInt16 nFamily,
310 : const OUString& rName,
311 : const OUString& rDisplayName );
312 : OUString GetStyleDisplayName( sal_uInt16 nFamily,
313 : const OUString& rName ) const;
314 :
315 : ProgressBarHelper* GetProgressBarHelper();
316 :
317 : void AddNumberStyle(sal_Int32 nKey, const OUString& sName);
318 :
319 : virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
320 : virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps);
321 : virtual void SetDocumentSpecificSettings(const OUString& _rSettingsGroupName,
322 : const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& _rSettings);
323 :
324 : XMLFontStylesContext *GetFontDecls();
325 : SvXMLStylesContext *GetStyles();
326 : SvXMLStylesContext *GetAutoStyles();
327 : const XMLFontStylesContext *GetFontDecls() const;
328 : const SvXMLStylesContext *GetStyles() const;
329 : const SvXMLStylesContext *GetAutoStyles() const;
330 :
331 3541 : sal_uInt16 getImportFlags() const { return mnImportFlags; }
332 110 : sal_Bool IsFormsSupported() const { return mbIsFormsSupported; }
333 : OUString GetAbsoluteReference(const OUString& rValue) const;
334 :
335 : sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
336 : sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
337 :
338 2 : bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }
339 :
340 : OUString GetODFVersion() const;
341 : bool IsOOoXML() const; // legacy non-ODF format?
342 :
343 : /**
344 : * Record an error condition that occurred during import. The
345 : * behavior of SetError can be modified using the error flag
346 : * constants.
347 : */
348 : void SetError(
349 : /// error ID, may contain an error flag
350 : sal_Int32 nId,
351 : /// string parameters for the error message
352 : const ::com::sun::star::uno::Sequence< OUString > & rMsgParams,
353 : /// original exception message (if applicable)
354 : const OUString& rExceptionMessage,
355 : /// error location (if applicable)
356 : const ::com::sun::star::uno::Reference<
357 : ::com::sun::star::xml::sax::XLocator> & rLocator );
358 :
359 : void SetError(
360 : sal_Int32 nId,
361 : const ::com::sun::star::uno::Sequence< OUString> & rMsgParams);
362 :
363 : void SetError( sal_Int32 nId );
364 : void SetError( sal_Int32 nId, const OUString& rMsg1 );
365 : void SetError( sal_Int32 nId, const OUString& rMsg1,
366 : const OUString& rMsg2 );
367 :
368 : /** return current error flags */
369 : sal_uInt16 GetErrorFlags() { return mnErrorFlags; }
370 :
371 : virtual void DisposingModel();
372 :
373 : ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
374 :
375 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
376 : GetComponentContext() const;
377 :
378 : // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#)
379 : sal_Bool IsShapePositionInHoriL2R() const;
380 :
381 : sal_Bool IsTextDocInOOoFileFormat() const;
382 :
383 : OUString GetBaseURL() const;
384 : OUString GetDocumentBase() const;
385 :
386 : /// name of stream in package, e.g., "content.xml"
387 : OUString GetStreamName() const;
388 :
389 : /// set the XmlId attribute of given UNO object (for RDF metadata)
390 : void SetXmlId(::com::sun::star::uno::Reference<
391 : ::com::sun::star::uno::XInterface> const & i_xIfc,
392 : OUString const & i_rXmlId);
393 :
394 : /// Add a RDFa statement; parameters are XML attribute values
395 : void AddRDFa( ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable> i_xObject,
396 : OUString const & i_rAbout,
397 : OUString const & i_rProperty,
398 : OUString const & i_rContent,
399 : OUString const & i_rDatatype);
400 :
401 : /// do not dllexport this; only for advanced cases (bookmark-start)
402 : SAL_DLLPRIVATE ::xmloff::RDFaImportHelper & GetRDFaImportHelper();
403 :
404 : // #i31958# XForms helper method
405 : // (to be implemented by applications suporting XForms)
406 : virtual void initXForms();
407 :
408 : /** returns the upd and build id (f.e. "680m124$Build-8964" gives rMaster = 680 and rBuild = 8964)
409 : from the metafile.
410 : this only works if the meta.xml was already imported and the
411 : import propertyset contains the string property "BuildId".
412 : If false is returned the build ids are not available (yet).
413 : **/
414 : bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const;
415 :
416 : static const sal_uInt16 OOo_1x = 10;
417 : static const sal_uInt16 OOo_2x = 20;
418 : static const sal_uInt16 OOo_30x = 30;
419 : static const sal_uInt16 OOo_31x = 31;
420 : static const sal_uInt16 OOo_32x = 32;
421 : static const sal_uInt16 OOo_33x = 33;
422 : static const sal_uInt16 OOo_34x = 34;
423 : static const sal_uInt16 LO_flag = 0x100;
424 : static const sal_uInt16 LO_3x = 30 | LO_flag;
425 : static const sal_uInt16 LO_4x = 40 | LO_flag;
426 : static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
427 :
428 : /** depending on whether the generator version indicates LO, compare
429 : against either the given LO or given OOo version */
430 : bool isGeneratorVersionOlderThan(
431 : sal_uInt16 const nOOoVersion, sal_uInt16 const nLOVersion);
432 :
433 : /** this checks the build ID and returns
434 :
435 : * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter)
436 : * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8
437 : * OOo_30x for files created with OpenOffice.org 3.0/3.0.1 or StarOffice 9/9 PU01
438 : * OOo_31x for files created with OpenOffice.org 3.1/3.1.1 or StarOffice 9 PU02/9 PU03
439 : * OOo_32x for files created with OpenOffice.org 3.2/3.2.1 or StarOffice 9 PU04 or Oracle Open Office 3.2.1
440 : * OOo_33x for files created with OpenOffice.org 3.3 (and minors) or Oracle Open Office 3.3 (and minors)
441 : * OOo_34x for files created with OpenOffice.org 3.4 Beta or Oracle Open Office 3.4 Beta
442 : * ProductVersionUnknown for files not created with OpenOffice.org, StarOffice or Oracle Open Office
443 : */
444 : sal_uInt16 getGeneratorVersion() const;
445 :
446 : /** If true, the URL for graphic shapes may be stored as a package URL and
447 : loaded later (on demand) by the application. Otherwise graphics are
448 : loaded immediately and the graphic shape gets the graphic manager URL.
449 :
450 : @see <member>mbIsGraphicLoadOnDemandSupported</member>
451 : */
452 : bool isGraphicLoadOnDemandSupported() const;
453 :
454 : /**
455 : Returns true if the embedded font document URL has already been processed.
456 : Otherwise returns false and consequent calls with the same URL will return true.
457 : */
458 : bool embeddedFontAlreadyProcessed( const OUString& url );
459 :
460 0 : virtual void NotifyEmbeddedFontRead() {};
461 : };
462 :
463 25755 : inline UniReference< XMLTextImportHelper > SvXMLImport::GetTextImport()
464 : {
465 25755 : if( !mxTextImport.is() )
466 402 : mxTextImport = CreateTextImport();
467 :
468 25755 : return mxTextImport;
469 : }
470 :
471 3743 : inline UniReference< XMLShapeImportHelper > SvXMLImport::GetShapeImport()
472 : {
473 3743 : if( !mxShapeImport.is() )
474 318 : mxShapeImport = CreateShapeImport();
475 :
476 3743 : return mxShapeImport;
477 : }
478 :
479 298 : inline UniReference< SchXMLImportHelper > SvXMLImport::GetChartImport()
480 : {
481 298 : if( !mxChartImport.is() )
482 298 : mxChartImport = CreateChartImport();
483 :
484 298 : return mxChartImport;
485 : }
486 :
487 785 : inline UniReference< ::xmloff::OFormLayerXMLImport > SvXMLImport::GetFormImport()
488 : {
489 785 : if( !mxFormImport.is() )
490 298 : mxFormImport = CreateFormImport();
491 :
492 785 : return mxFormImport;
493 : }
494 :
495 0 : inline void SvXMLImport::SetEmbeddedResolver(
496 : com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
497 : {
498 0 : mxEmbeddedResolver = _xEmbeddedResolver;
499 0 : }
500 :
501 175 : inline void SvXMLImport::SetGraphicResolver(
502 : com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
503 : {
504 175 : mxGraphicResolver = _xGraphicResolver;
505 175 : }
506 :
507 655 : inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier()
508 : {
509 655 : if ( ! mxNumberFormatsSupplier.is() && mxModel.is() )
510 603 : _CreateNumberFormatsSupplier();
511 :
512 655 : return mxNumberFormatsSupplier;
513 : }
514 :
515 7284 : inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport()
516 : {
517 7284 : if ( mpNumImport == NULL)
518 611 : _CreateDataStylesImport();
519 :
520 7284 : return mpNumImport;
521 : }
522 :
523 :
524 : #endif // _XMLOFF_XMLIMP_HXX
525 :
526 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|