diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2018-06-14 20:55:23 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-06-20 13:41:05 +0200 |
commit | ad6bdc81f3b47cc46a7751e93e59fb92edd28baf (patch) | |
tree | a6a0e4b45ed65ee6d0369db74fb1bc2f823a31b1 | |
parent | 6cb04c2c6ca284bc18f25403252231580190aa3b (diff) |
tdf#77517 make Calc function ROW accept external references.
Change-Id: Ibd4f858abe825652c3df68ce7a21cbf16feea735
Reviewed-on: https://gerrit.libreoffice.org/55824
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit b1740fba0d1e6e3d69c3781734509317f42a0e4f)
Reviewed-on: https://gerrit.libreoffice.org/56129
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index e87e28d9c4db..9adedd0729ea 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4361,7 +4361,7 @@ void ScInterpreter::ScRow() sal_uInt8 nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 0, 1 ) ) { - double nVal = 0; + double nVal = 0.0; if (nParamCount == 0) { nVal = aPos.Row() + 1; @@ -4400,15 +4400,39 @@ void ScInterpreter::ScRow() nVal = static_cast<double>(nRow1 + 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.Row() + 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 ) + { + 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) { ScMatrixRef pResMat = GetNewMat( 1, @@ -4421,8 +4445,6 @@ void ScInterpreter::ScRow() PushMatrix(pResMat); return; } - else - nVal = 0.0; } else nVal = static_cast<double>(nRow1 + 1); @@ -4430,7 +4452,6 @@ void ScInterpreter::ScRow() break; default: SetError( FormulaError::IllegalParameter ); - nVal = 0.0; } } PushDouble( nVal ); |