diff options
author | Eike Rathke <erack@redhat.com> | 2017-05-23 13:32:19 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-23 13:32:26 +0200 |
commit | 5e974c89c8647040f796605aeae1322303532e58 (patch) | |
tree | be8003b0c5508c94394e0b01e0215c338169e66b | |
parent | 30660bd7e9d7f8639508dfceb24c335388370b0b (diff) |
Handle COUNTBLANK with array of references, tdf#58874
Change-Id: Icf8d2ac32a75ebb45c8c6b3b5ae46d01757eb07a
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index a782953b5425..28b12c351227 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4924,6 +4924,9 @@ void ScInterpreter::ScCountEmptyCells() { if ( MustHaveParamCount( GetByte(), 1 ) ) { + const SCSIZE nMatRows = GetRefListArrayMaxSize(1); + // There's either one RefList and nothing else, or none. + ScMatrixRef xResMat = (nMatRows ? GetNewMat( 1, nMatRows) : nullptr); sal_uLong nMaxCount = 0, nCount = 0; switch (GetStackType()) { @@ -4937,14 +4940,16 @@ void ScInterpreter::ScCountEmptyCells() nCount = 1; } break; - case svDoubleRef : case svRefList : + case svDoubleRef : { ScRange aRange; short nParam = 1; + SCSIZE nRefListArrayPos = 0; size_t nRefInList = 0; while (nParam-- > 0) { + nRefListArrayPos = nRefInList; PopDoubleRef( aRange, nParam, nRefInList); nMaxCount += static_cast<sal_uLong>(aRange.aEnd.Row() - aRange.aStart.Row() + 1) * @@ -4958,12 +4963,20 @@ void ScInterpreter::ScCountEmptyCells() if (!isCellContentEmpty(rCell)) ++nCount; } + if (xResMat) + { + xResMat->PutDouble( nMaxCount - nCount, 0, nRefListArrayPos); + nMaxCount = nCount = 0; + } } } break; default : SetError(FormulaError::IllegalParameter); break; } - PushDouble(nMaxCount - nCount); + if (xResMat) + PushMatrix( xResMat); + else + PushDouble(nMaxCount - nCount); } } |