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

Winfried Donkers winfrieddonkers at libreoffice.org
Wed Oct 30 18:54:49 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               |    6 ++-
 sc/source/core/tool/parclass.cxx               |    2 +
 sc/source/filter/excel/xlformula.cxx           |    4 +-
 sc/source/filter/oox/formulabase.cxx           |    4 +-
 sc/source/ui/src/scfuncs.src                   |   48 +++++++++++++++++++++++++
 10 files changed, 81 insertions(+), 5 deletions(-)

New commits:
commit 781363934af5c0ff3401161c385c6c93c9352c2c
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Tue Oct 29 17:30:42 2013 +0100

    fdo#61002 add Excel 2010 functions VAR.P and VAR.S
    
    Change-Id: I23f286eaaef79d196a65e8079b62cf577539e9f1
    Reviewed-on: https://gerrit.libreoffice.org/6477
    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 c6aec3a..3ec56c0 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -184,6 +184,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     String SC_OPCODE_VAR_A { Text = "VARA" ; };
     String SC_OPCODE_VAR_P { Text = "VARP" ; };
     String SC_OPCODE_VAR_P_A { Text = "VARPA" ; };
+    String SC_OPCODE_VAR_P_MS { Text = "COM.MICROSOFT.VAR.P" ; };
+    String SC_OPCODE_VAR_S { Text = "COM.MICROSOFT.VAR.S" ; };
     String SC_OPCODE_ST_DEV { Text = "STDEV" ; };
     String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
     String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
@@ -536,6 +538,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     String SC_OPCODE_VAR_A { Text = "VARA" ; };
     String SC_OPCODE_VAR_P { Text = "VARP" ; };
     String SC_OPCODE_VAR_P_A { Text = "VARPA" ; };
+    String SC_OPCODE_VAR_P_MS { Text = "VAR.P" ; };
+    String SC_OPCODE_VAR_S { Text = "VAR.S" ; };
     String SC_OPCODE_ST_DEV { Text = "STDEV" ; };
     String SC_OPCODE_ST_DEV_A { Text = "STDEVA" ; };
     String SC_OPCODE_ST_DEV_P { Text = "STDEVP" ; };
@@ -1295,6 +1299,14 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "VARPA" ;
     };
+    String SC_OPCODE_VAR_P_MS
+    {
+        Text [ en-US ] = "VAR.P" ;
+    };
+    String SC_OPCODE_VAR_S
+    {
+        Text [ en-US ] = "VAR.S" ;
+    };
     String SC_OPCODE_ST_DEV
     {
         Text [ en-US ] = "STDEV" ;
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index bb80900..b9b4f7a 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -412,8 +412,10 @@
 #define SC_OPCODE_COVARIANCE_P      414
 #define SC_OPCODE_ST_DEV_P_MS       415
 #define SC_OPCODE_ST_DEV_S          416
+#define SC_OPCODE_VAR_P_MS          417
+#define SC_OPCODE_VAR_S             418
 
-#define SC_OPCODE_STOP_2_PAR        417     /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_STOP_2_PAR        419     /* 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 79b229c..6dd28d3 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -220,6 +220,8 @@ enum OpCodeEnum
         ocISPMT             = SC_OPCODE_ISPMT,
         ocVar               = SC_OPCODE_VAR,
         ocVarP              = SC_OPCODE_VAR_P,
+        ocVarP_MS           = SC_OPCODE_VAR_P_MS,
+        ocVarS              = SC_OPCODE_VAR_S,
         ocStDev             = SC_OPCODE_ST_DEV,
         ocStDevP            = SC_OPCODE_ST_DEV_P,
         ocStDevP_MS         = SC_OPCODE_ST_DEV_P_MS,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 30b8899..831e2d9 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -682,5 +682,7 @@
 #define HID_FUNC_COVARIANCE_S                                   "SC_HID_FUNC_COVARIANCE_S"
 #define HID_FUNC_ST_DEV_P_MS                                    "SC_HID_FUNC_ST_DEV_P_MS"
 #define HID_FUNC_ST_DEV_S                                       "SC_HID_FUNC_ST_DEV_S"
+#define HID_FUNC_VAR_P_MS                                       "SC_HID_FUNC_VAR_P_MS"
+#define HID_FUNC_VAR_S                                          "SC_HID_FUNC_VAR_S"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index db82ac4..90af819 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2436,6 +2436,8 @@ void Test::testFunctionLists()
         "TRIMMEAN",
         "TTEST",
         "VAR",
+        "VAR.P",
+        "VAR.S",
         "VARA",
         "VARP",
         "VARPA",
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 1a3e131..daa66c6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4009,9 +4009,11 @@ StackVar ScInterpreter::Interpret()
                 case ocAverageA         : ScAverage( true );            break;
                 case ocCount            : ScCount();                    break;
                 case ocCount2           : ScCount2();                   break;
-                case ocVar              : ScVar( false );               break;
+                case ocVar              :
+                case ocVarS             : ScVar( false );               break;
                 case ocVarA             : ScVar( true );                break;
-                case ocVarP             : ScVarP( false );              break;
+                case ocVarP             :
+                case ocVarP_MS          : ScVarP( false );              break;
                 case ocVarPA            : ScVarP( true );               break;
                 case ocStDev            :
                 case ocStDevS           : ScStDev( false );             break;
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index 6b5888d..7f86e63 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -189,6 +189,8 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
     { ocVarA,            {{ Reference                                            }, 1 }},
     { ocVarP,            {{ Reference                                            }, 1 }},
     { ocVarPA,           {{ Reference                                            }, 1 }},
+    { ocVarP_MS,         {{ Reference                                            }, 1 }},
+    { ocVarS,            {{ Reference                                            }, 1 }},
     { ocVLookup,         {{ Value, Reference, Value, Value                       }, 0 }},
     { ocXor,             {{ Reference                                            }, 1 }},
     { ocZTest,           {{ Reference, Value, Value                              }, 0 }},
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index dc87d74..025827f 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -410,7 +410,9 @@ 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_RX(         ocStDevP_MS,     1, MX,  0,  "STDEV.P" ),
-    EXC_FUNCENTRY_V_RX(         ocStDevS,        1, MX,  0,  "STDEV.S" )
+    EXC_FUNCENTRY_V_RX(         ocStDevS,        1, MX,  0,  "STDEV.S" ),
+    EXC_FUNCENTRY_V_RX(         ocVarP_MS,       1, MX,  0,  "VAR.P" ),
+    EXC_FUNCENTRY_V_RX(         ocVarS,          1, MX,  0,  "VAR.S" )
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 09ac066..794deff 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -749,7 +749,9 @@ 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.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 }
+    { "COM.MICROSOFT.STDEV.S",                "STDEV.S",             NOID,    NOID,   1, MX,  V, { RX }, FUNCFLAG_MACROCALL_NEW },
+    { "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 }
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 64d14e3..b6d157f 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -5087,6 +5087,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 VAR.S #*=-
+    Resource SC_OPCODE_VAR_S
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Calculates the variance based on a sample." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_VAR_S );
+            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 VARIANZ #*=-
     Resource SC_OPCODE_VAR_A
     {
@@ -5135,6 +5159,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "Number 1, number 2, ... are 1 to 30 numerical arguments which represent a population." ;
         };
     };
+     // -=*# Resource for function VAR.P #*=-
+    Resource SC_OPCODE_VAR_P_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US ] = "Calculates variance based on the entire population." ;
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_VAR_P_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 represent a population." ;
+        };
+    };
      // -=*# Resource for function VARIANZENA #*=-
     Resource SC_OPCODE_VAR_P_A
     {


More information about the Libreoffice-commits mailing list