[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Thu Mar 28 10:49:20 PDT 2013
sc/source/core/inc/interpre.hxx | 2 --
sc/source/core/tool/interpr4.cxx | 36 +++++++++++++++---------------------
sc/source/core/tool/interpr5.cxx | 9 +++++----
3 files changed, 20 insertions(+), 27 deletions(-)
New commits:
commit d57461b25cc13be7991fa3bc275c5f29385a0e72
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 28 13:50:51 2013 -0400
ScInterpreter is now free of ScBaseCell. Hooray! \o/
Change-Id: I00617da47485e751f6aba41ab382220ad05eb9b6
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index c565e47..c4845f0 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -35,7 +35,6 @@
class ScDocument;
class SbxVariable;
-class ScBaseCell;
class ScValueCell;
class ScFormulaCell;
class SvNumberFormatter;
@@ -190,7 +189,6 @@ double ConvertStringToValue( const String& );
double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
double GetValueCellValue( const ScAddress&, double fOrig );
-ScBaseCell* GetCell( const ScAddress& rPos );
void GetCellString( OUString& rStr, ScRefCellValue& rCell );
sal_uInt16 GetCellErrCode( const ScRefCellValue& rCell );
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index e624c89..fe05654 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -510,11 +510,6 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue&
return fValue;
}
-ScBaseCell* ScInterpreter::GetCell( const ScAddress& rPos )
-{
- return pDok->GetCell( rPos );
-}
-
void ScInterpreter::GetCellString( OUString& rStr, ScRefCellValue& rCell )
{
sal_uInt16 nErr = 0;
@@ -678,26 +673,24 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol = nCol1;
while (nCol <= nCol2)
{
- ScBaseCell* pCell;
- pDok->GetCell(nCol, nRow, nTab, pCell);
- if (pCell)
+ ScRefCellValue aCell;
+ aCell.assign(*pDok, ScAddress(nCol, nRow, nTab));
+ if (!aCell.isEmpty())
{
String aStr;
sal_uInt16 nErr = 0;
bool bOk = true;
- switch ( pCell->GetCellType() )
+ switch (aCell.meType)
{
- case CELLTYPE_STRING :
- aStr = ((ScStringCell*)pCell)->GetString();
- break;
- case CELLTYPE_EDIT :
- aStr = ((ScEditCell*)pCell)->GetString();
+ case CELLTYPE_STRING:
+ case CELLTYPE_EDIT:
+ aStr = aCell.getString();
break;
- case CELLTYPE_FORMULA :
- if (!((ScFormulaCell*)pCell)->IsValue())
+ case CELLTYPE_FORMULA:
+ if (!aCell.mpFormula->IsValue())
{
- nErr = ((ScFormulaCell*)pCell)->GetErrCode();
- aStr = ((ScFormulaCell*)pCell)->GetString();
+ nErr = aCell.mpFormula->GetErrCode();
+ aStr = aCell.mpFormula->GetString();
}
else
bOk = false;
@@ -3527,9 +3520,10 @@ void ScInterpreter::ScTableOp()
iBroadcast != pTableOp->aNotifiedFormulaPos.end();
++iBroadcast )
{ // emulate broadcast and indirectly collect cell pointers
- ScBaseCell* pCell = pDok->GetCell( *iBroadcast );
- if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
- ((ScFormulaCell*)pCell)->SetTableOpDirty();
+ ScRefCellValue aCell;
+ aCell.assign(*pDok, *iBroadcast);
+ if (aCell.meType == CELLTYPE_FORMULA)
+ aCell.mpFormula->SetTableOpDirty();
}
}
else
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 09196d9..7dc9b57 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -635,15 +635,16 @@ void ScInterpreter::ScMatValue()
{
ScAddress aAdr;
PopSingleRef( aAdr );
- ScBaseCell* pCell = GetCell( aAdr );
- if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
+ ScRefCellValue aCell;
+ aCell.assign(*pDok, aAdr);
+ if (aCell.meType == CELLTYPE_FORMULA)
{
- sal_uInt16 nErrCode = ((ScFormulaCell*)pCell)->GetErrCode();
+ sal_uInt16 nErrCode = aCell.mpFormula->GetErrCode();
if (nErrCode != 0)
PushError( nErrCode);
else
{
- const ScMatrix* pMat = ((ScFormulaCell*)pCell)->GetMatrix();
+ const ScMatrix* pMat = aCell.mpFormula->GetMatrix();
CalculateMatrixValue(pMat,nC,nR);
}
}
More information about the Libreoffice-commits
mailing list