chart2/source/controller/main/ChartController_Tools.cxx |    4 -
 chart2/source/controller/main/ChartTransferable.cxx     |    8 +-
 chart2/source/controller/main/ChartTransferable.hxx     |    2 
 dbaccess/source/ui/browser/dbexchange.cxx               |    6 -
 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             |   10 +--
 dbaccess/source/ui/tabledesign/TEditControl.cxx         |    4 -
 dbaccess/source/ui/tabledesign/TableRowExchange.cxx     |    6 -
 include/sot/storage.hxx                                 |   10 ---
 include/svx/galmisc.hxx                                 |    5 -
 include/svx/galtheme.hxx                                |    4 -
 include/vcl/transfer.hxx                                |    7 --
 sc/source/ui/app/drwtrans.cxx                           |   18 ++---
 sc/source/ui/app/transobj.cxx                           |   22 +++----
 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                          |    6 -
 sc/source/ui/view/viewfun5.cxx                          |    8 +-
 sd/source/ui/app/sdxfer.cxx                             |   12 +--
 sd/source/ui/inc/View.hxx                               |    2 
 sd/source/ui/inc/sdxfer.hxx                             |    2 
 sd/source/ui/view/sdview3.cxx                           |   24 +++----
 sot/source/sdstor/storage.cxx                           |   50 ----------------
 svx/inc/galleryfilestorage.hxx                          |    6 -
 svx/source/gallery2/galleryfilestorage.cxx              |   14 +---
 svx/source/gallery2/galmisc.cxx                         |   18 ++---
 svx/source/gallery2/galtheme.cxx                        |   12 +--
 sw/source/uibase/dochdl/swdtflvr.cxx                    |   32 +++++-----
 sw/source/uibase/inc/swdtflvr.hxx                       |    2 
 vcl/source/treelist/transfer.cxx                        |   36 +++++------
 34 files changed, 145 insertions(+), 199 deletions(-)

