[gnumeric] Handle "is-true-formula" on ODF import.



commit 1117238232459c1446fc3ea2e96b00fa5594a903
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Wed Jun 24 02:41:38 2009 -0600

    Handle  "is-true-formula"  on ODF import.
    
    2009-06-24 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_style_map_load_one_value): new
    	(oo_style_map): use odf_style_map_load_one_value and
    	  handle "is-true-formula"

 plugins/openoffice/ChangeLog         |    6 ++++++
 plugins/openoffice/openoffice-read.c |   33 +++++++++++++++++++++++++--------
 2 files changed, 31 insertions(+), 8 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 8679b33..32cfebe 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,11 @@
 2009-06-24 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (odf_style_map_load_one_value): new
+	(oo_style_map): use odf_style_map_load_one_value and
+	  handle "is-true-formula"
+
+2009-06-24 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (odf_style_map_load_two_values): new
 	(oo_style_map): handle cell-content-is-between and try to
 	  handle cell-content-is-not-between
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 144c654..b4c84ad 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -2558,12 +2558,26 @@ odf_style_map_load_two_values (GsfXMLIn *xin, char *condition, GnmStyleCond *con
 				(xin, condition, &pp,
 				 GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES,
 				 FORMULA_OPENFORMULA);
-			return (cond->texpr[0] != NULL) && (cond->texpr[1] != NULL);
+			return ((cond->texpr[0] != NULL) && (cond->texpr[1] != NULL));
 		}
 	}
 	return FALSE;
 }
 
+static gboolean
+odf_style_map_load_one_value (GsfXMLIn *xin, char *condition, GnmStyleCond *cond)
+{
+	OOParseState *state = (OOParseState *)xin->user_state;
+	GnmParsePos   pp;
+
+	parse_pos_init (&pp, state->pos.wb, NULL, 0, 0);
+	cond->texpr[0] = oo_expr_parse_str 
+		(xin, condition, &pp,
+		 GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES,
+		 FORMULA_OPENFORMULA);
+	return (cond->texpr[0] != NULL);
+}
+
 
 static void
 oo_style_map (GsfXMLIn *xin, xmlChar const **attrs)
@@ -2631,13 +2645,9 @@ oo_style_map (GsfXMLIn *xin, xmlChar const **attrs)
 			break;
 		}
 		if (success) {
-			GnmParsePos   pp;
-			while (*condition == ' ') condition++;
-			parse_pos_init (&pp, state->pos.wb, NULL, 0, 0);
-			cond.texpr[0] = oo_expr_parse_str (xin, condition, &pp,
-							   GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES, 
-							   FORMULA_OPENFORMULA);
-			success = (cond.texpr[0] != NULL);
+			char *text = g_strdup (condition);
+			success = odf_style_map_load_one_value (xin, text, &cond);
+			g_free (text);
 		}
 
 	} else if (g_str_has_prefix (condition, "cell-content-is-between")) {
@@ -2654,6 +2664,13 @@ oo_style_map (GsfXMLIn *xin, xmlChar const **attrs)
 		text = g_strdup (condition);
 		success = odf_style_map_load_two_values (xin, text, &cond);
 		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_map_load_one_value (xin, text, &cond);
+		g_free (text);
 	}
 	
 	if (!success)



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