From fd95f1ab6220c6a530fd2e4e727417f504a5db51 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 2 Dec 2011 23:43:23 +0100 Subject: refactor SdrModel::GetDocumentStream Remove 3 ~identical implementations of GetDocumentStream and the associated struct SdrDocumentStreamInfo. --- sw/inc/drawdoc.hxx | 5 ++--- sw/source/core/draw/drawdoc.cxx | 40 ++-------------------------------------- 2 files changed, 4 insertions(+), 41 deletions(-) (limited to 'sw') diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx index 4c699c3b2591..cdc2c3ba538e 100644 --- a/sw/inc/drawdoc.hxx +++ b/sw/inc/drawdoc.hxx @@ -47,9 +47,8 @@ public: virtual SdrPage* AllocPage(bool bMasterPage); - - // For "load on demand" of graphics in DrawingLayer. - virtual SvStream* GetDocumentStream( SdrDocumentStreamInfo& rInfo ) const; + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::embed::XStorage> GetDocumentStorage() const; // For saving of rectangles as control-replacement for versions < 5.0. virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const; diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index 92684dc79d1c..00ea9c7e276a 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -161,45 +161,9 @@ SdrPage* SwDrawDocument::AllocPage(bool bMasterPage) return pPage; } - -SvStream* SwDrawDocument::GetDocumentStream( SdrDocumentStreamInfo& rInfo ) const +uno::Reference SwDrawDocument::GetDocumentStorage() const { - SvStream* pRet = NULL; - uno::Reference < embed::XStorage > xRoot( pDoc->GetDocStorage() ); - if( xRoot.is() ) - { - if( rInfo.maUserData.Len() && - ( rInfo.maUserData.GetToken( 0, ':' ) == - String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) ) - { - const String aPicturePath( rInfo.maUserData.GetToken( 1, ':' ) ); - - // graphic from picture stream in picture storage in XML package - if( aPicturePath.GetTokenCount( '/' ) == 2 ) - { - const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) ); - const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) ); - - try - { - uno::Reference < embed::XStorage > xPictureStorage = xRoot->openStorageElement( - aPictureStorageName, embed::ElementModes::READ ); - uno::Reference < io::XStream > xStream = xPictureStorage->openStreamElement( - aPictureStreamName, embed::ElementModes::READ ); - pRet = utl::UcbStreamHelper::CreateStream( xStream ); - if( pRet ) - { - rInfo.mbDeleteAfterUse = sal_True; - rInfo.mxStorageRef = xPictureStorage; - } - } - catch ( uno::Exception& ) - { - } - } - } - } - return pRet; + return pDoc->GetDocStorage(); } SdrLayerID SwDrawDocument::GetControlExportLayerId( const SdrObject & ) const -- cgit