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

Winfried Donkers winfrieddonkers at libreoffice.org
Wed Mar 5 03:53:46 PST 2014


 formula/source/core/api/FormulaCompiler.cxx    |    1 
 formula/source/core/resource/core_resource.src |   28 +++++
 include/formula/compiler.hrc                   |    6 -
 include/formula/opcode.hxx                     |    4 
 sc/inc/helpids.h                               |    4 
 sc/qa/unit/subsequent_filters-test.cxx         |   10 -
 sc/qa/unit/ucalc.cxx                           |    4 
 sc/source/core/inc/interpre.hxx                |    2 
 sc/source/core/tool/interpr3.cxx               |   27 ++++
 sc/source/core/tool/interpr4.cxx               |    6 -
 sc/source/core/tool/interpr5.cxx               |   63 +++++++++++
 sc/source/core/tool/parclass.cxx               |    3 
 sc/source/filter/excel/xlformula.cxx           |    6 -
 sc/source/filter/oox/formulabase.cxx           |    6 -
 sc/source/ui/src/scfuncs.src                   |  136 +++++++++++++++++++++++++
 15 files changed, 297 insertions(+), 9 deletions(-)

New commits:
commit e4def6edaa4686e50bbfd4490a4b9ddb928397a4
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Sun Feb 2 12:37:39 2014 +0100

    fdo#72197 Add Excel 2010 functions
    
    MODE.SNGL, MODE.MULT, NEGBINOM.DIST, Z.TEST
    
    Change-Id: I55eb05e1ebdb9dbc3ce9ae84e3cdacfdfa112091
    Reviewed-on: https://gerrit.libreoffice.org/7776
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 0302855..d37f8cf 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -842,6 +842,7 @@ bool FormulaCompiler::IsMatrixFunction( OpCode eOpCode )
         case ocMatMult :
         case ocMatInv :
         case ocMatrixUnit :
