[gnumeric] fix some empty string handling in ODF import/export



commit 126b850b03889113e32901f08e3d212097eba42f
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue May 22 02:01:41 2012 -0600

    fix some empty string handling in ODF import/export
    
    2012-05-22  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (oo_add_text_to_cell): even add empty strings
    	* openoffice-write.c (odf_write_cell): write text:p also for empty
    	strings

 plugins/openoffice/openoffice-read.c  |   22 ++++++++++------------
 plugins/openoffice/openoffice-write.c |   16 +++++++---------
 2 files changed, 17 insertions(+), 21 deletions(-)
---
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 6ec14cf..4a8bf7c 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3796,19 +3796,17 @@ oo_add_text_to_cell (OOParseState *state, char const *str, PangoAttrList *attrs)
 		return;
 
 	if (VALUE_IS_STRING (state->curr_cell->value)) {
+		GOFormat *fmt = state->curr_cell->value->v_str.fmt;
 		start = strlen (state->curr_cell->value->v_str.val->str);
-		if (*str != 0) {
-			GOFormat *fmt = state->curr_cell->value->v_str.fmt;
-			if (fmt != NULL)
-				go_format_ref (fmt);
-			v = value_new_string_str
-				(go_string_new_nocopy
-				 (g_strconcat (state->curr_cell->value->v_str.val->str,
-					       str, NULL)));
-			if (fmt != NULL) {
-				value_set_fmt (v, fmt);
-				go_format_unref (fmt);
-			}
+		if (fmt != NULL)
+			go_format_ref (fmt);
+		v = value_new_string_str
+			(go_string_new_nocopy
+			 (g_strconcat (state->curr_cell->value->v_str.val->str,
+				       str, NULL)));
+		if (fmt != NULL) {
+			value_set_fmt (v, fmt);
+			go_format_unref (fmt);
 		}
 	} else
 		v = value_new_string (str);
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 59e6634..2c42811 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3289,15 +3289,13 @@ odf_write_cell (GnmOOExport *state, GnmCell *cell, GnmRange const *merge_range,
 			char *rendered_string = gnm_cell_get_rendered_text (cell);
 			gboolean white_written = TRUE;
 
-			if (*rendered_string != '\0' || link != NULL) {
-				gsf_xml_out_start_element (state->xml, TEXT "p");
-				odf_write_link_start (state, link);
-				if (*rendered_string != '\0')
-					odf_add_chars (state, rendered_string, strlen (rendered_string),
-						       &white_written);
-				odf_write_link_end (state, link);
-				gsf_xml_out_end_element (state->xml);   /* p */
-			}
+			gsf_xml_out_start_element (state->xml, TEXT "p");
+			odf_write_link_start (state, link);
+			if (*rendered_string != '\0')
+				odf_add_chars (state, rendered_string, strlen (rendered_string),
+					       &white_written);
+			odf_write_link_end (state, link);
+			gsf_xml_out_end_element (state->xml);   /* p */
 			g_free (rendered_string);
 		} else {
 			GString *str = g_string_new (NULL);



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