diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-15 20:07:33 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-15 20:09:48 -0400 |
commit | 3e2bd1e4022e25b77bcc8eba5e02c1adc57008a1 (patch) | |
tree | ed204246cf18a498f9a5af6ff59ce80c64d3562b | |
parent | 27a2e19ed2c3203c9d63873796d7c9ec2f58dd3d (diff) |
fdo#73080: Correctly count blank cells in COUNTBLANK.
Especially when formula cells are involved.
Change-Id: I40950e7108778821c17d08354f01bb157b1551e6
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 358dab006806..44c3ea622d13 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4545,8 +4545,26 @@ void ScInterpreter::ScCountEmptyCells() ScCellIterator aIter( pDok, aRange, mnSubTotalFlags); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { - if (!aIter.hasEmptyData()) - ++nCount; + 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: + ; + } } } } |