summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2018-06-18 19:31:47 +0200
committerEike Rathke <erack@redhat.com>2018-06-20 01:38:48 +0200
commitd5c8199a94d0e2f722fff6637b930205a6641adf (patch)
tree5e5c221a70ba46563db553bdec668b2bc2fb487d
parent2f448d2ddf00579bb452c3d2e7a5287e8e78ff62 (diff)
tdf#77517 make Calc function COLUMN accept external references.
Change-Id: Ife00755586be9a42ac5cf1f9b3debb396db1b45f Reviewed-on: https://gerrit.libreoffice.org/56055 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 28f3e44e99283ede636c28c68bffb2b9df0bbcf8) Reviewed-on: https://gerrit.libreoffice.org/56128
-rw-r--r--sc/source/core/tool/interpr1.cxx40
1 files changed, 31 insertions, 9 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 712c0537e330..e87e28d9c4db 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4258,7 +4258,7 @@ void ScInterpreter::ScColumn()
sal_uInt8 nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 0, 1 ) )
{
- double nVal = 0;
+ double nVal = 0.0;
if (nParamCount == 0)
{
nVal = aPos.Col() + 1;
@@ -4297,15 +4297,40 @@ void ScInterpreter::ScColumn()
nVal = static_cast<double>(nCol1 + 1);
}
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 svExternalDoubleRef :
{
SCCOL nCol1;
- SCROW nRow1;
- SCTAB nTab1;
SCCOL nCol2;
- SCROW nRow2;
- SCTAB nTab2;
- PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+ if ( GetStackType() == svDoubleRef )
+ {
+ 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)
{
ScMatrixRef pResMat = GetNewMat(
@@ -4318,8 +4343,6 @@ void ScInterpreter::ScColumn()
PushMatrix(pResMat);
return;
}
- else
- nVal = 0.0;
}
else
nVal = static_cast<double>(nCol1 + 1);
@@ -4327,7 +4350,6 @@ void ScInterpreter::ScColumn()
break;
default:
SetError( FormulaError::IllegalParameter );
- nVal = 0.0;
}
}
PushDouble( nVal );