summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-28 10:59:07 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-28 17:03:54 -0400
commit2460b39d9c1d07abc50a7e645cb672c7b5a53084 (patch)
treec740587196d581010febb8612151524fad86a2a6 /sc
parentb9079dc23b163321ce0e0fdea9b8b4ec5799b6d2 (diff)
ScBaseCell::CellEqual is no more.
Change-Id: I9a2923ec85ce116662d66a38b61a5258ff113168
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/cell.hxx2
-rw-r--r--sc/source/core/data/cell.cxx80
-rw-r--r--sc/source/core/data/documen4.cxx24
3 files changed, 12 insertions, 94 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index b0919a66213a..166649db9fe7 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -100,8 +100,6 @@ public:
bool HasStringData() const;
rtl::OUString GetStringData() const; // only real strings
- static bool CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 );
-
private:
ScBaseCell& operator=( const ScBaseCell& );
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index cee5df395f50..66032a8471d8 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -345,86 +345,6 @@ rtl::OUString ScBaseCell::GetStringData() const
return aStr;
}
-bool ScBaseCell::CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 )
-{
- CellType eType1 = CELLTYPE_NONE;
- CellType eType2 = CELLTYPE_NONE;
- if ( pCell1 )
- {
- eType1 = pCell1->GetCellType();
- if (eType1 == CELLTYPE_EDIT)
- eType1 = CELLTYPE_STRING;
- else if (eType1 == CELLTYPE_NOTE)
- eType1 = CELLTYPE_NONE;
- }
- if ( pCell2 )
- {
- eType2 = pCell2->GetCellType();
- if (eType2 == CELLTYPE_EDIT)
- eType2 = CELLTYPE_STRING;
- else if (eType2 == CELLTYPE_NOTE)
- eType2 = CELLTYPE_NONE;
- }
- if ( eType1 != eType2 )
- return false;
-
- switch ( eType1 ) // Both Types are the same
- {
- case CELLTYPE_NONE: // Both Empty
- return true;
- case CELLTYPE_VALUE: // Really Value-Cells
- return ( ((const ScValueCell*)pCell1)->GetValue() ==
- ((const ScValueCell*)pCell2)->GetValue() );
- case CELLTYPE_STRING: // String or Edit
- {
- rtl::OUString aText1;
- if ( pCell1->GetCellType() == CELLTYPE_STRING )
- aText1 = ((const ScStringCell*)pCell1)->GetString();
- else
- aText1 = ((const ScEditCell*)pCell1)->GetString();
- rtl::OUString aText2;
- if ( pCell2->GetCellType() == CELLTYPE_STRING )
- aText2 = ((const ScStringCell*)pCell2)->GetString();
- else
- aText2 = ((const ScEditCell*)pCell2)->GetString();
- return ( aText1 == aText2 );
- }
- case CELLTYPE_FORMULA:
- {
- //! pasted Lines / allow Slots!!!!!
- //! Comparsion Function of the Formula Cell???
- //! To request with ScColumn::SwapRow to catch together!
-
- ScTokenArray* pCode1 = ((ScFormulaCell*)pCell1)->GetCode();
- ScTokenArray* pCode2 = ((ScFormulaCell*)pCell2)->GetCode();
-
- if (pCode1->GetLen() == pCode2->GetLen()) // nicht-UPN
- {
- bool bEqual = true;
- sal_uInt16 nLen = pCode1->GetLen();
- FormulaToken** ppToken1 = pCode1->GetArray();
- FormulaToken** ppToken2 = pCode2->GetArray();
- for (sal_uInt16 i=0; i<nLen; i++)
- if ( !ppToken1[i]->TextEqual(*(ppToken2[i])) )
- {
- bEqual = false;
- break;
- }
-
- if (bEqual)
- return true;
- }
-
- return false; // varying long or varying Tokens
- }
- default:
- OSL_FAIL("oops, something for the Cells???");
- }
- return false;
-}
-
-// ============================================================================
-
ScNoteCell::ScNoteCell( SvtBroadcaster* pBC ) :
ScBaseCell( CELLTYPE_NOTE )
{
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 3df2fbc5f830..27fd9fa7a8ff 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -790,18 +790,18 @@ sal_uInt16 ScDocument::RowDifferences( SCROW nThisRow, SCTAB nThisTab,
if (ValidCol(nOtherCol)) // nur Spalten vergleichen, die in beiden Dateien sind
{
- const ScBaseCell* pThisCell = GetCell( ScAddress( nThisCol, nThisRow, nThisTab ) );
- const ScBaseCell* pOtherCell = rOtherDoc.GetCell( ScAddress( nOtherCol, nOtherRow, nOtherTab ) );
- if (!ScBaseCell::CellEqual( pThisCell, pOtherCell ))
+ ScRefCellValue aThisCell, aOtherCell;
+ aThisCell.assign(*this, ScAddress(nThisCol, nThisRow, nThisTab));
+ aOtherCell.assign(rOtherDoc, ScAddress(nOtherCol, nOtherRow, nOtherTab));
+ if (!aThisCell.equalsWithoutFormat(aOtherCell))
{
- if ( pThisCell && pOtherCell )
+ if (!aThisCell.isEmpty() && !aOtherCell.isEmpty())
nDif += 3;
else
nDif += 4; // Inhalt <-> leer zaehlt mehr
}
- if ( ( pThisCell && pThisCell->GetCellType()!=CELLTYPE_NOTE ) ||
- ( pOtherCell && pOtherCell->GetCellType()!=CELLTYPE_NOTE ) )
+ if (!aThisCell.isEmpty() || !aOtherCell.isEmpty())
++nUsed;
}
}
@@ -831,18 +831,18 @@ sal_uInt16 ScDocument::ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
if (ValidRow(nOtherRow)) // nur Zeilen vergleichen, die in beiden Dateien sind
{
- const ScBaseCell* pThisCell = GetCell( ScAddress( nThisCol, nThisRow, nThisTab ) );
- const ScBaseCell* pOtherCell = rOtherDoc.GetCell( ScAddress( nOtherCol, nOtherRow, nOtherTab ) );
- if (!ScBaseCell::CellEqual( pThisCell, pOtherCell ))
+ ScRefCellValue aThisCell, aOtherCell;
+ aThisCell.assign(*this, ScAddress(nThisCol, nThisRow, nThisTab));
+ aOtherCell.assign(rOtherDoc, ScAddress(nOtherCol, nOtherRow, nOtherTab));
+ if (!aThisCell.equalsWithoutFormat(aOtherCell))
{
- if ( pThisCell && pOtherCell )
+ if (!aThisCell.isEmpty() && !aOtherCell.isEmpty())
nDif += 3;
else
nDif += 4; // Inhalt <-> leer zaehlt mehr
}
- if ( ( pThisCell && pThisCell->GetCellType()!=CELLTYPE_NOTE ) ||
- ( pOtherCell && pOtherCell->GetCellType()!=CELLTYPE_NOTE ) )
+ if (!aThisCell.isEmpty() || !aOtherCell.isEmpty())
++nUsed;
}
}