[Libreoffice-commits] .: 3 commits - sc/inc sc/Library_sc.mk sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Apr 9 18:45:54 PDT 2012
sc/Library_sc.mk | 1
sc/inc/recursionhelper.hxx | 93 +++++-------------------
sc/source/core/data/cell.cxx | 6 -
sc/source/core/tool/recursionhelper.cxx | 121 ++++++++++++++++++++++++++++++++
4 files changed, 146 insertions(+), 75 deletions(-)
New commits:
commit 53a40d5e0dd06735a6e44cd16ed47538108035de
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Mon Apr 9 21:45:19 2012 -0400
Make this non-inline too; for easier debugging.
diff --git a/sc/inc/recursionhelper.hxx b/sc/inc/recursionhelper.hxx
index f2a258d..929e24f 100644
--- a/sc/inc/recursionhelper.hxx
+++ b/sc/inc/recursionhelper.hxx
@@ -90,7 +90,7 @@ public:
bool & GetConvergingReference() { return bConverging; }
void StartIteration();
void ResumeIteration();
- void IncIteration() { ++nIteration; }
+ void IncIteration();
void EndIteration();
ScFormulaRecursionList::iterator GetLastIterationStart() { return aLastIterationStart; }
diff --git a/sc/source/core/tool/recursionhelper.cxx b/sc/source/core/tool/recursionhelper.cxx
index b98484b..cbee508 100644
--- a/sc/source/core/tool/recursionhelper.cxx
+++ b/sc/source/core/tool/recursionhelper.cxx
@@ -84,6 +84,11 @@ void ScRecursionHelper::ResumeIteration()
aLastIterationStart = GetIterationStart();
}
+void ScRecursionHelper::IncIteration()
+{
+ ++nIteration;
+}
+
void ScRecursionHelper::EndIteration()
{
aRecursionFormulas.erase( GetIterationStart(), GetIterationEnd());
commit 4be657d53281680ebfa72e96b93705599f4178e1
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Mon Apr 9 21:40:08 2012 -0400
Removed duplicated methods.
diff --git a/sc/inc/recursionhelper.hxx b/sc/inc/recursionhelper.hxx
index 176a93d..f2a258d 100644
--- a/sc/inc/recursionhelper.hxx
+++ b/sc/inc/recursionhelper.hxx
@@ -83,14 +83,6 @@ public:
void Insert( ScFormulaCell* p, bool bOldRunning, const ScFormulaResult & rRes );
- ScFormulaRecursionList::iterator GetStart()
- {
- return aRecursionFormulas.begin();
- }
- ScFormulaRecursionList::iterator GetEnd()
- {
- return aRecursionFormulas.end();
- }
bool IsInIterationReturn() const { return bInIterationReturn; }
void SetInIterationReturn( bool b );
bool IsDoingIteration() const { return nIteration > 0; }
@@ -102,8 +94,8 @@ public:
void EndIteration();
ScFormulaRecursionList::iterator GetLastIterationStart() { return aLastIterationStart; }
- ScFormulaRecursionList::iterator GetIterationStart() { return GetStart(); }
- ScFormulaRecursionList::iterator GetIterationEnd() { return GetEnd(); }
+ ScFormulaRecursionList::iterator GetIterationStart();
+ ScFormulaRecursionList::iterator GetIterationEnd();
/** Any return, recursion or iteration, iteration is always coupled with
recursion. */
bool IsInReturn() const { return bInRecursionReturn; }
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index f191c5d..9ccadde 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -1390,9 +1390,9 @@ void ScFormulaCell::Interpret()
{
rRecursionHelper.SetInRecursionReturn( false);
for (ScFormulaRecursionList::const_iterator aIter(
- rRecursionHelper.GetStart());
+ rRecursionHelper.GetIterationStart());
!rRecursionHelper.IsInReturn() && aIter !=
- rRecursionHelper.GetEnd(); ++aIter)
+ rRecursionHelper.GetIterationEnd(); ++aIter)
{
ScFormulaCell* pCell = (*aIter).pCell;
if (pCell->IsDirtyOrInTableOpDirty())
@@ -1412,7 +1412,7 @@ void ScFormulaCell::Interpret()
else if (bResumeIteration ||
rRecursionHelper.IsDoingIteration())
rRecursionHelper.GetList().erase(
- rRecursionHelper.GetStart(),
+ rRecursionHelper.GetIterationStart(),
rRecursionHelper.GetLastIterationStart());
else
rRecursionHelper.Clear();
diff --git a/sc/source/core/tool/recursionhelper.cxx b/sc/source/core/tool/recursionhelper.cxx
index 98e6c28..b98484b 100644
--- a/sc/source/core/tool/recursionhelper.cxx
+++ b/sc/source/core/tool/recursionhelper.cxx
@@ -32,13 +32,13 @@ void ScRecursionHelper::Init()
{
nRecursionCount = 0;
bInRecursionReturn = bDoingRecursion = bInIterationReturn = false;
- aInsertPos = GetEnd();
+ aInsertPos = GetIterationEnd();
ResetIteration();
}
void ScRecursionHelper::ResetIteration()
{
- aLastIterationStart = GetEnd();
+ aLastIterationStart = GetIterationEnd();
nIteration = 0;
bConverging = false;
}
@@ -90,6 +90,16 @@ void ScRecursionHelper::EndIteration()
ResetIteration();
}
+ScFormulaRecursionList::iterator ScRecursionHelper::GetIterationStart()
+{
+ return aRecursionFormulas.begin();
+}
+
+ScFormulaRecursionList::iterator ScRecursionHelper::GetIterationEnd()
+{
+ return aRecursionFormulas.end();
+}
+
void ScRecursionHelper::Clear()
{
aRecursionFormulas.clear();
commit 8b2fb88b124acd8fc7fa3443dafb3f955b47390d
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Mon Apr 9 21:34:24 2012 -0400
Make non-trivial methods non in-line.
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index f1226e4..224df82 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -202,6 +202,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/rangeseq \
sc/source/core/tool/rangeutl \
sc/source/core/tool/rechead \
+ sc/source/core/tool/recursionhelper \
sc/source/core/tool/refdata \
sc/source/core/tool/reffind \
sc/source/core/tool/refreshtimer \
diff --git a/sc/inc/recursionhelper.hxx b/sc/inc/recursionhelper.hxx
index dc44921..176a93d 100644
--- a/sc/inc/recursionhelper.hxx
+++ b/sc/inc/recursionhelper.hxx
@@ -40,10 +40,10 @@ class ScFormulaCell;
struct ScFormulaRecursionEntry
{
ScFormulaCell* pCell;
- sal_Bool bOldRunning;
+ bool bOldRunning;
ScFormulaResult aPreviousResult;
- ScFormulaRecursionEntry( ScFormulaCell* p, sal_Bool bR,
- const ScFormulaResult & rRes ) :
+ ScFormulaRecursionEntry(
+ ScFormulaCell* p, bool bR, const ScFormulaResult & rRes ) :
pCell(p), bOldRunning(bR), aPreviousResult( rRes)
{
}
@@ -65,44 +65,24 @@ class ScRecursionHelper
bool bInIterationReturn;
bool bConverging;
- void Init()
- {
- nRecursionCount = 0;
- bInRecursionReturn = bDoingRecursion = bInIterationReturn = false;
- aInsertPos = GetEnd();
- ResetIteration();
- }
- void ResetIteration()
- {
- aLastIterationStart = GetEnd();
- nIteration = 0;
- bConverging = false;
- }
+ void Init();
+ void ResetIteration();
- public:
+public:
- ScRecursionHelper() { Init(); }
+ ScRecursionHelper();
sal_uInt16 GetRecursionCount() const { return nRecursionCount; }
void IncRecursionCount() { ++nRecursionCount; }
void DecRecursionCount() { --nRecursionCount; }
/// A pure recursion return, no iteration.
bool IsInRecursionReturn() const { return bInRecursionReturn &&
!bInIterationReturn; }
- void SetInRecursionReturn( bool b )
- {
- // Do not use IsInRecursionReturn() here, it decouples iteration.
- if (b && !bInRecursionReturn)
- aInsertPos = aRecursionFormulas.begin();
- bInRecursionReturn = b;
- }
+ void SetInRecursionReturn( bool b );
bool IsDoingRecursion() const { return bDoingRecursion; }
void SetDoingRecursion( bool b ) { bDoingRecursion = b; }
- void Insert( ScFormulaCell* p, sal_Bool bOldRunning,
- const ScFormulaResult & rRes )
- {
- aRecursionFormulas.insert( aInsertPos, ScFormulaRecursionEntry( p,
- bOldRunning, rRes));
- }
+
+ void Insert( ScFormulaCell* p, bool bOldRunning, const ScFormulaResult & rRes );
+
ScFormulaRecursionList::iterator GetStart()
{
return aRecursionFormulas.begin();
@@ -112,33 +92,15 @@ class ScRecursionHelper
return aRecursionFormulas.end();
}
bool IsInIterationReturn() const { return bInIterationReturn; }
- void SetInIterationReturn( bool b )
- {
- // An iteration return is always coupled to a recursion return.
- SetInRecursionReturn( b);
- bInIterationReturn = b;
- }
+ void SetInIterationReturn( bool b );
bool IsDoingIteration() const { return nIteration > 0; }
sal_uInt16 GetIteration() const { return nIteration; }
bool & GetConvergingReference() { return bConverging; }
- void StartIteration()
- {
- SetInIterationReturn( false);
- nIteration = 1;
- bConverging = false;
- aLastIterationStart = GetIterationStart();
- }
- void ResumeIteration()
- {
- SetInIterationReturn( false);
- aLastIterationStart = GetIterationStart();
- }
+ void StartIteration();
+ void ResumeIteration();
void IncIteration() { ++nIteration; }
- void EndIteration()
- {
- aRecursionFormulas.erase( GetIterationStart(), GetIterationEnd());
- ResetIteration();
- }
+ void EndIteration();
+
ScFormulaRecursionList::iterator GetLastIterationStart() { return aLastIterationStart; }
ScFormulaRecursionList::iterator GetIterationStart() { return GetStart(); }
ScFormulaRecursionList::iterator GetIterationEnd() { return GetEnd(); }
@@ -148,13 +110,8 @@ class ScRecursionHelper
const ScFormulaRecursionList& GetList() const { return aRecursionFormulas; }
ScFormulaRecursionList& GetList() { return aRecursionFormulas; }
ScRecursionInIterationStack& GetRecursionInIterationStack() { return aRecursionInIterationStack; }
- void Clear()
- {
- aRecursionFormulas.clear();
- while (!aRecursionInIterationStack.empty())
- aRecursionInIterationStack.pop();
- Init();
- }
+
+ void Clear();
};
#endif // INCLUDED_RECURSIONHELPER_HXX
diff --git a/sc/source/core/tool/recursionhelper.cxx b/sc/source/core/tool/recursionhelper.cxx
new file mode 100644
index 0000000..98e6c28
--- /dev/null
+++ b/sc/source/core/tool/recursionhelper.cxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "recursionhelper.hxx"
+
+void ScRecursionHelper::Init()
+{
+ nRecursionCount = 0;
+ bInRecursionReturn = bDoingRecursion = bInIterationReturn = false;
+ aInsertPos = GetEnd();
+ ResetIteration();
+}
+
+void ScRecursionHelper::ResetIteration()
+{
+ aLastIterationStart = GetEnd();
+ nIteration = 0;
+ bConverging = false;
+}
+
+ScRecursionHelper::ScRecursionHelper()
+{
+ Init();
+}
+
+void ScRecursionHelper::SetInRecursionReturn( bool b )
+{
+ // Do not use IsInRecursionReturn() here, it decouples iteration.
+ if (b && !bInRecursionReturn)
+ aInsertPos = aRecursionFormulas.begin();
+ bInRecursionReturn = b;
+}
+
+void ScRecursionHelper::Insert(
+ ScFormulaCell* p, bool bOldRunning, const ScFormulaResult & rRes )
+{
+ aRecursionFormulas.insert( aInsertPos, ScFormulaRecursionEntry( p,
+ bOldRunning, rRes));
+}
+
+void ScRecursionHelper::SetInIterationReturn( bool b )
+{
+ // An iteration return is always coupled to a recursion return.
+ SetInRecursionReturn( b);
+ bInIterationReturn = b;
+}
+
+void ScRecursionHelper::StartIteration()
+{
+ SetInIterationReturn( false);
+ nIteration = 1;
+ bConverging = false;
+ aLastIterationStart = GetIterationStart();
+}
+
+void ScRecursionHelper::ResumeIteration()
+{
+ SetInIterationReturn( false);
+ aLastIterationStart = GetIterationStart();
+}
+
+void ScRecursionHelper::EndIteration()
+{
+ aRecursionFormulas.erase( GetIterationStart(), GetIterationEnd());
+ ResetIteration();
+}
+
+void ScRecursionHelper::Clear()
+{
+ aRecursionFormulas.clear();
+ while (!aRecursionInIterationStack.empty())
+ aRecursionInIterationStack.pop();
+ Init();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+
+
+
+
More information about the Libreoffice-commits
mailing list