diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-16 20:49:42 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-16 20:50:56 -0400 |
commit | 51b215902d8e1f415b5fef49fc50c7167f0c7787 (patch) | |
tree | ac65cd4b529d25b644f315ccfdf33f77804ee07e /sc | |
parent | 9d8f1795836f58cb275eae19818eb25ee80901a0 (diff) |
fdo#73080: Fix the single cell reference cases as well.
Change-Id: Ib9a8ae04733c5bcb982ef4d337112eb8249d0ee0
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 44c3ea622d13..d5dcb8e5ef68 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4510,12 +4510,39 @@ void ScInterpreter::ScMatch() } } +namespace { + +bool isCellContentEmpty( const ScRefCellValue& rCell ) +{ + switch (rCell.meType) + { + case CELLTYPE_VALUE: + case CELLTYPE_STRING: + case CELLTYPE_EDIT: + return false; + case CELLTYPE_FORMULA: + { + sc::FormulaResultValue aRes = rCell.mpFormula->GetResult(); + if (aRes.meType != sc::FormulaResultValue::String) + return false; + if (!aRes.maString.isEmpty()) + return false; + } + break; + default: + ; + } + + return true; +} + +} + void ScInterpreter::ScCountEmptyCells() { if ( MustHaveParamCount( GetByte(), 1 ) ) { sal_uLong nMaxCount = 0, nCount = 0; - CellType eCellType; switch (GetStackType()) { case svSingleRef : @@ -4523,8 +4550,9 @@ void ScInterpreter::ScCountEmptyCells() nMaxCount = 1; ScAddress aAdr; PopSingleRef( aAdr ); - eCellType = pDok->GetCellType(aAdr); - if (eCellType != CELLTYPE_NONE) + ScRefCellValue aCell; + aCell.assign(*pDok, aAdr); + if (!isCellContentEmpty(aCell)) nCount = 1; } break; @@ -4546,25 +4574,8 @@ void ScInterpreter::ScCountEmptyCells() for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { const ScRefCellValue& rCell = aIter.getRefCellValue(); - switch (rCell.meType) - { - case CELLTYPE_VALUE: - case CELLTYPE_STRING: - case CELLTYPE_EDIT: - ++nCount; - break; - case CELLTYPE_FORMULA: - { - sc::FormulaResultValue aRes = rCell.mpFormula->GetResult(); - if (aRes.meType != sc::FormulaResultValue::String) - ++nCount; - else if (!aRes.maString.isEmpty()) - ++nCount; - } - break; - default: - ; - } + if (!isCellContentEmpty(rCell)) + ++nCount; } } } |