summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/conditio.cxx17
-rw-r--r--sc/source/core/tool/token.cxx17
2 files changed, 18 insertions, 16 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 8ceebcc1411c..79b4ee063783 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -625,26 +625,11 @@ void ScConditionEntry::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt )
StartListening();
}
-//FIXME: Make this a comparison operator at the TokenArray?
static bool lcl_IsEqual( const ScTokenArray* pArr1, const ScTokenArray* pArr2 )
{
// We only compare the non-RPN array
if ( pArr1 && pArr2 )
- {
- sal_uInt16 nLen = pArr1->GetLen();
- if ( pArr2->GetLen() != nLen )
- return false;
-
- FormulaToken** ppToken1 = pArr1->GetArray();
- FormulaToken** ppToken2 = pArr2->GetArray();
- for (sal_uInt16 i=0; i<nLen; i++)
- {
- if ( ppToken1[i] != ppToken2[i] &&
- !(*ppToken1[i] == *ppToken2[i]) )
- return false; // Difference
- }
- return true; // All entries are the same
- }
+ return pArr1->EqualTokens( pArr2 );
else
return !pArr1 && !pArr2; // Both 0? -> the same
}
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 089ed5b5f48d..8103731db85f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1943,6 +1943,23 @@ ScTokenArray& ScTokenArray::operator=( const ScTokenArray& rArr )
return *this;
}
+bool ScTokenArray::EqualTokens( const ScTokenArray* pArr2) const
+{
+ // We only compare the non-RPN array
+ if ( pArr2->nLen != nLen )
+ return false;
+
+ FormulaToken** ppToken1 = GetArray();
+ FormulaToken** ppToken2 = pArr2->GetArray();
+ for (sal_uInt16 i=0; i<nLen; i++)
+ {
+ if ( ppToken1[i] != ppToken2[i] &&
+ !(*ppToken1[i] == *ppToken2[i]) )
+ return false; // Difference
+ }
+ return true; // All entries are the same
+}
+
void ScTokenArray::Clear()
{
mnHashValue = 0;