diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-09-10 14:47:28 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-09-11 09:27:05 +0200 |
commit | 0f690c3495fe66b22aa224ca229ca7b46941deac (patch) | |
tree | a7b3418677fd80aedf1b525396b3921015299eb1 /svx | |
parent | 313b8b0db3b68b7938f5cd138c6a226d00a47b67 (diff) |
Initial DocumentSettingsSerializer implementation
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/xtable.hxx | 21 | ||||
-rw-r--r-- | svx/source/inc/xmlxtexp.hxx | 10 | ||||
-rw-r--r-- | svx/source/inc/xmlxtimp.hxx | 5 | ||||
-rw-r--r-- | svx/source/xml/xmlxtexp.cxx | 186 | ||||
-rw-r--r-- | svx/source/xml/xmlxtimp.cxx | 126 | ||||
-rw-r--r-- | svx/source/xoutdev/xtable.cxx | 46 |
6 files changed, 264 insertions, 130 deletions
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx index 79bdfbe1a83e..00c0cb45ad08 100644 --- a/svx/inc/svx/xtable.hxx +++ b/svx/inc/svx/xtable.hxx @@ -43,6 +43,7 @@ #include <tools/table.hxx> #include "svx/svxdllapi.h" +#include <com/sun/star/embed/XStorage.hpp> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <com/sun/star/container/XNameContainer.hpp> @@ -215,9 +216,10 @@ protected: XPropertyEntryList_impl aList; BitmapList_impl* pBmpList; - sal_Bool bListDirty; - sal_Bool bBitmapsDirty; - sal_Bool bOwnPool; + bool bListDirty; + bool bBitmapsDirty; + bool bOwnPool; + bool bEmbedInDocument; XPropertyList( XPropertyListType t, const char *pDefaultExtension, @@ -248,11 +250,20 @@ public: sal_Bool IsDirty() const { return bListDirty && bBitmapsDirty; } void SetDirty( sal_Bool bDirty = sal_True ) { bListDirty = bDirty; bBitmapsDirty = bDirty; } + bool IsEmbedInDocument() const { return bEmbedInDocument; } + void SetEmbedInDocument(bool b) { bEmbedInDocument = b; } virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance() = 0; - sal_Bool Load(); - sal_Bool Save(); + bool Load(); + bool LoadFrom( const ::com::sun::star::uno::Reference< + ::com::sun::star::embed::XStorage > &xStorage, + const rtl::OUString &rURL ); + bool Save(); + bool SaveTo ( const ::com::sun::star::uno::Reference< + ::com::sun::star::embed::XStorage > &xStorage, + const rtl::OUString &rURL, + rtl::OUString *pOptName ); virtual sal_Bool Create() = 0; virtual sal_Bool CreateBitmapsForUI() = 0; virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; diff --git a/svx/source/inc/xmlxtexp.hxx b/svx/source/inc/xmlxtexp.hxx index 703454d235cf..d2f01a00bada 100644 --- a/svx/source/inc/xmlxtexp.hxx +++ b/svx/source/inc/xmlxtexp.hxx @@ -54,9 +54,12 @@ public: ~SvxXMLXTableExportComponent(); - static sal_Bool save( const rtl::OUString& rURL, const com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xTable ) throw(); - - sal_Bool exportTable() throw(); + static bool save( const rtl::OUString& rURL, + const com::sun::star::uno::Reference< + ::com::sun::star::container::XNameContainer >& xTable, + const ::com::sun::star::uno::Reference < + ::com::sun::star::embed::XStorage > &xStorage, + rtl::OUString *pOptName ) throw(); // methods without content: virtual void _ExportAutoStyles(); @@ -64,6 +67,7 @@ public: virtual void _ExportContent(); private: + bool exportTable() throw(); const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > & mxTable; }; diff --git a/svx/source/inc/xmlxtimp.hxx b/svx/source/inc/xmlxtimp.hxx index d57680f2db0a..463f2d520211 100644 --- a/svx/source/inc/xmlxtimp.hxx +++ b/svx/source/inc/xmlxtimp.hxx @@ -51,7 +51,10 @@ public: virtual ~SvxXMLXTableImport() throw (); - static sal_Bool load( const rtl::OUString& rUrl, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xTable ) throw(); + static bool load( const rtl::OUString &rPath, + const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XStorage > &xStorage, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xTable, + bool *bOptLoadedFromStorage ) throw(); protected: virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx index 7f01b788b888..4e613623adc2 100644 --- a/svx/source/xml/xmlxtexp.cxx +++ b/svx/source/xml/xmlxtexp.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include <tools/debug.hxx> +#include <tools/urlobj.hxx> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/uno/Sequence.hxx> @@ -179,101 +180,168 @@ SvxXMLXTableExportComponent::~SvxXMLXTableExportComponent() { } -sal_Bool SvxXMLXTableExportComponent::save( const OUString& rURL, const uno::Reference<container::XNameContainer >& xTable ) throw() +static void initializeStreamMetadata( const uno::Reference< uno::XInterface > &xOut ) { - uno::Reference < embed::XStorage > xStorage; - SfxMedium* pMedium = NULL; - sal_Bool bRet = sal_False; - - uno::Reference< XGraphicObjectResolver > xGrfResolver; - SvXMLGraphicHelper* pGraphicHelper = 0; + uno::Reference< beans::XPropertySet > xProps( xOut, uno::UNO_QUERY ); + if( !xProps.is() ) + { + OSL_FAIL( "Missing stream metadata interface" ); + return; + } try { - do - { - uno::Reference < io::XOutputStream > xOut; - uno::Reference < io::XStream > xStream; + xProps->setPropertyValue( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ), + uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/xml" ) ) ) ); + + // use stock encryption + xProps->setPropertyValue( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ), + uno::makeAny( sal_True ) ); + } catch ( const uno::Exception & ) + { + OSL_FAIL( "exception setting stream metadata" ); + } +} - sal_Bool bNeedStorage = xTable->getElementType() == ::getCppuType((const OUString*)0); +static void createStorageStream( uno::Reference < io::XOutputStream > *xOut, + SvXMLGraphicHelper **ppGraphicHelper, + uno::Reference < embed::XStorage > xSubStorage ) +{ + uno::Reference < io::XStream > xStream; + xStream = xSubStorage->openStreamElement( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) ), + embed::ElementModes::WRITE ); + *ppGraphicHelper = SvXMLGraphicHelper::Create( xSubStorage, GRAPHICHELPER_MODE_WRITE ); + initializeStreamMetadata( xStream ); + *xOut = xStream->getOutputStream(); +} - uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); - if( !xServiceFactory.is() ) - { - OSL_FAIL( "got no service manager" ); - return sal_False; - } +bool SvxXMLXTableExportComponent::save( + const OUString& rURL, + const uno::Reference<container::XNameContainer >& xTable, + const uno::Reference<embed::XStorage >& xStorage, + rtl::OUString *pOptName ) throw() +{ + bool bRet = false; + SfxMedium* pMedium = NULL; + SvXMLGraphicHelper* pGraphicHelper = NULL; + sal_Int32 eCreate = embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE; - uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) ); - if( !xWriter.is() ) - { - OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" ); - return sal_False; - } + INetURLObject aURLObj( rURL ); + bool bToStorage = aURLObj.GetProtocol() == INET_PROT_NOT_VALID; // a relative path - uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY ); + sal_Bool bSaveAsStorage = xTable->getElementType() == ::getCppuType((const OUString*)0); - if( bNeedStorage ) - { - xStorage = - ::comphelper::OStorageHelper::GetStorageFromURL( rURL, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); + if( pOptName ) + *pOptName = rURL; - if( !xStorage.is() ) - { - OSL_FAIL( "no storage!" ); - break; - } + try + { + uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); + if( !xServiceFactory.is() ) + { + OSL_FAIL( "got no service manager" ); + return false; + } - OUString sMetaName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) ); - xStream = xStorage->openStreamElement( sMetaName, embed::ElementModes::WRITE ); - pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_WRITE ); - xGrfResolver = pGraphicHelper; - xOut = xStream->getOutputStream(); - } + uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) ); + if( !xWriter.is() ) + { + OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" ); + return false; + } + + uno::Reference < io::XStream > xStream; + uno::Reference < io::XOutputStream > xOut; + uno::Reference<embed::XStorage > xSubStorage; + uno::Reference< XGraphicObjectResolver > xGrfResolver; + + uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY ); + + if( !bToStorage || !xStorage.is() ) + { // local URL -> SfxMedium route + if( bSaveAsStorage ) + xSubStorage = ::comphelper::OStorageHelper::GetStorageFromURL( rURL, eCreate ); else { pMedium = new SfxMedium( rURL, STREAM_WRITE | STREAM_TRUNC, sal_True ); pMedium->IsRemote(); SvStream* pStream = pMedium->GetOutStream(); - if( NULL == pStream ) + if( !pStream ) { OSL_FAIL( "no output stream!" ); - break; + return false; } xOut = new utl::OOutputStreamWrapper( *pStream ); } + } + else // save into the xSubStorage + { + rtl::OUString aPath = rURL; - uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY ); - xMetaSrc->setOutputStream( xOut ); - - const OUString aName; + if( bSaveAsStorage ) + { + try { + xSubStorage = xStorage->openStorageElement( aPath, eCreate ); + } catch (uno::Exception &e) { + OSL_FAIL( "no output storage!" ); + return false; + } + } + else + { + aPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".xml" ) ); + try { + xStream = xStorage->openStreamElement( aPath, eCreate ); + if( !xStream.is() ) + return false; + initializeStreamMetadata( xStream ); + xOut = xStream->getOutputStream(); + } catch (uno::Exception &e) { + OSL_FAIL( "no output stream!" ); + return false; + } + if( pOptName ) + *pOptName = aPath; + } + } - SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver ); + if( !xOut.is() && xSubStorage.is() ) + createStorageStream( &xOut, &pGraphicHelper, xSubStorage ); + if( !xOut.is() ) + return false; - bRet = aExporter.exportTable(); + uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY ); + xMetaSrc->setOutputStream( xOut ); + if( pGraphicHelper ) + xGrfResolver = pGraphicHelper; - } - while( 0 ); + // Finally do the export + const OUString aName; + SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver ); + bRet = aExporter.exportTable(); if( pGraphicHelper ) SvXMLGraphicHelper::Destroy( pGraphicHelper ); - if( xStorage.is() ) + if( xSubStorage.is() ) { - uno::Reference< XTransactedObject > xTrans( xStorage, UNO_QUERY ); + uno::Reference< XTransactedObject > xTrans( xSubStorage, UNO_QUERY ); if( xTrans.is() ) xTrans->commit(); - uno::Reference< XComponent > xComp( xStorage, UNO_QUERY ); + uno::Reference< XComponent > xComp( xSubStorage, UNO_QUERY ); if( xComp.is() ) - xStorage->dispose(); + xSubStorage->dispose(); } } catch( uno::Exception& ) { - bRet = sal_False; + bRet = false; } if( pMedium ) @@ -285,9 +353,9 @@ sal_Bool SvxXMLXTableExportComponent::save( const OUString& rURL, const uno::Ref return bRet; } -sal_Bool SvxXMLXTableExportComponent::exportTable() throw() +bool SvxXMLXTableExportComponent::exportTable() throw() { - sal_Bool bRet = sal_False; + bool bRet = false; try { @@ -362,7 +430,7 @@ sal_Bool SvxXMLXTableExportComponent::exportTable() throw() pExporter->exportEntry( *pNames, aAny ); } - bRet = sal_True; + bRet = true; } while(0); @@ -370,7 +438,7 @@ sal_Bool SvxXMLXTableExportComponent::exportTable() throw() } catch( Exception const& ) { - bRet = sal_False; + bRet = false; } return bRet; diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx index 2b1304d0913a..a276d0be1aee 100644 --- a/svx/source/xml/xmlxtimp.cxx +++ b/svx/source/xml/xmlxtimp.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include <tools/debug.hxx> +#include <tools/urlobj.hxx> #include <com/sun/star/document/XGraphicObjectResolver.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/io/XActiveDataControl.hpp> @@ -44,6 +45,7 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XSeekable.hdl> #include <comphelper/processfactory.hxx> +#include <comphelper/storagehelper.hxx> #include <unotools/streamwrap.hxx> #include <rtl/ustrbuf.hxx> #include <sfx2/docfile.hxx> @@ -361,82 +363,108 @@ SvxXMLXTableImport::~SvxXMLXTableImport() throw () { } -sal_Bool SvxXMLXTableImport::load( const OUString& rUrl, const uno::Reference< XNameContainer >& xTable ) throw() +static void openStorageStream( xml::sax::InputSource *pParserInput, + SvXMLGraphicHelper **ppGraphicHelper, + uno::Reference < embed::XStorage > xStorage ) { - sal_Bool bRet = sal_True; + uno::Reference < io::XStream > xIStm; + const String aContentStmName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) ); + xIStm.set( xStorage->openStreamElement( aContentStmName, embed::ElementModes::READ ), uno::UNO_QUERY_THROW ); + if( !xIStm.is() ) + { + OSL_FAIL( "could not open Content stream" ); + return; + } + pParserInput->aInputStream = xIStm->getInputStream(); + *ppGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_READ ); +} - uno::Reference< XGraphicObjectResolver > xGrfResolver; +bool SvxXMLXTableImport::load( const rtl::OUString &rPath, + const uno::Reference < embed::XStorage > &xStorage, + const uno::Reference< XNameContainer >& xTable, + bool *bOptLoadedFromStorage ) throw() +{ + bool bRet = true; SvXMLGraphicHelper* pGraphicHelper = 0; + INetURLObject aURLObj( rPath ); + bool bUseStorage = aURLObj.GetProtocol() == INET_PROT_NOT_VALID; // a relative path + try { - do + uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); + if( !xServiceFactory.is() ) { - SfxMedium aMedium( rUrl, STREAM_READ | STREAM_NOCREATE, sal_True ); + OSL_FAIL( "SvxXMLXTableImport::load: got no service manager" ); + return false; + } - uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); - if( !xServiceFactory.is() ) - { - OSL_FAIL( "SvxXMLXTableImport::load: got no service manager" ); - break; - } + uno::Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY_THROW ); - uno::Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY_THROW ); - uno::Reference < io::XStream > xIStm; - uno::Reference< io::XActiveDataSource > xSource; + xml::sax::InputSource aParserInput; + comphelper::OStorageHelper::LifecycleProxy aNasty; - xml::sax::InputSource aParserInput; + if( !bUseStorage || !xStorage.is() ) + { + SfxMedium aMedium( rPath, STREAM_READ | STREAM_NOCREATE, sal_True ); aParserInput.sSystemId = aMedium.GetName(); if( aMedium.IsStorage() ) { - uno::Reference < embed::XStorage > xStorage( aMedium.GetStorage( sal_False ), uno::UNO_QUERY_THROW ); - - const String aContentStmName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) ); - xIStm.set( xStorage->openStreamElement( aContentStmName, embed::ElementModes::READ ), uno::UNO_QUERY_THROW ); - if( !xIStm.is() ) - { - OSL_FAIL( "could not open Content stream" ); - break; - } - - aParserInput.aInputStream = xIStm->getInputStream(); - pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_READ ); - xGrfResolver = pGraphicHelper; + uno::Reference < embed::XStorage > xMediumStorage( aMedium.GetStorage( sal_False ), uno::UNO_QUERY_THROW ); + openStorageStream( &aParserInput, &pGraphicHelper, xMediumStorage ); } else - { aParserInput.aInputStream = aMedium.GetInputStream(); - uno::Reference< io::XSeekable > xSeek( aParserInput.aInputStream, uno::UNO_QUERY_THROW ); - xSeek->seek( 0 ); + } + else // relative URL into a storage + { + uno::Reference< embed::XStorage > xSubStorage; + try { + xSubStorage = comphelper::OStorageHelper::GetStorageAtPath( + xStorage, rPath, embed::ElementModes::READ, aNasty ); + } catch (uno::Exception &e) { } - - if( xSource.is() ) + if( xSubStorage.is() ) + openStorageStream( &aParserInput, &pGraphicHelper, xSubStorage ); + else { - uno::Reference< io::XActiveDataControl > xSourceControl( xSource, UNO_QUERY_THROW ); - xSourceControl->start(); + ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream; + xStream = comphelper::OStorageHelper::GetStreamAtPath( + xStorage, rPath, embed::ElementModes::READ, aNasty ); + if( !xStream.is() ) + return false; + aParserInput.aInputStream = xStream->getInputStream(); } + if( bOptLoadedFromStorage ) + *bOptLoadedFromStorage = true; + } - // #110680# - // uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xTable, xGrfResolver ) ); - uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xServiceFactory, xTable, xGrfResolver ) ); + uno::Reference< XGraphicObjectResolver > xGrfResolver; + if (pGraphicHelper) + xGrfResolver = pGraphicHelper; - xParser->setDocumentHandler( xHandler ); - xParser->parseStream( aParserInput ); - } - while(0); + try { + uno::Reference< io::XSeekable > xSeek( aParserInput.aInputStream, uno::UNO_QUERY_THROW ); + xSeek->seek( 0 ); + } catch( uno::Exception &) {} + + uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xServiceFactory, xTable, xGrfResolver ) ); + xParser->setDocumentHandler( xHandler ); + xParser->parseStream( aParserInput ); if( pGraphicHelper ) SvXMLGraphicHelper::Destroy( pGraphicHelper ); } - catch( uno::Exception& ) + catch( uno::Exception& e ) { -// CL: I disabled this assertion since its an error, but it happens -// each time you load a document with property tables that are not -// on the current machine. Maybe a better fix would be to place -// a file exists check before importing... -// OSL_FAIL("svx::SvxXMLXTableImport::load(), exception caught!"); - bRet = sal_False; + (void)e; +// thrown each time you load a document with property tables that are not +// on the current machine. FIXME: would be better to check a file exists +// before importing ... + fprintf (stderr, "parsing etc. exception '%s'\n", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + bRet = false; } return bRet; diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index a95663b5c164..84185609145f 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -57,13 +57,14 @@ XPropertyList::XPropertyList( pXPool ( pInPool ), pDefaultExt ( pDefaultExtension ), pBmpList ( NULL ), - bListDirty ( sal_True ), - bBitmapsDirty ( sal_True ), - bOwnPool ( sal_False ) + bListDirty ( true ), + bBitmapsDirty ( true ), + bOwnPool ( false ), + bEmbedInDocument( false ) { if( !pXPool ) { - bOwnPool = sal_True; + bOwnPool = true; pXPool = new XOutdevItemPool; DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" ); } @@ -149,7 +150,7 @@ Bitmap* XPropertyList::GetBitmap( long nIndex ) const { if( bBitmapsDirty ) { - ( (XPropertyList*) this )->bBitmapsDirty = sal_False; + ( (XPropertyList*) this )->bBitmapsDirty = false; ( (XPropertyList*) this )->CreateBitmapsForUI(); } if( (size_t)nIndex < pBmpList->size() ) @@ -228,18 +229,18 @@ void XPropertyList::SetName( const String& rString ) } } -sal_Bool XPropertyList::Load() +bool XPropertyList::Load() { if( bListDirty ) { - bListDirty = sal_False; + bListDirty = false; INetURLObject aURL( aPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { DBG_ASSERT( !aPath.Len(), "invalid URL" ); - return sal_False; + return false; } aURL.Append( aName ); @@ -247,20 +248,31 @@ sal_Bool XPropertyList::Load() if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString::createFromAscii( pDefaultExt ) ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), createInstance() ); + return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), + uno::Reference < embed::XStorage >(), + createInstance(), NULL ); } - return sal_False; + return false; } -sal_Bool XPropertyList::Save() +bool XPropertyList::LoadFrom( const uno::Reference < embed::XStorage > &xStorage, + const rtl::OUString &rURL ) +{ + if( !bListDirty ) + return false; + bListDirty = false; + return SvxXMLXTableImport::load( rURL, xStorage, createInstance(), &bEmbedInDocument ); +} + +bool XPropertyList::Save() { INetURLObject aURL( aPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { DBG_ASSERT( !aPath.Len(), "invalid URL" ); - return sal_False; + return false; } aURL.Append( aName ); @@ -268,7 +280,15 @@ sal_Bool XPropertyList::Save() if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString::createFromAscii( pDefaultExt ) ); - return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), createInstance() ); + return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), + createInstance(), + uno::Reference< embed::XStorage >(), NULL ); +} + +bool XPropertyList::SaveTo( const uno::Reference< embed::XStorage > &xStorage, + const rtl::OUString &rURL, rtl::OUString *pOptName ) +{ + return SvxXMLXTableExportComponent::save( rURL, createInstance(), xStorage, pOptName ); } XPropertyList *XPropertyList::CreatePropertyList( XPropertyListType t, |