From ccbebd991b6bbce30d10b88f464140338f706c5b Mon Sep 17 00:00:00 2001 From: Winfried Donkers Date: Fri, 4 Oct 2013 17:56:04 +0200 Subject: fdo#70000 add support for COVARIANCE.P and COVARIANCE.S functions These functions have been introduced with Excel 2010, but were not supported yet in calc. COVARIANCE.P (population) replaces the COVAR function, but the COVAR function remains present (in Excel as well as in calc). COVARIANCE.S (sample) is a new function. Change-Id: If5501b4090fb716adfb3d121c7898528fd1b7ad4 Reviewed-on: https://gerrit.libreoffice.org/6135 Reviewed-by: Eike Rathke Tested-by: Eike Rathke --- sc/source/filter/excel/xlformula.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sc/source/filter/excel') diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 8c4373941d43..f293230c4885 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -394,6 +394,23 @@ static const XclFunctionInfo saFuncTable_Oox[] = { opcode, NOID, minparam, MX, V, { RX }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \ { opcode, 255, (minparam)+1, MX, V, { RO_E, RX }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) } +#define EXC_FUNCENTRY_V_VA( opcode, minparam, maxparam, flags, asciiname ) \ + { opcode, NOID, minparam, maxparam, V, { VA }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \ + { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) } + +/** Functions new in Excel 2010. + + See http://office.microsoft.com/en-us/excel-help/what-s-new-changes-made-to-excel-functions-HA010355760.aspx + A lot of statistical functions have been renamed (the 'old' function names still exist). + + @See sc/source/filter/oox/formulabase.cxx saFuncTable2010 for V,VR,RO,... + */ +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" ) +}; + /** Functions new in Excel 2013. See http://office.microsoft.com/en-us/excel-help/new-functions-in-excel-2013-HA103980604.aspx @@ -505,6 +522,7 @@ XclFunctionProvider::XclFunctionProvider( const XclRoot& rRoot ) if( eBiff >= EXC_BIFF8 ) (this->*pFillFunc)( saFuncTable_8, STATIC_ARRAY_END( saFuncTable_8 ) ); (this->*pFillFunc)( saFuncTable_Oox, STATIC_ARRAY_END( saFuncTable_Oox ) ); + (this->*pFillFunc)( saFuncTable_2010, STATIC_ARRAY_END( saFuncTable_2010 ) ); (this->*pFillFunc)( saFuncTable_2013, STATIC_ARRAY_END( saFuncTable_2013 ) ); (this->*pFillFunc)( saFuncTable_Odf, STATIC_ARRAY_END( saFuncTable_Odf ) ); } -- cgit