[gnumeric] Fix ODF roundtrip of conditional formats. [#726201]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix ODF roundtrip of conditional formats. [#726201]
- Date: Fri, 14 Mar 2014 14:46:36 +0000 (UTC)
commit 2b2939cd47564583ac23a2f7db37cb3f6fc1fc07
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Fri Mar 14 08:46:07 2014 -0600
Fix ODF roundtrip of conditional formats. [#726201]
2014-03-14 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_style_load_two_values): do not force
explicit sheet references
(odf_style_load_one_value): ditto
(odf_style_add_condition): remove extra parentheses and trust
gnm_style_cond_canonicalize
plugins/openoffice/ChangeLog | 10 +++++++-
plugins/openoffice/openoffice-read.c | 39 +++++++++------------------------
2 files changed, 20 insertions(+), 29 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 9db3fe3..d662428 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,4 +1,12 @@
-2014-03-12 Andreas J. Guelzow <aguelzow pyrshep ca>
+2014-03-14 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (odf_style_load_two_values): do not force
+ explicit sheet references
+ (odf_style_load_one_value): ditto
+ (odf_style_add_condition): remove extra parentheses and trust
+ gnm_style_cond_canonicalize
+
+2014-03-14 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_style_add_condition): use
gnm_style_cond_canonicalize
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index d1b9d10..c08db2b 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3177,7 +3177,7 @@ odf_style_load_two_values (GsfXMLIn *xin, char *condition, GnmStyleCond *cond, g
texpr = oo_expr_parse_str
(xin, try + 1, &pp,
- GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES,
+ GNM_EXPR_PARSE_DEFAULT,
f_type);
if (texpr != NULL) {
gnm_style_cond_set_expr (cond, texpr, 1);
@@ -3189,7 +3189,7 @@ odf_style_load_two_values (GsfXMLIn *xin, char *condition, GnmStyleCond *cond, g
}
texpr = oo_expr_parse_str
(xin, condition, &pp,
- GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES,
+ GNM_EXPR_PARSE_DEFAULT,
f_type);
gnm_style_cond_set_expr (cond, texpr, 0);
if (texpr) gnm_expr_top_unref (texpr);
@@ -3210,7 +3210,7 @@ odf_style_load_one_value (GsfXMLIn *xin, char *condition, GnmStyleCond *cond, gc
odf_init_pp (&pp, xin, base);
texpr = oo_expr_parse_str
(xin, condition, &pp,
- GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES,
+ GNM_EXPR_PARSE_DEFAULT,
f_type);
gnm_style_cond_set_expr (cond, texpr, 0);
if (texpr) gnm_expr_top_unref (texpr);
@@ -3292,31 +3292,14 @@ odf_style_add_condition (GsfXMLIn *xin, GnmStyle *style, GnmStyle *cstyle,
text = g_strdup (condition);
success = odf_style_load_two_values (xin, text, cond, base, f_type);
g_free (text);
- } else if (g_str_has_prefix (condition, "is-true-formula")) {
- if (0 == strcmp (full_condition, "of:is-true-formula(ISERROR([.A1]))") &&
- g_str_has_suffix (base, ".$A$1")) {
- cond = gnm_style_cond_new (GNM_STYLE_COND_CONTAINS_ERR, sheet);
- success = TRUE;
- } else if (0 == strcmp (full_condition, "of:is-true-formula(NOT(ISERROR([.A1])))") &&
- g_str_has_suffix (base, ".$A$1")) {
- cond = gnm_style_cond_new (GNM_STYLE_COND_NOT_CONTAINS_ERR, sheet);
- success = TRUE;
- } else if (0 == strcmp (full_condition, "of:is-true-formula(NOT(ISERROR(FIND(\"
\";[.A1]))))") &&
- g_str_has_suffix (base, ".$A$1")) {
- cond = gnm_style_cond_new (GNM_STYLE_COND_CONTAINS_BLANKS, sheet);
- success = TRUE;
- } else if (0 == strcmp (full_condition, "of:is-true-formula(ISERROR(FIND(\" \";[.A1])))") &&
- g_str_has_suffix (base, ".$A$1")) {
- cond = gnm_style_cond_new (GNM_STYLE_COND_NOT_CONTAINS_BLANKS, sheet);
- success = TRUE;
- } else {
- char *text;
- cond = gnm_style_cond_new (GNM_STYLE_COND_CUSTOM, sheet);
- condition += strlen ("is-true-formula");
- text = g_strdup (condition);
- success = odf_style_load_one_value (xin, text, cond, base, f_type);
- g_free (text);
- }
+ } else if (g_str_has_prefix (condition, "is-true-formula(") && g_str_has_suffix (condition, ")") ) {
+ char *text;
+ cond = gnm_style_cond_new (GNM_STYLE_COND_CUSTOM, sheet);
+ condition += strlen ("is-true-formula(");
+ text = g_strdup (condition);
+ *(text + strlen (text) - 1) = '\0';
+ success = odf_style_load_one_value (xin, text, cond, base, f_type);
+ g_free (text);
}
if (!success || !cond) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]