[Libreoffice-commits] .: sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Thu Dec 1 02:43:58 PST 2011
sc/source/core/data/documen3.cxx | 9 ++++++---
sc/source/core/data/documen5.cxx | 6 ++++--
2 files changed, 10 insertions(+), 5 deletions(-)
New commits:
commit eec4e1202d5f2f39ad881ce4afd94b8384c8b3c2
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Thu Dec 1 10:17:05 2011 +0100
avoid Tabs size calculation in loops
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 545e7f4..63d926a 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -656,7 +656,8 @@ bool ScDocument::HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVb
bool ScDocument::HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents ) const
{
- for (SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabs.size()); nTab++)
+ SCTAB nSize = static_cast<SCTAB>(maTabs.size());
+ for (SCTAB nTab = 0; nTab < nSize; nTab++)
if (HasSheetEventScript( nTab, nEvent, bWithVbaEvents ))
return true;
return false;
@@ -664,7 +665,8 @@ bool ScDocument::HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents )
bool ScDocument::HasAnyCalcNotification() const
{
- for (SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabs.size()); nTab++)
+ SCTAB nSize = static_cast<SCTAB>(maTabs.size());
+ for (SCTAB nTab = 0; nTab < nSize; nTab++)
if (maTabs[nTab] && maTabs[nTab]->GetCalcNotification())
return true;
return false;
@@ -686,7 +688,8 @@ void ScDocument::SetCalcNotification( SCTAB nTab )
void ScDocument::ResetCalcNotifications()
{
- for (SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabs.size()); nTab++)
+ SCTAB nSize = static_cast<SCTAB>(maTabs.size());
+ for (SCTAB nTab = 0; nTab < nSize; nTab++)
if (maTabs[nTab] && maTabs[nTab]->GetCalcNotification())
maTabs[nTab]->SetCalcNotification(false);
}
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 9540c9f..4a1c2b4 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -133,7 +133,8 @@ void ScDocument::UpdateAllCharts()
size_t nDataCount = pChartCollection->size();
- for (SCTAB nTab=0; nTab< static_cast<SCTAB>(maTabs.size()); nTab++)
+ SCTAB nSize = static_cast<SCTAB>(maTabs.size());
+ for (SCTAB nTab=0; nTab< nSize; nTab++)
{
if (maTabs[nTab])
{
@@ -247,7 +248,8 @@ uno::Reference< chart2::XChartDocument > ScDocument::GetChartByName( const rtl::
if (pDrawLayer)
{
sal_uInt16 nCount = pDrawLayer->GetPageCount();
- for (sal_uInt16 nTab=0; nTab<nCount&& nTab < static_cast<SCTAB>(maTabs.size()); nTab++)
+ SCTAB nSize = static_cast<SCTAB>(maTabs.size());
+ for (sal_uInt16 nTab=0; nTab<nCount && nTab < nSize; nTab++)
{
SdrPage* pPage = pDrawLayer->GetPage(nTab);
OSL_ENSURE(pPage,"Page ?");
More information about the Libreoffice-commits
mailing list