summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-11-02 16:25:42 +0100
committerEike Rathke <erack@redhat.com>2013-11-02 16:29:49 +0100
commit06a5b1ecc39bb50dadc0bcb7378455500943ece3 (patch)
tree707e7b7633779affe09df96cce7a1b6b2ae01aec /sc/source/filter/excel
parent512a14438c4098ca2e30d0b10b6e18506c8475f1 (diff)
resolved fdo#67536 export internal equivalents as add-in to .xls
For BIFF .xls export the internal functions that are equivalents of known add-in functions as those add-in functions. Change-Id: If37f616a34fdabb3fa971fddad01da3dc1f28ee9
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r--sc/source/filter/excel/xeformula.cxx16
-rw-r--r--sc/source/filter/excel/xlformula.cxx24
2 files changed, 36 insertions, 4 deletions
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index a11c3b2db6e9..ba02aefae85f 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -140,6 +140,7 @@ public:
inline sal_uInt16 GetXclFuncIdx() const { return mrFuncInfo.mnXclFunc; }
inline bool IsVolatile() const { return mrFuncInfo.IsVolatile(); }
inline bool IsFixedParamCount() const { return mrFuncInfo.IsFixedParamCount(); }
+ inline bool IsAddInEquivalent() const { return mrFuncInfo.IsAddInEquivalent(); }
inline bool IsMacroFunc() const { return mrFuncInfo.IsMacroFunc(); }
inline sal_uInt8 GetSpaces() const { return mrTokData.mnSpaces; }
inline const XclExpExtFuncData& GetExtFuncData() const { return maExtFuncData; }
@@ -1361,8 +1362,11 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpScToken& rTokData )
mxData->mbOk = pFuncInfo != 0;
if( !mxData->mbOk ) return;
+ // internal functions equivalent to an existing add-in
+ if( pFuncInfo->IsAddInEquivalent() )
+ aExtFuncData.Set( pFuncInfo->GetAddInEquivalentFuncName(), true, false );
// functions simulated by a macro call in file format
- if( pFuncInfo->IsMacroFunc() )
+ else if( pFuncInfo->IsMacroFunc() )
aExtFuncData.Set( pFuncInfo->GetMacroFuncName(), false, true );
XclExpFuncData aFuncData( rTokData, *pFuncInfo, aExtFuncData );
@@ -1644,8 +1648,11 @@ void XclExpFmlaCompImpl::AppendDefaultParam( XclExpFuncData& rFuncData )
break;
default:
{
- OSL_ENSURE( rFuncData.IsMacroFunc(), "XclExpFmlaCompImpl::AppendDefaultParam - unknown opcode" );
- if( rFuncData.IsMacroFunc() )
+ if( rFuncData.IsAddInEquivalent() )
+ {
+ AppendAddInCallToken( rFuncData.GetExtFuncData() );
+ }
+ else if( rFuncData.IsMacroFunc() )
{
// Do not write the OOXML <definedName> element for new _xlfn.
// prefixed functions.
@@ -1655,7 +1662,10 @@ void XclExpFmlaCompImpl::AppendDefaultParam( XclExpFuncData& rFuncData )
AppendMacroCallToken( rFuncData.GetExtFuncData() );
}
else
+ {
+ SAL_WARN( "sc.filter", "XclExpFmlaCompImpl::AppendDefaultParam - unknown opcode" );
AppendMissingToken(); // to keep parameter count valid
+ }
}
}
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 064d1abf6b3c..78c443868076 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -40,6 +40,13 @@ OUString XclFunctionInfo::GetMacroFuncName() const
return OUString();
}
+OUString XclFunctionInfo::GetAddInEquivalentFuncName() const
+{
+ if( IsAddInEquivalent() )
+ return OUString( mpcMacroName, strlen(mpcMacroName), RTL_TEXTENCODING_UTF8 );
+ return OUString();
+}
+
// abbreviations for function return token class
const sal_uInt8 R = EXC_TOKCLASS_REF;
const sal_uInt8 V = EXC_TOKCLASS_VAL;
@@ -64,6 +71,7 @@ const sal_uInt8 MX = 30; /// Maximum parameter count.
#define EXC_FUNCNAME( ascii ) "_xlfn." ascii
#define EXC_FUNCNAME_ODF( ascii ) "_xlfnodf." ascii
+#define EXC_FUNCNAME_ADDIN( ascii ) "com.sun.star.sheet.addin." ascii
/** Functions new in BIFF2. */
static const XclFunctionInfo saFuncTable_2[] =
@@ -313,7 +321,21 @@ static const XclFunctionInfo saFuncTable_4[] =
{ ocPercentrank, 329, 2, 3, V, { RX, VR, VR_E }, 0, 0 },
{ ocModalValue, 330, 1, MX, V, { VA }, 0, 0 },
{ ocTrimMean, 331, 2, 2, V, { RX, VR }, 0, 0 },
- { ocTInv, 332, 2, 2, V, { VR }, 0, 0 }
+ { ocTInv, 332, 2, 2, V, { VR }, 0, 0 },
+ // Functions equivalent to add-in functions, use same parameters as
+ // ocExternal but add programmatical function name (here without
+ // "com.sun.star.sheet.addin.") so it can be looked up and stored as
+ // add-in, as older Excel versions only know them as add-in.
+ // These are the functions flagged as AddInMap::bMapDupToInternal=true in
+ // sc/source/core/tool/odffmap.cxx
+ { ocIsEven, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getIseven" ) },
+ { ocIsOdd, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getIsodd" ) },
+ { ocGCD, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getGcd" ) },
+ { ocLCM, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getLcm" ) },
+ { ocEffektiv, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getEffect" ) },
+ { ocKumKapZ, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getCumprinc" ) },
+ { ocKumZinsZ, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getCumipmt" ) },
+ { ocNominal, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getNominal" ) }
};
/** Functions new in BIFF5/BIFF7. Unsupported functions: DATESTRING, NUMBERSTRING. */