diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 10:42:10 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 17:03:54 -0400 |
commit | b9079dc23b163321ce0e0fdea9b8b4ec5799b6d2 (patch) | |
tree | 9247bbb30983c869144e1848cbae2baa51e4265f /sc/source | |
parent | 91acb4a276acdfaa6f85a68b18104ab87f1abf80 (diff) |
Remove HasCellValueData() and adjusted all its call sites.
Change-Id: Idd651a0f970607d5f5434128e5270af10336048c
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 64 | ||||
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 56 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 11 |
5 files changed, 74 insertions, 63 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index fa4d82addddb..48f8dc4cb526 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -196,7 +196,6 @@ ScBaseCell* GetCell( const ScAddress& rPos ); void GetCellString( String& rStr, const ScBaseCell* pCell ); void GetCellString( OUString& rStr, ScRefCellValue& rCell ); sal_uInt16 GetCellErrCode( const ScRefCellValue& rCell ); -bool HasCellValueData( const ScBaseCell* pCell ); bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index fcdf226b073d..53ebdf23eb6c 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1415,11 +1415,12 @@ void ScInterpreter::ScAnd() PopSingleRef( aAdr ); if ( !nGlobalError ) { - ScBaseCell* pCell = GetCell( aAdr ); - if ( HasCellValueData( pCell ) ) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { bHaveValue = true; - nRes &= ( GetCellValue( aAdr, pCell ) != 0.0 ); + nRes &= ( GetCellValue(aAdr, aCell) != 0.0 ); } // else: Xcl raises no error here } @@ -1515,11 +1516,12 @@ void ScInterpreter::ScOr() PopSingleRef( aAdr ); if ( !nGlobalError ) { - ScBaseCell* pCell = GetCell( aAdr ); - if ( HasCellValueData( pCell ) ) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { bHaveValue = true; - nRes |= ( GetCellValue( aAdr, pCell ) != 0.0 ); + nRes |= ( GetCellValue(aAdr, aCell) != 0.0 ); } // else: Xcl raises no error here } @@ -1617,11 +1619,12 @@ void ScInterpreter::ScXor() PopSingleRef( aAdr ); if ( !nGlobalError ) { - ScBaseCell* pCell = GetCell( aAdr ); - if ( HasCellValueData( pCell ) ) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { bHaveValue = true; - nRes ^= ( GetCellValue( aAdr, pCell ) != 0.0 ); + nRes ^= ( GetCellValue(aAdr, aCell) != 0.0 ); } /* TODO: set error? Excel doesn't have XOR, but * doesn't set an error in this case for AND and @@ -5110,7 +5113,7 @@ void ScInterpreter::ScMatch() if (nGlobalError == 0) { double fVal; - String sStr; + OUString sStr; ScQueryParam rParam; rParam.nCol1 = nCol1; rParam.nRow1 = nRow1; @@ -5149,16 +5152,17 @@ void ScInterpreter::ScMatch() PushInt(0); return ; } - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - fVal = GetCellValue( aAdr, pCell ); + fVal = GetCellValue(aAdr, aCell); rItem.meType = ScQueryEntry::ByValue; rItem.mfVal = fVal; } else { - GetCellString(sStr, pCell); + GetCellString(sStr, aCell); rItem.meType = ScQueryEntry::ByString; rItem.maString = sStr; } @@ -5741,10 +5745,11 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) { aAdr.SetCol( nCol + nColDiff); aAdr.SetRow( nRow + nRowDiff); - ScBaseCell* pCell = GetCell( aAdr ); - if ( HasCellValueData(pCell) ) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - fVal = GetCellValue( aAdr, pCell ); + fVal = GetCellValue(aAdr, aCell); ++fCount; if ( bNull && fVal != 0.0 ) { @@ -5792,10 +5797,11 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) { aAdr.SetCol( aCellIter.GetCol() + nColDiff); aAdr.SetRow( aCellIter.GetRow() + nRowDiff); - ScBaseCell* pCell = GetCell( aAdr ); - if ( HasCellValueData(pCell) ) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - fVal = GetCellValue( aAdr, pCell ); + fVal = GetCellValue(aAdr, aCell); ++fCount; if ( bNull && fVal != 0.0 ) { @@ -6397,10 +6403,11 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc ) { aAdr.SetCol( static_cast<SCCOL>(nCol) + nMainCol1); aAdr.SetRow( static_cast<SCROW>(nRow) + nMainRow1); - ScBaseCell* pCell = GetCell( aAdr ); - if ( HasCellValueData(pCell) ) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - fVal = GetCellValue( aAdr, pCell ); + fVal = GetCellValue(aAdr, aCell); ++fCount; if ( bNull && fVal != 0.0 ) { @@ -7399,7 +7406,7 @@ ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField ) bool bByVal = true; double nVal = 0.0; - String aStr; + OUString aStr; ScRange aMissingRange; bool bRangeFake = false; switch (GetStackType()) @@ -7417,13 +7424,14 @@ ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField ) { ScAddress aAdr; PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) - nVal = GetCellValue( aAdr, pCell ); + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) + nVal = GetCellValue(aAdr, aCell); else { bByVal = false; - GetCellString(aStr, pCell); + GetCellString(aStr, aCell); } } break; diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index bb87e617e69c..3fadc45b22a4 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2234,10 +2234,11 @@ void ScInterpreter::ScZTest() { ScAddress aAdr; PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - fVal = GetCellValue( aAdr, pCell ); + fVal = GetCellValue(aAdr, aCell); fSum += fVal; fSumSqr += fVal*fVal; rValCount++; @@ -2665,10 +2666,11 @@ void ScInterpreter::ScHarMean() case svSingleRef : { PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - double x = GetCellValue( aAdr, pCell ); + double x = GetCellValue(aAdr, aCell); if (x > 0.0) { nVal += 1.0/x; @@ -2788,10 +2790,11 @@ void ScInterpreter::ScGeoMean() case svSingleRef : { PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - double x = GetCellValue( aAdr, pCell ); + double x = GetCellValue(aAdr, aCell); if (x > 0.0) { nVal += log(x); @@ -2927,10 +2930,11 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std:: case svSingleRef : { PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - fVal = GetCellValue( aAdr, pCell ); + fVal = GetCellValue(aAdr, aCell); fSum += fVal; values.push_back(fVal); fCount++; @@ -3345,9 +3349,10 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 nParamCount, vector<double case svSingleRef : { PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) - rArray.push_back( GetCellValue( aAdr, pCell)); + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) + rArray.push_back(GetCellValue(aAdr, aCell)); } break; case formula::svDoubleRef : @@ -3532,10 +3537,11 @@ void ScInterpreter::ScRank() ScAddress aAdr; PopSingleRef( aAdr ); double fVal = GetDouble(); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - double x = GetCellValue( aAdr, pCell ); + double x = GetCellValue(aAdr, aCell); if (x == fVal) bValid = true; } @@ -3651,10 +3657,11 @@ void ScInterpreter::ScAveDev() case svSingleRef : { PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) { - rVal += GetCellValue( aAdr, pCell ); + rVal += GetCellValue(aAdr, aCell); rValCount++; } } @@ -3733,9 +3740,10 @@ void ScInterpreter::ScAveDev() case svSingleRef : { PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) - rVal += fabs(GetCellValue( aAdr, pCell ) - nMiddle); + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) + rVal += fabs(GetCellValue(aAdr, aCell) - nMiddle); } break; case formula::svDoubleRef : diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 92d446762920..8f9133a94833 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -193,11 +193,6 @@ sal_uInt16 ScInterpreter::GetCellErrCode( const ScRefCellValue& rCell ) return rCell.meType == CELLTYPE_FORMULA ? rCell.mpFormula->GetErrorCode() : 0; } -bool ScInterpreter::HasCellValueData( const ScBaseCell* pCell ) -{ - return pCell ? pCell->HasValueData() : false; -} - /** Convert string content to numeric value. Converted are only integer numbers including exponent, and ISO 8601 dates diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 5e0c46491c10..829a1e02d501 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -666,13 +666,14 @@ void ScInterpreter::ScMatValue() { ScAddress aAdr( sal::static_int_cast<SCCOL>( nCol1 + nR ), sal::static_int_cast<SCROW>( nRow1 + nC ), nTab1 ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellValueData(pCell)) - PushDouble(GetCellValue( aAdr, pCell )); + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasNumeric()) + PushDouble(GetCellValue(aAdr, aCell)); else { - String aStr; - GetCellString(aStr, pCell); + OUString aStr; + GetCellString(aStr, aCell); PushString(aStr); } } |