+        case ocModalValue_Multi :
             return true;
         default:
         {
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index d3b3ea3..a6de271 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -301,6 +301,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_WEIBULL { Text = "WEIBULL" ; };
     String SC_OPCODE_WEIBULL_MS { Text = "COM.MICROSOFT.WEIBULL.DIST" ; };
     String SC_OPCODE_NEG_BINOM_VERT { Text = "NEGBINOMDIST" ; };
+    String SC_OPCODE_NEG_BINOM_DIST_MS { Text = "COM.MICROSOFT.NEGBINOM.DIST" ; };
     String SC_OPCODE_KRIT_BINOM { Text = "CRITBINOM" ; };
     String SC_OPCODE_BINOM_INV { Text = "COM.MICROSOFT.BINOM.INV" ; };
     String SC_OPCODE_KURT { Text = "KURT" ; };
@@ -313,7 +314,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_DEV_SQ { Text = "DEVSQ" ; };
     String SC_OPCODE_MEDIAN { Text = "MEDIAN" ; };
     String SC_OPCODE_MODAL_VALUE { Text = "MODE" ; };
+    String SC_OPCODE_MODAL_VALUE_MS { Text = "COM.MICROSOFT.MODE.SNGL" ; };
+    String SC_OPCODE_MODAL_VALUE_MULTI { Text = "COM.MICROSOFT.MODE.MULT" ; };
     String SC_OPCODE_Z_TEST { Text = "ZTEST" ; };
+    String SC_OPCODE_Z_TEST_MS { Text = "COM.MICROSOFT.Z.TEST" ; };
     String SC_OPCODE_T_TEST { Text = "TTEST" ; };
     String SC_OPCODE_T_TEST_MS { Text = "COM.MICROSOFT.T.TEST" ; };
     String SC_OPCODE_RANK { Text = "RANK" ; };
@@ -695,6 +699,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
     String SC_OPCODE_WEIBULL { Text = "WEIBULL" ; };
     String SC_OPCODE_WEIBULL_MS { Text = "_xlfn.WEIBULL.DIST" ; };
     String SC_OPCODE_NEG_BINOM_VERT { Text = "NEGBINOMDIST" ; };
+    String SC_OPCODE_NEG_BINOM_DIST_MS { Text = "_xlfn.NEGBINOM.DIST" ; };
     String SC_OPCODE_KRIT_BINOM { Text = "CRITBINOM" ; };
     String SC_OPCODE_BINOM_INV { Text = "_xlfn.BINOM.INV" ; };
     String SC_OPCODE_KURT { Text = "KURT" ; };
@@ -707,7 +712,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
     String SC_OPCODE_DEV_SQ { Text = "DEVSQ" ; };
     String SC_OPCODE_MEDIAN { Text = "MEDIAN" ; };
     String SC_OPCODE_MODAL_VALUE { Text = "MODE" ; };
+    String SC_OPCODE_MODAL_VALUE_MS { Text = "_xlfn.MODE.SNGL" ; };
+    String SC_OPCODE_MODAL_VALUE_MULTI { Text = "_xlfn.MODE.MULT" ; };
     String SC_OPCODE_Z_TEST { Text = "ZTEST" ; };
+    String SC_OPCODE_Z_TEST_MS { Text = "_xlfn.Z.TEST" ; };
     String SC_OPCODE_T_TEST { Text = "TTEST" ; };
     String SC_OPCODE_T_TEST_MS { Text = "_xlfn.T.TEST" ; };
     String SC_OPCODE_RANK { Text = "RANK" ; };
@@ -1091,6 +1099,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_WEIBULL { Text = "WEIBULL" ; };
     String SC_OPCODE_WEIBULL_MS { Text = "WEIBULL.DIST" ; };
     String SC_OPCODE_NEG_BINOM_VERT { Text = "NEGBINOMDIST" ; };
+    String SC_OPCODE_NEG_BINOM_DIST_MS { Text = "NEGBINOM.DIST" ; };
     String SC_OPCODE_KRIT_BINOM { Text = "CRITBINOM" ; };
     String SC_OPCODE_BINOM_INV { Text = "BINOM.INV" ; };
     String SC_OPCODE_KURT { Text = "KURT" ; };
@@ -1103,7 +1112,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_DEV_SQ { Text = "DEVSQ" ; };
     String SC_OPCODE_MEDIAN { Text = "MEDIAN" ; };
     String SC_OPCODE_MODAL_VALUE { Text = "MODE" ; };
+    String SC_OPCODE_MODAL_VALUE_MS { Text = "MODE.SNGL" ; };
+    String SC_OPCODE_MODAL_VALUE_MULTI { Text = "MODE.MULT" ; };
     String SC_OPCODE_Z_TEST { Text = "ZTEST" ; };
+    String SC_OPCODE_Z_TEST_MS { Text = "Z.TEST" ; };
     String SC_OPCODE_T_TEST { Text = "TTEST" ; };
     String SC_OPCODE_T_TEST_MS { Text = "T.TEST" ; };
     String SC_OPCODE_RANK { Text = "RANK" ; };
@@ -2249,6 +2261,10 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "NEGBINOMDIST" ;
     };
+    String SC_OPCODE_NEG_BINOM_DIST_MS
+    {
+        Text [ en-US ] = "NEGBINOM.DIST" ;
+    };
     String SC_OPCODE_KRIT_BINOM
     {
         Text [ en-US ] = "CRITBINOM" ;
@@ -2297,10 +2313,22 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "MODE" ;
     };
+    String SC_OPCODE_MODAL_VALUE_MS
+    {
+        Text [ en-US ] = "MODE.SNGL" ;
+    };
+    String SC_OPCODE_MODAL_VALUE_MULTI
+    {
+        Text [ en-US ] = "MODE.MULT" ;
+    };
     String SC_OPCODE_Z_TEST
     {
         Text [ en-US ] = "ZTEST" ;
     };
+    String SC_OPCODE_Z_TEST_MS
+    {
+        Text [ en-US ] = "Z.TEST" ;
+    };
     String SC_OPCODE_T_TEST
     {
         Text [ en-US ] = "TTEST" ;
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index 1c03f6d..4566c00 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -456,8 +456,12 @@
 #define SC_OPCODE_PERCENT_RANK_EXC  458
 #define SC_OPCODE_QUARTILE_EXC      459
 #define SC_OPCODE_RANK_AVG          460
+#define SC_OPCODE_MODAL_VALUE_MS    461
+#define SC_OPCODE_MODAL_VALUE_MULTI 462
+#define SC_OPCODE_NEG_BINOM_DIST_MS 463
+#define SC_OPCODE_Z_TEST_MS         464
 
-#define SC_OPCODE_STOP_2_PAR        461     /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_STOP_2_PAR        465     /* 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 c754dc7..19f644d 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -347,6 +347,7 @@ enum OpCodeEnum
         ocWeibull           = SC_OPCODE_WEIBULL,
         ocWeibull_MS        = SC_OPCODE_WEIBULL_MS,
         ocNegBinomVert      = SC_OPCODE_NEG_BINOM_VERT,
+        ocNegBinomDist_MS   = SC_OPCODE_NEG_BINOM_DIST_MS,
         ocKritBinom         = SC_OPCODE_KRIT_BINOM,
         ocKurt              = SC_OPCODE_KURT,
         ocHarMean           = SC_OPCODE_HAR_MEAN,
@@ -358,7 +359,10 @@ enum OpCodeEnum
         ocDevSq             = SC_OPCODE_DEV_SQ,
         ocMedian            = SC_OPCODE_MEDIAN,
         ocModalValue        = SC_OPCODE_MODAL_VALUE,
+        ocModalValue_MS     = SC_OPCODE_MODAL_VALUE_MS,
+        ocModalValue_Multi  = SC_OPCODE_MODAL_VALUE_MULTI,
         ocZTest             = SC_OPCODE_Z_TEST,
+        ocZTest_MS          = SC_OPCODE_Z_TEST_MS,
         ocTTest             = SC_OPCODE_T_TEST,
         ocTTest_MS          = SC_OPCODE_T_TEST_MS,
         ocRank              = SC_OPCODE_RANK,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 6e5ec3b..80a6bc4 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -700,5 +700,9 @@
 #define HID_FUNC_QUARTILE_EXC                                   "SC_HID_FUNC_QUARTILE_EXC"
 #define HID_FUNC_RANK_EQ                                        "SC_HID_FUNC_RANK_EQ"
 #define HID_FUNC_RANK_AVG                                       "SC_HID_FUNC_RANK_AVG"
+#define HID_FUNC_MODAL_VALUE_MS                                 "SC_HID_FUNC_MODAL_VALUE_MS"
+#define HID_FUNC_MODAL_VALUE_MULTI                              "SC_HID_FUNC_MODAL_VALUE_MULTI"
+#define HID_FUNC_NEGBINOMDIST_MS                                "SC_HID_FUNC_NEGBINOMDIST_MS"
+#define HID_FUNC_Z_TEST_MS                                      "SC_HID_FUNC_Z_TEST_MS"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 636b864..4a005df2 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -459,10 +459,10 @@ void ScFiltersTest::testFunctionsExcel2010()
         { 36, true  },
         { 37, true  },
         { 38, true  },
-        { 39, false },
-        { 40, false },
-        { 41, false },
-        { 42, false },
+        { 39, true  },
+        { 40, true  },
+        { 41, true  },
+        { 42, true  },
         { 43, false },
         { 44, true  },
         { 45, true  },
@@ -493,7 +493,7 @@ void ScFiltersTest::testFunctionsExcel2010()
         { 70, true  },
         { 71, true  },
         { 72, false },
-        { 73, false }
+        { 73, true  }
     };
 
     for (size_t i=0; i < SAL_N_ELEMENTS(aTests); ++i)
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d5d70550..bf691c6 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2607,6 +2607,9 @@ void Test::testFunctionLists()
         "MIN",
         "MINA",
         "MODE",
+        "MODE.MULT",
+        "MODE.SNGL",
+        "NEGBINOM.DIST",
         "NEGBINOMDIST",
         "NORM.DIST",
         "NORM.INV",
@@ -2666,6 +2669,7 @@ void Test::testFunctionLists()
         "VARPA",
         "WEIBULL",
         "WEIBULL.DIST",
+        "Z.TEST",
         "ZTEST",
         0
     };
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 5d361bf..9e09777 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -767,6 +767,7 @@ void ScChiInv();
 void ScBetaInv();
 void ScCritBinom();
 void ScNegBinomDist();
+void ScNegBinomDist_MS();
 void ScKurt();
 void ScHarMean();
 void ScGeoMean();
@@ -781,6 +782,7 @@ void GetNumberSequenceArray( sal_uInt8 nParamCount, ::std::vector<double>& rArra
 void GetSortArray(sal_uInt8 nParamCount, ::std::vector<double>& rSortArray, ::std::vector<long>* pIndexOrder = NULL);
 void QuickSort(::std::vector<double>& rSortArray, ::std::vector<long>* pIndexOrder = NULL);
 void ScModalValue();
+void ScModalValue_Multi();
 void ScAveDev();
 void ScDevSq();
 void ScZTest();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index d10c721..3c7fb4f 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1521,6 +1521,32 @@ void ScInterpreter::ScNegBinomDist()
     }
 }
 
+void ScInterpreter::ScNegBinomDist_MS()
+{
+    if ( MustHaveParamCount( GetByte(), 4 ) )
+    {
+        bool bCumulative = GetBool();
+        double p      = GetDouble();                    // p
+        double r      = GetDouble();                    // r
+        double x      = GetDouble();                    // x
+        if ( r < 0.0 || x < 0.0 || p < 0.0 || p > 1.0 )
+            PushIllegalArgument();
+        else
+        {
+            double q = 1.0 - p;
+            if ( bCumulative )
+                PushDouble( 1.0 - GetBetaDist( q, x + 1, r ) );
+            else
+            {
+                double fFactor = pow( p, r );
+                for ( double i = 0.0; i < x; i++ )
+                    fFactor *= ( i + r ) / ( i + 1.0 ) * q;
+                PushDouble( fFactor );
+            }
+        }
+    }
+}
+
 void ScInterpreter::ScNormDist( int nMinParamCount )
 {
     sal_uInt8 nParamCount = GetByte();
@@ -2571,6 +2597,7 @@ void ScInterpreter::ScZTest()
             PushDouble(0.5 - gauss((mue-x)*sqrt(rValCount)/sigma));
     }
 }
+
 bool ScInterpreter::CalculateTest(bool _bTemplin
                                   ,const SCSIZE nC1, const SCSIZE nC2,const SCSIZE nR1,const SCSIZE nR2
                                   ,const ScMatrixRef& pMat1,const ScMatrixRef& pMat2
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 135b01c..7a6b424 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4143,6 +4143,8 @@ StackVar ScInterpreter::Interpret()
                 case ocSchiefe          : ScSkew();                     break;
                 case ocSkewp            : ScSkewp();                    break;
                 case ocModalValue       : ScModalValue();               break;
+                case ocModalValue_MS    : ScModalValue();               break;
+                case ocModalValue_Multi : ScModalValue_Multi();         break;
                 case ocMedian           : ScMedian();                   break;
                 case ocGeoMean          : ScGeoMean();                  break;
                 case ocHarMean          : ScHarMean();                  break;
@@ -4151,9 +4153,11 @@ StackVar ScInterpreter::Interpret()
                 case ocBinomInv         :
                 case ocKritBinom        : ScCritBinom();                break;
                 case ocNegBinomVert     : ScNegBinomDist();             break;
+                case ocNegBinomDist_MS  : ScNegBinomDist_MS();          break;
                 case ocNoName           : ScNoName();                   break;
                 case ocBad              : ScBadName();                  break;
-                case ocZTest            : ScZTest();                    break;
+                case ocZTest            :
+                case ocZTest_MS         : ScZTest();                    break;
                 case ocTTest            :
                 case ocTTest_MS         : ScTTest();                    break;
                 case ocFTest            :
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index d8b97c03..b5733f4 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -832,6 +832,69 @@ void ScInterpreter::ScMatDet()
     }
 }
 
+void ScInterpreter::ScModalValue_Multi()
+{
+    sal_uInt8 nParamCount = GetByte();
+    if ( !MustHaveParamCountMin( nParamCount, 1 ) )
+        return;
+    vector<double> aSortArray;
+    GetSortArray(nParamCount, aSortArray);
+    SCSIZE nSize = aSortArray.size();
+    if ( aSortArray.empty() || nSize == 0 || nGlobalError )
+        PushNoValue();
+    else
+    {
+        SCSIZE nMax = 1, nCount = 1;
+        double nOldVal = aSortArray[0];
+        vector<double> aResultArray;
+        aResultArray.resize( 1 );
+        aResultArray[ 0 ] = aSortArray[ 0 ];
+        SCSIZE i;
+
+        for ( i = 1; i < nSize; i++ )
+        {
+            if ( aSortArray[ i ] == nOldVal )
+            {
+                nCount++;
+                if ( nCount > nMax && aResultArray.size() > 1 )
+                {
+                    aResultArray.clear();
+                    aResultArray.resize( 1 );
+                    aResultArray[ 0 ] = nOldVal;
+                }
+            }
+            else
+            {
+                nOldVal = aSortArray[ i ];
+                if ( nCount >= nMax )
+                {
+                    if ( nCount > nMax )
+                        nMax = nCount;
+                    aResultArray.resize( aResultArray.size() + 1 );
+                }
+                aResultArray[ aResultArray.size() -1  ] = nOldVal;
+                nCount = 1;
+            }
+        }
+        if ( nCount > nMax )
+            nMax = nCount;
+        else
+        {
+            if ( nCount < nMax )
+                aResultArray.resize( aResultArray.size() - 1 );
+        }
+
+        if ( nMax == 1 && nCount == 1 )
+            PushNoValue();
+        else
+        {
+            ScMatrixRef pResMatrix = GetNewMat( 1, aResultArray.size(), true );
+            pResMatrix->PutDoubleVector( aResultArray, 0, 0 );
+            PushMatrix( pResMatrix );
+        }
+    }
+}
+
 void ScInterpreter::ScMatInv()
 {
     if ( MustHaveParamCount( GetByte(), 1 ) )
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index 3da2a9d..ae10b6c 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -139,6 +139,8 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
     { ocMinA,            {{ Reference                                            }, 1 }},
     { ocMIRR,            {{ Reference, Value, Value                              }, 0 }},
     { ocModalValue,      {{ ForceArray                                           }, 1 }},
+    { ocModalValue_MS,   {{ ForceArray                                           }, 1 }},
+    { ocModalValue_Multi,{{ ForceArray                                           }, 1 }},
     { ocMul,             {{ Array, Array                                         }, 0 }},
     { ocMultiArea,       {{ Reference                                            }, 1 }},
     { ocNPV,             {{ Value, Reference                                     }, 1 }},
@@ -197,6 +199,7 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
     { ocVLookup,         {{ Value, Reference, Value, Value                       }, 0 }},
     { ocXor,             {{ Reference                                            }, 1 }},
     { ocZTest,           {{ Reference, Value, Value                              }, 0 }},
+    { ocZTest_MS,        {{ Reference, Value, Value                              }, 0 }},
     // Excel doubts:
     // ocN, ocT: Excel says (and handles) Reference, error? This means no
     // position dependent SingleRef if DoubleRef, and no array calculation,
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 83a79ca..cdf3f23 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -477,7 +477,11 @@ static const XclFunctionInfo saFuncTable_2010[] =
     EXC_FUNCENTRY_V_VR( ocPercentile_Exc,   2,  2,  0,  "PERCENTILE.EXC" ),
     EXC_FUNCENTRY_V_VR( ocPercentrank_Exc,  2,  3,  0,  "PERCENTRANK.EXC" ),
     EXC_FUNCENTRY_V_VR( ocQuartile_Exc,     2,  2,  0,  "QUARTILE.EXC" ),
-    EXC_FUNCENTRY_V_VR( ocRank_Avg,         2,  3,  0,  "RANK.AVG" )
+    EXC_FUNCENTRY_V_VR( ocRank_Avg,         2,  3,  0,  "RANK.AVG" ),
+    EXC_FUNCENTRY_V_RX( ocModalValue_MS,    1, MX,  0,  "MODE.SNGL" ),
+    EXC_FUNCENTRY_V_RX( ocModalValue_Multi, 1, MX,  0,  "MODE.MULT" ),
+    EXC_FUNCENTRY_V_VR( ocNegBinomDist_MS,  4,  4,  0,  "NEGBINOM.DIST" ),
+    EXC_FUNCENTRY_V_VR( ocZTest_MS,         2,  3,  0,  "Z.TEST" ),
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 37133ef..f4bdb31 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -795,7 +795,11 @@ static const FunctionData saFuncTable2010[] =
     { "COM.MICROSOFT.PERCENTILE.EXC",         "PERCENTILE.EXC",      NOID,   NOID,    2,  2,  V, { RX, VR }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.PERCENTRANK.EXC",        "PERCENTRANK.EXC",     NOID,   NOID,    2,  3,  V, { RX, VR, VR_E }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.QUARTILE.EXC",           "QUARTILE.EXC",        NOID,   NOID,    2,  2,  V, { RX, VR }, FUNCFLAG_MACROCALL_NEW },
-    { "COM.MICROSOFT.RANK.AVG",               "RANK.AVG",            NOID,   NOID,    2,  3,  V, { VR, RO, VR }, FUNCFLAG_MACROCALL_NEW }
+    { "COM.MICROSOFT.RANK.AVG",               "RANK.AVG",            NOID,   NOID,    2,  3,  V, { VR, RO, VR }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.MODE.SNGL",              "MODE.SNGL",           NOID,   NOID,    1,  MX, V, { VA }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.MODE.MULT",              "MODE.MULT",           NOID,   NOID,    1,  MX, V, { VA }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.NEGBINOM.DIST",          "NEGBINOM.DIST",       NOID,   NOID,    4,  4,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.Z.TEST",                 "Z.TEST",              NOID,   NOID,    2,  3,  V, { RX, 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 e57b618..e7cfe26 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -5591,6 +5591,54 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample." ;
         };
     };
+     // -=*# Resource for function MOD.SNGL #*=-
+    Resource SC_OPCODE_MODAL_VALUE_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Returns the most common value in a sample." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_MODAL_VALUE_MS );
+            VAR_ARGS;   0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "number " ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample." ;
+        };
+    };
+     // -=*# Resource for function MOD.MULTI #*=-
+    Resource SC_OPCODE_MODAL_VALUE_MULTI
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Returns the most common value in a sample." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_MODAL_VALUE_MULTI );
+            VAR_ARGS;   0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "number " ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "Number 1, number 2, ... are 1 to 254 numerical arguments which portray a sample." ;
+        };
+    };
      // -=*# Resource for function MEDIAN #*=-
     Resource SC_OPCODE_MEDIAN
     {
@@ -6471,6 +6519,54 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "The success probability of a trial." ;
         };
     };
+     // -=*# Resource for function NEGBINOM.DIST #*=-
+    Resource SC_OPCODE_NEG_BINOM_DIST_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Values of the negative binomial distribution." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_NEGBINOMDIST_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 failures in the trial range." ;
+        };
+        String 4 // Name of Parameter 2
+        {
+            Text [ en-US ] = "R" ;
+        };
+        String 5 // Description of Parameter 2
+        {
+            Text [ en-US ] = "The number of successes in the trial sequence." ;
+        };
+        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 ] = "Cumulative" ;
+        };
+        String 9 // Description of Parameter 4
+        {
+            Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE calculates the cumulative distribution function." ;
+        };
+    };
      // -=*# Resource for function KRITBINOM #*=-
     Resource SC_OPCODE_KRIT_BINOM
     {
@@ -8890,6 +8986,46 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "The known standard deviation of the population. If omitted, the standard deviation of the given sample is used." ;
         };
     };
+     // -=*# Resource for function Z.TEST #*=-
+    Resource SC_OPCODE_Z_TEST_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Calculates the probability of observing a z-statistic greater than the one computed based on a sample." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_Z_TEST_MS );
+            3;  0;  0;  1;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "data" ;
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "The given sample, drawn from a normally distributed population." ;
+        };
+        String 4 // Name of Parameter 2
+        {
+            Text [ en-US ] = "mu" ;
+        };
+        String 5 // Description of Parameter 2
+        {
+            Text [ en-US ] = "The known mean of the population." ;
+        };
+        String 6 // Name of Parameter 3
+        {
+            Text [ en-US ] = "sigma" ;
+        };
+        String 7 // Description of Parameter 3
+        {
+            Text [ en-US ] = "The known standard deviation of the population. If omitted, the standard deviation of the given sample is used." ;
+        };
+    };
      // -=*# Resource for function CHITEST #*=-
     Resource SC_OPCODE_CHI_TEST
     {


More information about the Libreoffice-commits mailing list