sc/source/core/tool/interpr1.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 5e974c89c8647040f796605aeae1322303532e58 Author: Eike Rathke <er...@redhat.com> Date: Tue May 23 13:32:19 2017 +0200 Handle COUNTBLANK with array of references, tdf#58874 Change-Id: Icf8d2ac32a75ebb45c8c6b3b5ae46d01757eb07a 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); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits