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

tdf#77517 make Calc function COLUMN accept external references.

Change-Id: Ife00755586be9a42ac5cf1f9b3debb396db1b45f
Reviewed-on: https://gerrit.libreoffice.org/56055
Tested-by: Jenkins
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst 19b098f1
...@@ -4258,7 +4258,7 @@ void ScInterpreter::ScColumn() ...@@ -4258,7 +4258,7 @@ void ScInterpreter::ScColumn()
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.Col() + 1; nVal = aPos.Col() + 1;
...@@ -4297,15 +4297,40 @@ void ScInterpreter::ScColumn() ...@@ -4297,15 +4297,40 @@ void ScInterpreter::ScColumn()
nVal = static_cast<double>(nCol1 + 1); nVal = static_cast<double>(nCol1 + 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.Col() + 1 );
}
break;
case svDoubleRef : case svDoubleRef :
case svExternalDoubleRef :
{ {
SCCOL nCol1; SCCOL nCol1;
SCROW nRow1;
SCTAB nTab1;
SCCOL nCol2; SCCOL nCol2;
SCROW nRow2; if ( GetStackType() == svDoubleRef )
SCTAB nTab2; {
PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); SCROW nRow1;
SCTAB nTab1;
SCROW nRow2;
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 );
nCol1 = aAbs.aStart.Col();
nCol2 = aAbs.aEnd.Col();
}
if (nCol2 > nCol1) if (nCol2 > nCol1)
{ {
ScMatrixRef pResMat = GetNewMat( ScMatrixRef pResMat = GetNewMat(
...@@ -4318,8 +4343,6 @@ void ScInterpreter::ScColumn() ...@@ -4318,8 +4343,6 @@ void ScInterpreter::ScColumn()
PushMatrix(pResMat); PushMatrix(pResMat);
return; return;
} }
else
nVal = 0.0;
} }
else else
nVal = static_cast<double>(nCol1 + 1); nVal = static_cast<double>(nCol1 + 1);
...@@ -4327,7 +4350,6 @@ void ScInterpreter::ScColumn() ...@@ -4327,7 +4350,6 @@ void ScInterpreter::ScColumn()
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