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