[gnumeric] Fix writing and only-style reading of repeated print ranges.



commit 2db945db2a574fc826d2c86807a1c209819c3e24
Author: Morten Welinder <terra gnome org>
Date:   Tue Apr 21 13:04:26 2009 -0400

    Fix writing and only-style reading of repeated print ranges.
---
 ChangeLog           |    8 ++++++++
 src/xml-io.c        |   15 +++++++--------
 src/xml-sax-write.c |   11 +++++------
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 46b9e22..9a80f5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-21  Morten Welinder  <terra gnome org>
+
+	* src/xml-io.c (xml_read_print_repeat_range): Adapt to print-info
+	changes.
+
+	* src/xml-sax-write.c (xml_write_print_repeat_range): Fix writing
+	repeated ranges.
+
 2009-04-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/gnm-so-filled.c (gnm_so_filled_user_config): adjust for 
diff --git a/src/xml-io.c b/src/xml-io.c
index 3742268..44d2ad3 100644
--- a/src/xml-io.c
+++ b/src/xml-io.c
@@ -546,7 +546,7 @@ xml_read_print_margins (XmlParseContext *ctxt, xmlNodePtr tree)
 
 static void
 xml_read_print_repeat_range (XmlParseContext *ctxt, xmlNodePtr tree,
-			     char const *name, PrintRepeatRange *range)
+			     char const *name, char **range)
 {
 	xmlNodePtr child;
 
@@ -555,20 +555,19 @@ xml_read_print_repeat_range (XmlParseContext *ctxt, xmlNodePtr tree,
 	g_return_if_fail (name != NULL);
 	g_return_if_fail (range != NULL);
 
-	range->use = FALSE;
+	g_free (*range);
+	*range = NULL;
 	if (ctxt->version > GNM_XML_V4 &&
 	    (child = e_xml_get_child_by_name (tree, CC2XML (name)))) {
 		xmlChar *s = xml_node_get_cstr (child, "value");
-
 		if (s) {
-			GnmRange r;
-			if (range_parse (&r, CXML2C (s), ctxt->sheet)) {
-				range->range = r;
-				range->use   = TRUE;
-			}
+			*range = g_strdup (CXML2C (s));
 			xmlFree (s);
 		}
 	}
+
+	if (!*range)
+		*range = g_strdup ("");
 }
 
 static void
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index 9c05e11..912df98 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -233,12 +233,11 @@ xml_write_print_unit (GnmOutputXML *state, char const *name,
 static void
 xml_write_print_repeat_range (GnmOutputXML *state,
 			      char const *name,
-			      PrintRepeatRange *range)
+			      const char *range)
 {
-	if (range->use) {
+	if (range && *range) {
 		gsf_xml_out_start_element (state->output, name);
-		gsf_xml_out_add_cstr_unchecked (state->output, "value",
-			range_as_string (&range->range));
+		gsf_xml_out_add_cstr_unchecked (state->output, "value", range);
 		gsf_xml_out_end_element (state->output);
 	}
 }
@@ -357,8 +356,8 @@ xml_write_print_info (GnmOutputXML *state, PrintInformation *pi)
 	gsf_xml_out_end_element (state->output);
 
 
-	xml_write_print_repeat_range (state, GNM "repeat_top", &pi->repeat_top);
-	xml_write_print_repeat_range (state, GNM "repeat_left", &pi->repeat_left);
+	xml_write_print_repeat_range (state, GNM "repeat_top", pi->repeat_top);
+	xml_write_print_repeat_range (state, GNM "repeat_left", pi->repeat_left);
 
 	/* this was once an enum, hence the silly strings */
 	gsf_xml_out_simple_element (state->output, GNM "order",



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