[Libreoffice-commits] core.git: include/formula reportbuilder/java reportdesign/source

Eike Rathke erack at redhat.com
Wed Jul 5 11:48:20 UTC 2017


 include/formula/funcvarargs.h                                                  |    2 -
 reportbuilder/java/org/libreoffice/report/pentaho/StarFunctionDescription.java |    2 -
 reportdesign/source/ui/misc/FunctionHelper.cxx                                 |   14 +++++++---
 3 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 91287c7456b1bc7060a0f1f08902960eb7a868dc
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jul 5 13:44:08 2017 +0200

    Enable the Formula Wizard to display 255 argument fields
    
    Previously it was, for example for SUM,
    
    1
    2
    3
    ...
    28
    29
    30,31,32,33,...,253,254,255
    
    ie. for more than 30 parameters the exceeding ones were crammed into the last
    (30th) edit field. The expression still worked, but this was ugly, and
    selecting the last field it was easy to overwrite all remaining arguments at
    once.
    
    Change-Id: I6b27a20e7f07d3a6b4752855f04d6239e6375418

diff --git a/include/formula/funcvarargs.h b/include/formula/funcvarargs.h
index 1be68692fe41..ed529ee98680 100644
--- a/include/formula/funcvarargs.h
+++ b/include/formula/funcvarargs.h
@@ -32,7 +32,7 @@
     functionDescription.isInfiniteParameterCount() which though looks like it
     could be easily adapted.
  */
-#define VAR_ARGS            30
+#define VAR_ARGS            255
 
 /** Used to indicate a variable number of paired parameters for the Function Wizard.
 
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/StarFunctionDescription.java b/reportbuilder/java/org/libreoffice/report/pentaho/StarFunctionDescription.java
index 96c4346e9989..2eddaf307ae9 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/StarFunctionDescription.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/StarFunctionDescription.java
@@ -153,7 +153,7 @@ public final class StarFunctionDescription extends WeakBase
         if (infinite)
         {
             // Identical value as VAR_ARGS from formula/funcvarargs.h
-            count = 30;
+            count = 255;
         }
         final FunctionArgument[] args = new FunctionArgument[count];
         for (int i = 0; i < args.length; i++)
diff --git a/reportdesign/source/ui/misc/FunctionHelper.cxx b/reportdesign/source/ui/misc/FunctionHelper.cxx
index 9c9c7450f03e..b001bf39440d 100644
--- a/reportdesign/source/ui/misc/FunctionHelper.cxx
+++ b/reportdesign/source/ui/misc/FunctionHelper.cxx
@@ -212,16 +212,22 @@ sal_uInt32 FunctionDescription::getVarArgsStart() const
     // Don't use defines/constants that could change in future, parameter count
     // could be part of an implicit stable API.
     // offapi/com/sun/star/report/meta/XFunctionDescription.idl doesn't tell.
-    const sal_uInt32 nVarArgs30 = 30;         // ugly hard coded VAR_ARGS of formula::ParaWin
-    const sal_uInt32 nPairedVarArgs60 = 60;   // ugly hard coded PAIRED_VAR_ARGS of formula::ParaWin
+    const sal_uInt32 nVarArgs30 = 30;           // ugly hard coded old VAR_ARGS of formula::ParaWin
+    const sal_uInt32 nPairedVarArgs60 = 60;     // ugly hard coded old PAIRED_VAR_ARGS of formula::ParaWin
+    const sal_uInt32 nVarArgs255 = 255;         // ugly hard coded new VAR_ARGS of formula::ParaWin
+    const sal_uInt32 nPairedVarArgs510 = 510;   // ugly hard coded new PAIRED_VAR_ARGS of formula::ParaWin
     sal_uInt32 nLen = m_aParameter.getLength();
     // If the value of VAR_ARGS changes then adapt *and* maintain implicit API
     // stability, ie. old code using the old VAR_ARGS and PAIRED_VAR_ARGS
     // values must still be handled. It is *not* sufficient to simply change
     // the values here.
-    static_assert(nVarArgs30 == VAR_ARGS && nPairedVarArgs60 == PAIRED_VAR_ARGS,
+    static_assert(nVarArgs255 == VAR_ARGS && nPairedVarArgs510 == PAIRED_VAR_ARGS,
             "VAR_ARGS or PAIRED_VAR_ARGS has unexpected value");
-    if (nLen >= nPairedVarArgs60)
+    if (nLen >= nPairedVarArgs510)
+        nLen -= nPairedVarArgs510;
+    else if (nLen >= nVarArgs255)
+        nLen -= nVarArgs255;
+    else if (nLen >= nPairedVarArgs60)
         nLen -= nPairedVarArgs60;
     else if (nLen >= nVarArgs30)
         nLen -= nVarArgs30;


More information about the Libreoffice-commits mailing list