sc/source/filter/excel/excel.cxx | 7 +++++-- sw/source/filter/ww8/ww8par.cxx | 24 +++++++++++++++++++----- sw/source/filter/ww8/ww8par.hxx | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-)
New commits: commit cd7a2e8c60d67701a311942f0abfe9afaae822cf Author: Caolán McNamara <caol...@redhat.com> Date: Thu Nov 2 19:27:54 2017 +0000 revert drop of SetBufferSize reported spike in load time, so still necessary I guess Change-Id: I38c139b85ed922af18674ac84263150407a3277f Reviewed-on: https://gerrit.libreoffice.org/44231 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index cd396d4c299d..5f9addb25489 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -121,6 +121,8 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument* ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF; if( pBookStrm ) { + pBookStrm->SetBufferSize( 0x8000 ); // still needed? + XclImpRootData aImpData( eBiff, rMedium, xRootStrg, *pDocument, RTL_TEXTENCODING_MS_1252 ); std::unique_ptr< ImportExcel > xFilter; switch( eBiff ) @@ -167,8 +169,9 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, // open the "Book"/"Workbook" stream tools::SvRef<SotStorageStream> xStrgStrm = ScfTools::OpenStorageStreamWrite( xRootStrg, aStrmName ); - if (!xStrgStrm.is() || xStrgStrm->GetError()) - return SCERR_IMPORT_OPEN; + if( !xStrgStrm.is() || xStrgStrm->GetError() ) return SCERR_IMPORT_OPEN; + + xStrgStrm->SetBufferSize( 0x8000 ); // still needed? ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF; XclExpRootData aExpData( bBiff8 ? EXC_BIFF8 : EXC_BIFF5, rMedium, xRootStrg, *pDocument, eNach ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 5caf9c1772b3..c90803a6f969 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -6277,18 +6277,30 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW2(SvStream &rStream) return TestImportDOC(rStream, "WW6"); } -ErrCode WW8Reader::OpenMainStream(tools::SvRef<SotStorageStream>& rRef) +ErrCode WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ) { ErrCode nRet = ERR_SWG_READ_ERROR; OSL_ENSURE( pStg.get(), "Where is my Storage?" ); rRef = pStg->OpenSotStream( "WordDocument", StreamMode::READ | StreamMode::SHARE_DENYALL); - if (rRef.is()) - nRet = rRef->GetError(); + + if( rRef.is() ) + { + if( ERRCODE_NONE == rRef->GetError() ) + { + sal_uInt16 nOld = rRef->GetBufferSize(); + rRef->SetBufferSize( rBuffSize ); + rBuffSize = nOld; + nRet = ERRCODE_NONE; + } + else + nRet = rRef->GetError(); + } return nRet; } ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */) { + sal_uInt16 nOldBuffSize = 32768; bool bNew = !bInsertMode; // New Doc (no inserting) tools::SvRef<SotStorageStream> refStrm; // So that no one else can steal the Stream @@ -6317,7 +6329,7 @@ ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, cons if( pStg.is() ) { - nRet = OpenMainStream(refStrm); + nRet = OpenMainStream( refStrm, nOldBuffSize ); pIn = refStrm.get(); } else @@ -6351,6 +6363,7 @@ ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, cons if( refStrm.is() ) { + refStrm->SetBufferSize( nOldBuffSize ); refStrm.clear(); } else @@ -6378,8 +6391,9 @@ bool WW8Reader::ReadGlossaries(SwTextBlocks& rBlocks, bool bSaveRelFiles) const WW8Reader *pThis = const_cast<WW8Reader *>(this); + sal_uInt16 nOldBuffSize = 32768; tools::SvRef<SotStorageStream> refStrm; - if (!pThis->OpenMainStream(refStrm)) + if (!pThis->OpenMainStream(refStrm, nOldBuffSize)) { WW8Glossary aGloss( refStrm, 8, pStg.get() ); bRet = aGloss.Load( rBlocks, bSaveRelFiles ); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 868858c49570..5760b1ba1a46 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -131,7 +131,7 @@ struct WW8LFOInfo; class WW8Reader : public StgReader { virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; - ErrCode OpenMainStream(tools::SvRef<SotStorageStream>& rRef); + ErrCode OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ); public: virtual int GetReaderType() override;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits