[Libreoffice-commits] core.git: sc/source
Serge Krot
Serge.Krot at cib.de
Thu Nov 23 21:20:04 UTC 2017
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(-)
New commits:
commit 4c5a19f9cf98fb2b38ee6b4b35f4074499270353
Author: Serge Krot <Serge.Krot at cib.de>
Date: Thu Nov 23 11:13:35 2017 +0100
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 <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
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<SCTAB>(maTabs.size());
+ const SCTAB nCount = static_cast<SCTAB>(maTabs.size());
ScPrintRangeSaver* pNew = new ScPrintRangeSaver( nCount );
for (SCTAB i=0; i<nCount; i++)
if (maTabs[i])
@@ -6285,8 +6285,9 @@ ScPrintRangeSaver* ScDocument::CreatePrintRangeSaver() const
void ScDocument::RestorePrintRanges( const ScPrintRangeSaver& rSaver )
{
- SCTAB nCount = rSaver.GetTabCount();
- for (SCTAB i=0; i<nCount && i < static_cast<SCTAB>(maTabs.size()); i++)
+ const SCTAB nCount = rSaver.GetTabCount();
+ const SCTAB maxIndex = std::min(nCount, static_cast<SCTAB>(maTabs.size()));
+ for (SCTAB i=0; i<maxIndex; i++)
if (maTabs[i])
maTabs[i]->RestorePrintRanges( rSaver.GetTabData(i) );
}
@@ -6298,10 +6299,10 @@ bool ScDocument::NeedPageResetAfterTab( SCTAB nTab ) const
if ( nTab + 1 < static_cast<SCTAB>(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<beans::PropertyVal
{
OutputDevice* pRet = nullptr;
const beans::PropertyValue* pPropArray = rOptions.getConstArray();
- long nPropCount = rOptions.getLength();
+ const long nPropCount = rOptions.getLength();
for (long i = 0; i < nPropCount; i++)
{
const beans::PropertyValue& rProp = pPropArray[i];
- OUString aPropName(rProp.Name);
+ const OUString & rPropName = rProp.Name;
- if (aPropName == SC_UNONAME_RENDERDEV)
+ if (rPropName == SC_UNONAME_RENDERDEV)
{
uno::Reference<awt::XDevice> 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<nTab&& i < static_cast<SCTAB>(nPages.size()); i++ )
+ const SCTAB maxIndex = std::min(nTab, static_cast<SCTAB>(nPages.size()));
+ for ( SCTAB i=0; i<maxIndex; i++ )
nRet += nPages[i];
return nRet;
}
More information about the Libreoffice-commits
mailing list