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