From 4a122d1e61278debe7e386e3d9f442e68eddba9b Mon Sep 17 00:00:00 2001 From: Winfried Donkers Date: Sun, 20 Oct 2013 09:38:19 +0200 Subject: 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 Reviewed-by: Eike Rathke --- 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 ++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 8e5557304efd..db82ac470c43 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 af6424c01289..1a3e13110f1b 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 f293230c4885..dc87d74403f7 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 d119a88142fc..09ac0668280f 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 93ea5c345e60..11fdecb450e7 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -5161,6 +5161,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; // -=*# Resource for function STABW #*=- Resource SC_OPCODE_ST_DEV + { + 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 STDEV.S #*=- + Resource SC_OPCODE_ST_DEV_S { String 1 // Description { @@ -5209,6 +5233,30 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; // -=*# Resource for function STABWN #*=- Resource SC_OPCODE_ST_DEV_P + { + 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 STDEV.P #*=- + Resource SC_OPCODE_ST_DEV_P_MS { String 1 // Description { -- cgit