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