xref: /AOO41X/main/xmloff/inc/xmloff/xmlimp.hxx (revision ecfe53c5d1886e1e0d215b0d140d05282ab1c477)
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         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
218     virtual void SAL_CALL endDocument(void)
219         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
220     virtual void SAL_CALL startElement(const ::rtl::OUString& aName,
221                               const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
222         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
223     virtual void SAL_CALL endElement(const ::rtl::OUString& aName)
224         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
225     virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
226         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
227     virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces)
228         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
229     virtual void SAL_CALL processingInstruction(const ::rtl::OUString& aTarget,
230                                        const ::rtl::OUString& aData)
231         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
232     virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
233         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
234 
235     // ::com::sun::star::xml::sax::XExtendedDocumentHandler
236     virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
237     virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException );
238     virtual void SAL_CALL comment(const ::rtl::OUString& sComment)
239         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
240     virtual void SAL_CALL allowLineBreak(void)
241         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
242     virtual void SAL_CALL unknown(const ::rtl::OUString& sString)
243         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
244 
245     // XImporter
246     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);
247 
248     // XFilter
249     virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException);
250     virtual void SAL_CALL cancel(  ) throw (::com::sun::star::uno::RuntimeException);
251 
252     // XInitialization
253     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);
254 
255     // XUnoTunnel
256     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
257 
258     // XServiceInfo
259     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
260     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
261     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
262 
263     // may be called by certain subclasses that handle document meta-data
264     // override to provide customized handling of document statistics
265     // the base class implementation initializes the progress bar and should
266     // be called by overriding methods
267     virtual void SetStatistics(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > & i_rStats);
268 
269     // get import helper for text
270     inline UniReference< XMLTextImportHelper > GetTextImport();
HasTextImport() const271     sal_Bool HasTextImport() const { return mxTextImport.is(); }
272     inline SvXMLNumFmtHelper* GetDataStylesImport();
273 
274     // get import helper for shapes
275     inline UniReference< XMLShapeImportHelper > GetShapeImport();
276 
277     // get import helper for charts
278     inline UniReference< SchXMLImportHelper > GetChartImport();
279 
280     // get import helper for form layer
281     inline UniReference< ::xmloff::OFormLayerXMLImport > GetFormImport();
282 
283     // get XPropertySet with import information
getImportInfo() const284     inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getImportInfo() const { return mxImportInfo; }
285 
286     // get import helper for events
287     XMLEventImportHelper& GetEventImport();
288 
GetNamespaceMap()289     SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
GetNamespaceMap() const290     const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
GetMM100UnitConverter() const291     const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
GetMM100UnitConverter()292         SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
GetLocator() const293     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & GetLocator() const { return mxLocator; }
294     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
GetModel() const295         GetModel() const { return mxModel; }
296 
297     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetGradientHelper();
298     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetHatchHelper();
299     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetBitmapHelper();
300     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetTransGradientHelper();
301     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetMarkerHelper();
302     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetDashHelper();
303     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)304     inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
305     {
306         mxNumberFormatsSupplier = _xNumberFormatSupplier;
307     }
308 
309     // Convert a local packe URL into either a graphic manager or a
310     // internal package URL. The later one happens only if bLoadURL is true
311     ::rtl::OUString ResolveGraphicObjectURL( const ::rtl::OUString& rURL, sal_Bool bLoadOnDemand );
312     ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
313         GetStreamForGraphicObjectURLFromBase64();
314     ::rtl::OUString ResolveGraphicObjectURLFromBase64(
315         const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOut );
316 
317     sal_Bool IsPackageURL( const ::rtl::OUString& rURL ) const;
318     ::rtl::OUString ResolveEmbeddedObjectURL( const ::rtl::OUString& rURL,
319                                               const ::rtl::OUString& rClassId );
320     ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
321         GetStreamForEmbeddedObjectURLFromBase64();
322     ::rtl::OUString ResolveEmbeddedObjectURLFromBase64();
323 
324     void AddStyleDisplayName( sal_uInt16 nFamily,
325                               const ::rtl::OUString& rName,
326                               const ::rtl::OUString& rDisplayName );
327     ::rtl::OUString GetStyleDisplayName( sal_uInt16 nFamily,
328                                       const ::rtl::OUString& rName ) const;
329 
330     ProgressBarHelper*  GetProgressBarHelper();
331 
332     void AddNumberStyle(sal_Int32 nKey, const rtl::OUString& sName);
333 
334     virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
335     virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps);
336     virtual void SetDocumentSpecificSettings(const ::rtl::OUString& _rSettingsGroupName,
337                     const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& _rSettings);
338 
339     XMLFontStylesContext *GetFontDecls();
340     SvXMLStylesContext *GetStyles();
341     SvXMLStylesContext *GetAutoStyles();
342     SvXMLStylesContext *GetMasterStyles();
343     const XMLFontStylesContext *GetFontDecls() const;
344     const SvXMLStylesContext *GetStyles() const;
345     const SvXMLStylesContext *GetAutoStyles() const;
346     const SvXMLStylesContext *GetMasterStyles() const;
347 
getImportFlags() const348     sal_uInt16  getImportFlags() const { return mnImportFlags; }
IsFormsSupported() const349     sal_Bool    IsFormsSupported() const { return mbIsFormsSupported; }
350     rtl::OUString GetAbsoluteReference(const rtl::OUString& rValue) const;
351 
352     sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c );
353     sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c );
354 
IsTableShapeSupported() const355     bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }
356 
357     ::rtl::OUString GetODFVersion() const;
358 
359     /**
360      * Record an error condition that occured during import. The
361      * behavior of SetError can be modified using the error flag
362      * constants.
363      */
364     void SetError(
365         /// error ID, may contain an error flag
366         sal_Int32 nId,
367         /// string parameters for the error message
368         const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams,
369         /// original exception message (if applicable)
370         const ::rtl::OUString& rExceptionMessage,
371         /// error location (if applicable)
372         const ::com::sun::star::uno::Reference<
373             ::com::sun::star::xml::sax::XLocator> & rLocator );
374 
375     void SetError(
376         sal_Int32 nId,
377         const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams);
378 
379     void SetError( sal_Int32 nId );
380     void SetError( sal_Int32 nId, const rtl::OUString& rMsg1 );
381     void SetError( sal_Int32 nId, const rtl::OUString& rMsg1,
382                                   const rtl::OUString& rMsg2 );
383     void SetError( sal_Int32 nId, const rtl::OUString& rMsg1,
384                                   const rtl::OUString& rMsg2,
385                                   const rtl::OUString& rMsg3 );
386     void SetError( sal_Int32 nId, const rtl::OUString& rMsg1,
387                                   const rtl::OUString& rMsg2,
388                                   const rtl::OUString& rMsg3,
389                                   const rtl::OUString& rMsg4 );
390 
391     /** return list of errors */
392     XMLErrors* GetErrors();
393 
394     /** return current error flags */
GetErrorFlags()395     sal_uInt16 GetErrorFlags()  { return mnErrorFlags; }
396 
397     virtual void DisposingModel();
398 
399     ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
400 
401     // #110680#
402     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
403 
404     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
405     GetComponentContext() const;
406 
407     // --> OD 2004-08-10 #i28749#
408     sal_Bool IsShapePositionInHoriL2R() const;
409     // <--
410 
411     // --> OD 2007-12-19 #152540#
412     sal_Bool IsTextDocInOOoFileFormat() const;
413     // <--
414 
415     String GetBaseURL() const;
416     String GetDocumentBase() const;
417 
418     /// name of stream in package, e.g., "content.xml"
419     ::rtl::OUString GetStreamName() const;
420 
421     /// set the XmlId attribute of given UNO object (for RDF metadata)
422     void SetXmlId(::com::sun::star::uno::Reference<
423             ::com::sun::star::uno::XInterface> const & i_xIfc,
424         ::rtl::OUString const & i_rXmlId);
425 
426     /// Add a RDFa statement; parameters are XML attribute values
427     void AddRDFa(
428         ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
429             i_xObject,
430         ::rtl::OUString const & i_rAbout,
431         ::rtl::OUString const & i_rProperty,
432         ::rtl::OUString const & i_rContent,
433         ::rtl::OUString const & i_rDatatype);
434 
435     /// do not dllexport this; only for advanced cases (bookmark-start)
436     SAL_DLLPRIVATE ::xmloff::RDFaImportHelper & GetRDFaImportHelper();
437 
438     // #i31958# XForms helper method
439     // (to be implemented by applications suporting XForms)
440     virtual void initXForms();
441 
442     /** returns the upd and build id (f.e. "680m124$Build-8964" gives rMaster = 680 and rBuild = 8964)
443         from the metafile.
444         this only works if the meta.xml was already imported and the
445         import propertyset contains the string property "BuildId".
446         If false is returned the build ids are not available (yet).
447     **/
448     bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const;
449 
450     static const sal_uInt16 OOo_1x = 10;
451     static const sal_uInt16 OOo_2x = 20;
452     // --> ORW
453     static const sal_uInt16 OOo_30x = 30;
454     static const sal_uInt16 OOo_31x = 31;
455     static const sal_uInt16 OOo_32x = 32;
456     static const sal_uInt16 OOo_33x = 33;
457     static const sal_uInt16 OOo_34x = 34;
458     static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16;
459     // <--
460 
461     /** this checks the build ID and returns
462 
463         * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter)
464         * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8
465         * OOo_30x for files created with OpenOffice.org 3.0/3.0.1 or StarOffice 9/9 PU01
466         * OOo_31x for files created with OpenOffice.org 3.1/3.1.1 or StarOffice 9 PU02/9 PU03
467         * OOo_32x for files created with OpenOffice.org 3.2/3.2.1 or StarOffice 9 PU04 or Oracle Open Office 3.2.1
468         * OOo_33x for files created with OpenOffice.org 3.3 (and minors) or Oracle Open Office 3.3 (and minors)
469         * OOo_34x for files created with OpenOffice.org 3.4 Beta or Oracle Open Office 3.4 Beta
470         * ProductVersionUnknown for files not created with OpenOffice.org, StarOffice or Oracle Open Office
471     */
472     sal_uInt16 getGeneratorVersion() const;
473 
474     /** If true, the URL for graphic shapes may be stored as a package URL and
475         loaded later (on demand) by the application. Otherwise graphics are
476         loaded immediately and the graphic shape gets the graphic manager URL.
477 
478         @see <member>mbIsGraphicLoadOnDemandSupported</member>
479      */
480     bool isGraphicLoadOnDemandSupported() const;
481 };
482 
GetTextImport()483 inline UniReference< XMLTextImportHelper > SvXMLImport::GetTextImport()
484 {
485     if( !mxTextImport.is() )
486         mxTextImport = CreateTextImport();
487 
488     return mxTextImport;
489 }
490 
GetShapeImport()491 inline UniReference< XMLShapeImportHelper > SvXMLImport::GetShapeImport()
492 {
493     if( !mxShapeImport.is() )
494         mxShapeImport = CreateShapeImport();
495 
496     return mxShapeImport;
497 }
498 
GetChartImport()499 inline UniReference< SchXMLImportHelper > SvXMLImport::GetChartImport()
500 {
501     if( !mxChartImport.is() )
502         mxChartImport = CreateChartImport();
503 
504     return mxChartImport;
505 }
506 
GetFormImport()507 inline UniReference< ::xmloff::OFormLayerXMLImport > SvXMLImport::GetFormImport()
508 {
509     if( !mxFormImport.is() )
510         mxFormImport = CreateFormImport();
511 
512     return mxFormImport;
513 }
514 
SetEmbeddedResolver(com::sun::star::uno::Reference<com::sun::star::document::XEmbeddedObjectResolver> & _xEmbeddedResolver)515 inline void SvXMLImport::SetEmbeddedResolver(
516     com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
517 {
518     mxEmbeddedResolver = _xEmbeddedResolver;
519 }
520 
SetGraphicResolver(com::sun::star::uno::Reference<com::sun::star::document::XGraphicObjectResolver> & _xGraphicResolver)521 inline void SvXMLImport::SetGraphicResolver(
522     com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
523 {
524     mxGraphicResolver = _xGraphicResolver;
525 }
526 
GetNumberFormatsSupplier()527 inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier()
528 {
529     if ( ! mxNumberFormatsSupplier.is() && mxModel.is() )
530         _CreateNumberFormatsSupplier();
531 
532     return mxNumberFormatsSupplier;
533 }
534 
GetDataStylesImport()535 inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport()
536 {
537     if ( mpNumImport == NULL)
538         _CreateDataStylesImport();
539 
540     return mpNumImport;
541 }
542 
543 
544 #endif  //  _XMLOFF_XMLIMP_HXX
545