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