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 <cppuhelper/weak.hxx>
43 : #include <xmloff/txtimp.hxx>
44 : #include <xmloff/shapeimport.hxx>
45 : #include <xmloff/SchXMLImportHelper.hxx>
46 : #include <xmloff/ProgressBarHelper.hxx>
47 : #include <cppuhelper/implbase6.hxx>
48 : #include <xmloff/formlayerimport.hxx>
49 :
50 : #include <com/sun/star/beans/NamedValue.hpp>
51 :
52 : namespace com { namespace sun { namespace star {
53 : namespace uno { class XComponentContext; }
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 :
142 : protected:
143 : // #110680#
144 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
145 :
146 : ::com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
147 : sal_Bool mbIsFormsSupported;
148 : bool mbIsTableShapeSupported;
149 : bool mbIsGraphicLoadOnDemandSupported;
150 :
151 : // This method is called after the namespace map has been updated, but
152 : // before a context for the current element has been pushed.
153 : virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
154 : const OUString& rLocalName,
155 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
156 :
157 : virtual XMLTextImportHelper* CreateTextImport();
158 : inline void ClearTextImport() { mxTextImport = 0; }
159 : virtual XMLShapeImportHelper* CreateShapeImport();
160 : inline sal_Bool HasShapeImport() const { return mxShapeImport.is(); }
161 : inline void ClearShapeImport() { mxShapeImport = 0; }
162 :
163 : virtual SchXMLImportHelper* CreateChartImport();
164 : virtual ::xmloff::OFormLayerXMLImport* CreateFormImport();
165 :
166 : void SetFontDecls( XMLFontStylesContext *pFontDecls );
167 : void SetStyles( SvXMLStylesContext *pStyles );
168 : void SetAutoStyles( SvXMLStylesContext *pAutoStyles );
169 : void SetMasterStyles( SvXMLStylesContext *pMasterStyles );
170 :
171 : sal_Bool IsODFVersionConsistent( const OUString& aODFVersion );
172 :
173 : const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
174 : inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
175 :
176 : const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
177 : void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver );
178 :
179 :
180 : void _CreateNumberFormatsSupplier();
181 : void _CreateDataStylesImport();
182 :
183 : public:
184 : // #110680#
185 : // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
186 : SvXMLImport(
187 : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
188 : sal_uInt16 nImportFlags = IMPORT_ALL ) throw();
189 :
190 : virtual ~SvXMLImport() throw();
191 :
192 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
193 :
194 : // ::com::sun::star::xml::sax::XDocumentHandler
195 : virtual void SAL_CALL startDocument(void)
196 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
197 : virtual void SAL_CALL endDocument(void)
198 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
199 : virtual void SAL_CALL startElement(const OUString& aName,
200 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
201 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
202 : virtual void SAL_CALL endElement(const OUString& aName)
203 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
204 : virtual void SAL_CALL characters(const OUString& aChars)
205 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
206 : virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces)
207 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
208 : virtual void SAL_CALL processingInstruction(const OUString& aTarget,
209 : const OUString& aData)
210 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
211 : virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
212 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
213 :
214 : // ::com::sun::star::xml::sax::XExtendedDocumentHandler
215 : virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
216 : virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException );
217 : virtual void SAL_CALL comment(const OUString& sComment)
218 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
219 : virtual void SAL_CALL allowLineBreak(void)
220 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
221 : virtual void SAL_CALL unknown(const OUString& sString)
222 : throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
223 :
224 : // XImporter
225 : 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);
226 :
227 : // XFilter
228 : virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException);
229 : virtual void SAL_CALL cancel( ) throw (::com::sun::star::uno::RuntimeException);
230 :
231 : // XInitialization
232 : 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);
233 :
234 : // XUnoTunnel
235 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
236 :
237 : // XServiceInfo
238 : virtual OUString SAL_CALL getImplementationName( )
239 : throw(::com::sun::star::uno::RuntimeException);
240 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
241 : throw(::com::sun::star::uno::RuntimeException);
242 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
243 : throw(::com::sun::star::uno::RuntimeException);
244 :
245 : // may be called by certain subclasses that handle document meta-data
246 : // override to provide customized handling of document statistics
247 : // the base class implementation initializes the progress bar and should
248 : // be called by overriding methods
249 : virtual void SetStatistics(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > & i_rStats);
250 :
251 : // get import helper for text
252 : inline UniReference< XMLTextImportHelper > GetTextImport();
253 137 : sal_Bool HasTextImport() const { return mxTextImport.is(); }
254 : inline SvXMLNumFmtHelper* GetDataStylesImport();
255 :
256 : // get import helper for shapes
257 : inline UniReference< XMLShapeImportHelper > GetShapeImport();
258 :
259 : // get import helper for charts
260 : inline UniReference< SchXMLImportHelper > GetChartImport();
261 :
262 : // get import helper for form layer
263 : inline UniReference< ::xmloff::OFormLayerXMLImport > GetFormImport();
264 :
265 : // get XPropertySet with import information
266 52 : inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getImportInfo() const { return mxImportInfo; }
267 :
268 : // get import helper for events
269 : XMLEventImportHelper& GetEventImport();
270 :
271 30123 : SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
272 0 : const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
273 : const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
274 4430 : SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
275 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & GetLocator() const { return mxLocator; }
276 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
277 1156 : GetModel() const { return mxModel; }
278 :
279 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetGradientHelper();
280 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetHatchHelper();
281 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetBitmapHelper();
282 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetTransGradientHelper();
283 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetMarkerHelper();
284 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetDashHelper();
285 : inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier();
286 : inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
287 : {
288 : mxNumberFormatsSupplier = _xNumberFormatSupplier;
289 : }
290 :
291 : // Convert a local packe URL into either a graphic manager or a
292 : // internal package URL. The later one happens only if bLoadURL is true
293 : OUString ResolveGraphicObjectURL( const OUString& rURL, sal_Bool bLoadOnDemand );
294 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
295 : GetStreamForGraphicObjectURLFromBase64();
296 : OUString ResolveGraphicObjectURLFromBase64(
297 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOut );
298 :
299 : sal_Bool IsPackageURL( const OUString& rURL ) const;
300 : OUString ResolveEmbeddedObjectURL( const OUString& rURL,
301 : const OUString& rClassId );
302 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
303 : GetStreamForEmbeddedObjectURLFromBase64();
304 : OUString ResolveEmbeddedObjectURLFromBase64();
305 :
306 : // get source storage we're importing from (if available)
307 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
308 : GetSourceStorage();
309 :
310 : void AddStyleDisplayName( sal_uInt16 nFamily,
311 : const OUString& rName,
312 : const OUString& rDisplayName );
313 : OUString GetStyleDisplayName( sal_uInt16 nFamily,
314 : const OUString& rName ) const;
315 :
316 : ProgressBarHelper* GetProgressBarHelper();
317 :
318 : void AddNumberStyle(sal_Int32 nKey, const OUString& sName);
319 :
320 : virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
321 : virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps);
322 : virtual void SetDocumentSpecificSettings(const OUString& _rSettingsGroupName,
323 : const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& _rSettings);
324 :
325 : XMLFontStylesContext *GetFontDecls();
326 : SvXMLStylesContext *GetStyles();
327 : SvXMLStylesContext *GetAutoStyles();
328 : const XMLFontStylesContext *GetFontDecls() const;
329 : const SvXMLStylesContext *GetStyles() const;
330 : const SvXMLStylesContext *GetAutoStyles() const;
331 :
332 102 : sal_uInt16 getImportFlags() const { return mnImportFlags; }
333 43 : sal_Bool IsFormsSupported() const { return mbIsFormsSupported; }
334 : OUString GetAbsoluteReference(const OUString& rValue) const;
335 :
336 : sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
337 : sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
338 :
339 2 : bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }
340 :
341 : OUString GetODFVersion() const;
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 : // #110680#
376 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
377 :
378 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
379 : GetComponentContext() const;
380 :
381 : // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#)
382 : sal_Bool IsShapePositionInHoriL2R() const;
383 :
384 : sal_Bool IsTextDocInOOoFileFormat() const;
385 :
386 : OUString GetBaseURL() const;
387 : OUString GetDocumentBase() const;
388 :
389 : /// name of stream in package, e.g., "content.xml"
390 : OUString GetStreamName() const;
391 :
392 : /// set the XmlId attribute of given UNO object (for RDF metadata)
393 : void SetXmlId(::com::sun::star::uno::Reference<
394 : ::com::sun::star::uno::XInterface> const & i_xIfc,
395 : OUString const & i_rXmlId);
396 :
397 : /// Add a RDFa statement; parameters are XML attribute values
398 : void AddRDFa( ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable> i_xObject,
399 : OUString const & i_rAbout,
400 : OUString const & i_rProperty,
401 : OUString const & i_rContent,
402 : OUString const & i_rDatatype);
403 :
404 : /// do not dllexport this; only for advanced cases (bookmark-start)
405 : SAL_DLLPRIVATE ::xmloff::RDFaImportHelper & GetRDFaImportHelper();
406 :
407 : // #i31958# XForms helper method
408 : // (to be implemented by applications suporting XForms)
409 : virtual void initXForms();
410 :
411 : /** returns the upd and build id (f.e. "680m124$Build-8964" gives rMaster = 680 and rBuild = 8964)
412 : from the metafile.
413 : this only works if the meta.xml was already imported and the
414 : import propertyset contains the string property "BuildId".
415 : If false is returned the build ids are not available (yet).
416 : **/
417 : bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const;
418 :
419 : static const sal_uInt16 OOo_1x = 10;
420 : static const sal_uInt16 OOo_2x = 20;
421 : static const sal_uInt16 OOo_30x = 30;
422 : static const sal_uInt16 OOo_31x = 31;
423 : static const sal_uInt16 OOo_32x = 32;
424 : static const sal_uInt16 OOo_33x = 33;
425 : static const sal_uInt16 OOo_34x = 34;
426 : static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
427 :
428 : /** this checks the build ID and returns
429 :
430 : * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter)
431 : * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8
432 : * OOo_30x for files created with OpenOffice.org 3.0/3.0.1 or StarOffice 9/9 PU01
433 : * OOo_31x for files created with OpenOffice.org 3.1/3.1.1 or StarOffice 9 PU02/9 PU03
434 : * OOo_32x for files created with OpenOffice.org 3.2/3.2.1 or StarOffice 9 PU04 or Oracle Open Office 3.2.1
435 : * OOo_33x for files created with OpenOffice.org 3.3 (and minors) or Oracle Open Office 3.3 (and minors)
436 : * OOo_34x for files created with OpenOffice.org 3.4 Beta or Oracle Open Office 3.4 Beta
437 : * ProductVersionUnknown for files not created with OpenOffice.org, StarOffice or Oracle Open Office
438 : */
439 : sal_uInt16 getGeneratorVersion() const;
440 :
441 : /** If true, the URL for graphic shapes may be stored as a package URL and
442 : loaded later (on demand) by the application. Otherwise graphics are
443 : loaded immediately and the graphic shape gets the graphic manager URL.
444 :
445 : @see <member>mbIsGraphicLoadOnDemandSupported</member>
446 : */
447 : bool isGraphicLoadOnDemandSupported() const;
448 : };
449 :
450 4093 : inline UniReference< XMLTextImportHelper > SvXMLImport::GetTextImport()
451 : {
452 4093 : if( !mxTextImport.is() )
453 48 : mxTextImport = CreateTextImport();
454 :
455 4093 : return mxTextImport;
456 : }
457 :
458 1676 : inline UniReference< XMLShapeImportHelper > SvXMLImport::GetShapeImport()
459 : {
460 1676 : if( !mxShapeImport.is() )
461 86 : mxShapeImport = CreateShapeImport();
462 :
463 1676 : return mxShapeImport;
464 : }
465 :
466 82 : inline UniReference< SchXMLImportHelper > SvXMLImport::GetChartImport()
467 : {
468 82 : if( !mxChartImport.is() )
469 82 : mxChartImport = CreateChartImport();
470 :
471 82 : return mxChartImport;
472 : }
473 :
474 126 : inline UniReference< ::xmloff::OFormLayerXMLImport > SvXMLImport::GetFormImport()
475 : {
476 126 : if( !mxFormImport.is() )
477 48 : mxFormImport = CreateFormImport();
478 :
479 126 : return mxFormImport;
480 : }
481 :
482 : inline void SvXMLImport::SetEmbeddedResolver(
483 : com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
484 : {
485 : mxEmbeddedResolver = _xEmbeddedResolver;
486 : }
487 :
488 : inline void SvXMLImport::SetGraphicResolver(
489 : com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
490 : {
491 : mxGraphicResolver = _xGraphicResolver;
492 : }
493 :
494 220 : inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier()
495 : {
496 220 : if ( ! mxNumberFormatsSupplier.is() && mxModel.is() )
497 220 : _CreateNumberFormatsSupplier();
498 :
499 220 : return mxNumberFormatsSupplier;
500 : }
501 :
502 2113 : inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport()
503 : {
504 2113 : if ( mpNumImport == NULL)
505 220 : _CreateDataStylesImport();
506 :
507 2113 : return mpNumImport;
508 : }
509 :
510 :
511 : #endif // _XMLOFF_XMLIMP_HXX
512 :
513 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|