New commits:
commit 25b642fdd87da4d5ed556600d0eb69d72865f666
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Apr 1 20:52:59 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Apr 2 07:53:43 2024 +0200

    simplify SotTempStream and lifetime
    
    It is really just an SvStream instance, and the lifetime does
    not need reference counting
    
    Change-Id: Idb5ffd96f852aae0dc1a94cddc0a83fbcdf974ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165655
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/main/ChartController_Tools.cxx 
b/chart2/source/controller/main/ChartController_Tools.cxx
index 6df81215f261..6cf3a22e41ad 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -266,7 +266,7 @@ void ChartController::executeDispatch_Paste()
     {
         if ( aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
         {
-            tools::SvRef<SotTempStream> xStm;
+            std::unique_ptr<SvStream> xStm;
             if ( aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::DRAWING, xStm ) )
             {
                 xStm->Seek( 0 );
@@ -284,7 +284,7 @@ void ChartController::executeDispatch_Paste()
         else if ( aDataHelper.HasFormat( SotClipboardFormatId::SVXB ) )
         {
             // graphic exchange format (graphic manager bitmap format?)
-            tools::SvRef<SotTempStream> xStm;
+            std::unique_ptr<SvStream> xStm;
             if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, 
xStm ))
             {
                 TypeSerializer aSerializer(*xStm);
diff --git a/chart2/source/controller/main/ChartTransferable.cxx 
b/chart2/source/controller/main/ChartTransferable.cxx
index d369562d03d2..7c8eb12041f6 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<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId,
+bool ChartTransferable::WriteObject( SvStream& rOStm, void* pUserObject, 
sal_uInt32 nUserObjectId,
     const datatransfer::DataFlavor& /* rFlavor */ )
 {
     // called from SetObject, put data into stream
@@ -118,7 +118,7 @@ bool ChartTransferable::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void*
                 SdrModel* pMarkedObjModel = static_cast< SdrModel* >( 
pUserObject );
                 if ( pMarkedObjModel )
                 {
-                    rxOStm->SetBufferSize( 0xff00 );
+                    rOStm.SetBufferSize( 0xff00 );
 
                     // for the changed pool defaults from drawing layer pool 
set those
                     // attributes as hard attributes to preserve them for 
saving
@@ -140,10 +140,10 @@ bool ChartTransferable::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void*
                         }
                     }
 
-                    Reference< io::XOutputStream > xDocOut( new 
utl::OOutputStreamWrapper( *rxOStm ) );
+                    Reference< io::XOutputStream > xDocOut( new 
utl::OOutputStreamWrapper( rOStm ) );
                     SvxDrawingLayerExport( pMarkedObjModel, xDocOut );
 
-                    bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+                    bRet = ( rOStm.GetError() == ERRCODE_NONE );
                 }
             }
             break;
diff --git a/chart2/source/controller/main/ChartTransferable.hxx 
b/chart2/source/controller/main/ChartTransferable.hxx
index fd782864bfc6..486fdb48c5a9 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<SotTempStream>& rxOStm, void* 
pUserObject, sal_uInt32 nUserObjectId,
+    virtual bool WriteObject( SvStream& rOStm, 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 dc6398f48aea..dc318dc0f61c 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -140,14 +140,14 @@ namespace dbaui
         osl_atomic_decrement( &m_refCount );
     }
 
-    bool ODataClipboard::WriteObject( ::tools::SvRef<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId, const 
css::datatransfer::DataFlavor& /*rFlavor*/ )
+    bool ODataClipboard::WriteObject( SvStream& rOStm, void* pUserObject, 
sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
     {
         if (nUserObjectId == FORMAT_OBJECT_ID_RTF || nUserObjectId == 
FORMAT_OBJECT_ID_HTML )
         {
             ODatabaseImportExport* pExport = 
static_cast<ODatabaseImportExport*>(pUserObject);
-            if ( pExport && rxOStm.is() )
+            if ( pExport )
             {
-                pExport->setStream(rxOStm.get());
+                pExport->setStream(&rOStm);
                 return pExport->Write();
             }
         }
diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx 
b/dbaccess/source/ui/inc/TableCopyHelper.hxx
index b543dade80bb..636ca85c7752 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<SotTempStream> aHtmlRtfStorage;
+            std::unique_ptr<SvStream>       aHtmlRtfStorage;
             ElementType                     nType;
             std::unique_ptr<weld::TreeIter> xDroppedAt;
             sal_Int8                        nAction;
diff --git a/dbaccess/source/ui/inc/TableRowExchange.hxx 
b/dbaccess/source/ui/inc/TableRowExchange.hxx
index 36e249795137..9450ab2ff827 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<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId, const 
css::datatransfer::DataFlavor& rFlavor ) override;
+        virtual bool        WriteObject( SvStream& rOStm, 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 7fb0c6ee0b96..050f5bd3b849 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<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId, const 
css::datatransfer::DataFlavor& rFlavor ) override;
+        virtual bool        WriteObject( SvStream& rOStm, 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 c69c04699769..e2842172d408 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -265,16 +265,16 @@ bool OTableCopyHelper::copyTagTable(const 
TransferableDataHelper& _aDroppedData
         _rAsyncDrop.bHtml           = bHtml;
         _rAsyncDrop.bError          = 
!copyTagTable(_rAsyncDrop,true,_xConnection);
 
-        bRet = ( !_rAsyncDrop.bError && bOk && 
_rAsyncDrop.aHtmlRtfStorage.is() );
+        bRet = ( !_rAsyncDrop.bError && bOk && _rAsyncDrop.aHtmlRtfStorage );
         if ( bRet )
         {
             // now we need to copy the stream
             ::utl::TempFileNamed aTmp;
             _rAsyncDrop.aUrl = aTmp.GetURL();
-            ::tools::SvRef<SotTempStream> aNew = new SotTempStream( 
aTmp.GetFileName() );
+            std::unique_ptr<SvStream> aNew = SotTempStream::Create( 
aTmp.GetFileName() );
             _rAsyncDrop.aHtmlRtfStorage->Seek(STREAM_SEEK_TO_BEGIN);
-            _rAsyncDrop.aHtmlRtfStorage->CopyTo( aNew.get() );
-            _rAsyncDrop.aHtmlRtfStorage = aNew;
+            aNew->WriteStream(*_rAsyncDrop.aHtmlRtfStorage);
+            _rAsyncDrop.aHtmlRtfStorage = std::move(aNew);
         }
         else
             _rAsyncDrop.aHtmlRtfStorage = nullptr;
@@ -286,7 +286,7 @@ void OTableCopyHelper::asyncCopyTagTable(  DropDescriptor& 
_rDesc
                                 ,std::u16string_view i_rDestDataSource
                                 ,const SharedConnection& _xConnection)
 {
-    if ( _rDesc.aHtmlRtfStorage.is() )
+    if ( _rDesc.aHtmlRtfStorage )
     {
         copyTagTable(_rDesc,false,_xConnection);
         _rDesc.aHtmlRtfStorage = nullptr;
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx 
b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 55696fe36463..76121d5537be 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -774,9 +774,9 @@ void OTableEditorCtrl::InsertRows( sal_Int32 nRow )
     TransferableDataHelper 
aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
     if(aTransferData.HasFormat(SotClipboardFormatId::SBA_TABED))
     {
-        ::tools::SvRef<SotTempStream> aStreamRef;
+        std::unique_ptr<SvStream> aStreamRef;
         bool bOk = 
aTransferData.GetSotStorageStream(SotClipboardFormatId::SBA_TABED,aStreamRef);
-        if (bOk && aStreamRef.is())
+        if (bOk && aStreamRef)
         {
             aStreamRef->Seek(STREAM_SEEK_TO_BEGIN);
             aStreamRef->ResetError();
diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx 
b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
index c56450ac1c26..a4a80be7463e 100644
--- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
@@ -31,16 +31,16 @@ namespace dbaui
         : m_vTableRow(std::move(_rvTableRow))
     {
     }
-    bool OTableRowExchange::WriteObject( tools::SvRef<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId, const 
css::datatransfer::DataFlavor& /*rFlavor*/ )
+    bool OTableRowExchange::WriteObject( SvStream& rOStm, void* pUserObject, 
sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
     {
         if(nUserObjectId == FORMAT_OBJECT_ID_SBA_TABED)
         {
             std::vector< std::shared_ptr<OTableRow> >* pRows = static_cast< 
std::vector< std::shared_ptr<OTableRow> >* >(pUserObject);
             if(pRows)
             {
-                (*rxOStm).WriteInt32( pRows->size() ); // first stream the size
+                rOStm.WriteInt32( pRows->size() ); // first stream the size
                 for (auto const& row : *pRows)
-                    WriteOTableRow(*rxOStm, *row);
+                    WriteOTableRow(rOStm, *row);
                 return true;
             }
         }
diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx
index 2a49b4a39475..39246b779a29 100644
--- a/include/sot/storage.hxx
+++ b/include/sot/storage.hxx
@@ -35,15 +35,9 @@ enum class SotClipboardFormatId : sal_uInt32;
 
 class BaseStorageStream;
 
-class SOT_DLLPUBLIC SotTempStream final : virtual public SvRefBase, public 
SvStream
+namespace SotTempStream
 {
-friend class SotStorage;
-
-    virtual ~SotTempStream() override;
-public:
-    SotTempStream(OUString const & rString, StreamMode = 
StreamMode::STD_READWRITE);
-
-    void CopyTo(SotTempStream * pDestStm);
+    SOT_DLLPUBLIC std::unique_ptr<SvStream> Create(OUString const & rString, 
StreamMode = StreamMode::STD_READWRITE);
 };
 
 class SOT_DLLPUBLIC SotStorageStream final : virtual public SotObject, public 
SvStream
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index 60dfb3cc993e..33a4425b03e7 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -36,7 +36,6 @@ namespace com::sun::star::awt { class XProgressBar; }
 class INetURLObject;
 class GalleryTheme;
 class SotStorageStream;
-class SotTempStream;
 
 struct ExchangeData
 {
@@ -140,7 +139,7 @@ using TransferableHelper::CopyToClipboard;
     GalleryTheme*                   mpTheme;
     SgaObjKind                      meObjectKind;
     sal_uInt32                      mnObjectPos;
-    tools::SvRef<SotTempStream>  mxModelStream;
+    std::unique_ptr<SvStream>       mxModelStream;
     std::unique_ptr<GraphicObject>  mpGraphicObject;
     std::unique_ptr<INetURLObject>  mpURL;
 
@@ -155,7 +154,7 @@ public:
     // TransferableHelper
     virtual void                    AddSupportedFormats() override;
     virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const 
OUString& rDestDoc ) override;
-    virtual bool                    WriteObject( tools::SvRef<SotTempStream>& 
rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const 
css::datatransfer::DataFlavor& rFlavor ) override;
+    virtual bool                    WriteObject( SvStream& 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 e14372066f51..52333b0f4d19 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -140,8 +140,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<SotTempStream> const & rModelStreamRef);
-    SAL_DLLPRIVATE bool         InsertModelStream(const 
tools::SvRef<SotTempStream>& rModelStream, sal_uInt32 nInsertPos);
+    SAL_DLLPRIVATE bool         GetModelStream(sal_uInt32 nPos, SvStream & 
rModelStream);
+    SAL_DLLPRIVATE bool         InsertModelStream(SvStream& 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 78b5b9e03d5c..93bd892daa3d 100644
--- a/include/vcl/transfer.hxx
+++ b/include/vcl/transfer.hxx
@@ -58,7 +58,6 @@ class INetBookmark;
 class INetImage;
 class FileList;
 class SotStorageStream;
-class SotTempStream;
 namespace vcl { class Window; }
 
 // Drag&Drop defines
@@ -245,7 +244,7 @@ protected:
 
     virtual void        AddSupportedFormats() = 0;
     virtual bool        GetData( const css::datatransfer::DataFlavor& rFlavor, 
const OUString& rDestDoc ) = 0;
-    virtual bool        WriteObject( tools::SvRef<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId, const 
css::datatransfer::DataFlavor& rFlavor );
+    virtual bool        WriteObject( SvStream& rOStm, void* pUserObject, 
sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor );
     virtual void        DragFinished( sal_Int8 nDropAction );
     virtual void        ObjectReleased();
 
@@ -352,8 +351,8 @@ public:
     css::uno::Sequence<sal_Int8> GetSequence( SotClipboardFormatId nFormat, 
const OUString& rDestDoc ) const;
     css::uno::Sequence<sal_Int8> GetSequence( const 
css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
 
-    bool                        GetSotStorageStream( SotClipboardFormatId 
nFormat, tools::SvRef<SotTempStream>& rStreamRef ) const;
-    bool                        GetSotStorageStream( const 
css::datatransfer::DataFlavor& rFlavor, tools::SvRef<SotTempStream>& rStreamRef 
) const;
+    bool                        GetSotStorageStream( SotClipboardFormatId 
nFormat, std::unique_ptr<SvStream>& rStreamRef ) const;
+    bool                        GetSotStorageStream( const 
css::datatransfer::DataFlavor& rFlavor, std::unique_ptr<SvStream>& rStreamRef ) 
const;
 
     css::uno::Reference<css::io::XInputStream> GetInputStream( 
SotClipboardFormatId nFormat, const OUString& rDestDoc ) const;
     css::uno::Reference<css::io::XInputStream> GetInputStream( const 
css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) const;
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 76c221dd18d3..d66b32aba4bc 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -425,7 +425,7 @@ bool ScDrawTransferObj::GetData( const 
css::datatransfer::DataFlavor& rFlavor, c
     return bOK;
 }
 
-bool ScDrawTransferObj::WriteObject( tools::SvRef<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId,
+bool ScDrawTransferObj::WriteObject( SvStream& rOStm, void* pUserObject, 
sal_uInt32 nUserObjectId,
                                         const css::datatransfer::DataFlavor& 
/* rFlavor */ )
 {
     // called from SetObject, put data into stream
@@ -437,7 +437,7 @@ bool ScDrawTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void*
             {
                 SdrModel* pDrawModel = static_cast<SdrModel*>(pUserObject);
                 pDrawModel->BurnInStyleSheetAttributes();
-                rxOStm->SetBufferSize( 0xff00 );
+                rOStm.SetBufferSize( 0xff00 );
 
                 // for the changed pool defaults from drawing layer pool set 
those
                 // attributes as hard attributes to preserve them for saving
@@ -465,11 +465,11 @@ bool ScDrawTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void*
                 }
 
                 {
-                    css::uno::Reference<css::io::XOutputStream> xDocOut( new 
utl::OOutputStreamWrapper( *rxOStm ) );
+                    css::uno::Reference<css::io::XOutputStream> xDocOut( new 
utl::OOutputStreamWrapper( rOStm ) );
                     SvxDrawingLayerExport( pDrawModel, xDocOut );
                 }
 
-                bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+                bRet = ( rOStm.GetError() == ERRCODE_NONE );
             }
             break;
 
@@ -493,13 +493,13 @@ bool ScDrawTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void*
                         xPers->storeToEntry( xWorkStore, aDummyName, aSeq, 
aSeq );
                         if ( xWorkStore->isStreamElement( aDummyName ) )
                         {
-                            uno::Reference < io::XOutputStream > xDocOut( new 
utl::OOutputStreamWrapper( *rxOStm ) );
+                            uno::Reference < io::XOutputStream > xDocOut( new 
utl::OOutputStreamWrapper( rOStm ) );
                             uno::Reference < io::XStream > xNewStream = 
xWorkStore->openStreamElement( aDummyName, embed::ElementModes::READ );
                             ::comphelper::OStorageHelper::CopyInputToOutput( 
xNewStream->getInputStream(), xDocOut );
                         }
                         else
                         {
-                            uno::Reference < io::XStream > xDocStr( new 
utl::OStreamWrapper( *rxOStm ) );
+                            uno::Reference < io::XStream > xDocStr( new 
utl::OStreamWrapper( rOStm ) );
                             uno::Reference< embed::XStorage > xDocStg = 
::comphelper::OStorageHelper::GetStorageFromStream( xDocStr );
                             uno::Reference < embed::XStorage > xNewStg = 
xWorkStore->openStorageElement( aDummyName, embed::ElementModes::READ );
                             xNewStg->copyToStorage( xDocStg );
@@ -539,8 +539,8 @@ bool ScDrawTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void*
                     if ( xTransact.is() )
                         xTransact->commit();
 
-                    rxOStm->SetBufferSize( 0xff00 );
-                    rxOStm->WriteStream( *pTempStream );
+                    rOStm.SetBufferSize( 0xff00 );
+                    rOStm.WriteStream( *pTempStream );
 
                     xWorkStore->dispose();
                     xWorkStore.clear();
@@ -548,7 +548,7 @@ bool ScDrawTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void*
                 catch ( uno::Exception& )
                 {}
 
-                bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+                bRet = ( rOStm.GetError() == ERRCODE_NONE );
             }
             break;
 
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 23278c0bcef1..5d5cd26090c8 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -455,7 +455,7 @@ bool ScTransferObj::GetData( const 
datatransfer::DataFlavor& rFlavor, const OUSt
     return bOK;
 }
 
-bool ScTransferObj::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* 
pUserObject, sal_uInt32 nUserObjectId,
+bool ScTransferObj::WriteObject( SvStream& rOStm, void* pUserObject, 
sal_uInt32 nUserObjectId,
                                         const datatransfer::DataFlavor& 
rFlavor )
 {
     // called from SetObject, put data into stream
@@ -469,8 +469,8 @@ bool ScTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void* pUse
 
                 SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor 
);
                 // mba: no BaseURL for data exchange
-                if ( pImpEx->ExportStream( *rxOStm, OUString(), nFormat ) )
-                    bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+                if ( pImpEx->ExportStream( rOStm, OUString(), nFormat ) )
+                    bRet = ( rOStm.GetError() == ERRCODE_NONE );
             }
             break;
 
@@ -480,8 +480,8 @@ bool ScTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void* pUse
                 ScTabEditEngine* pEngine = 
static_cast<ScTabEditEngine*>(pUserObject);
                 if ( nUserObjectId == SCTRANS_TYPE_EDIT_RTF )
                 {
-                    pEngine->Write( *rxOStm, EETextFormat::Rtf );
-                    bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+                    pEngine->Write( rOStm, EETextFormat::Rtf );
+                    bRet = ( rOStm.GetError() == ERRCODE_NONE );
                 }
                 else
                 {
@@ -497,7 +497,9 @@ bool ScTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void* pUse
                     uno::Reference<datatransfer::XTransferable> xEditTrans = 
pEngine->CreateTransferable( aSel );
                     TransferableDataHelper aEditHelper( xEditTrans );
 
-                    bRet = aEditHelper.GetSotStorageStream( rFlavor, rxOStm );
+                    std::unique_ptr<SvStream> xStrm;
+                    bRet = aEditHelper.GetSotStorageStream( rFlavor, xStrm );
+                    rOStm.WriteStream(*xStrm);
                 }
             }
             break;
@@ -505,8 +507,8 @@ bool ScTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void* pUse
         case SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT:
             {
                 ScTabEditEngine* pEngine = 
static_cast<ScTabEditEngine*>(pUserObject);
-                pEngine->Write(*rxOStm, EETextFormat::Xml);
-                bRet = (rxOStm->GetError() == ERRCODE_NONE);
+                pEngine->Write(rOStm, EETextFormat::Xml);
+                bRet = (rOStm.GetError() == ERRCODE_NONE);
             }
             break;
 
@@ -531,8 +533,8 @@ bool ScTransferObj::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void* pUse
                 if ( xTransact.is() )
                     xTransact->commit();
 
-                rxOStm->SetBufferSize( 0xff00 );
-                rxOStm->WriteStream( *pTempStream );
+                rOStm.SetBufferSize( 0xff00 );
+                rOStm.WriteStream( *pTempStream );
 
                 bRet = true;
 
diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx
index 2e485db9a2af..001c64cbd016 100644
--- a/sc/source/ui/inc/drwtrans.hxx
+++ b/sc/source/ui/inc/drwtrans.hxx
@@ -71,7 +71,7 @@ public:
 
     virtual void        AddSupportedFormats() override;
     virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const 
OUString& rDestDoc ) override;
-    virtual bool        WriteObject( tools::SvRef<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId,
+    virtual bool        WriteObject( SvStream& rOStm, 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 9b160e127cc9..8813bf5b40d2 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -74,7 +74,7 @@ public:
 
     virtual void        AddSupportedFormats() override;
     virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const 
OUString& rDestDoc ) override;
-    virtual bool        WriteObject( tools::SvRef<SotTempStream>& rxOStm, 
void* pUserObject, sal_uInt32 nUserObjectId,
+    virtual bool        WriteObject( SvStream& rOStm, 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 541642241eb4..ae95da62ef02 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4367,7 +4367,7 @@ static SotClipboardFormatId lcl_GetDropFormatId( const 
uno::Reference<datatransf
         //  If it's a Writer object, insert RTF instead of OLE
 
         bool bDoRtf = false;
-        tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> 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 3ae5cbc52c61..07a9205fc427 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -776,7 +776,7 @@ bool ScViewFunc::PasteOnDrawObjectLinked(
 
     if ( aDataHelper.HasFormat( SotClipboardFormatId::SVXB ) )
     {
-        tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> 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 8ff799ad46f4..339cff8978dd 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -161,13 +161,13 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW 
nStartRow,
             ScAddress( nStartCol, nStartRow, GetViewData().GetTabNo() ) );
 
         OUString aStr;
-        tools::SvRef<SotTempStream> xStream;
-        if ( aDataHelper.GetSotStorageStream( SotClipboardFormatId::RTF, 
xStream ) && xStream.is() )
+        std::unique_ptr<SvStream> xStream;
+        if ( aDataHelper.GetSotStorageStream( SotClipboardFormatId::RTF, 
xStream ) && xStream )
             // mba: clipboard always must contain absolute URLs (could be from 
alien source)
             aImpEx.ImportStream( *xStream, OUString(), 
SotClipboardFormatId::RTF );
         else if ( aDataHelper.GetString( SotClipboardFormatId::RTF, aStr ) )
             aImpEx.ImportString( aStr, SotClipboardFormatId::RTF );
-        else if ( aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::RICHTEXT, xStream ) && xStream.is() )
+        else if ( aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::RICHTEXT, xStream ) && xStream )
             aImpEx.ImportStream( *xStream, OUString(), 
SotClipboardFormatId::RICHTEXT );
         else if ( aDataHelper.GetString( SotClipboardFormatId::RICHTEXT, aStr 
) )
             aImpEx.ImportString( aStr, SotClipboardFormatId::RICHTEXT );
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 27c90299a908..fe8492c9f065 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -232,7 +232,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId 
nFormatId,
     }
     else if (nFormatId == SotClipboardFormatId::SVXB)
     {
-        tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
         if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm 
) )
         {
             Graphic aGraphic;
@@ -243,7 +243,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId 
nFormatId,
     }
     else if ( nFormatId == SotClipboardFormatId::DRAWING )
     {
-        tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
         if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, 
xStm ) )
         {
             MakeDrawLayer();    // before loading model, so 3D factory has 
been created
@@ -677,8 +677,8 @@ bool ScViewFunc::PasteDataFormatFormattedText( 
SotClipboardFormatId nFormatId,
     pObj->SetOverwriting( true );
 
     auto pStrBuffer = std::make_shared<OUString>();
-    tools::SvRef<SotTempStream> xStream;
-    if ( rDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.is() 
)
+    std::unique_ptr<SvStream> xStream;
+    if ( rDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream )
     {
         // Static variables for per-session storage. This could be
         // changed to longer-term storage in future.
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 257a7c10aee4..065459e5d7ff 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -555,7 +555,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor, 
const OUString& rDestDo
     return bOK;
 }
 
-bool SdTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* 
pObject, sal_uInt32 nObjectType, const DataFlavor& )
+bool SdTransferable::WriteObject( SvStream& rOStm, void* pObject, sal_uInt32 
nObjectType, const DataFlavor& )
 {
     bool bRet = false;
 
@@ -569,18 +569,18 @@ bool SdTransferable::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void* pOb
                 SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pObject);
                 if ( !bDontBurnInStyleSheet )
                     pDoc->BurnInStyleSheetAttributes();
-                rxOStm->SetBufferSize( 16348 );
+                rOStm.SetBufferSize( 16348 );
 
                 rtl::Reference< SdXImpressDocument > xComponent( new 
SdXImpressDocument( pDoc, true ) );
                 pDoc->setUnoModel( xComponent );
 
                 {
-                    css::uno::Reference<css::io::XOutputStream> xDocOut( new 
utl::OOutputStreamWrapper( *rxOStm ) );
+                    css::uno::Reference<css::io::XOutputStream> xDocOut( new 
utl::OOutputStreamWrapper( rOStm ) );
                     SvxDrawingLayerExport( pDoc, xDocOut, xComponent, 
(pDoc->GetDocumentType() == DocumentType::Impress) ? 
"com.sun.star.comp.Impress.XMLClipboardExporter" : 
"com.sun.star.comp.DrawingLayer.XMLExporter" );
                 }
 
                 xComponent->dispose();
-                bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+                bRet = ( rOStm.GetError() == ERRCODE_NONE );
             }
             catch( Exception& )
             {
@@ -612,8 +612,8 @@ bool SdTransferable::WriteObject( 
tools::SvRef<SotTempStream>& rxOStm, void* pOb
                 if ( xTransact.is() )
                     xTransact->commit();
 
-                rxOStm->SetBufferSize( 0xff00 );
-                rxOStm->WriteStream( *pTempStream );
+                rOStm.SetBufferSize( 0xff00 );
+                rOStm.WriteStream( *pTempStream );
 
                 bRet = true;
             }
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index bae64b0ac7cb..596816931c15 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -175,7 +175,7 @@ public:
     SdrMediaObj*            InsertMediaObj(const OUString& rURL, sal_Int8& 
rAction,
                                             const Point& rPos, const Size& 
rSize );
 
-    bool PasteRTFTable( const ::tools::SvRef<SotTempStream>& xStm, SdrPage* 
pPage, SdrInsertFlags nPasteOptions );
+    bool PasteRTFTable( SvStream& rOStm, 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 d6d382870dbb..b93ef331f1d4 100644
--- a/sd/source/ui/inc/sdxfer.hxx
+++ b/sd/source/ui/inc/sdxfer.hxx
@@ -105,7 +105,7 @@ protected:
 
     virtual void                    AddSupportedFormats() override;
     virtual bool                    GetData( const 
css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
-    virtual bool                    WriteObject( tools::SvRef<SotTempStream>& 
rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const 
css::datatransfer::DataFlavor& rFlavor ) override;
+    virtual bool                    WriteObject( SvStream& rOStm, void* 
pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& 
rFlavor ) override;
     virtual void                    ObjectReleased() override final;
 
 private:
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index ddd0ad28ece5..16947c001d72 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -322,7 +322,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     // ImageMap?
     if( !pOwnData && aDataHelper.HasFormat( SotClipboardFormatId::SVIM ) )
     {
-        ::tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
 
         if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVIM, xStm 
) )
         {
@@ -341,7 +341,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
         if( ( bIsRTF || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT 
) )
             && ! aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
         {
-            ::tools::SvRef<SotTempStream> xStm;
+            std::unique_ptr<SvStream> xStm;
 
             if( aDataHelper.GetSotStorageStream( bIsRTF ? 
SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) )
             {
@@ -685,7 +685,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::PDF ))
     {
-        ::tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
         if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::PDF, xStm ) 
)
         {
             Point aInsertPos(rPos);
@@ -705,7 +705,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::DRAWING ))
     {
-        ::tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
 
         if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::DRAWING, 
xStm ) )
         {
@@ -1227,7 +1227,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && (!bLink || pPickObj) && 
CHECK_FORMAT_TRANS(SotClipboardFormatId::SVXB))
     {
-        ::tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
 
         if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::SVXB, xStm 
) )
         {
@@ -1416,7 +1416,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML))
     {
-        ::tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
 
         if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::HTML, xStm 
) )
         {
@@ -1428,7 +1428,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && !bLink && 
CHECK_FORMAT_TRANS(SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT))
     {
-        ::tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
         if( aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, xStm ) )
         {
             OutlinerView* pOLV = GetTextEditOutlinerView();
@@ -1459,7 +1459,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
         bool bIsRTF = CHECK_FORMAT_TRANS(SotClipboardFormatId::RTF);
         if (bIsRTF || CHECK_FORMAT_TRANS(SotClipboardFormatId::RICHTEXT))
         {
-            ::tools::SvRef<SotTempStream> xStm;
+            std::unique_ptr<SvStream> xStm;
 
             if( aDataHelper.GetSotStorageStream( bIsRTF ? 
SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) )
             {
@@ -1467,7 +1467,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
                 if( bTable )
                 {
-                    bReturn = PasteRTFTable( xStm, pPage, nPasteOptions );
+                    bReturn = PasteRTFTable( *xStm, pPage, nPasteOptions );
                 }
                 else
                 {
@@ -1496,7 +1496,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
         bool bIsHtmlSimple = 
CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML_SIMPLE);
         if (bIsHtmlSimple)
         {
-            ::tools::SvRef<SotTempStream> xStm;
+            std::unique_ptr<SvStream> xStm;
 
             if 
(aDataHelper.GetSotStorageStream(SotClipboardFormatId::HTML_SIMPLE, xStm))
             {
@@ -1598,7 +1598,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     return bReturn;
 }
 
-bool View::PasteRTFTable( const ::tools::SvRef<SotTempStream>& xStm, SdrPage* 
pPage, SdrInsertFlags nPasteOptions )
+bool View::PasteRTFTable( SvStream& rStm, SdrPage* pPage, SdrInsertFlags 
nPasteOptions )
 {
     DrawDocShellRef xShell = new DrawDocShell(SfxObjectCreateMode::INTERNAL, 
false, DocumentType::Impress);
     xShell->DoInitNew();
@@ -1607,7 +1607,7 @@ bool View::PasteRTFTable( const 
::tools::SvRef<SotTempStream>& xStm, SdrPage* pP
     pModel->GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
     pModel->InsertPage(pModel->AllocPage(false).get());
 
-    CreateTableFromRTF(*xStm, pModel);
+    CreateTableFromRTF(rStm, pModel);
     bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions);
 
     xShell->DoClose();
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 766c339f497d..937681ee56ef 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -42,60 +42,16 @@
 
 using namespace ::com::sun::star;
 
-static SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode 
nMode )
+std::unique_ptr<SvStream> SotTempStream::Create( const OUString & rName, 
StreamMode nMode )
 {
-    SvLockBytesRef xLB;
     if( !rName.isEmpty() )
     {
-        SvStream * pFileStm = new SvFileStream( rName, nMode );
-        xLB = new SvLockBytes( pFileStm, true );
+        return std::make_unique<SvFileStream>( rName, nMode );
     }
     else
     {
-        SvStream * pCacheStm = new SvMemoryStream();
-        xLB = new SvLockBytes( pCacheStm, true );
+        return std::make_unique<SvMemoryStream>();
     }
-    return xLB;
-}
-
-SotTempStream::SotTempStream( const OUString & rName, StreamMode nMode )
-    : SvStream( MakeLockBytes_Impl( rName, nMode ).get() )
-{
-    if( nMode & StreamMode::WRITE )
-        m_isWritable = true;
-    else
-        m_isWritable = false;
-}
-
-SotTempStream::~SotTempStream()
-{
-    FlushBuffer();
-}
-
-void SotTempStream::CopyTo( SotTempStream * pDestStm )
-{
-    FlushBuffer(); // 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<sal_uInt8[]> pMem(new sal_uInt8[ BUFSIZE ]);
-    sal_Int32  nRead;
-    while (0 != (nRead = ReadBytes(pMem.get(), BUFSIZE)))
-    {
-        if (nRead != static_cast<sal_Int32>(pDestStm->WriteBytes(pMem.get(), 
nRead)))
-        {
-            SetError( SVSTREAM_GENERALERROR );
-            break;
-        }
-    }
-    pMem.reset();
-
-    // set position
-    pDestStm->Seek( nPos );
-    Seek( nPos );
 }
 
 SotStorageStream::SotStorageStream( BaseStorageStream * pStm )
diff --git a/svx/inc/galleryfilestorage.hxx b/svx/inc/galleryfilestorage.hxx
index f913b0574fc1..42c40beef667 100644
--- a/svx/inc/galleryfilestorage.hxx
+++ b/svx/inc/galleryfilestorage.hxx
@@ -81,10 +81,8 @@ public:
     bool readModel(const GalleryObject* pObject, SdrModel& rModel);
     SgaObjectSvDraw insertModel(const FmFormModel& rModel, const 
INetURLObject& rUserURL);
 
-    bool readModelStream(const GalleryObject* pObject,
-                         tools::SvRef<SotTempStream> const& rxModelStream);
-    SgaObjectSvDraw insertModelStream(const tools::SvRef<SotTempStream>& 
rxModelStream,
-                                      const INetURLObject& rUserURL);
+    bool readModelStream(const GalleryObject* pObject, SvStream& rModelStream);
+    SgaObjectSvDraw insertModelStream(SvStream& rModelStream, const 
INetURLObject& rUserURL);
 
     INetURLObject implCreateUniqueURL(SgaObjKind eObjKind, const 
INetURLObject& rUserURL,
                                       ConvertDataFormat nFormat = 
ConvertDataFormat::Unknown);
diff --git a/svx/source/gallery2/galleryfilestorage.cxx 
b/svx/source/gallery2/galleryfilestorage.cxx
index bef365a0060c..73f6492c1268 100644
--- a/svx/source/gallery2/galleryfilestorage.cxx
+++ b/svx/source/gallery2/galleryfilestorage.cxx
@@ -332,8 +332,7 @@ SgaObjectSvDraw GalleryFileStorage::insertModel(const 
FmFormModel& rModel,
     return SgaObjectSvDraw();
 }
 
-bool GalleryFileStorage::readModelStream(const GalleryObject* pObject,
-                                         tools::SvRef<SotTempStream> const& 
rxModelStream)
+bool GalleryFileStorage::readModelStream(const GalleryObject* pObject, 
SvStream& rxModelStream)
 {
     const INetURLObject aURL(ImplGetURL(pObject));
     rtl::Reference<SotStorage> xSotStorage(GetSvDrawStorage());
@@ -363,13 +362,13 @@ bool GalleryFileStorage::readModelStream(const 
GalleryObject* pObject,
 
                         {
                             uno::Reference<io::XOutputStream> xDocOut(
-                                new utl::OOutputStreamWrapper(*rxModelStream));
+                                new utl::OOutputStreamWrapper(rxModelStream));
 
                             SvxDrawingLayerExport(aModel.GetModel(), xDocOut);
                         }
                     }
 
-                    bRet = (rxModelStream->GetError() == ERRCODE_NONE);
+                    bRet = (rxModelStream.GetError() == ERRCODE_NONE);
                 }
             }
 
@@ -379,9 +378,8 @@ bool GalleryFileStorage::readModelStream(const 
GalleryObject* pObject,
     return bRet;
 }
 
-SgaObjectSvDraw
-GalleryFileStorage::insertModelStream(const tools::SvRef<SotTempStream>& 
rxModelStream,
-                                      const INetURLObject& rUserURL)
+SgaObjectSvDraw GalleryFileStorage::insertModelStream(SvStream& rModelStream,
+                                                      const INetURLObject& 
rUserURL)
 {
     INetURLObject aURL(implCreateUniqueURL(SgaObjKind::SvDraw, rUserURL));
     rtl::Reference<SotStorage> xSotStorage(GetSvDrawStorage());
@@ -397,7 +395,7 @@ GalleryFileStorage::insertModelStream(const 
tools::SvRef<SotTempStream>& rxModel
             GalleryCodec aCodec(*xOutputStream);
 
             xOutputStream->SetBufferSize(16348);
-            aCodec.Write(*rxModelStream);
+            aCodec.Write(rModelStream);
 
             if (!xOutputStream->GetError())
             {
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index ab5713f7a4df..3eacf5691819 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -394,13 +394,13 @@ void GalleryTransferable::InitData( bool bLazy )
                         mpGraphicObject.reset(new GraphicObject( 
std::move(aGraphic) ));
                 }
 
-                if( !mxModelStream.is() )
+                if( !mxModelStream )
                 {
-                    mxModelStream = new SotTempStream( "" );
+                    mxModelStream = SotTempStream::Create( "" );
                     mxModelStream->SetBufferSize( 16348 );
 
-                    if (!mpTheme || !mpTheme->GetModelStream(mnObjectPos, 
mxModelStream))
-                        mxModelStream.clear();
+                    if (!mpTheme || !mpTheme->GetModelStream(mnObjectPos, 
*mxModelStream))
+                        mxModelStream.reset();
                     else
                         mxModelStream->Seek( 0 );
                 }
@@ -480,7 +480,7 @@ bool GalleryTransferable::GetData( const 
datatransfer::DataFlavor& rFlavor, cons
 
     if( ( SotClipboardFormatId::DRAWING == nFormat ) && ( SgaObjKind::SvDraw 
== meObjectKind ) )
     {
-        bRet = ( mxModelStream.is() && SetObject( mxModelStream.get(), 0, 
rFlavor ) );
+        bRet = ( mxModelStream && SetObject( mxModelStream.get(), 0, rFlavor ) 
);
     }
     else if( ( SotClipboardFormatId::SIMPLE_FILE == nFormat ) && mpURL )
     {
@@ -502,15 +502,15 @@ bool GalleryTransferable::GetData( const 
datatransfer::DataFlavor& rFlavor, cons
     return bRet;
 }
 
-bool GalleryTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, 
void* pUserObject,
+bool GalleryTransferable::WriteObject( SvStream& rOStm, void* pUserObject,
                                            sal_uInt32, const 
datatransfer::DataFlavor& )
 {
     bool bRet = false;
 
     if( pUserObject )
     {
-        rxOStm->WriteStream( *static_cast< SotStorageStream* >( pUserObject ) 
);
-        bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+        rOStm.WriteStream( *static_cast< SotStorageStream* >( pUserObject ) );
+        bRet = ( rOStm.GetError() == ERRCODE_NONE );
     }
 
     return bRet;
@@ -533,7 +533,7 @@ void GalleryTransferable::DragFinished( sal_Int8 
nDropAction )
 
 void GalleryTransferable::ObjectReleased()
 {
-    mxModelStream.clear();
+    mxModelStream.reset();
     mpGraphicObject.reset();
     mpURL.reset();
 }
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 4b6d0c86200a..857de6ecd413 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -456,24 +456,24 @@ bool GalleryTheme::InsertModel(const FmFormModel& rModel, 
sal_uInt32 nInsertPos)
     return bRet;
 }
 
-bool GalleryTheme::GetModelStream(sal_uInt32 nPos, tools::SvRef<SotTempStream> 
const & rxModelStream)
+bool GalleryTheme::GetModelStream(sal_uInt32 nPos, SvStream& rModelStream)
 {
     const GalleryObject*    pObject = 
maGalleryObjectCollection.getForPosition( nPos );
     bool                    bRet = false;
 
     if( pObject && ( SgaObjKind::SvDraw == pObject->eObjKind ) )
     {
-        bRet = mpGalleryStorageEngine->readModelStream(pObject, rxModelStream);
+        bRet = mpGalleryStorageEngine->readModelStream(pObject, rModelStream);
     }
 
     return bRet;
 }
 
-bool GalleryTheme::InsertModelStream(const tools::SvRef<SotTempStream>& 
rxModelStream, sal_uInt32 nInsertPos)
+bool GalleryTheme::InsertModelStream(SvStream& rModelStream, sal_uInt32 
nInsertPos)
 {
     bool            bRet = false;
 
-    const SgaObjectSvDraw aObjSvDraw = 
mpGalleryStorageEngine->insertModelStream(rxModelStream, 
GetParent()->GetUserURL());
+    const SgaObjectSvDraw aObjSvDraw = 
mpGalleryStorageEngine->insertModelStream(rModelStream, 
GetParent()->GetUserURL());
     if(aObjSvDraw.IsValid())
         bRet = InsertObject( aObjSvDraw, nInsertPos );
 
@@ -542,10 +542,10 @@ bool GalleryTheme::InsertTransferable(const 
uno::Reference< datatransfer::XTrans
 
         if( aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
         {
-            tools::SvRef<SotTempStream> xModelStm;
+            std::unique_ptr<SvStream> xModelStm;
 
             if( aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::DRAWING, xModelStm ) )
-                bRet = InsertModelStream( xModelStm, nInsertPos );
+                bRet = InsertModelStream( *xModelStm, nInsertPos );
         }
         else if( aDataHelper.HasFormat( SotClipboardFormatId::FILE_LIST ) ||
                  aDataHelper.HasFormat( SotClipboardFormatId::SIMPLE_FILE ) )
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 2e4d990ecf62..7e3ea868c816 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -694,7 +694,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, 
const OUString& rDestDo
     return bOK;
 }
 
-bool SwTransferable::WriteObject( tools::SvRef<SotTempStream>& xStream,
+bool SwTransferable::WriteObject( SvStream& rOStream,
                                     void* pObject, sal_uInt32 nObjectType,
                                     const DataFlavor& /*rFlavor*/ )
 {
@@ -707,7 +707,7 @@ bool SwTransferable::WriteObject( 
tools::SvRef<SotTempStream>& xStream,
         {
             // don't change the sequence of commands
             SdrModel *pModel = static_cast<SdrModel*>(pObject);
-            xStream->SetBufferSize( 16348 );
+            rOStream.SetBufferSize( 16348 );
 
             // for the changed pool defaults from drawing layer pool set those
             // attributes as hard attributes to preserve them for saving
@@ -735,11 +735,11 @@ bool SwTransferable::WriteObject( 
tools::SvRef<SotTempStream>& xStream,
             }
 
             {
-                uno::Reference<io::XOutputStream> xDocOut( new 
utl::OOutputStreamWrapper( *xStream ) );
+                uno::Reference<io::XOutputStream> xDocOut( new 
utl::OOutputStreamWrapper( rOStream ) );
                 SvxDrawingLayerExport( pModel, xDocOut );
             }
 
-            bRet = ERRCODE_NONE == xStream->GetError();
+            bRet = ERRCODE_NONE == rOStream.GetError();
         }
         break;
 
@@ -764,8 +764,8 @@ bool SwTransferable::WriteObject( 
tools::SvRef<SotTempStream>& xStream,
                 if ( xTransact.is() )
                     xTransact->commit();
 
-                xStream->SetBufferSize( 0xff00 );
-                xStream->WriteStream( *pTempStream );
+                rOStream.SetBufferSize( 0xff00 );
+                rOStream.WriteStream( *pTempStream );
 
                 xWorkStore->dispose();
                 xWorkStore.clear();
@@ -774,17 +774,17 @@ bool SwTransferable::WriteObject( 
tools::SvRef<SotTempStream>& xStream,
             {
             }
 
-            bRet = ( xStream->GetError() == ERRCODE_NONE );
+            bRet = ( rOStream.GetError() == ERRCODE_NONE );
         }
         break;
 
     case SWTRANSFER_OBJECTTYPE_DDE:
         {
-            xStream->SetBufferSize( 1024 );
+            rOStream.SetBufferSize( 1024 );
             SwTransferDdeLink* pDdeLnk = 
static_cast<SwTransferDdeLink*>(pObject);
-            if( pDdeLnk->WriteData( *xStream ) )
+            if( pDdeLnk->WriteData( rOStream ) )
             {
-                bRet = ERRCODE_NONE == xStream->GetError();
+                bRet = ERRCODE_NONE == rOStream.GetError();
             }
         }
         break;
@@ -830,10 +830,10 @@ bool SwTransferable::WriteObject( 
tools::SvRef<SotTempStream>& xStream,
         aDbgWrt.Write( xWrt );
 #endif
 
-        SwWriter aWrt( *xStream, *pDoc );
+        SwWriter aWrt( rOStream, *pDoc );
         if( ! aWrt.Write( xWrt ).IsError() )
         {
-            xStream->WriteChar( '
+            rOStream.WriteChar( '
             bRet = true;
         }
     }
@@ -2148,7 +2148,7 @@ bool SwTransferable::PasteFileContent( const 
TransferableDataHelper& rData,
 
     MSE40HTMLClipFormatObj aMSE40ClpObj;
 
-    tools::SvRef<SotTempStream> xStrm;
+    std::unique_ptr<SvStream> xStrm;
     SvStream* pStream = nullptr;
     Reader* pRead = nullptr;
     OUString sData;
@@ -2233,7 +2233,7 @@ bool SwTransferable::PasteFileContent( const 
TransferableDataHelper& rData,
         pResId = STR_CLPBRD_FORMAT_ERROR;
 
     // Exist a SvMemoryStream? (data in the OUString and xStrm is empty)
-    if( pStream && !xStrm.is() )
+    if( pStream && !xStrm )
         delete pStream;
 
     if (bMsg && pResId)
@@ -2767,7 +2767,7 @@ bool SwTransferable::PasteSdrFormat(  const 
TransferableDataHelper& rData,
                                     const Point* pPt, SotExchangeActionFlags 
nActionFlags, bool bNeedToSelectBeforePaste)
 {
     bool bRet = false;
-    tools::SvRef<SotTempStream> xStrm;
+    std::unique_ptr<SvStream> xStrm;
     if( rData.GetSotStorageStream( SotClipboardFormatId::DRAWING, xStrm ))
     {
         xStrm->SetVersion( SOFFICE_FILEFORMAT_50 );
@@ -2808,7 +2808,7 @@ bool SwTransferable::PasteGrf( const 
TransferableDataHelper& rData, SwWrtShell&
 
     case SotClipboardFormatId::SVXB:
     {
-        tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
 
         if(rData.GetSotStorageStream(SotClipboardFormatId::SVXB, xStm))
         {
diff --git a/sw/source/uibase/inc/swdtflvr.hxx 
b/sw/source/uibase/inc/swdtflvr.hxx
index cde24ff4f5ad..c643aa052b0b 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -157,7 +157,7 @@ class SAL_DLLPUBLIC_RTTI SwTransferable final : public 
TransferableHelper
 
     virtual void        AddSupportedFormats() override;
     virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const 
OUString& rDestDoc ) override;
-    virtual bool        WriteObject( tools::SvRef<SotTempStream>& rxOStm,
+    virtual bool        WriteObject( SvStream& rOStm,
                                         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 a479280a6189..489d7d3d0230 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -904,17 +904,17 @@ bool TransferableHelper::SetINetImage( const INetImage& 
rINtImg,
 
 bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 
nUserObjectId, const DataFlavor& rFlavor )
 {
-    tools::SvRef<SotTempStream> xStm( new SotTempStream( OUString() ) );
+    SvMemoryStream aStm;
 
-    xStm->SetVersion( SOFFICE_FILEFORMAT_50 );
+    aStm.SetVersion( SOFFICE_FILEFORMAT_50 );
 
-    if( pUserObject && WriteObject( xStm, pUserObject, nUserObjectId, rFlavor 
) )
+    if( pUserObject && WriteObject( aStm, pUserObject, nUserObjectId, rFlavor 
) )
     {
-        const sal_uInt32        nLen = xStm->TellEnd();
+        const sal_uInt32        nLen = aStm.TellEnd();
         Sequence< sal_Int8 >    aSeq( nLen );
 
-        xStm->Seek( STREAM_SEEK_TO_BEGIN );
-        xStm->ReadBytes(aSeq.getArray(), nLen);
+        aStm.Seek( STREAM_SEEK_TO_BEGIN );
+        aStm.ReadBytes(aSeq.getArray(), nLen);
 
         if( nLen && ( SotExchange::GetFormat( rFlavor ) == 
SotClipboardFormatId::STRING ) )
         {
@@ -932,7 +932,7 @@ bool TransferableHelper::SetObject( void* pUserObject, 
sal_uInt32 nUserObjectId,
 }
 
 
-bool TransferableHelper::WriteObject( tools::SvRef<SotTempStream>&, void*, 
sal_uInt32, const DataFlavor& )
+bool TransferableHelper::WriteObject( SvStream&, void*, sal_uInt32, const 
DataFlavor& )
 {
     OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" );
     return false;
@@ -1568,7 +1568,7 @@ bool TransferableDataHelper::GetBitmapEx( 
SotClipboardFormatId nFormat, BitmapEx
 
 bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& 
rBmpEx ) const
 {
-    tools::SvRef<SotTempStream> xStm;
+    std::unique_ptr<SvStream> 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
@@ -1679,7 +1679,7 @@ bool 
TransferableDataHelper::GetGDIMetaFile(SotClipboardFormatId nFormat, GDIMet
 
 bool TransferableDataHelper::GetGDIMetaFile( const DataFlavor& rFlavor, 
GDIMetaFile& rMtf ) const
 {
-    tools::SvRef<SotTempStream> xStm;
+    std::unique_ptr<SvStream> xStm;
     DataFlavor          aSubstFlavor;
     bool                bRet = false;
 
@@ -1762,7 +1762,7 @@ bool TransferableDataHelper::GetGraphic( const 
css::datatransfer::DataFlavor& rF
             TransferableDataHelper::IsEqual(aFlavor, rFlavor))
     {
         Graphic aGraphic;
-        tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
         if (GetSotStorageStream(rFlavor, xStm))
         {
             if (GraphicConverter::Import(*xStm, aGraphic) == ERRCODE_NONE)
@@ -1800,7 +1800,7 @@ bool TransferableDataHelper::GetGraphic( const 
css::datatransfer::DataFlavor& rF
     }
     else
     {
-        tools::SvRef<SotTempStream> xStm;
+        std::unique_ptr<SvStream> xStm;
 
         if( GetSotStorageStream( rFlavor, xStm ) )
         {
@@ -1823,8 +1823,8 @@ bool TransferableDataHelper::GetImageMap( 
SotClipboardFormatId nFormat, ImageMap
 
 bool TransferableDataHelper::GetImageMap( const css::datatransfer::DataFlavor& 
rFlavor, ImageMap& rIMap ) const
 {
-    tools::SvRef<SotTempStream> xStm;
-    bool                bRet = GetSotStorageStream( rFlavor, xStm );
+    std::unique_ptr<SvStream> xStm;
+    bool bRet = GetSotStorageStream( rFlavor, xStm );
 
     if( bRet )
     {
@@ -2018,7 +2018,7 @@ bool TransferableDataHelper::GetINetImage(
         const css::datatransfer::DataFlavor& rFlavor,
         INetImage& rINtImg ) const
 {
-    tools::SvRef<SotTempStream> xStm;
+    std::unique_ptr<SvStream> xStm;
     bool bRet = GetSotStorageStream( rFlavor, xStm );
 
     if( bRet )
@@ -2037,7 +2037,7 @@ bool TransferableDataHelper::GetFileList( 
SotClipboardFormatId nFormat,
 
 bool TransferableDataHelper::GetFileList( FileList& rFileList ) const
 {
-    tools::SvRef<SotTempStream> xStm;
+    std::unique_ptr<SvStream> xStm;
     bool                bRet = false;
 
     for( sal_uInt32 i = 0, nFormatCount = GetFormatCount(); ( i < nFormatCount 
) && !bRet; ++i )
@@ -2088,20 +2088,20 @@ Sequence<sal_Int8> TransferableDataHelper::GetSequence( 
const DataFlavor& rFlavo
 }
 
 
-bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId 
nFormat, tools::SvRef<SotTempStream>& rxStream ) const
+bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId 
nFormat, std::unique_ptr<SvStream>& rxStream ) const
 {
     DataFlavor aFlavor;
     return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && 
GetSotStorageStream( aFlavor, rxStream ) );
 }
 
 
-bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, 
tools::SvRef<SotTempStream>& rxStream ) const
+bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, 
std::unique_ptr<SvStream>& rxStream ) const
 {
     Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
 
     if (aSeq.hasElements())
     {
-        rxStream = new SotTempStream( "" );
+        rxStream = SotTempStream::Create( "" );
         rxStream->WriteBytes( aSeq.getConstArray(), aSeq.getLength() );
         rxStream->Seek( 0 );
     }

Reply via email to