summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-06-18 15:11:30 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-06-24 16:51:25 -0400
commit46419cd7a2d453c6f252c28dfb9dbfb08605e1c4 (patch)
treef07f04cc6ccb108acd8fb2fe9f774c940b380a41 /sc/source/core/data
parentc008dc483f8c6840803983e7e351cec6fdd32070 (diff)
ScFormulaCell is no longer a child class of ScBaseCell.
Change-Id: Id33072f193045e2eaf51373b47dac803f9a5d52c
Diffstat (limited to 'sc/source/core/data')
-rw-r--r--sc/source/core/data/attarray.cxx1
-rw-r--r--sc/source/core/data/cell.cxx26
-rw-r--r--sc/source/core/data/cellvalue.cxx2
-rw-r--r--sc/source/core/data/colorscale.cxx4
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/formulacell.cxx6
-rw-r--r--sc/source/core/data/table2.cxx2
-rw-r--r--sc/source/core/data/validat.cxx2
8 files changed, 8 insertions, 37 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 631874b41631..d0cee2f409b7 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -40,6 +40,7 @@
#include "rechead.hxx"
#include "globstr.hrc"
#include "segmenttree.hxx"
+#include "cell.hxx"
#include "formulacell.hxx"
#include "cellvalue.hxx"
#include "editutil.hxx"
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 6ccc80a9f872..901075228178 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -60,8 +60,6 @@ ScBaseCell* lclCloneCell( const ScBaseCell& rSrcCell, ScDocument& rDestDoc, cons
return new ScStringCell( static_cast< const ScStringCell& >( rSrcCell ) );
case CELLTYPE_EDIT:
return new ScEditCell(static_cast<const ScEditCell&>(rSrcCell), rDestDoc, rDestPos);
- case CELLTYPE_FORMULA:
- return new ScFormulaCell( static_cast< const ScFormulaCell& >( rSrcCell ), rDestDoc, rDestPos, nCloneFlags );
default:;
}
OSL_FAIL( "lclCloneCell - unknown cell type" );
@@ -74,8 +72,6 @@ ScBaseCell* ScBaseCell::Clone( ScDocument& rDestDoc, int nCloneFlags ) const
{
// notes will not be cloned -> cell address only needed for formula cells
ScAddress aDestPos;
- if( eCellType == CELLTYPE_FORMULA )
- aDestPos = static_cast< const ScFormulaCell* >( this )->aPos;
return lclCloneCell( *this, rDestDoc, aDestPos, nCloneFlags );
}
@@ -84,28 +80,6 @@ ScBaseCell* ScBaseCell::Clone( ScDocument& rDestDoc, const ScAddress& rDestPos,
return lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
}
-void ScBaseCell::Delete()
-{
- switch (eCellType)
- {
- case CELLTYPE_VALUE:
- delete (ScValueCell*) this;
- break;
- case CELLTYPE_STRING:
- delete (ScStringCell*) this;
- break;
- case CELLTYPE_EDIT:
- delete (ScEditCell*) this;
- break;
- case CELLTYPE_FORMULA:
- delete (ScFormulaCell*) this;
- break;
- default:
- OSL_FAIL("Attempt to Delete() an unknown CELLTYPE");
- break;
- }
-}
-
bool ScBaseCell::HasEmptyData() const
{
switch ( eCellType )
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 169d2f7ef6d7..abc1bbc5d5aa 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -172,7 +172,7 @@ void ScCellValue::clear()
delete mpEditText;
break;
case CELLTYPE_FORMULA:
- mpFormula->Delete();
+ delete mpFormula;
break;
default:
;
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 2eca97c75082..70865be1a577 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -39,7 +39,7 @@ ScColorScaleEntry::ScColorScaleEntry(const ScColorScaleEntry& rEntry):
{
if(rEntry.mpCell)
{
- mpCell.reset(static_cast<ScFormulaCell*>(rEntry.mpCell->Clone(*rEntry.mpCell->GetDocument(), SC_CLONECELL_NOMAKEABS_EXTERNAL)));
+ mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, SC_CLONECELL_NOMAKEABS_EXTERNAL));
mpCell->StartListeningTo( mpCell->GetDocument() );
}
}
@@ -52,7 +52,7 @@ ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry&
{
if(rEntry.mpCell)
{
- mpCell.reset(static_cast<ScFormulaCell*>(rEntry.mpCell->Clone(*pDoc, SC_CLONECELL_NOMAKEABS_EXTERNAL)));
+ mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, SC_CLONECELL_NOMAKEABS_EXTERNAL));
mpCell->StartListeningTo( pDoc );
}
}
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index df4b328e62e0..512a5b109f10 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1059,7 +1059,7 @@ void ScDocument::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell )
{
if (!TableExists(rPos.Tab()))
{
- pCell->Delete();
+ delete pCell;
return;
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 2cd5317102eb..883d0499dd9a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -394,7 +394,6 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
const OUString& rFormula,
const FormulaGrammar::Grammar eGrammar,
sal_uInt8 cMatInd ) :
- ScBaseCell( CELLTYPE_FORMULA ),
eTempGrammar( eGrammar),
pCode( NULL ),
pDocument( pDoc ),
@@ -428,7 +427,6 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
const ScTokenArray* pArr,
const FormulaGrammar::Grammar eGrammar, sal_uInt8 cInd ) :
- ScBaseCell( CELLTYPE_FORMULA ),
eTempGrammar( eGrammar),
pCode( pArr ? new ScTokenArray( *pArr ) : new ScTokenArray ),
pDocument( pDoc ),
@@ -473,7 +471,6 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
}
ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, int nCloneFlags ) :
- ScBaseCell( rCell ),
SvtListener(),
aResult( rCell.aResult ),
eTempGrammar( rCell.eTempGrammar),
@@ -1826,8 +1823,7 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
else
pFCell = this; // this MM_FORMULA
// There's only one this, don't compare pFCell==this.
- if ( pFCell && pFCell->GetCellType() == CELLTYPE_FORMULA
- && pFCell->cMatrixFlag == MM_FORMULA )
+ if (pFCell && pFCell->cMatrixFlag == MM_FORMULA)
{
pFCell->GetMatColsRows( nC, nR );
if ( nC == 0 || nR == 0 )
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 3c5b486efa07..7b8d409a0f58 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1447,7 +1447,7 @@ void ScTable::SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell )
{
if (!ValidColRow(nCol, nRow))
{
- pCell->Delete();
+ delete pCell;
return;
}
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 258e7e02b074..f910083a46ba 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -657,7 +657,7 @@ bool ScValidationData::GetSelectionFromFormula(
xMatRef->PutError( nErrCode, 0, 0);
bOk = false;
}
- else if (aValidationSrc.HasValueData())
+ else if (aValidationSrc.IsValue())
xMatRef->PutDouble( aValidationSrc.GetValue(), 0);
else
{