summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2017-11-23 11:13:35 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-11-23 22:19:39 +0100
commit4c5a19f9cf98fb2b38ee6b4b35f4074499270353 (patch)
tree8b6ce2cba20c0325c66d2ba5780994eb35d18572
parent723aae2d5b800be159e423e3a0e8f3cc282b0020 (diff)
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@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sc/source/core/data/document.cxx13
-rw-r--r--sc/source/ui/unoobj/docuno.cxx8
-rw-r--r--sc/source/ui/view/pfuncache.cxx3
3 files changed, 13 insertions, 11 deletions
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;
}