diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 10:14:46 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 17:03:53 -0400 |
commit | 86a9278609f3a60d1bf25ac69371789cfa911f85 (patch) | |
tree | eaa6120b5b08dd553c0342527a90d675de7e4d20 /sc/source | |
parent | ea6ee3f9213ced2c86e684b043ad71cac22911e6 (diff) |
Remove HasCellEmptyData() from ScInterpreter.
Change-Id: Ide68fed6195adb655539e2d3ea3d16cf0b3363d5
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 77 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 13 |
5 files changed, 54 insertions, 49 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index bf57765f9be0..9e691162561f 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 HasCellEmptyData( const ScBaseCell* pCell ); bool HasCellValueData( const ScBaseCell* pCell ); bool HasCellStringData( const ScBaseCell* pCell ); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 3e480e13eea5..4dc426c5e472 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -617,12 +617,13 @@ bool ScInterpreter::JumpMatrix( short nStackLevel ) } else { - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellEmptyData( pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasEmptyValue()) pResMat->PutEmpty( nC, nR ); - else if (HasCellValueData( pCell)) + else if (aCell.hasNumeric()) { - double fVal = GetCellValue( aAdr, pCell); + double fVal = GetCellValue(aAdr, aCell); if ( nGlobalError ) { fVal = CreateDoubleError( @@ -633,8 +634,8 @@ bool ScInterpreter::JumpMatrix( short nStackLevel ) } else { - String aStr; - GetCellString( aStr, pCell ); + OUString aStr; + GetCellString(aStr, aCell); if ( nGlobalError ) { pResMat->PutDouble( CreateDoubleError( @@ -684,12 +685,13 @@ bool ScInterpreter::JumpMatrix( short nStackLevel ) nRow = aRange.aStart.Row(); aAdr.SetCol( static_cast<SCCOL>(nCol) ); aAdr.SetRow( static_cast<SCROW>(nRow) ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellEmptyData( pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasEmptyValue()) pResMat->PutEmpty( nC, nR ); - else if (HasCellValueData( pCell)) + else if (aCell.hasNumeric()) { - double fCellVal = GetCellValue( aAdr, pCell); + double fCellVal = GetCellValue(aAdr, aCell); if ( nGlobalError ) { fCellVal = CreateDoubleError( @@ -700,8 +702,8 @@ bool ScInterpreter::JumpMatrix( short nStackLevel ) } else { - String aStr; - GetCellString( aStr, pCell ); + OUString aStr; + GetCellString(aStr, aCell); if ( nGlobalError ) { pResMat->PutDouble( CreateDoubleError( @@ -1022,18 +1024,21 @@ double ScInterpreter::Compare() ScAddress aAdr; if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellEmptyData( pCell)) - aComp.bEmpty[ i ] = true; - else if (HasCellStringData( pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasEmptyValue()) + aComp.bEmpty[i] = true; + else if (aCell.hasString()) { - GetCellString( *aComp.pVal[ i ], pCell); - aComp.bVal[ i ] = false; + OUString aStr; + GetCellString(aStr, aCell); + *aComp.pVal[i] = aStr; + aComp.bVal[i] = false; } else { - aComp.nVal[ i ] = GetCellValue( aAdr, pCell ); - aComp.bVal[ i ] = true; + aComp.nVal[i] = GetCellValue(aAdr, aCell); + aComp.bVal[i] = true; } } break; @@ -1108,18 +1113,21 @@ ScMatrixRef ScInterpreter::CompareMat( ScCompareOptions* pOptions ) case svSingleRef: { PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellEmptyData( pCell)) - aComp.bEmpty[ i ] = true; - else if (HasCellStringData( pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasEmptyValue()) + aComp.bEmpty[i] = true; + else if (aCell.hasString()) { - GetCellString( *aComp.pVal[ i ], pCell); - aComp.bVal[ i ] = false; + OUString aStr; + GetCellString(aStr, aCell); + *aComp.pVal[i] = aStr; + aComp.bVal[i] = false; } else { - aComp.nVal[ i ] = GetCellValue( aAdr, pCell ); - aComp.bVal[ i ] = true; + aComp.nVal[i] = GetCellValue(aAdr, aCell); + aComp.bVal[i] = true; } } break; @@ -6521,7 +6529,7 @@ void ScInterpreter::ScLookup() // For double, string and single reference. double fDataVal = 0.0; - String aDataStr; + OUString aDataStr; ScAddress aDataAdr; bool bValueData = false; @@ -6575,19 +6583,20 @@ void ScInterpreter::ScLookup() case svSingleRef: { PopSingleRef( aDataAdr ); - const ScBaseCell* pDataCell = GetCell( aDataAdr ); - if (HasCellEmptyData( pDataCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aDataAdr); + if (aCell.hasEmptyValue()) { // Empty cells aren't found anywhere, bail out early. SetError( NOTAVAILABLE); } - else if (HasCellValueData( pDataCell)) + else if (aCell.hasNumeric()) { - fDataVal = GetCellValue( aDataAdr, pDataCell ); + fDataVal = GetCellValue(aDataAdr, aCell); bValueData = true; } else - GetCellString( aDataStr, pDataCell ); + GetCellString(aDataStr, aCell); } break; default: diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index a2b6041562c0..449806f37f5c 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -793,10 +793,11 @@ void ScInterpreter::ScNPV() { ScAddress aAdr; PopSingleRef( aAdr ); - ScBaseCell* pCell = GetCell( aAdr ); - if (!HasCellEmptyData(pCell) && HasCellValueData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (!aCell.hasEmptyValue() && aCell.hasNumeric()) { - double nCellVal = GetCellValue( aAdr, pCell ); + double nCellVal = GetCellValue(aAdr, aCell); nVal += (nCellVal / pow(1.0 + nZins, (double)nCount)); nCount++; } diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index ef39a4a7d72e..361663c2fbcc 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::HasCellEmptyData( const ScBaseCell* pCell ) -{ - return pCell ? pCell->HasEmptyData() : true; -} - bool ScInterpreter::HasCellValueData( const ScBaseCell* pCell ) { return pCell ? pCell->HasValueData() : false; diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index f574c4acc33b..5e0c46491c10 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -521,15 +521,16 @@ ScMatrixRef ScInterpreter::GetMatrix() pMat = GetNewMat(1, 1); if (pMat) { - ScBaseCell* pCell = GetCell( aAdr ); - if (HasCellEmptyData(pCell)) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (aCell.hasEmptyValue()) pMat->PutEmpty(0, 0); - else if (HasCellValueData(pCell)) - pMat->PutDouble(GetCellValue(aAdr, pCell), 0); + else if (aCell.hasNumeric()) + pMat->PutDouble(GetCellValue(aAdr, aCell), 0); else { - String aStr; - GetCellString(aStr, pCell); + OUString aStr; + GetCellString(aStr, aCell); pMat->PutString(aStr, 0); } } |