diff options
author | Eike Rathke <erack@redhat.com> | 2013-01-12 17:29:09 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-01-12 17:31:29 +0100 |
commit | 0dce7abb566c87d6263108a1a81850b83098659f (patch) | |
tree | 941413d4c1e5ff6642445d7b5bc860c0f8ceebb2 | |
parent | 484bb96aa975d834e326d927d36ee17808b8b6b5 (diff) |
fdo#56124 IFERROR IFNA Excel import/export
Change-Id: I796e99f8893cb48fa2351f7799bb247a3488ce69
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xlformula.cxx | 13 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabase.cxx | 11 |
3 files changed, 22 insertions, 4 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index d4d69ddbd84b..c40211386828 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -433,6 +433,8 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create // Additional functions not within range of functions. static const sal_uInt16 aOpCodes[] = { SC_OPCODE_IF, + SC_OPCODE_IF_ERROR, + SC_OPCODE_IF_NA, SC_OPCODE_CHOSE, SC_OPCODE_AND, SC_OPCODE_OR, diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 58b3aa945985..0cee777a2d0c 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -365,7 +365,16 @@ static const XclFunctionInfo saFuncTable_Oox[] = { ocAverageIf, NOID, 2, 3, V, { RO, VR, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "AVERAGEIF" ) }, { ocAverageIf, 255, 3, 4, V, { RO_E, RO, VR, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "AVERAGEIF" ) }, { ocAverageIfs, NOID, 3, MX, V, { RO, RO, VR }, EXC_FUNCFLAG_IMPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "AVERAGEIFS" ) }, - { ocAverageIfs, 255, 4, MX, V, { RO_E, RO, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "AVERAGEIFS" ) } + { ocAverageIfs, 255, 4, MX, V, { RO_E, RO, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "AVERAGEIFS" ) }, + { ocIfError, NOID, 2, 2, V, { VO, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "IFERROR" ) }, + { ocIfError, 255, 3, 3, V, { RO_E, VO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "IFERROR" ) } +}; + +/** Functions new in Excel 2013. */ +static const XclFunctionInfo saFuncTable_2013[] = +{ + { ocIfNA, NOID, 2, 2, V, { VO, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "IFNA" ) }, + { ocIfNA, 255, 3, 3, V, { RO_E, VO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "IFNA" ) } }; #define EXC_FUNCENTRY_ODF( opcode, minparam, maxparam, flags, asciiname ) \ @@ -393,7 +402,6 @@ static const XclFunctionInfo saFuncTable_Odf[] = EXC_FUNCENTRY_ODF( ocFormula, 1, 1, 0, "FORMULA" ), EXC_FUNCENTRY_ODF( ocGamma, 1, 1, 0, "GAMMA" ), EXC_FUNCENTRY_ODF( ocGauss, 1, 1, 0, "GAUSS" ), - EXC_FUNCENTRY_ODF( ocNoName, 2, 2, 0, "IFNA" ), EXC_FUNCENTRY_ODF( ocIsFormula, 1, 1, 0, "ISFORMULA" ), EXC_FUNCENTRY_ODF( ocWeek, 1, 2, 0, "ISOWEEKNUM" ), EXC_FUNCENTRY_ODF( ocMatrixUnit, 1, 1, 0, "MUNIT" ), @@ -434,6 +442,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_2013, STATIC_ARRAY_END( saFuncTable_2013 ) ); (this->*pFillFunc)( saFuncTable_Odf, STATIC_ARRAY_END( saFuncTable_Odf ) ); } diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index e9796f8bd68c..847beee3b556 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -711,13 +711,20 @@ static const FunctionData saFuncTableOox[] = { 0, "CUBEKPIMEMBER", 477, NOID, 3, 4, V, { VR }, 0 }, { 0, "CUBESET", 478, NOID, 2, 5, V, { VR, RX, VR }, 0 }, { 0, "CUBESETCOUNT", 479, NOID, 1, 1, V, { VR }, 0 }, - { 0, "IFERROR", 480, NOID, 2, 2, V, { VO, RO }, 0 }, + { "IFERROR", "IFERROR", 480, NOID, 2, 2, V, { VO, RO }, FUNCFLAG_MACROCALL }, { "COUNTIFS", "COUNTIFS", 481, NOID, 2, MX, V, { RO, VR }, FUNCFLAG_MACROCALL | FUNCFLAG_PARAMPAIRS }, { "SUMIFS", "SUMIFS", 482, NOID, 3, MX, V, { RO, RO, VR }, FUNCFLAG_MACROCALL | FUNCFLAG_PARAMPAIRS }, { "AVERAGEIF", "AVERAGEIF", 483, NOID, 2, 3, V, { RO, VR, RO }, FUNCFLAG_MACROCALL }, { "AVERAGEIFS", "AVERAGEIFS", 484, NOID, 3, MX, V, { RO, RO, VR }, FUNCFLAG_MACROCALL | FUNCFLAG_PARAMPAIRS } }; +/** Functions new in Excel 2013. */ +/* FIXME: BIFF12 function identifer available? Where to obtain? */ +static const FunctionData saFuncTable2013[] = +{ + { "IFNA", "IFNA", NOID, NOID, 2, 2, V, { VO, RO }, FUNCFLAG_MACROCALL }, +}; + /** Functions defined by OpenFormula, but not supported by Calc or by Excel. */ static const FunctionData saFuncTableOdf[] = { @@ -739,7 +746,6 @@ static const FunctionData saFuncTableOdf[] = { "FORMULA", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, { "GAMMA", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, { "GAUSS", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF }, - { "IFNA", 0, NOID, NOID, 2, 2, V, { VR, RO }, FUNCFLAG_MACROCALLODF }, { "ISFORMULA", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF }, { "ISOWEEKNUM", 0, NOID, NOID, 1, 2, V, { VR }, FUNCFLAG_MACROCALLODF }, { "MUNIT", 0, NOID, NOID, 1, 1, A, { VR }, FUNCFLAG_MACROCALLODF }, @@ -866,6 +872,7 @@ FunctionProviderImpl::FunctionProviderImpl( FilterType eFilter, BiffType eBiff, if( eBiff >= BIFF8 ) initFuncs( saFuncTableBiff8, STATIC_ARRAY_END( saFuncTableBiff8 ), nMaxParam, bImportFilter ); initFuncs( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ), nMaxParam, bImportFilter ); + initFuncs( saFuncTable2013, STATIC_ARRAY_END( saFuncTable2013 ), nMaxParam, bImportFilter ); initFuncs( saFuncTableOdf, STATIC_ARRAY_END( saFuncTableOdf ), nMaxParam, bImportFilter ); } |