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

Winfried Donkers winfrieddonkers at libreoffice.org
Fri Oct 25 06:07:55 PDT 2013


 formula/source/core/resource/core_resource.src |   12 ++++++
 include/formula/compiler.hrc                   |    4 +-
 include/formula/opcode.hxx                     |    2 +
 sc/qa/unit/ucalc.cxx                           |    2 +
 sc/source/core/tool/interpr4.cxx               |    6 ++-
 sc/source/filter/excel/xlformula.cxx           |    4 +-
 sc/source/filter/oox/formulabase.cxx           |    4 +-
 sc/source/ui/src/scfuncs.src                   |   48 +++++++++++++++++++++++++
 8 files changed, 77 insertions(+), 5 deletions(-)

New commits:
commit 4a122d1e61278debe7e386e3d9f442e68eddba9b
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Sun Oct 20 09:38:19 2013 +0200

    fdo#44134 adding Excel 2010 functions STDEV.P and STDEV.S
    
    Change-Id: If7b2767a69285ac72fa7120b1149a66f118cce8f
    Reviewed-on: https://gerrit.libreoffice.org/6354
    Tested-by: Eike Rathke <erack at redhat.com>
    Reviewed-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 d1eb878..c6aec3a 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -188,6 +188,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
     String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
     String SC_OPCODE_ST_DEV_P_A { Text = "STDEVPA" ; };
+    String SC_OPCODE_ST_DEV_P_MS { Text = "COM.MICROSOFT.STDEV.P" ; };
+    String SC_OPCODE_ST_DEV_S { Text = "COM.MICROSOFT.STDEV.S" ; };
     String SC_OPCODE_B { Text = "BINOM.DIST.RANGE" ; };
     String SC_OPCODE_NORM_DIST { Text = "NORMDIST" ; };
     String SC_OPCODE_EXP_DIST { Text = "EXPONDIST" ; };
@@ -538,6 +540,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
     String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
     String SC_OPCODE_ST_DEV_P_A { Text = "STDEVPA" ; };
+    String SC_OPCODE_ST_DEV_P_MS { Text = "STDEV.P" ; };
+    String SC_OPCODE_ST_DEV_S { Text = "STDEV.S" ; };
     String SC_OPCODE_B { Text = "B" ; };
     String SC_OPCODE_NORM_DIST { Text = "NORMDIST" ; };
     String SC_OPCODE_EXP_DIST { Text = "EXPONDIST" ; };
@@ -1307,6 +1311,14 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "STDEVPA" ;
     };
+    String SC_OPCODE_ST_DEV_P_MS
+    {
+        Text [ en-US ] = "STDEV.P" ;
+    };
+    String SC_OPCODE_ST_DEV_S
+    {
+        Text [ en-US ] = "STDEV.S" ;
+    };
     String SC_OPCODE_B
     {
         Text [ en-US ] = "B";
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index 21449b5..bb80900 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -410,8 +410,10 @@
 #define SC_OPCODE_WEBSERVICE        412
 #define SC_OPCODE_COVARIANCE_S      413
 #define SC_OPCODE_COVARIANCE_P      414
+#define SC_OPCODE_ST_DEV_P_MS       415
+#define SC_OPCODE_ST_DEV_S          416
 
-#define SC_OPCODE_STOP_2_PAR        415     /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_STOP_2_PAR        417     /* 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 9ebd9d5..79b229c 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -222,6 +222,8 @@ enum OpCodeEnum
         ocVarP              = SC_OPCODE_VAR_P,
         ocStDev             = SC_OPCODE_ST_DEV,
         ocStDevP            = SC_OPCODE_ST_DEV_P,
+        ocStDevP_MS         = SC_OPCODE_ST_DEV_P_MS,
+        ocStDevS            = SC_OPCODE_ST_DEV_S,
         ocB                 = SC_OPCODE_B,
         ocNormDist          = SC_OPCODE_NORM_DIST,
         ocExpDist           = SC_OPCODE_EXP_DIST,
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 8e55573..db82ac4 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2425,6 +2425,8 @@ void Test::testFunctionLists()
         "SMALL",
         "STANDARDIZE",
         "STDEV",
+        "STDEV.P",
+        "STDEV.S",
         "STDEVA",
         "STDEVP",
         "STDEVPA",
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index af6424c..1a3e131 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4013,9 +4013,11 @@ StackVar ScInterpreter::Interpret()
                 case ocVarA             : ScVar( true );                break;
                 case ocVarP             : ScVarP( false );              break;
                 case ocVarPA            : ScVarP( true );               break;
-                case ocStDev            : ScStDev( false );             break;
+                case ocStDev            :
+                case ocStDevS           : ScStDev( false );             break;
                 case ocStDevA           : ScStDev( true );              break;
-                case ocStDevP           : ScStDevP( false );            break;
+                case ocStDevP           :
+                case ocStDevP_MS        : ScStDevP( false );            break;
                 case ocStDevPA          : ScStDevP( true );             break;
                 case ocBW               : ScBW();                       break;
                 case ocDIA              : ScDIA();                      break;
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index f293230..dc87d74 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -408,7 +408,9 @@ static const XclFunctionInfo saFuncTable_Oox[] =
 static const XclFunctionInfo saFuncTable_2010[] =
 {
     EXC_FUNCENTRY_V_VA(         ocCovarianceP,   2,  2,  0,  "COVARIANCE.P" ),
-    EXC_FUNCENTRY_V_VA(         ocCovarianceS,   2,  2,  0,  "COVARIANCE.S" )
+    EXC_FUNCENTRY_V_VA(         ocCovarianceS,   2,  2,  0,  "COVARIANCE.S" ),
+    EXC_FUNCENTRY_V_RX(         ocStDevP_MS,     1, MX,  0,  "STDEV.P" ),
+    EXC_FUNCENTRY_V_RX(         ocStDevS,        1, MX,  0,  "STDEV.S" )
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index d119a88..09ac066 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -747,7 +747,9 @@ static const FunctionData saFuncTableOox[] =
 static const FunctionData saFuncTable2010[] =
 {
     { "COM.MICROSOFT.COVARIANCE.P",           "COVARIANCE.P",        NOID,    NOID,   2,  2,  V, { VA }, FUNCFLAG_MACROCALL_NEW },
-    { "COM.MICROSOFT.COVARIANCE.S",           "COVARIANCE.S",        NOID,    NOID,   2,  2,  V, { VA }, FUNCFLAG_MACROCALL_NEW }
+    { "COM.MICROSOFT.COVARIANCE.S",           "COVARIANCE.S",        NOID,    NOID,   2,  2,  V, { VA }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.STDEV.P",                "STDEV.P",             NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.STDEV.S",                "STDEV.S",             NOID,    NOID,   1, MX,  V, { RX }, 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 93ea5c3..11fdecb 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -5183,6 +5183,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
         };
     };
+     // -=*# Resource for function STDEV.S #*=-
+    Resource SC_OPCODE_ST_DEV_S
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Calculates the standard deviation based on a sample." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_STABW );
+            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 of a population." ;
+        };
+    };
      // -=*# Resource for function STABWA #*=-
     Resource SC_OPCODE_ST_DEV_A
     {
@@ -5231,6 +5255,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which portray a sample of a population." ;
         };
     };
+     // -=*# Resource for function STDEV.P #*=-
+    Resource SC_OPCODE_ST_DEV_P_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Calculates the standard deviation based on the entire population." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_STABWN );
+            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 of a population." ;
+        };
+    };
      // -=*# Resource for function STABWNA #*=-
     Resource SC_OPCODE_ST_DEV_P_A
     {


More information about the Libreoffice-commits mailing list