summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-10-15 20:07:33 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-10-15 20:30:04 -0400
commitc1b850ed0ad3740fb7dc731f0f1bb49b7f5562d4 (patch)
treebec5bb977a5f89d0d20af7bc20f1a05f4371acc0
parent05e9de8d69dd9a2194f6f561fa77c0c61534e9a8 (diff)
fdo#73080: Correctly count blank cells in COUNTBLANK.
Especially when formula cells are involved. Change-Id: I40950e7108778821c17d08354f01bb157b1551e6 (cherry picked from commit 3e2bd1e4022e25b77bcc8eba5e02c1adc57008a1)
-rw-r--r--sc/source/core/tool/interpr1.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index a42dbad7da9f..7d5b8f3d0b70 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4632,8 +4632,26 @@ void ScInterpreter::ScCountEmptyCells()
ScCellIterator aIter( pDok, aRange, glSubTotal);
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:
+ ;
+ }
}
}
}