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