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