diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-06-18 15:11:30 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-06-24 16:51:25 -0400 |
commit | 46419cd7a2d453c6f252c28dfb9dbfb08605e1c4 (patch) | |
tree | f07f04cc6ccb108acd8fb2fe9f774c940b380a41 /sc | |
parent | c008dc483f8c6840803983e7e351cec6fdd32070 (diff) |
ScFormulaCell is no longer a child class of ScBaseCell.
Change-Id: Id33072f193045e2eaf51373b47dac803f9a5d52c
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/cell.hxx | 4 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/attarray.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/cell.cxx | 26 | ||||
-rw-r--r-- | sc/source/core/data/cellvalue.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/validat.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk3.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 2 |
12 files changed, 12 insertions, 46 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 597feb85719c..860104b4e68e 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -55,10 +55,6 @@ public: broadcaster will not be cloned. */ ScBaseCell* Clone( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const; - /** Due to the fact that ScBaseCell does not have a vtable, this function - deletes the cell by calling the appropriate d'tor of the derived class. */ - void Delete(); - inline CellType GetCellType() const { return (CellType)eCellType; } /** ScFormulaCell with formula::svEmptyCell result, or ScNoteCell (may have been diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 10a5b585de4d..1c4093974955 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -20,7 +20,6 @@ #ifndef SC_FORMULACELL_HXX #define SC_FORMULACELL_HXX -#include "cell.hxx" #include "formularesult.hxx" #include "formula/tokenarray.hxx" @@ -35,6 +34,7 @@ class EndListeningContext; } +class ScProgress; class ScTokenArray; struct ScSimilarFormulaDelta; @@ -65,7 +65,7 @@ enum ScMatrixMode { MM_FAKE = 3 // Interpret "as-if" matrix formula (legacy) }; -class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener +class SC_DLLPUBLIC ScFormulaCell : public SvtListener { private: ScFormulaResult aResult; @@ -112,8 +112,6 @@ public: ~ScFormulaCell(); - using ScBaseCell::Clone; - ScFormulaCell* Clone() const; /** Empty formula cell, or with a preconstructed token array. */ 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 { diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 6066984a2f55..e38010663024 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -50,6 +50,7 @@ #include "docuno.hxx" #include "progress.hxx" #include "editutil.hxx" +#include "cell.hxx" // STATIC DATA --------------------------------------------------------------- diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 832f59c4e878..917911a8fa19 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2612,7 +2612,7 @@ void ScChart2DataSequence::BuildDataCache() if (nErr) break; - if (pFCell->HasValueData()) + if (pFCell->IsValue()) { rItem.mfValue = pFCell->GetValue(); rItem.mbIsValue = true; |