Kaydet (Commit) 3e2bd1e4 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#73080: Correctly count blank cells in COUNTBLANK.

Especially when formula cells are involved.

Change-Id: I40950e7108778821c17d08354f01bb157b1551e6
üst 27a2e19e
...@@ -4545,8 +4545,26 @@ void ScInterpreter::ScCountEmptyCells() ...@@ -4545,8 +4545,26 @@ void ScInterpreter::ScCountEmptyCells()
ScCellIterator aIter( pDok, aRange, mnSubTotalFlags); ScCellIterator aIter( pDok, aRange, mnSubTotalFlags);
for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
{ {
if (!aIter.hasEmptyData()) const ScRefCellValue& rCell = aIter.getRefCellValue();
++nCount; 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:
;
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment