[Libreoffice-commits] core.git: formula/source include/formula sc/inc sc/qa sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Mon Nov 4 18:13:13 CET 2013


 formula/source/core/resource/core_resource.src |   12 +++
 include/formula/compiler.hrc                   |    4 -
 include/formula/opcode.hxx                     |    2 
 sc/inc/helpids.h                               |    2 
 sc/qa/unit/ucalc.cxx                           |    2 
 sc/source/core/tool/interpr4.cxx               |    4 -
 sc/source/filter/excel/xlformula.cxx           |    4 -
 sc/source/filter/oox/formulabase.cxx           |    4 -
 sc/source/ui/src/scfuncs.src                   |   88 +++++++++++++++++++++++++
 9 files changed, 118 insertions(+), 4 deletions(-)

New commits:
commit e362bc7892e0fd193e541838be4bd26b7ff42fdd
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Fri Nov 1 20:29:06 2013 +0100

    fdo#71081 add Excel 2010 functions BINOM.DIST and BINOM.INV
    
    Change-Id: Iaecccd9ec6ab6a08c6c7ee8c024a3eba48ca1682
    Reviewed-on: https://gerrit.libreoffice.org/6521
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index 8f49229..3843d25 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -196,6 +196,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_NORM_DIST { Text = "NORMDIST" ; };
     String SC_OPCODE_EXP_DIST { Text = "EXPONDIST" ; };
     String SC_OPCODE_BINOM_DIST { Text = "BINOMDIST" ; };
+    String SC_OPCODE_BINOM_DIST_MS { Text = "COM.MICROSOFT.BINOM.DIST" ; };
     String SC_OPCODE_POISSON_DIST { Text = "POISSON" ; };
     String SC_OPCODE_KOMBIN { Text = "COMBIN" ; };
     String SC_OPCODE_KOMBIN_2 { Text = "COMBINA" ; };
@@ -287,6 +288,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_WEIBULL { Text = "WEIBULL" ; };
     String SC_OPCODE_NEG_BINOM_VERT { Text = "NEGBINOMDIST" ; };
     String SC_OPCODE_KRIT_BINOM { Text = "CRITBINOM" ; };
+    String SC_OPCODE_BINOM_INV { Text = "COM.MICROSOFT.BINOM.INV" ; };
     String SC_OPCODE_KURT { Text = "KURT" ; };
     String SC_OPCODE_HAR_MEAN { Text = "HARMEAN" ; };
     String SC_OPCODE_GEO_MEAN { Text = "GEOMEAN" ; };
@@ -552,6 +554,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_NORM_DIST { Text = "NORMDIST" ; };
     String SC_OPCODE_EXP_DIST { Text = "EXPONDIST" ; };
     String SC_OPCODE_BINOM_DIST { Text = "BINOMDIST" ; };
+    String SC_OPCODE_BINOM_DIST_MS { Text = "BINOM.DIST" ; };
     String SC_OPCODE_POISSON_DIST { Text = "POISSON" ; };
     String SC_OPCODE_KOMBIN { Text = "COMBIN" ; };
     String SC_OPCODE_KOMBIN_2 { Text = "COMBINA" ; };
@@ -643,6 +646,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_WEIBULL { Text = "WEIBULL" ; };
     String SC_OPCODE_NEG_BINOM_VERT { Text = "NEGBINOMDIST" ; };
     String SC_OPCODE_KRIT_BINOM { Text = "CRITBINOM" ; };
+    String SC_OPCODE_BINOM_INV { Text = "BINOM.INV" ; };
     String SC_OPCODE_KURT { Text = "KURT" ; };
     String SC_OPCODE_HAR_MEAN { Text = "HARMEAN" ; };
     String SC_OPCODE_GEO_MEAN { Text = "GEOMEAN" ; };
@@ -1351,6 +1355,10 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "BINOMDIST" ;
     };
+    String SC_OPCODE_BINOM_DIST_MS
+    {
+        Text [ en-US ] = "BINOM.DIST" ;
+    };
     String SC_OPCODE_POISSON_DIST
     {
         Text [ en-US ] = "POISSON" ;
@@ -1716,6 +1724,10 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "CRITBINOM" ;
     };
+    String SC_OPCODE_BINOM_INV
+    {
+        Text [ en-US ] = "BINOM.INV" ;
+    };
     String SC_OPCODE_KURT
     {
         Text [ en-US ] = "KURT" ;
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index d8c45b2..323d540 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -416,8 +416,10 @@
 #define SC_OPCODE_VAR_S             418
 #define SC_OPCODE_BETA_DIST_MS      419
 #define SC_OPCODE_BETA_INV_MS       420
+#define SC_OPCODE_BINOM_DIST_MS     421
+#define SC_OPCODE_BINOM_INV         422
 
-#define SC_OPCODE_STOP_2_PAR        421     /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_STOP_2_PAR        423     /* last function with two or more parameters' OpCode + 1 */
 #define SC_OPCODE_STOP_FUNCTION     SC_OPCODE_STOP_2_PAR            /* last function's OpCode + 1 */
 #define SC_OPCODE_LAST_OPCODE_ID    (SC_OPCODE_STOP_FUNCTION - 1)   /* last OpCode */
 
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 5d96e07..3c14bae 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -230,6 +230,8 @@ enum OpCodeEnum
         ocNormDist          = SC_OPCODE_NORM_DIST,
         ocExpDist           = SC_OPCODE_EXP_DIST,
         ocBinomDist         = SC_OPCODE_BINOM_DIST,
+        ocBinomDist_MS      = SC_OPCODE_BINOM_DIST_MS,
+        ocBinomInv          = SC_OPCODE_BINOM_INV,
         ocPoissonDist       = SC_OPCODE_POISSON_DIST,
         ocKombin            = SC_OPCODE_KOMBIN,
         ocKombin2           = SC_OPCODE_KOMBIN_2,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 820086e..12c39d6 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -686,5 +686,7 @@
 #define HID_FUNC_VAR_S                                          "SC_HID_FUNC_VAR_S"
 #define HID_FUNC_BETADIST_MS                                    "SC_HID_FUNC_BETADIST_MS"
 #define HID_FUNC_BETAINV_MS                                     "SC_HID_FUNC_BETAINV_MS"
+#define HID_FUNC_BINOM_DIST_MS                                  "SC_HID_FUNC_BINOM_DIST_MS"
+#define HID_FUNC_BINOM_INV_MS                                   "SC_HID_FUNC_BINOM_INV_MS"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b5de6a5..0b34f81 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2361,6 +2361,8 @@ void Test::testFunctionLists()
         "BETA.INV",
         "BETADIST",
         "BETAINV",
+        "BINOM.DIST",
+        "BINOM.INV",
         "BINOMDIST",
         "CHIDIST",
         "CHIINV",
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 97db18c..35488e5 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4100,7 +4100,8 @@ StackVar ScInterpreter::Interpret()
                 case ocB                : ScB();                        break;
                 case ocNormDist         : ScNormDist();                 break;
                 case ocExpDist          : ScExpDist();                  break;
-                case ocBinomDist        : ScBinomDist();                break;
+                case ocBinomDist        :
+                case ocBinomDist_MS     : ScBinomDist();                break;
                 case ocPoissonDist      : ScPoissonDist();              break;
                 case ocKombin           : ScKombin();                   break;
                 case ocKombin2          : ScKombin2();                  break;
@@ -4123,6 +4124,7 @@ StackVar ScInterpreter::Interpret()
                 case ocGeoMean          : ScGeoMean();                  break;
                 case ocHarMean          : ScHarMean();                  break;
                 case ocWeibull          : ScWeibull();                  break;
+                case ocBinomInv         :
                 case ocKritBinom        : ScCritBinom();                break;
                 case ocNegBinomVert     : ScNegBinomDist();             break;
                 case ocNoName           : ScNoName();                   break;
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 78c4438..10cc2fe 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -436,7 +436,9 @@ static const XclFunctionInfo saFuncTable_2010[] =
     EXC_FUNCENTRY_V_RX(         ocVarP_MS,       1, MX,  0,  "VAR.P" ),
     EXC_FUNCENTRY_V_RX(         ocVarS,          1, MX,  0,  "VAR.S" ),
     EXC_FUNCENTRY_V_VR(         ocBetaDist_MS,   4,  6,  0,  "BETA.DIST" ),
-    EXC_FUNCENTRY_V_VR(         ocBetaInv_MS,    3,  5,  0,  "BETA.INV" )
+    EXC_FUNCENTRY_V_VR(         ocBetaInv_MS,    3,  5,  0,  "BETA.INV" ),
+    EXC_FUNCENTRY_V_VR(         ocBinomDist_MS,  4,  4,  0,  "BINOM.DIST" ),
+    EXC_FUNCENTRY_V_VR(         ocBinomInv,      3,  3,  0,  "BINOM.INV" )
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 146f332..e5bd94c 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -754,7 +754,9 @@ static const FunctionData saFuncTable2010[] =
     { "COM.MICROSOFT.VAR.P",                  "VAR.P"  ,             NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.VAR.S",                  "VAR.S",               NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.BETA.DIST",              "BETA.DIST"  ,         NOID,    NOID,   4,  6,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
-    { "COM.MICROSOFT.BETA.INV",               "BETA.INV",            NOID,    NOID,   3,  5,  V, { VR }, FUNCFLAG_MACROCALL_NEW }
+    { "COM.MICROSOFT.BETA.INV",               "BETA.INV",            NOID,    NOID,   3,  5,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.BINOM.DIST",             "BINOM.DIST",          NOID,    NOID,   4,  4,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.BINOM.INV",              "BINOM.INV",           NOID,    NOID,   3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW }
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 18b6b79..b686082 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -6087,6 +6087,54 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "Cumulated. C=0 calculates the individual probability, C=1 the cumulated probability." ;
         };
     };
+     // -=*# Resource for function BINOM.DIST #*=-
+    Resource SC_OPCODE_BINOM_DIST_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Values of the binomial distribution." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_BINOM_DIST_MS );
+            4;  0;  0;  0;  0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "X" ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "The number of successes in a series of trials." ;
+        };
+        String 4 // Name of Parameter 2
+        {
+            Text [ en-US ] = "trials" ;
+        };
+        String 5 // Description of Parameter 2
+        {
+            Text [ en-US ] = "The total number of trials." ;
+        };
+        String 6 // Name of Parameter 3
+        {
+            Text [ en-US ] = "SP" ;
+        };
+        String 7 // Description of Parameter 3
+        {
+            Text [ en-US ] = "The success probability of a trial." ;
+        };
+        String 8 // Name of Parameter 4
+        {
+            Text [ en-US ] = "C" ;
+        };
+        String 9 // Description of Parameter 4
+        {
+            Text [ en-US ] = "Cumulated. C=0 calculates the individual probability, C=1 the cumulated probability." ;
+        };
+    };
      // -=*# Resource for function NEGBINOMVERT #*=-
     Resource SC_OPCODE_NEG_BINOM_VERT
     {
@@ -6167,6 +6215,46 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "The border probability that is attained or exceeded." ;
         };
     };
+     // -=*# Resource for function BINOM.INV #*=-
+    Resource SC_OPCODE_BINOM_INV
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Border arguments of the binomial distribution." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_BINOM_INV_MS );
+            3;  0;  0;  0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "trials" ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "The total number of trials." ;
+        };
+        String 4 // Name of Parameter 2
+        {
+            Text [ en-US ] = "SP" ;
+        };
+        String 5 // Description of Parameter 2
+        {
+            Text [ en-US ] = "The success probability of a trial." ;
+        };
+        String 6 // Name of Parameter 3
+        {
+            Text [ en-US ] = "alpha" ;
+        };
+        String 7 // Description of Parameter 3
+        {
+            Text [ en-US ] = "The border probability that is attained or exceeded." ;
+        };
+    };
      // -=*# Resource for function POISSON #*=-
     Resource SC_OPCODE_POISSON_DIST
     {


More information about the Libreoffice-commits mailing list