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