[gnumeric] Improve function import to ODF. [#750627]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve function import to ODF. [#750627]
- Date: Thu, 11 Jun 2015 05:23:33 +0000 (UTC)
commit c3e1a27a0a01acaaa583aacd00207106af43fc59
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Wed Jun 10 23:19:51 2015 -0600
Improve function import to ODF. [#750627]
2015-06-10 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_func_map_in): Add some new excel function names
and handle a potential COM.MICROSOFT. prefix.
NEWS | 1 +
plugins/openoffice/ChangeLog | 5 +++
plugins/openoffice/openoffice-read.c | 58 +++++++++++++++++++++++++++++++---
3 files changed, 59 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 8840df2..9958281 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Gnumeric 1.12.23
Andreas:
* Fix memory handling error on fuzzed sxc file. [#748535]
* Improve import/export of page layout from/to ODF.
+ * Improve function import to ODF. [#750627]
Jean:
* Fix xlsx import of plot area manual layout. [#748016]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 6db5a97..ee8d041 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-10 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (oo_func_map_in): Add some new excel function names
+ and handle a potential COM.MICROSOFT. prefix.
+
2015-06-05 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_page_layout): write scaling information
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 68911f8..29f7357 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -12922,6 +12922,45 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
{ "TRUE","TRUE" }, /* see handler */
{ "USDOLLAR","DOLLAR" },
+/* The following are known to have appeared (usually with a COM.MICROSOFT prefix. */
+
+ { "BETA.INV","BETAINV" },
+ { "BINOM.DIST","BINOMDIST" },
+ { "BINOM.INV","CRITBINOM" },
+ { "CHISQ.DIST.RT","CHIDIST" },
+ { "CHISQ.INV.RT","CHIINV" },
+ { "CHISQ.TEST","CHITEST" },
+ { "CONFIDENCE.NORM","CONFIDENCE" },
+ { "COVARIANCE.P","COVAR" },
+ { "EXPON.DIST","EXPONDIST" },
+ { "F.DIST.RT","FDIST" },
+ { "F.INV.RT","FINV" },
+ { "F.TEST","FTEST" },
+ { "GAMMA.DIST","GAMMADIST" },
+ { "GAMMA.INV","GAMMAINV" },
+ { "GAMMALN.PRECISE","GAMMALN" },
+ { "HYPGEOM.DIST","HYPGEOMDIST" },
+ { "LOGNORM.DIST","LOGNORMDIST" },
+ { "LOGNORM.INV","LOGINV" },
+ { "MODE.SNGL","MODE" },
+ { "NEGBINOM.DIST","NEGBINOMDIST" },
+ { "NORM.DIST","NORMDIST" },
+ { "NORM.INV","NORMINV" },
+ { "NORM.S.INV","NORMSINV" },
+ { "PERCENTILE.INC","PERCENTILE" },
+ { "PERCENTRANK.INC","PERCENTRANK" },
+ { "POISSON.DIST","POISSON" },
+ { "QUARTILE.INC","QUARTILE" },
+ { "RANK.EQ","RANK" },
+ { "STDEV.S","STDEV" },
+ { "STDEV.P","STDEVP" },
+ { "T.INV.2T","TINV" },
+ { "T.TEST","TTEST" },
+ { "VAR.S","VAR" },
+ { "VAR.P","VARP" },
+ { "WEIBULL.DIST","WEIBULL" },
+ { "Z.TEST","ZTEST" },
+
/* { "ADDRESS","ADDRESS" }, also see handler */
/* { "ABS","ABS" }, */
/* { "ACCRINT","ACCRINT" }, */
@@ -13296,9 +13335,9 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
};
static char const OOoAnalysisPrefix[] = "com.sun.star.sheet.addin.Analysis.get";
static char const GnumericPrefix[] = "ORG.GNUMERIC.";
+ static char const MicrosoftPrefix[] = "COM.MICROSOFT.";
- GnmFunc *f;
- char const *new_name;
+ GnmFunc *f = NULL;
int i;
GnmExpr const * (*handler) (GnmConventions const *convs, Workbook *scope, GnmExprList *args);
ODFConventions *oconv = (ODFConventions *)convs;
@@ -13337,13 +13376,22 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
if (0 == g_ascii_strncasecmp (name, GnumericPrefix, sizeof (GnumericPrefix)-1)) {
f = gnm_func_lookup_or_add_placeholder (name+sizeof (GnumericPrefix)-1);
- } else if (0 != g_ascii_strncasecmp (name, OOoAnalysisPrefix, sizeof (OOoAnalysisPrefix)-1)) {
+ } else if (0 == g_ascii_strncasecmp (name, OOoAnalysisPrefix, sizeof (OOoAnalysisPrefix)-1)) {
+ f = gnm_func_lookup_or_add_placeholder (name+sizeof (OOoAnalysisPrefix)-1);
+ } else if (0 == g_ascii_strncasecmp (name, MicrosoftPrefix, sizeof (MicrosoftPrefix)-1)) {
+ char const *new_name;
+ if (NULL != namemap &&
+ NULL != (new_name = g_hash_table_lookup (namemap, name+sizeof (MicrosoftPrefix)-1)))
+ f = gnm_func_lookup_or_add_placeholder (new_name);
+ }
+
+ if (NULL == f) {
+ char const *new_name;
if (NULL != namemap &&
NULL != (new_name = g_hash_table_lookup (namemap, name)))
name = new_name;
f = gnm_func_lookup_or_add_placeholder (name);
- } else
- f = gnm_func_lookup_or_add_placeholder (name+sizeof (OOoAnalysisPrefix)-1);
+ }
return gnm_expr_new_funcall (f, args);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]