From db9f13986fc7ef3d4b44d71459c58e9ea0ae8bcb Mon Sep 17 00:00:00 2001 From: Noel Date: Mon, 21 Dec 2020 16:28:17 +0200 Subject: split SotStorageStream into two classes since it has two completely different paths of control Change-Id: I89b739d318d52245208a4bda1230f69d19f3ae0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108104 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../controller/main/ChartController_Tools.cxx | 4 +- .../source/controller/main/ChartTransferable.cxx | 7 +- .../source/controller/main/ChartTransferable.hxx | 2 +- dbaccess/source/ui/browser/dbexchange.cxx | 2 +- dbaccess/source/ui/inc/TableCopyHelper.hxx | 2 +- dbaccess/source/ui/inc/TableRowExchange.hxx | 2 +- dbaccess/source/ui/inc/dbexchange.hxx | 2 +- dbaccess/source/ui/misc/TableCopyHelper.cxx | 3 +- dbaccess/source/ui/tabledesign/TEditControl.cxx | 2 +- .../source/ui/tabledesign/TableRowExchange.cxx | 2 +- include/sot/storage.hxx | 14 +- include/svx/gallerybinaryengine.hxx | 4 +- include/svx/galmisc.hxx | 5 +- include/svx/galtheme.hxx | 4 +- include/vcl/transfer.hxx | 7 +- sc/source/ui/app/drwtrans.cxx | 8 +- sc/source/ui/app/transobj.cxx | 3 +- sc/source/ui/inc/drwtrans.hxx | 2 +- sc/source/ui/inc/transobj.hxx | 2 +- sc/source/ui/view/gridwin.cxx | 2 +- sc/source/ui/view/viewfun3.cxx | 2 +- sc/source/ui/view/viewfun4.cxx | 2 +- sc/source/ui/view/viewfun5.cxx | 6 +- sd/source/ui/app/sdxfer.cxx | 6 +- sd/source/ui/inc/View.hxx | 2 +- sd/source/ui/inc/sdxfer.hxx | 2 +- sd/source/ui/view/sdview3.cxx | 16 +- sot/source/sdstor/storage.cxx | 163 +++++++-------------- svx/source/gallery2/gallerybinaryengine.cxx | 7 +- svx/source/gallery2/galmisc.cxx | 4 +- svx/source/gallery2/galtheme.cxx | 6 +- sw/source/uibase/dochdl/swdtflvr.cxx | 16 +- sw/source/uibase/inc/swdtflvr.hxx | 2 +- vcl/source/treelist/transfer.cxx | 24 +-- 34 files changed, 140 insertions(+), 197 deletions(-) diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index ed0776d94c79..8d78185159d9 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -270,7 +270,7 @@ void ChartController::executeDispatch_Paste() { if ( aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) ) { - tools::SvRef xStm; + tools::SvRef xStm; if ( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStm ) ) { xStm->Seek( 0 ); @@ -288,7 +288,7 @@ void ChartController::executeDispatch_Paste() else if ( aDataHelper.HasFormat( SotClipboardFormatId::SVXB ) ) { // graphic exchange format (graphic manager bitmap format?) - tools::SvRef xStm; + tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm )) ReadGraphic( *xStm, aGraphic ); } diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx index 67db8d3e4503..03e8eaef2509 100644 --- a/chart2/source/controller/main/ChartTransferable.cxx +++ b/chart2/source/controller/main/ChartTransferable.cxx @@ -105,7 +105,7 @@ bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, c return bResult; } -bool ChartTransferable::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, +bool ChartTransferable::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const datatransfer::DataFlavor& /* rFlavor */ ) { // called from SetObject, put data into stream @@ -141,10 +141,7 @@ bool ChartTransferable::WriteObject( tools::SvRef& rxOStm, voi } Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) ); - if ( SvxDrawingLayerExport( pMarkedObjModel, xDocOut ) ) - { - rxOStm->Commit(); - } + SvxDrawingLayerExport( pMarkedObjModel, xDocOut ); bRet = ( rxOStm->GetError() == ERRCODE_NONE ); } diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx index c825a0a6e7d8..34567dceb6a9 100644 --- a/chart2/source/controller/main/ChartTransferable.hxx +++ b/chart2/source/controller/main/ChartTransferable.hxx @@ -46,7 +46,7 @@ protected: // implementation of TransferableHelper methods virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; private: diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx index d9358ec776ad..dc6398f48aea 100644 --- a/dbaccess/source/ui/browser/dbexchange.cxx +++ b/dbaccess/source/ui/browser/dbexchange.cxx @@ -140,7 +140,7 @@ namespace dbaui osl_atomic_decrement( &m_refCount ); } - bool ODataClipboard::WriteObject( ::tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ ) + bool ODataClipboard::WriteObject( ::tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ ) { if (nUserObjectId == FORMAT_OBJECT_ID_RTF || nUserObjectId == FORMAT_OBJECT_ID_HTML ) { diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx index 92ddceb37507..b543dade80bb 100644 --- a/dbaccess/source/ui/inc/TableCopyHelper.hxx +++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx @@ -72,7 +72,7 @@ namespace dbaui OUString sDefaultTableName; OUString aUrl; - tools::SvRef aHtmlRtfStorage; + tools::SvRef aHtmlRtfStorage; ElementType nType; std::unique_ptr xDroppedAt; sal_Int8 nAction; diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx b/dbaccess/source/ui/inc/TableRowExchange.hxx index 38c0eb36f820..729862721d44 100644 --- a/dbaccess/source/ui/inc/TableRowExchange.hxx +++ b/dbaccess/source/ui/inc/TableRowExchange.hxx @@ -32,7 +32,7 @@ namespace dbaui protected: virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; virtual void ObjectReleased() override; }; } diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx index a5c2752d1656..7fb0c6ee0b96 100644 --- a/dbaccess/source/ui/inc/dbexchange.hxx +++ b/dbaccess/source/ui/inc/dbexchange.hxx @@ -75,7 +75,7 @@ namespace dbaui virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; virtual void ObjectReleased() override; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; }; } diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx index 7e944e4d9516..e5c3f529b4a1 100644 --- a/dbaccess/source/ui/misc/TableCopyHelper.cxx +++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx @@ -273,10 +273,9 @@ bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedData // now we need to copy the stream ::utl::TempFile aTmp; _rAsyncDrop.aUrl = aTmp.GetURL(); - ::tools::SvRef aNew = new SotStorageStream( aTmp.GetFileName() ); + ::tools::SvRef aNew = new SotTempStream( aTmp.GetFileName() ); _rAsyncDrop.aHtmlRtfStorage->Seek(STREAM_SEEK_TO_BEGIN); _rAsyncDrop.aHtmlRtfStorage->CopyTo( aNew.get() ); - aNew->Commit(); _rAsyncDrop.aHtmlRtfStorage = aNew; } else diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 55114d3a416a..a89397ccb2a5 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -772,7 +772,7 @@ void OTableEditorCtrl::InsertRows( sal_Int32 nRow ) TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); if(aTransferData.HasFormat(SotClipboardFormatId::SBA_TABED)) { - ::tools::SvRef aStreamRef; + ::tools::SvRef aStreamRef; bool bOk = aTransferData.GetSotStorageStream(SotClipboardFormatId::SBA_TABED,aStreamRef); if (bOk && aStreamRef.is()) { diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx index 53b54cef400c..916b8112f7c5 100644 --- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx +++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx @@ -32,7 +32,7 @@ namespace dbaui : m_vTableRow(_rvTableRow) { } - bool OTableRowExchange::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ ) + bool OTableRowExchange::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ ) { if(nUserObjectId == FORMAT_OBJECT_ID_SBA_TABED) { diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx index 4fc2efab42b5..3a07333565ea 100644 --- a/include/sot/storage.hxx +++ b/include/sot/storage.hxx @@ -35,6 +35,17 @@ enum class SotClipboardFormatId : sal_uInt32; class BaseStorageStream; +class SOT_DLLPUBLIC SotTempStream final : virtual public SotObject, public SvStream +{ +friend class SotStorage; + + virtual ~SotTempStream() override; +public: + SotTempStream(OUString const & rString, StreamMode = StreamMode::STD_READWRITE); + + void CopyTo(SotTempStream * pDestStm); +}; + class SOT_DLLPUBLIC SotStorageStream final : virtual public SotObject, public SvStream { friend class SotStorage; @@ -47,15 +58,12 @@ friend class SotStorage; virtual ~SotStorageStream() override; public: - SotStorageStream(OUString const & rString, - StreamMode = StreamMode::STD_READWRITE); SotStorageStream(BaseStorageStream *pBaseStream); virtual void ResetError() override; virtual void SetSize(sal_uInt64 nNewSize) override; sal_uInt32 GetSize() const; - void CopyTo(SotStorageStream * pDestStm); bool Commit(); bool SetProperty(OUString const & rName, css::uno::Any const & rValue); virtual sal_uInt64 TellEnd() override; diff --git a/include/svx/gallerybinaryengine.hxx b/include/svx/gallerybinaryengine.hxx index 4f1351880269..ab928b9324d5 100644 --- a/include/svx/gallerybinaryengine.hxx +++ b/include/svx/gallerybinaryengine.hxx @@ -86,8 +86,8 @@ public: SgaObjectSvDraw insertModel(const FmFormModel& rModel, const INetURLObject& rUserURL); bool readModelStream(const GalleryObject* pObject, - tools::SvRef const& rxModelStream); - SgaObjectSvDraw insertModelStream(const tools::SvRef& rxModelStream, + tools::SvRef const& rxModelStream); + SgaObjectSvDraw insertModelStream(const tools::SvRef& rxModelStream, const INetURLObject& rUserURL); INetURLObject implCreateUniqueURL(SgaObjKind eObjKind, const INetURLObject& rUserURL, diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx index dd5a361105de..49310e63a619 100644 --- a/include/svx/galmisc.hxx +++ b/include/svx/galmisc.hxx @@ -36,6 +36,7 @@ namespace com::sun::star::awt { class XProgressBar; } class INetURLObject; class GalleryTheme; class SotStorageStream; +class SotTempStream; struct ExchangeData { @@ -139,7 +140,7 @@ using TransferableHelper::CopyToClipboard; GalleryTheme* mpTheme; SgaObjKind meObjectKind; sal_uInt32 mnObjectPos; - tools::SvRef mxModelStream; + tools::SvRef mxModelStream; std::unique_ptr mpGraphicObject; std::unique_ptr mpURL; @@ -154,7 +155,7 @@ public: // TransferableHelper virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; virtual void DragFinished( sal_Int8 nDropAction ) override; virtual void ObjectReleased() override; diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx index 61d360158847..7c8d9508cfc1 100644 --- a/include/svx/galtheme.hxx +++ b/include/svx/galtheme.hxx @@ -141,8 +141,8 @@ public: bool GetModel(sal_uInt32 nPos, SdrModel& rModel); bool InsertModel(const FmFormModel& rModel, sal_uInt32 nInsertPos); - SAL_DLLPRIVATE bool GetModelStream(sal_uInt32 nPos, tools::SvRef const & rModelStreamRef); - SAL_DLLPRIVATE bool InsertModelStream(const tools::SvRef& rModelStream, sal_uInt32 nInsertPos); + SAL_DLLPRIVATE bool GetModelStream(sal_uInt32 nPos, tools::SvRef const & rModelStreamRef); + SAL_DLLPRIVATE bool InsertModelStream(const tools::SvRef& rModelStream, sal_uInt32 nInsertPos); SAL_DLLPRIVATE bool GetURL(sal_uInt32 nPos, INetURLObject& rURL); bool InsertURL(const INetURLObject& rURL, sal_uInt32 nInsertPos = SAL_MAX_UINT32); diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index 2ec7c340b69f..f7c41fafa00b 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -57,6 +57,7 @@ class INetBookmark; class INetImage; class FileList; class SotStorageStream; +class SotTempStream; namespace vcl { class Window; } // Drag&Drop defines @@ -244,7 +245,7 @@ protected: virtual void AddSupportedFormats() = 0; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) = 0; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ); + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ); virtual void DragFinished( sal_Int8 nDropAction ); virtual void ObjectReleased(); @@ -357,8 +358,8 @@ public: css::uno::Sequence GetSequence( SotClipboardFormatId nFormat, const OUString& rDestDoc ); css::uno::Sequence GetSequence( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ); - bool GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef& rStreamRef ); - bool GetSotStorageStream( const css::datatransfer::DataFlavor& rFlavor, tools::SvRef& rStreamRef ); + bool GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef& rStreamRef ); + bool GetSotStorageStream( const css::datatransfer::DataFlavor& rFlavor, tools::SvRef& rStreamRef ); css::uno::Reference GetInputStream( SotClipboardFormatId nFormat, const OUString& rDestDoc ); css::uno::Reference GetInputStream( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ); diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 5aa2d53aa6a7..a3526cebb19d 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -428,7 +428,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c return bOK; } -bool ScDrawTransferObj::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, +bool ScDrawTransferObj::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /* rFlavor */ ) { // called from SetObject, put data into stream @@ -468,8 +468,7 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef& rxOStm, voi { css::uno::Reference xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) ); - if( SvxDrawingLayerExport( pDrawModel, xDocOut ) ) - rxOStm->Commit(); + SvxDrawingLayerExport( pDrawModel, xDocOut ); } bRet = ( rxOStm->GetError() == ERRCODE_NONE ); @@ -510,8 +509,6 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef& rxOStm, voi if ( xTrans.is() ) xTrans->commit(); } - - rxOStm->Commit(); } catch ( uno::Exception& ) { @@ -554,7 +551,6 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef& rxOStm, voi xWorkStore->dispose(); xWorkStore.clear(); - rxOStm->Commit(); } catch ( uno::Exception& ) {} diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 713a5d8e6ea8..b83a085d5c08 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -442,7 +442,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt return bOK; } -bool ScTransferObj::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, +bool ScTransferObj::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const datatransfer::DataFlavor& rFlavor ) { // called from SetObject, put data into stream @@ -530,7 +530,6 @@ bool ScTransferObj::WriteObject( tools::SvRef& rxOStm, void* p xWorkStore->dispose(); xWorkStore.clear(); - rxOStm->Commit(); } break; diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx index f45727674297..bfb5175738dc 100644 --- a/sc/source/ui/inc/drwtrans.hxx +++ b/sc/source/ui/inc/drwtrans.hxx @@ -72,7 +72,7 @@ public: virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; virtual void DragFinished( sal_Int8 nDropAction ) override; diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx index 360b46f9a3e8..fdcfd6f408dc 100644 --- a/sc/source/ui/inc/transobj.hxx +++ b/sc/source/ui/inc/transobj.hxx @@ -73,7 +73,7 @@ public: virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; virtual void DragFinished( sal_Int8 nDropAction ) override; virtual sal_Bool SAL_CALL isComplex() override; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 243dd206f655..9dadd10d5927 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3931,7 +3931,7 @@ static SotClipboardFormatId lcl_GetDropFormatId( const uno::Reference xStm; + tools::SvRef xStm; TransferableObjectDescriptor aObjDesc; if( aDataHelper.GetTransferableObjectDescriptor( SotClipboardFormatId::OBJECTDESCRIPTOR, aObjDesc ) && aDataHelper.GetSotStorageStream( SotClipboardFormatId::EMBED_SOURCE, xStm ) ) diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index af9e50ab2373..95b6bd3d7cde 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -777,7 +777,7 @@ bool ScViewFunc::PasteOnDrawObjectLinked( if ( aDataHelper.HasFormat( SotClipboardFormatId::SVXB ) ) { - tools::SvRef xStm; + tools::SvRef xStm; ScDrawView* pScDrawView = GetScDrawView(); if( pScDrawView && aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ) ) diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index aae8c1bff580..5697b0ba2291 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -159,7 +159,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, ScAddress( nStartCol, nStartRow, GetViewData().GetTabNo() ) ); OUString aStr; - tools::SvRef xStream; + tools::SvRef xStream; if ( aDataHelper.GetSotStorageStream( SotClipboardFormatId::RTF, xStream ) && xStream.is() ) // mba: clipboard always must contain absolute URLs (could be from alien source) aImpEx.ImportStream( *xStream, OUString(), SotClipboardFormatId::RTF ); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index aad9b69a8719..e5d52fabfe83 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -300,7 +300,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, auto pStrBuffer = std::make_shared(); - tools::SvRef xStream; + tools::SvRef xStream; if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.is() ) { if (nFormatId == SotClipboardFormatId::HTML && @@ -497,7 +497,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, } else if (nFormatId == SotClipboardFormatId::SVXB) { - tools::SvRef xStm; + tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ) ) { Graphic aGraphic; @@ -507,7 +507,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, } else if ( nFormatId == SotClipboardFormatId::DRAWING ) { - tools::SvRef xStm; + tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStm ) ) { MakeDrawLayer(); // before loading model, so 3D factory has been created diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 6302608f93cc..4752d85f16b0 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -559,7 +559,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo return bOK; } -bool SdTransferable::WriteObject( tools::SvRef& rxOStm, void* pObject, sal_uInt32 nObjectType, const DataFlavor& ) +bool SdTransferable::WriteObject( tools::SvRef& rxOStm, void* pObject, sal_uInt32 nObjectType, const DataFlavor& ) { bool bRet = false; @@ -580,8 +580,7 @@ bool SdTransferable::WriteObject( tools::SvRef& rxOStm, void* { css::uno::Reference xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) ); - if( SvxDrawingLayerExport( pDoc, xDocOut, xComponent, (pDoc->GetDocumentType() == DocumentType::Impress) ? "com.sun.star.comp.Impress.XMLClipboardExporter" : "com.sun.star.comp.DrawingLayer.XMLExporter" ) ) - rxOStm->Commit(); + SvxDrawingLayerExport( pDoc, xDocOut, xComponent, (pDoc->GetDocumentType() == DocumentType::Impress) ? "com.sun.star.comp.Impress.XMLClipboardExporter" : "com.sun.star.comp.DrawingLayer.XMLExporter" ); } xComponent->dispose(); @@ -626,7 +625,6 @@ bool SdTransferable::WriteObject( tools::SvRef& rxOStm, void* } bRet = true; - rxOStm->Commit(); } catch ( Exception& ) {} diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 4693ce3e9596..3d0eca9750b5 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -167,7 +167,7 @@ public: SdrMediaObj* InsertMediaObj( const OUString& rURL, const OUString& rMimeType, sal_Int8& rAction, const Point& rPos, const Size& rSize ); - bool PasteRTFTable( const ::tools::SvRef& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions ); + bool PasteRTFTable( const ::tools::SvRef& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions ); bool IsPresObjSelected(bool bOnPage = true, bool bOnMasterPage = true, bool bCheckPresObjListOnly = false, bool bCheckLayoutOnly = false) const; diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx index b142291e7124..7285ac0a620a 100644 --- a/sd/source/ui/inc/sdxfer.hxx +++ b/sd/source/ui/inc/sdxfer.hxx @@ -106,7 +106,7 @@ protected: virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; virtual void ObjectReleased() override final; virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index d5c2f494c3e6..9657e76fc492 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -305,7 +305,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, // ImageMap? if( !pOwnData && aDataHelper.HasFormat( SotClipboardFormatId::SVIM ) ) { - ::tools::SvRef xStm; + ::tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVIM, xStm ) ) { @@ -324,7 +324,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if( ( bIsRTF || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT ) ) && ! aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) ) { - ::tools::SvRef xStm; + ::tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) ) { @@ -668,7 +668,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::DRAWING )) { - ::tools::SvRef xStm; + ::tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStm ) ) { @@ -1193,7 +1193,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(SotClipboardFormatId::SVXB)) { - ::tools::SvRef xStm; + ::tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm ) ) { @@ -1382,7 +1382,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML)) { - ::tools::SvRef xStm; + ::tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::HTML, xStm ) ) { @@ -1394,7 +1394,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT)) { - ::tools::SvRef xStm; + ::tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, xStm ) ) { OutlinerView* pOLV = GetTextEditOutlinerView(); @@ -1425,7 +1425,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, bool bIsRTF = CHECK_FORMAT_TRANS(SotClipboardFormatId::RTF); if (bIsRTF || CHECK_FORMAT_TRANS(SotClipboardFormatId::RICHTEXT)) { - ::tools::SvRef xStm; + ::tools::SvRef xStm; if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) ) { @@ -1523,7 +1523,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, return bReturn; } -bool View::PasteRTFTable( const ::tools::SvRef& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions ) +bool View::PasteRTFTable( const ::tools::SvRef& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions ) { std::unique_ptr pModel(new SdDrawDocument( DocumentType::Impress, mpDocSh )); pModel->NewOrLoadCompleted(DocCreationMode::New); diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 56ffb92dc108..dd038048986e 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -58,9 +58,8 @@ static SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMo return xLB; } -SotStorageStream::SotStorageStream( const OUString & rName, StreamMode nMode ) +SotTempStream::SotTempStream( const OUString & rName, StreamMode nMode ) : SvStream( MakeLockBytes_Impl( rName, nMode ).get() ) - , pOwnStm( nullptr ) { if( nMode & StreamMode::WRITE ) m_isWritable = true; @@ -68,105 +67,94 @@ SotStorageStream::SotStorageStream( const OUString & rName, StreamMode nMode ) m_isWritable = false; } -SotStorageStream::SotStorageStream( BaseStorageStream * pStm ) +SotTempStream::~SotTempStream() { - if( pStm ) - { - if( StreamMode::WRITE & pStm->GetMode() ) - m_isWritable = true; - else - m_isWritable = false; + Flush(); +} - pOwnStm = pStm; - SetError( pStm->GetError() ); - pStm->ResetError(); - } - else +void SotTempStream::CopyTo( SotTempStream * pDestStm ) +{ + Flush(); // write all data + + sal_uInt64 nPos = Tell(); // save position + Seek( 0 ); + pDestStm->SetSize( 0 ); // empty target stream + + constexpr int BUFSIZE = 64 * 1024; + std::unique_ptr pMem(new sal_uInt8[ BUFSIZE ]); + sal_uLong nRead; + while (0 != (nRead = ReadBytes(pMem.get(), BUFSIZE))) { - pOwnStm = nullptr; - m_isWritable = true; - SetError( SVSTREAM_INVALID_PARAMETER ); + if (nRead != pDestStm->WriteBytes(pMem.get(), nRead)) + { + SetError( SVSTREAM_GENERALERROR ); + break; + } } + pMem.reset(); + + // set position + pDestStm->Seek( nPos ); + Seek( nPos ); +} + +SotStorageStream::SotStorageStream( BaseStorageStream * pStm ) + : pOwnStm(pStm) +{ + assert( pStm ); + if( StreamMode::WRITE & pStm->GetMode() ) + m_isWritable = true; + else + m_isWritable = false; + + SetError( pStm->GetError() ); + pStm->ResetError(); } SotStorageStream::~SotStorageStream() { - Flush(); //SetBufferSize(0); + Flush(); delete pOwnStm; } void SotStorageStream::ResetError() { SvStream::ResetError(); - if( pOwnStm ) - pOwnStm->ResetError(); + pOwnStm->ResetError(); } std::size_t SotStorageStream::GetData(void* pData, std::size_t const nSize) { - std::size_t nRet = 0; - - if( pOwnStm ) - { - nRet = pOwnStm->Read( pData, nSize ); - SetError( pOwnStm->GetError() ); - } - else - nRet = SvStream::GetData( pData, nSize ); - + std::size_t nRet = pOwnStm->Read( pData, nSize ); + SetError( pOwnStm->GetError() ); return nRet; } std::size_t SotStorageStream::PutData(const void* pData, std::size_t const nSize) { - std::size_t nRet = 0; - - if( pOwnStm ) - { - nRet = pOwnStm->Write( pData, nSize ); - SetError( pOwnStm->GetError() ); - } - else - nRet = SvStream::PutData( pData, nSize ); + std::size_t nRet = pOwnStm->Write( pData, nSize ); + SetError( pOwnStm->GetError() ); return nRet; } sal_uInt64 SotStorageStream::SeekPos(sal_uInt64 nPos) { - sal_uLong nRet = 0; - - if( pOwnStm ) - { - nRet = pOwnStm->Seek( nPos ); - SetError( pOwnStm->GetError() ); - } - else - nRet = SvStream::SeekPos( nPos ); - + sal_uLong nRet = pOwnStm->Seek( nPos ); + SetError( pOwnStm->GetError() ); return nRet; } void SotStorageStream::FlushData() { - if( pOwnStm ) - { - pOwnStm->Flush(); - SetError( pOwnStm->GetError() ); - } - else - SvStream::FlushData(); + pOwnStm->Flush(); + SetError( pOwnStm->GetError() ); } void SotStorageStream::SetSize(sal_uInt64 const nNewSize) { sal_uInt64 const nPos = Tell(); - if( pOwnStm ) - { - pOwnStm->SetSize( nNewSize ); - SetError( pOwnStm->GetError() ); - } - else - SvStream::SetSize( nNewSize ); + pOwnStm->SetSize( nNewSize ); + SetError( pOwnStm->GetError() ); if( nNewSize < nPos ) // jump to the end @@ -185,54 +173,15 @@ sal_uInt64 SotStorageStream::TellEnd() // otherwise we return a 0 value from StgEntry::GetSize FlushBuffer(); - if (pOwnStm) - return pOwnStm->GetSize(); - - return SvStream::TellEnd(); -} - -void SotStorageStream::CopyTo( SotStorageStream * pDestStm ) -{ - Flush(); // write all data - pDestStm->ClearBuffer(); - if( !pOwnStm || !pDestStm->pOwnStm ) - { - // If Ole2 or not only own StorageStreams - sal_uInt64 nPos = Tell(); // save position - Seek( 0 ); - pDestStm->SetSize( 0 ); // empty target stream - - std::unique_ptr pMem(new sal_uInt8[ 8192 ]); - sal_uLong nRead; - while (0 != (nRead = ReadBytes(pMem.get(), 8192))) - { - if (nRead != pDestStm->WriteBytes(pMem.get(), nRead)) - { - SetError( SVSTREAM_GENERALERROR ); - break; - } - } - pMem.reset(); - // set position - pDestStm->Seek( nPos ); - Seek( nPos ); - } - else - { - pOwnStm->CopyTo( pDestStm->pOwnStm ); - SetError( pOwnStm->GetError() ); - } + return pOwnStm->GetSize(); } bool SotStorageStream::Commit() { - if( pOwnStm ) - { - pOwnStm->Flush(); - if( pOwnStm->GetError() == ERRCODE_NONE ) - pOwnStm->Commit(); - SetError( pOwnStm->GetError() ); - } + pOwnStm->Flush(); + if( pOwnStm->GetError() == ERRCODE_NONE ) + pOwnStm->Commit(); + SetError( pOwnStm->GetError() ); return GetError() == ERRCODE_NONE; } diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx index 8b7715eeb9ac..8f0fa9fcb240 100644 --- a/svx/source/gallery2/gallerybinaryengine.cxx +++ b/svx/source/gallery2/gallerybinaryengine.cxx @@ -334,7 +334,7 @@ SgaObjectSvDraw GalleryBinaryEngine::insertModel(const FmFormModel& rModel, } bool GalleryBinaryEngine::readModelStream(const GalleryObject* pObject, - tools::SvRef const& rxModelStream) + tools::SvRef const& rxModelStream) { const INetURLObject aURL(ImplGetURL(pObject)); tools::SvRef xSotStorage(GetSvDrawStorage()); @@ -366,8 +366,7 @@ bool GalleryBinaryEngine::readModelStream(const GalleryObject* pObject, uno::Reference xDocOut( new utl::OOutputStreamWrapper(*rxModelStream)); - if (SvxDrawingLayerExport(aModel.GetModel(), xDocOut)) - rxModelStream->Commit(); + SvxDrawingLayerExport(aModel.GetModel(), xDocOut); } } @@ -382,7 +381,7 @@ bool GalleryBinaryEngine::readModelStream(const GalleryObject* pObject, } SgaObjectSvDraw -GalleryBinaryEngine::insertModelStream(const tools::SvRef& rxModelStream, +GalleryBinaryEngine::insertModelStream(const tools::SvRef& rxModelStream, const INetURLObject& rUserURL) { INetURLObject aURL(implCreateUniqueURL(SgaObjKind::SvDraw, rUserURL)); diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index df089a47aff2..a3613424f041 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -396,7 +396,7 @@ void GalleryTransferable::InitData( bool bLazy ) if( !mxModelStream.is() ) { - mxModelStream = new SotStorageStream( "" ); + mxModelStream = new SotTempStream( "" ); mxModelStream->SetBufferSize( 16348 ); if (!mpTheme || !mpTheme->GetModelStream(mnObjectPos, mxModelStream)) @@ -502,7 +502,7 @@ bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor, cons return bRet; } -bool GalleryTransferable::WriteObject( tools::SvRef& rxOStm, void* pUserObject, +bool GalleryTransferable::WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32, const datatransfer::DataFlavor& ) { bool bRet = false; diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 2dad05a061af..e9ca797a3e8d 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -453,7 +453,7 @@ bool GalleryTheme::InsertModel(const FmFormModel& rModel, sal_uInt32 nInsertPos) return bRet; } -bool GalleryTheme::GetModelStream(sal_uInt32 nPos, tools::SvRef const & rxModelStream) +bool GalleryTheme::GetModelStream(sal_uInt32 nPos, tools::SvRef const & rxModelStream) { const GalleryObject* pObject = maGalleryObjectCollection.getForPosition( nPos ); bool bRet = false; @@ -466,7 +466,7 @@ bool GalleryTheme::GetModelStream(sal_uInt32 nPos, tools::SvRef& rxModelStream, sal_uInt32 nInsertPos) +bool GalleryTheme::InsertModelStream(const tools::SvRef& rxModelStream, sal_uInt32 nInsertPos) { bool bRet = false; @@ -539,7 +539,7 @@ bool GalleryTheme::InsertTransferable(const uno::Reference< datatransfer::XTrans if( aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) ) { - tools::SvRef xModelStm; + tools::SvRef xModelStm; if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, xModelStm ) ) bRet = InsertModelStream( xModelStm, nInsertPos ); diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 784683be6603..e5312d2be203 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -677,7 +677,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo return bOK; } -bool SwTransferable::WriteObject( tools::SvRef& xStream, +bool SwTransferable::WriteObject( tools::SvRef& xStream, void* pObject, sal_uInt32 nObjectType, const DataFlavor& /*rFlavor*/ ) { @@ -719,8 +719,7 @@ bool SwTransferable::WriteObject( tools::SvRef& xStream, { uno::Reference xDocOut( new utl::OOutputStreamWrapper( *xStream ) ); - if( SvxDrawingLayerExport( pModel, xDocOut ) ) - xStream->Commit(); + SvxDrawingLayerExport( pModel, xDocOut ); } bRet = ERRCODE_NONE == xStream->GetError(); @@ -758,7 +757,6 @@ bool SwTransferable::WriteObject( tools::SvRef& xStream, xWorkStore->dispose(); xWorkStore.clear(); - xStream->Commit(); } catch (const uno::Exception&) { @@ -774,7 +772,6 @@ bool SwTransferable::WriteObject( tools::SvRef& xStream, SwTransferDdeLink* pDdeLnk = static_cast(pObject); if( pDdeLnk->WriteData( *xStream ) ) { - xStream->Commit(); bRet = ERRCODE_NONE == xStream->GetError(); } } @@ -825,7 +822,6 @@ bool SwTransferable::WriteObject( tools::SvRef& xStream, if( ! aWrt.Write( xWrt ).IsError() ) { xStream->WriteChar( '\0' ); // terminate with a zero - xStream->Commit(); bRet = true; } } @@ -2102,7 +2098,7 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData, MSE40HTMLClipFormatObj aMSE40ClpObj; - tools::SvRef xStrm; + tools::SvRef xStrm; SvStream* pStream = nullptr; Reader* pRead = nullptr; OUString sData; @@ -2561,7 +2557,7 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, OUString aApp, aTopic, aItem; { - tools::SvRef xStrm; + tools::SvRef xStrm; if( !rData.GetSotStorageStream( SotClipboardFormatId::LINK, xStrm )) { OSL_ENSURE( false, "DDE Data not found." ); @@ -2729,7 +2725,7 @@ bool SwTransferable::PasteSdrFormat( TransferableDataHelper& rData, const Point* pPt, SotExchangeActionFlags nActionFlags, bool bNeedToSelectBeforePaste) { bool bRet = false; - tools::SvRef xStrm; + tools::SvRef xStrm; if( rData.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStrm )) { xStrm->SetVersion( SOFFICE_FILEFORMAT_50 ); @@ -2770,7 +2766,7 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, case SotClipboardFormatId::SVXB: { - tools::SvRef xStm; + tools::SvRef xStm; if(rData.GetSotStorageStream(SotClipboardFormatId::SVXB, xStm)) { diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx index cdd3e2124e1e..6a74656e6cb5 100644 --- a/sw/source/uibase/inc/swdtflvr.hxx +++ b/sw/source/uibase/inc/swdtflvr.hxx @@ -158,7 +158,7 @@ class SW_DLLPUBLIC SwTransferable : public TransferableHelper protected: virtual void AddSupportedFormats() override; virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; - virtual bool WriteObject( tools::SvRef& rxOStm, + virtual bool WriteObject( tools::SvRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index a14da846739b..874bc4b9e7d8 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -872,7 +872,7 @@ bool TransferableHelper::SetINetImage( const INetImage& rINtImg, bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const DataFlavor& rFlavor ) { - tools::SvRef xStm( new SotStorageStream( OUString() ) ); + tools::SvRef xStm( new SotTempStream( OUString() ) ); xStm->SetVersion( SOFFICE_FILEFORMAT_50 ); @@ -900,7 +900,7 @@ bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, } -bool TransferableHelper::WriteObject( tools::SvRef&, void*, sal_uInt32, const DataFlavor& ) +bool TransferableHelper::WriteObject( tools::SvRef&, void*, sal_uInt32, const DataFlavor& ) { OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" ); return false; @@ -1561,7 +1561,7 @@ bool TransferableDataHelper::GetBitmapEx( SotClipboardFormatId nFormat, BitmapEx bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& rBmpEx ) { - tools::SvRef xStm; + tools::SvRef xStm; DataFlavor aSubstFlavor; bool bRet(GetSotStorageStream(rFlavor, xStm)); bool bSuppressPNG(false); // #122982# If PNG stream not accessed, but BMP one, suppress trying to load PNG @@ -1673,7 +1673,7 @@ bool TransferableDataHelper::GetGDIMetaFile(SotClipboardFormatId nFormat, GDIMet bool TransferableDataHelper::GetGDIMetaFile( const DataFlavor& rFlavor, GDIMetaFile& rMtf ) { - tools::SvRef xStm; + tools::SvRef xStm; DataFlavor aSubstFlavor; bool bRet = false; @@ -1755,7 +1755,7 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF TransferableDataHelper::IsEqual(aFlavor, rFlavor)) { Graphic aGraphic; - tools::SvRef xStm; + tools::SvRef xStm; if (GetSotStorageStream(rFlavor, xStm)) { if (GraphicConverter::Import(*xStm, aGraphic) == ERRCODE_NONE) @@ -1793,7 +1793,7 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF } else { - tools::SvRef xStm; + tools::SvRef xStm; if( GetSotStorageStream( rFlavor, xStm ) ) { @@ -1815,7 +1815,7 @@ bool TransferableDataHelper::GetImageMap( SotClipboardFormatId nFormat, ImageMap bool TransferableDataHelper::GetImageMap( const css::datatransfer::DataFlavor& rFlavor, ImageMap& rIMap ) { - tools::SvRef xStm; + tools::SvRef xStm; bool bRet = GetSotStorageStream( rFlavor, xStm ); if( bRet ) @@ -1996,7 +1996,7 @@ bool TransferableDataHelper::GetINetImage( const css::datatransfer::DataFlavor& rFlavor, INetImage& rINtImg ) { - tools::SvRef xStm; + tools::SvRef xStm; bool bRet = GetSotStorageStream( rFlavor, xStm ); if( bRet ) @@ -2015,7 +2015,7 @@ bool TransferableDataHelper::GetFileList( SotClipboardFormatId nFormat, bool TransferableDataHelper::GetFileList( FileList& rFileList ) { - tools::SvRef xStm; + tools::SvRef xStm; bool bRet = false; for( sal_uInt32 i = 0, nFormatCount = GetFormatCount(); ( i < nFormatCount ) && !bRet; ++i ) @@ -2066,20 +2066,20 @@ Sequence TransferableDataHelper::GetSequence( const DataFlavor& rFlavo } -bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef& rxStream ) +bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef& rxStream ) { DataFlavor aFlavor; return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSotStorageStream( aFlavor, rxStream ) ); } -bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, tools::SvRef& rxStream ) +bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, tools::SvRef& rxStream ) { Sequence aSeq = GetSequence(rFlavor, OUString()); if (aSeq.hasElements()) { - rxStream = new SotStorageStream( "" ); + rxStream = new SotTempStream( "" ); rxStream->WriteBytes( aSeq.getConstArray(), aSeq.getLength() ); rxStream->Seek( 0 ); } -- cgit