summaryrefslogtreecommitdiff
path: root/sw/source/uibase/dochdl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-09-19 18:50:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-20 09:54:40 +0200
commitca09f1a350c23f49b90950680fffa687979a8ae2 (patch)
tree825954a43509f26702c0df01bacb6621b8d4e7b5 /sw/source/uibase/dochdl
parentaddfb3cce0f7ce8fbd0b169d467b6956ed95dbb5 (diff)
simplify usage of TempFile in sw
TempFile already handles the stream. And not touching the URL means we stay on the fast path for temp files. Change-Id: I7e5f1cb7c83fc78d392c6874154563b64dd4a672 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140203 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/dochdl')
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 0907404dd0bc..cd00b2698032 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -740,8 +740,9 @@ bool SwTransferable::WriteObject( tools::SvRef<SotTempStream>& xStream,
{
::utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
+ SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE);
uno::Reference< embed::XStorage > xWorkStore =
- ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE );
+ ::comphelper::OStorageHelper::GetStorageFromStream( new utl::OStreamWrapper(*pTempStream), embed::ElementModes::READWRITE );
// write document storage
pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false );
@@ -754,13 +755,8 @@ bool SwTransferable::WriteObject( tools::SvRef<SotTempStream>& xStream,
if ( xTransact.is() )
xTransact->commit();
- std::unique_ptr<SvStream> pSrcStm(::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), StreamMode::READ ));
- if( pSrcStm )
- {
- xStream->SetBufferSize( 0xff00 );
- xStream->WriteStream( *pSrcStm );
- pSrcStm.reset();
- }
+ xStream->SetBufferSize( 0xff00 );
+ xStream->WriteStream( *pTempStream );
xWorkStore->dispose();
xWorkStore.clear();