Kaydet (Commit) a44d1b8d authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: tdf#91502 handle ISFORMULA() in array context

Obtaining the usual matrix for iterated scalar values doesn't work
here because we don't want the formulas' results but whether there
are formulas at the referenced positions.

Change-Id: I7912f9019d21b803ca327cb022df2014d3cc5c5a
Reviewed-on: https://gerrit.libreoffice.org/58115Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: Jenkins
üst 5da06c77
......@@ -2691,6 +2691,52 @@ void ScInterpreter::ScIsFormula()
switch ( GetStackType() )
{
case svDoubleRef :
if (bMatrixFormula || pCur->IsInForceArray())
{
SCCOL nCol1, nCol2;
SCROW nRow1, nRow2;
SCTAB nTab1, nTab2;
PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
if (nGlobalError != FormulaError::NONE)
{
PushError( nGlobalError);
return;
}
if (nTab1 != nTab2)
{
PushIllegalArgument();
return;
}
ScMatrixRef pResMat = GetNewMat( static_cast<SCSIZE>(nCol2 - nCol1 + 1),
static_cast<SCSIZE>(nRow2 - nRow1 + 1), true);
if (!pResMat)
{
PushError( FormulaError::MatrixSize);
return;
}
/* TODO: we really should have a gap-aware cell iterator. */
SCSIZE i=0, j=0;
ScAddress aAdr( 0, 0, nTab1);
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
{
aAdr.SetCol(nCol);
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
{
aAdr.SetRow(nRow);
ScRefCellValue aCell(*pDok, aAdr);
pResMat->PutBoolean( (aCell.meType == CELLTYPE_FORMULA), i,j);
++j;
}
++i;
j = 0;
}
PushMatrix( pResMat);
return;
}
SAL_FALLTHROUGH;
case svSingleRef :
{
ScAddress aAdr;
......
......@@ -158,6 +158,7 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
{ ocIndirect, {{ Value, Value }, 0, Reference }},
{ ocIntercept, {{ ForceArray, ForceArray }, 0, Value }},
{ ocIntersect, {{ Reference, Reference }, 0, Reference }},
{ ocIsFormula, {{ Reference }, 0, Value }},
{ ocIsRef, {{ Reference }, 0, Value }},
{ ocKurt, {{ Reference }, 1, Value }},
{ ocLCM, {{ Reference }, 1, Value }},
......
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