[gnumeric] On ODF import of conditional styles try to recognize some of the Gnuemric specific expressions.



commit 25f77b0d5a1a12122b05177e928979b4415f7c8d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon May 21 20:04:01 2012 -0600

    On ODF import of conditional styles try to recognize some of the Gnuemric specific expressions.
    
    2012-05-21  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_style_add_condition): try to recognize some
    	of the Gnumeric specific expressions.

 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |   32 +++++++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 2c824fc..8db1767 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2012-05-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (odf_style_add_condition): try to recognize some
+	of the Gnumeric specific expressions.
+
+2012-05-21  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-write.c (odf_determine_base): initialize pp even if we
 	raise a warning
 	(odf_save_style_map): make sure pp is initialized.
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 0d52b92..9b1b55f 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3116,14 +3116,32 @@ odf_style_add_condition (GsfXMLIn *xin, GnmStyle *style, GnmStyle *cstyle,
 		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")) {
-		char *text;
-		cond.op = GNM_STYLE_COND_CUSTOM;
-		condition += strlen ("is-true-formula");
-		text = g_strdup (condition);
-		success = odf_style_load_one_value (xin, text, &cond, base, f_type);
-		g_free (text);
+		if (0 == strcmp (full_condition, "of:is-true-formula(ISERROR([.A1]))") &&
+		    g_str_has_suffix (base, ".$A$1")) {
+			cond.op = GNM_STYLE_COND_CONTAINS_ERR;
+			success = TRUE;
+		} else if (0 == strcmp (full_condition, "of:is-true-formula(NOT(ISERROR([.A1])))") &&
+			   g_str_has_suffix (base, ".$A$1")) {
+			cond.op = GNM_STYLE_COND_NOT_CONTAINS_ERR;
+			success = TRUE;
+		} else if (0 == strcmp (full_condition, "of:is-true-formula(NOT(ISERROR(FIND(\" \";[.A1]))))") &&
+			   g_str_has_suffix (base, ".$A$1")) {
+			cond.op = GNM_STYLE_COND_CONTAINS_BLANKS;
+			success = TRUE;
+		} else if (0 == strcmp (full_condition, "of:is-true-formula(ISERROR(FIND(\" \";[.A1])))") &&
+			   g_str_has_suffix (base, ".$A$1")) {
+			cond.op = GNM_STYLE_COND_NOT_CONTAINS_BLANKS;
+			success = TRUE;
+		} else {
+			char *text;
+			cond.op = GNM_STYLE_COND_CUSTOM;
+			condition += strlen ("is-true-formula");
+			text = g_strdup (condition);
+			success = odf_style_load_one_value (xin, text, &cond, base, f_type);
+			g_free (text);
+		}
 	}
-
+	
 	if (!success) {
 		if (cond.texpr[0] != NULL)
 			gnm_expr_top_unref (cond.texpr[0]);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]