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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jul 27 19:49:58 UTC 2018


 sc/source/core/tool/interpr1.cxx |   48 ++++++++++++++++++++++++++++++++++++++-
 sc/source/core/tool/parclass.cxx |    1 
 2 files changed, 48 insertions(+), 1 deletion(-)

New commits:
commit c20eb29560fa9d9e552c799203156c0742451eba
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Jul 26 15:00:09 2018 +0200
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Fri Jul 27 21:49:45 2018 +0200

    Related: tdf#91502 handle FORMULA() pCur->IsInForceArray() as well
    
    ... so using it in SUMPRODUCT() and other ForceArray context works
    as expected.
    
    Change-Id: I60197301edcd2c24f8cb0c5fcf4dc4699d9a6165
    Reviewed-on: https://gerrit.libreoffice.org/58118
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 2008a520e429bc2581001d61b63ff934c2255be0)
    Reviewed-on: https://gerrit.libreoffice.org/58175
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 3eb8fab7b968..c0558c869ad4 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2759,7 +2759,7 @@ void ScInterpreter::ScFormula()
     switch ( GetStackType() )
     {
         case svDoubleRef :
-            if (bMatrixFormula)
+            if (bMatrixFormula || pCur->IsInForceArray())
             {
                 SCCOL nCol1, nCol2;
                 SCROW nRow1, nRow2;
commit f3b221773c9a1afb88d4675c303f0f03a7ccaaea
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Jul 26 14:47:57 2018 +0200
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Fri Jul 27 21:49:30 2018 +0200

    Resolves: tdf#91502 handle ISFORMULA() in array context
    
    Obtaining the usual matrix for iterated scalar values doesn't work
    here because we don't want the formulas' results but whether there
    are formulas at the referenced positions.
    
    Change-Id: I7912f9019d21b803ca327cb022df2014d3cc5c5a
    Reviewed-on: https://gerrit.libreoffice.org/58115
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit a44d1b8d47e0ef6645c7c5def1fe5d34d470ae0b)
    Reviewed-on: https://gerrit.libreoffice.org/58174
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c83951d59b79..3eb8fab7b968 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2691,6 +2691,52 @@ void ScInterpreter::ScIsFormula()
     switch ( GetStackType() )
     {
         case svDoubleRef :
+            if (bMatrixFormula || pCur->IsInForceArray())
+            {
+                SCCOL nCol1, nCol2;
+                SCROW nRow1, nRow2;
+                SCTAB nTab1, nTab2;
+                PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
+                if (nGlobalError != FormulaError::NONE)
+                {
+                    PushError( nGlobalError);
+                    return;
+                }
+                if (nTab1 != nTab2)
+                {
+                    PushIllegalArgument();
+                    return;
+                }
+
+                ScMatrixRef pResMat = GetNewMat( static_cast<SCSIZE>(nCol2 - nCol1 + 1),
+                        static_cast<SCSIZE>(nRow2 - nRow1 + 1), true);
+                if (!pResMat)
+                {
+                    PushError( FormulaError::MatrixSize);
+                    return;
+                }
+
+                /* TODO: we really should have a gap-aware cell iterator. */
+                SCSIZE i=0, j=0;
+                ScAddress aAdr( 0, 0, nTab1);
+                for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+                {
+                    aAdr.SetCol(nCol);
+                    for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+                    {
+                        aAdr.SetRow(nRow);
+                        ScRefCellValue aCell(*pDok, aAdr);
+                        pResMat->PutBoolean( (aCell.meType == CELLTYPE_FORMULA), i,j);
+                        ++j;
+                    }
+                    ++i;
+                    j = 0;
+                }
+
+                PushMatrix( pResMat);
+                return;
+            }
+        SAL_FALLTHROUGH;
         case svSingleRef :
         {
             ScAddress aAdr;
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index 7464dbf9a843..a4c3e7241087 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -158,6 +158,7 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
     { ocIndirect,        {{ Value, Value                                         }, 0, Reference }},
     { ocIntercept,       {{ ForceArray, ForceArray                               }, 0, Value }},
     { ocIntersect,       {{ Reference, Reference                                 }, 0, Reference }},
+    { ocIsFormula,       {{ Reference                                            }, 0, Value }},
     { ocIsRef,           {{ Reference                                            }, 0, Value }},
     { ocKurt,            {{ Reference                                            }, 1, Value }},
     { ocLCM,             {{ Reference                                            }, 1, Value }},


More information about the Libreoffice-commits mailing list