diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 01:07:36 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 01:12:52 -0400 |
commit | 6a944422c42a27ce9dc6fd2432c18f3743ac088f (patch) | |
tree | d6b1334e73c74f4a115bf4172978b462cbddd77f /sc | |
parent | 226aefbc5587568c60c966ff22762e77c7838fd4 (diff) |
A bit more.
Change-Id: I7617bfa094ba8e6fb2c19944362bd604f5299732
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/cell.cxx | 13 | ||||
-rw-r--r-- | sc/source/core/tool/detfunc.cxx | 37 |
2 files changed, 22 insertions, 28 deletions
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index 0dff21a1b4c2..cee5df395f50 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -723,17 +723,16 @@ void ScFormulaCell::GetFormula( rtl::OUStringBuffer& rBuffer, * pCell only if (!this->IsInChangeTrack()), * GetEnglishFormula() omitted that test. * Can we live without in all cases? */ - ScBaseCell* pCell; + ScFormulaCell* pCell = NULL; ScSingleRefData& rRef = p->GetSingleRef(); rRef.CalcAbsIfRel( aPos ); if ( rRef.Valid() ) - pCell = pDocument->GetCell( ScAddress( rRef.nCol, - rRef.nRow, rRef.nTab ) ); - else - pCell = NULL; - if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA) + pCell = pDocument->GetFormulaCell( + ScAddress(rRef.nCol, rRef.nRow, rRef.nTab)); + + if (pCell) { - ((ScFormulaCell*)pCell)->GetFormula( rBuffer, eGrammar); + pCell->GetFormula( rBuffer, eGrammar); return; } else diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 958162fd0b8c..cd75cddcc3a5 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -67,6 +67,7 @@ #include "rangelst.hxx" #include "reftokenhelper.hxx" #include "formulaiter.hxx" +#include "cellvalue.hxx" #include <vector> @@ -821,14 +822,12 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevelArea( const ScRange& rRef, sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel ) { - ScBaseCell* pCell; - pDoc->GetCell( nCol, nRow, nTab, pCell ); - if (!pCell) - return DET_INS_EMPTY; - if (pCell->GetCellType() != CELLTYPE_FORMULA) + ScRefCellValue aCell; + aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab)); + if (aCell.meType != CELLTYPE_FORMULA) return DET_INS_EMPTY; - ScFormulaCell* pFCell = (ScFormulaCell*)pCell; + ScFormulaCell* pFCell = aCell.mpFormula; if (pFCell->IsRunning()) return DET_INS_CIRCULAR; @@ -838,7 +837,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetective sal_uInt16 nResult = DET_INS_EMPTY; - ScDetectiveRefIter aIter( (ScFormulaCell*) pCell ); + ScDetectiveRefIter aIter(pFCell); ScRange aRef; while ( aIter.GetNextRef( aRef ) ) { @@ -912,14 +911,12 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL { OSL_ENSURE( nLevel<1000, "Level" ); - ScBaseCell* pCell; - pDoc->GetCell( nCol, nRow, nTab, pCell ); - if (!pCell) - return nLevel; - if (pCell->GetCellType() != CELLTYPE_FORMULA) + ScRefCellValue aCell; + aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab)); + if (aCell.meType != CELLTYPE_FORMULA) return nLevel; - ScFormulaCell* pFCell = (ScFormulaCell*)pCell; + ScFormulaCell* pFCell = aCell.mpFormula; if (pFCell->IsRunning()) return nLevel; @@ -935,7 +932,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL DeleteArrowsAt( nCol, nRow, sal_True ); // Pfeile, die hierher zeigen } - ScDetectiveRefIter aIter( (ScFormulaCell*) pCell ); + ScDetectiveRefIter aIter(pFCell); ScRange aRef; while ( aIter.GetNextRef( aRef) ) { @@ -974,14 +971,12 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel ) { - ScBaseCell* pCell; - pDoc->GetCell( nCol, nRow, nTab, pCell ); - if (!pCell) - return DET_INS_EMPTY; - if (pCell->GetCellType() != CELLTYPE_FORMULA) + ScRefCellValue aCell; + aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab)); + if (aCell.meType != CELLTYPE_FORMULA) return DET_INS_EMPTY; - ScFormulaCell* pFCell = (ScFormulaCell*)pCell; + ScFormulaCell* pFCell = aCell.mpFormula; if (pFCell->IsRunning()) return DET_INS_CIRCULAR; @@ -991,7 +986,7 @@ sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiv sal_uInt16 nResult = DET_INS_EMPTY; - ScDetectiveRefIter aIter( (ScFormulaCell*) pCell ); + ScDetectiveRefIter aIter(pFCell); ScRange aRef; ScAddress aErrorPos; sal_Bool bHasError = false; |