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

Eike Rathke erack at redhat.com
Wed Mar 21 11:29:26 UTC 2018


 formula/source/core/api/FormulaCompiler.cxx |    6 +++++-
 formula/source/ui/dlg/formula.cxx           |    1 +
 include/formula/paramclass.hxx              |   11 +++++++++--
 sc/source/core/tool/interpr1.cxx            |    9 ++++++++-
 4 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit b52ca1a7cf9e3652ebd433753b6642b6f5124d1f
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Mar 6 18:41:56 2018 +0100

    Resolves: tdf#116100 fewer array of references cases, tdf#58874 related
    
    In particular if in any ForceArray context use the matrix result
    instead of the array of references list.
    
    (cherry picked from commit cfc6cf5177f8df23af35c4509c0276a19de56cce)
    
    Change-Id: I72328a690760637f6d31fadba447641c64711a67
    Reviewed-on: https://gerrit.libreoffice.org/50842
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 0ee613dcd8f0..715a2608c7ea 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -2606,9 +2606,11 @@ void FormulaCompiler::ForceArrayOperator( FormulaTokenRef const & rCurr )
     else if (eType == formula::ParamClass::ReferenceOrForceArray)
     {
         // Inherit further only if the return class of the nested function is
-        // not Reference.
+        // not Reference. Else flag as suppressed.
         if (GetForceArrayParameter( rCurr.get(), SAL_MAX_UINT16) != ParamClass::Reference)
             rCurr->SetInForceArray( eType);
+        else
+            rCurr->SetInForceArray( formula::ParamClass::SuppressedReferenceOrForceArray);
         return;
     }
 
@@ -2622,6 +2624,8 @@ void FormulaCompiler::ForceArrayOperator( FormulaTokenRef const & rCurr )
         {
             if (GetForceArrayParameter( rCurr.get(), SAL_MAX_UINT16) != ParamClass::Reference)
                 rCurr->SetInForceArray( eType);
+            else
+                rCurr->SetInForceArray( formula::ParamClass::SuppressedReferenceOrForceArray);
         }
     }
 }
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 1a7505ac06f8..c98167ea54bc 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -762,6 +762,7 @@ void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, co
                             case ParamClass::Array:
                             case ParamClass::ForceArray:
                             case ParamClass::ReferenceOrForceArray:
+                            case ParamClass::SuppressedReferenceOrForceArray:
                                 ;   // nothing, only as array/matrix
                             // no default to get compiler warning
                         }
diff --git a/include/formula/paramclass.hxx b/include/formula/paramclass.hxx
index e8d411088061..a22854fc890c 100644
--- a/include/formula/paramclass.hxx
+++ b/include/formula/paramclass.hxx
@@ -51,8 +51,15 @@ namespace formula
             propagated to subsequent operators and functions being part of a
             parameter of this function. Used with functions that treat
             references separately from arrays, but need the forced array
-            calculation of parameters that are not references.*/
-        ReferenceOrForceArray
+            calculation of parameters that are not references. */
+        ReferenceOrForceArray,
+
+        /** Same as ReferenceOrForceArray but suppressed / not inherited in the
+            compiler's ForceArray context to indicate that a result of
+            Reference in JumpMatrix context should use the result matrix
+            instead of the array of references. Never used as initial parameter
+            classification. */
+        SuppressedReferenceOrForceArray
     };
 }
 
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 18a93676fa4a..679a165f7e9c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -800,12 +800,19 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
     }
     if ( !bCont )
     {   // We're done with it, throw away jump matrix, keep result.
-        // For an intermediate result of Reference use the array of references,
+        // For an intermediate result of Reference use the array of references
+        // if there are more than one reference and the current ForceArray
+        // context is not ForceArray or related, suppressed, ...,
         // else (also for a final result of Reference) use the matrix.
         // Treat the result of a jump command as final and use the matrix (see
         // tdf#115493 for why).
+        ParamClass eParamClass;
         if (!FormulaCompiler::IsOpCodeJumpCommand( pJumpMatrix->GetOpCode()) &&
+                pJumpMatrix->GetRefList().size() > 1 &&
                 ScParameterClassification::GetParameterType( pCur, SAL_MAX_UINT16) == ParamClass::Reference &&
+                (eParamClass = pCur->GetInForceArray()) != ParamClass::ForceArray &&
+                eParamClass != ParamClass::ReferenceOrForceArray &&
+                eParamClass != ParamClass::SuppressedReferenceOrForceArray &&
                 aCode.PeekNextOperator())
         {
             FormulaTokenRef xRef = new ScRefListToken(true);


More information about the Libreoffice-commits mailing list