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