[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Wed Jun 20 11:41:28 UTC 2018


 sc/source/core/tool/interpr1.cxx |   39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

New commits:
commit ad6bdc81f3b47cc46a7751e93e59fb92edd28baf
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Thu Jun 14 20:55:23 2018 +0200

    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 at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit b1740fba0d1e6e3d69c3781734509317f42a0e4f)
    Reviewed-on: https://gerrit.libreoffice.org/56129

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 );


More information about the Libreoffice-commits mailing list