Kaydet (Commit) b1740fba authored tarafından Winfried Donkers's avatar Winfried Donkers Kaydeden (comit) Eike Rathke

tdf#77517 make Calc function ROW accept external references.

Change-Id: Ibd4f858abe825652c3df68ce7a21cbf16feea735
Reviewed-on: https://gerrit.libreoffice.org/55824
Tested-by: Jenkins
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst 4f965ca5
...@@ -4339,7 +4339,7 @@ void ScInterpreter::ScRow() ...@@ -4339,7 +4339,7 @@ void ScInterpreter::ScRow()
sal_uInt8 nParamCount = GetByte(); sal_uInt8 nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 0, 1 ) ) if ( MustHaveParamCount( nParamCount, 0, 1 ) )
{ {
double nVal = 0; double nVal = 0.0;
if (nParamCount == 0) if (nParamCount == 0)
{ {
nVal = aPos.Row() + 1; nVal = aPos.Row() + 1;
...@@ -4378,15 +4378,39 @@ void ScInterpreter::ScRow() ...@@ -4378,15 +4378,39 @@ void ScInterpreter::ScRow()
nVal = static_cast<double>(nRow1 + 1); nVal = static_cast<double>(nRow1 + 1);
} }
break; break;
case svExternalSingleRef :
{
sal_uInt16 nFileId;
OUString aTabName;
ScSingleRefData aRef;
PopExternalSingleRef( nFileId, aTabName, aRef );
ScAddress aAbsRef = aRef.toAbs( aPos );
nVal = static_cast<double>( aAbsRef.Row() + 1 );
}
break;
case svDoubleRef : case svDoubleRef :
case svExternalDoubleRef :
{ {
SCCOL nCol1;
SCROW nRow1; SCROW nRow1;
SCTAB nTab1;
SCCOL nCol2;
SCROW nRow2; SCROW nRow2;
SCTAB nTab2; if ( GetStackType() == svDoubleRef )
PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); {
SCCOL nCol1;
SCTAB nTab1;
SCCOL nCol2;
SCTAB nTab2;
PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
}
else
{
sal_uInt16 nFileId;
OUString aTabName;
ScComplexRefData aRef;
PopExternalDoubleRef( nFileId, aTabName, aRef );
ScRange aAbs = aRef.toAbs( aPos );
nRow1 = aAbs.aStart.Row();
nRow2 = aAbs.aEnd.Row();
}
if (nRow2 > nRow1) if (nRow2 > nRow1)
{ {
ScMatrixRef pResMat = GetNewMat( 1, ScMatrixRef pResMat = GetNewMat( 1,
...@@ -4399,8 +4423,6 @@ void ScInterpreter::ScRow() ...@@ -4399,8 +4423,6 @@ void ScInterpreter::ScRow()
PushMatrix(pResMat); PushMatrix(pResMat);
return; return;
} }
else
nVal = 0.0;
} }
else else
nVal = static_cast<double>(nRow1 + 1); nVal = static_cast<double>(nRow1 + 1);
...@@ -4408,7 +4430,6 @@ void ScInterpreter::ScRow() ...@@ -4408,7 +4430,6 @@ void ScInterpreter::ScRow()
break; break;
default: default:
SetError( FormulaError::IllegalParameter ); SetError( FormulaError::IllegalParameter );
nVal = 0.0;
} }
} }
PushDouble( nVal ); PushDouble( nVal );
......
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