From 4c5a19f9cf98fb2b38ee6b4b35f4074499270353 Mon Sep 17 00:00:00 2001 From: Serge Krot Date: Thu, 23 Nov 2017 11:13:35 +0100 Subject: related tdf#108757 small enhancements for speed up - no strings reallocation - faster for-loops Change-Id: I98a355eb3bcb48219afd6334615c9c092ed1a352 Reviewed-on: https://gerrit.libreoffice.org/45142 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- sc/source/core/data/document.cxx | 13 +++++++------ sc/source/ui/unoobj/docuno.cxx | 8 ++++---- sc/source/ui/view/pfuncache.cxx | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3fb8c338f242..019bfcb99f4a 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6275,7 +6275,7 @@ void ScDocument::SetRepeatRowRange( SCTAB nTab, const ScRange* pNew ) ScPrintRangeSaver* ScDocument::CreatePrintRangeSaver() const { - SCTAB nCount = static_cast(maTabs.size()); + const SCTAB nCount = static_cast(maTabs.size()); ScPrintRangeSaver* pNew = new ScPrintRangeSaver( nCount ); for (SCTAB i=0; i(maTabs.size()); i++) + const SCTAB nCount = rSaver.GetTabCount(); + const SCTAB maxIndex = std::min(nCount, static_cast(maTabs.size())); + for (SCTAB i=0; iRestorePrintRanges( rSaver.GetTabData(i) ); } @@ -6298,10 +6299,10 @@ bool ScDocument::NeedPageResetAfterTab( SCTAB nTab ) const if ( nTab + 1 < static_cast(maTabs.size()) && maTabs[nTab] && maTabs[nTab+1] ) { - OUString aNew = maTabs[nTab+1]->GetPageStyle(); - if ( aNew != maTabs[nTab]->GetPageStyle() ) + const OUString & rNew = maTabs[nTab+1]->GetPageStyle(); + if ( rNew != maTabs[nTab]->GetPageStyle() ) { - SfxStyleSheetBase* pStyle = mxPoolHelper->GetStylePool()->Find( aNew, SfxStyleFamily::Page ); + SfxStyleSheetBase* pStyle = mxPoolHelper->GetStylePool()->Find( rNew, SfxStyleFamily::Page ); if ( pStyle ) { const SfxItemSet& rSet = pStyle->GetItemSet(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 60bd3239cc27..ca287c11b398 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1338,13 +1338,13 @@ static OutputDevice* lcl_GetRenderDevice( const uno::Sequence xRenderDevice(rProp.Value, uno::UNO_QUERY); if ( xRenderDevice.is() ) @@ -1947,7 +1947,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec // resolve the hyperlinks for PDF export - if ( pPDFData ) + if ( pPDFData && !pPDFData->GetBookmarks().empty() ) { // iterate over the hyperlinks that were output for this page diff --git a/sc/source/ui/view/pfuncache.cxx b/sc/source/ui/view/pfuncache.cxx index daf593fdbb3d..c738d4920f79 100644 --- a/sc/source/ui/view/pfuncache.cxx +++ b/sc/source/ui/view/pfuncache.cxx @@ -163,7 +163,8 @@ SCTAB ScPrintFuncCache::GetTabForPage( long nPage ) const long ScPrintFuncCache::GetTabStart( SCTAB nTab ) const { long nRet = 0; - for ( SCTAB i=0; i(nPages.size()); i++ ) + const SCTAB maxIndex = std::min(nTab, static_cast(nPages.size())); + for ( SCTAB i=0; i