summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2020-12-21 16:28:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-22 07:41:48 +0100
commitdb9f13986fc7ef3d4b44d71459c58e9ea0ae8bcb (patch)
tree5cea6356782106abd471e77aefcf43e20e68069a
parent0eeb310d9ed8654ac4c96c444ebad49a567ad618 (diff)
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 <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx4
-rw-r--r--chart2/source/controller/main/ChartTransferable.cxx7
-rw-r--r--chart2/source/controller/main/ChartTransferable.hxx2
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx2
-rw-r--r--dbaccess/source/ui/inc/TableCopyHelper.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableRowExchange.hxx2
-rw-r--r--dbaccess/source/ui/inc/dbexchange.hxx2
-rw-r--r--dbaccess/source/ui/misc/TableCopyHelper.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableRowExchange.cxx2
-rw-r--r--include/sot/storage.hxx14
-rw-r--r--include/svx/gallerybinaryengine.hxx4
-rw-r--r--include/svx/galmisc.hxx5
-rw-r--r--include/svx/galtheme.hxx4
-rw-r--r--include/vcl/transfer.hxx7
-rw-r--r--sc/source/ui/app/drwtrans.cxx8
-rw-r--r--sc/source/ui/app/transobj.cxx3
-rw-r--r--sc/source/ui/inc/drwtrans.hxx2
-rw-r--r--sc/source/ui/inc/transobj.hxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/viewfun3.cxx2
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
-rw-r--r--sc/source/ui/view/viewfun5.cxx6
-rw-r--r--sd/source/ui/app/sdxfer.cxx6
-rw-r--r--sd/source/ui/inc/View.hxx2
-rw-r--r--sd/source/ui/inc/sdxfer.hxx2
-rw-r--r--sd/source/ui/view/sdview3.cxx16
-rw-r--r--sot/source/sdstor/storage.cxx163
-rw-r--r--svx/source/gallery2/gallerybinaryengine.cxx7
-rw-r--r--svx/source/gallery2/galmisc.cxx4
-rw-r--r--svx/source/gallery2/galtheme.cxx6
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx16
-rw-r--r--sw/source/uibase/inc/swdtflvr.hxx2
-rw-r--r--vcl/source/treelist/transfer.cxx24
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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+bool ChartTransferable::WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream>& 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
+ bool ODataClipboard::WriteObject( ::tools::SvRef<SotTempStream>& 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<SotStorageStream> aHtmlRtfStorage;
+ tools::SvRef<SotTempStream> 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 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream> aNew = new SotStorageStream( aTmp.GetFileName() );
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream> aStreamRef;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& /*rFlavor*/ )
+ bool OTableRowExchange::WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream> const& rxModelStream);
- SgaObjectSvDraw insertModelStream(const tools::SvRef<SotStorageStream>& rxModelStream,
+ tools::SvRef<SotTempStream> const& rxModelStream);
+ SgaObjectSvDraw insertModelStream(const tools::SvRef<SotTempStream>& 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<SotStorageStream> mxModelStream;
+ tools::SvRef<SotTempStream> mxModelStream;
std::unique_ptr<GraphicObject> mpGraphicObject;
std::unique_ptr<INetURLObject> 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream> const & rModelStreamRef);
- SAL_DLLPRIVATE bool InsertModelStream(const tools::SvRef<SotStorageStream>& rModelStream, 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 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor );
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<sal_Int8> GetSequence( SotClipboardFormatId nFormat, const OUString& rDestDoc );
css::uno::Sequence<sal_Int8> GetSequence( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc );
- bool GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef<SotStorageStream>& rStreamRef );
- bool GetSotStorageStream( const css::datatransfer::DataFlavor& rFlavor, tools::SvRef<SotStorageStream>& rStreamRef );
+ bool GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef<SotTempStream>& rStreamRef );
+ bool GetSotStorageStream( const css::datatransfer::DataFlavor& rFlavor, tools::SvRef<SotTempStream>& rStreamRef );
css::uno::Reference<css::io::XInputStream> GetInputStream( SotClipboardFormatId nFormat, const OUString& rDestDoc );
css::uno::Reference<css::io::XInputStream> 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+bool ScDrawTransferObj::WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream>& rxOStm, voi
{
css::uno::Reference<css::io::XOutputStream> 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<SotStorageStream>& rxOStm, voi
if ( xTrans.is() )
xTrans->commit();
}
-
- rxOStm->Commit();
}
catch ( uno::Exception& )
{
@@ -554,7 +551,6 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef<SotStorageStream>& 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+bool ScTransferObj::WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream>& 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<datatransf
// If it's a Writer object, insert RTF instead of OLE
bool bDoRtf = false;
- tools::SvRef<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStream;
+ tools::SvRef<SotTempStream> 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<OUString>();
- tools::SvRef<SotStorageStream> xStream;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream>& rxOStm, void* pObject, sal_uInt32 nObjectType, const DataFlavor& )
+bool SdTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pObject, sal_uInt32 nObjectType, const DataFlavor& )
{
bool bRet = false;
@@ -580,8 +580,7 @@ bool SdTransferable::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void*
{
css::uno::Reference<css::io::XOutputStream> 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<SotStorageStream>& 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<SotStorageStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions );
+ bool PasteRTFTable( const ::tools::SvRef<SotTempStream>& 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<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream> xStm;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ ::tools::SvRef<SotTempStream> 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<SotStorageStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions )
+bool View::PasteRTFTable( const ::tools::SvRef<SotTempStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions )
{
std::unique_ptr<SdDrawDocument> 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<sal_uInt8[]> 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<sal_uInt8[]> 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<SotStorageStream> const& rxModelStream)
+ tools::SvRef<SotTempStream> const& rxModelStream)
{
const INetURLObject aURL(ImplGetURL(pObject));
tools::SvRef<SotStorage> xSotStorage(GetSvDrawStorage());
@@ -366,8 +366,7 @@ bool GalleryBinaryEngine::readModelStream(const GalleryObject* pObject,
uno::Reference<io::XOutputStream> 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<SotStorageStream>& rxModelStream,
+GalleryBinaryEngine::insertModelStream(const tools::SvRef<SotTempStream>& 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<SotStorageStream>& rxOStm, void* pUserObject,
+bool GalleryTransferable::WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream> const & rxModelStream)
+bool GalleryTheme::GetModelStream(sal_uInt32 nPos, tools::SvRef<SotTempStream> const & rxModelStream)
{
const GalleryObject* pObject = maGalleryObjectCollection.getForPosition( nPos );
bool bRet = false;
@@ -466,7 +466,7 @@ bool GalleryTheme::GetModelStream(sal_uInt32 nPos, tools::SvRef<SotStorageStream
return bRet;
}
-bool GalleryTheme::InsertModelStream(const tools::SvRef<SotStorageStream>& rxModelStream, sal_uInt32 nInsertPos)
+bool GalleryTheme::InsertModelStream(const tools::SvRef<SotTempStream>& 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<SotStorageStream> xModelStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream>& xStream,
+bool SwTransferable::WriteObject( tools::SvRef<SotTempStream>& xStream,
void* pObject, sal_uInt32 nObjectType,
const DataFlavor& /*rFlavor*/ )
{
@@ -719,8 +719,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream,
{
uno::Reference<io::XOutputStream> 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<SotStorageStream>& xStream,
xWorkStore->dispose();
xWorkStore.clear();
- xStream->Commit();
}
catch (const uno::Exception&)
{
@@ -774,7 +772,6 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream,
SwTransferDdeLink* pDdeLnk = static_cast<SwTransferDdeLink*>(pObject);
if( pDdeLnk->WriteData( *xStream ) )
{
- xStream->Commit();
bRet = ERRCODE_NONE == xStream->GetError();
}
}
@@ -825,7 +822,6 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& 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<SotStorageStream> xStrm;
+ tools::SvRef<SotTempStream> xStrm;
SvStream* pStream = nullptr;
Reader* pRead = nullptr;
OUString sData;
@@ -2561,7 +2557,7 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData,
OUString aApp, aTopic, aItem;
{
- tools::SvRef<SotStorageStream> xStrm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStrm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream>& rxOStm,
+ virtual bool WriteObject( tools::SvRef<SotTempStream>& 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<SotStorageStream> xStm( new SotStorageStream( OUString() ) );
+ tools::SvRef<SotTempStream> 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<SotStorageStream>&, void*, sal_uInt32, const DataFlavor& )
+bool TransferableHelper::WriteObject( tools::SvRef<SotTempStream>&, 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> 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<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> xStm;
bool bRet = GetSotStorageStream( rFlavor, xStm );
if( bRet )
@@ -1996,7 +1996,7 @@ bool TransferableDataHelper::GetINetImage(
const css::datatransfer::DataFlavor& rFlavor,
INetImage& rINtImg )
{
- tools::SvRef<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> xStm;
bool bRet = GetSotStorageStream( rFlavor, xStm );
if( bRet )
@@ -2015,7 +2015,7 @@ bool TransferableDataHelper::GetFileList( SotClipboardFormatId nFormat,
bool TransferableDataHelper::GetFileList( FileList& rFileList )
{
- tools::SvRef<SotStorageStream> xStm;
+ tools::SvRef<SotTempStream> xStm;
bool bRet = false;
for( sal_uInt32 i = 0, nFormatCount = GetFormatCount(); ( i < nFormatCount ) && !bRet; ++i )
@@ -2066,20 +2066,20 @@ Sequence<sal_Int8> TransferableDataHelper::GetSequence( const DataFlavor& rFlavo
}
-bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef<SotStorageStream>& rxStream )
+bool TransferableDataHelper::GetSotStorageStream( SotClipboardFormatId nFormat, tools::SvRef<SotTempStream>& rxStream )
{
DataFlavor aFlavor;
return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSotStorageStream( aFlavor, rxStream ) );
}
-bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, tools::SvRef<SotStorageStream>& rxStream )
+bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, tools::SvRef<SotTempStream>& rxStream )
{
Sequence<sal_Int8> aSeq = GetSequence(rFlavor, OUString());
if (aSeq.hasElements())
{
- rxStream = new SotStorageStream( "" );
+ rxStream = new SotTempStream( "" );
rxStream->WriteBytes( aSeq.getConstArray(), aSeq.getLength() );
rxStream->Seek( 0 );
}