diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-12-02 23:43:23 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-12-03 00:48:15 +0100 |
commit | fd95f1ab6220c6a530fd2e4e727417f504a5db51 (patch) | |
tree | b378d6e72698a8329f41d7919016574a301016e2 /sw | |
parent | aa59ee85a8e902aa4dc956822e9169093de6c454 (diff) |
refactor SdrModel::GetDocumentStream
Remove 3 ~identical implementations of GetDocumentStream and the associated
struct SdrDocumentStreamInfo.
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/drawdoc.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/draw/drawdoc.cxx | 40 |
2 files changed, 4 insertions, 41 deletions
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<embed::XStorage> 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 |