[gnumeric] watch for string values without markup [#582847]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] watch for string values without markup [#582847]
- Date: Sat, 16 May 2009 12:49:43 -0400 (EDT)
commit 5c56b010db55d4b8c114e07f4e61bf2a62437911
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Sat May 16 10:48:16 2009 -0600
watch for string values without markup [#582847]
2009-05-16 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_cell): watch for string values
without markup
---
plugins/openoffice/ChangeLog | 5 +++
plugins/openoffice/openoffice-write.c | 60 +++++++++++++++++----------------
2 files changed, 36 insertions(+), 29 deletions(-)
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index a23c18d..fe79cec 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-16 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-write.c (odf_write_cell): watch for string values
+ without markup
+
2009-05-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_cell): watch for empty rendered
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index c569d59..b0ed27f 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -796,7 +796,6 @@ odf_write_cell (GnmOOExport *state, GnmCell *cell, GnmRange const *merge_range,
gsf_xml_out_add_int (state->xml,
TABLE "number-rows-spanned", rows_spanned);
if (cell != NULL) {
- gboolean write_rendered_string = TRUE;
gboolean pp = TRUE;
GnmStyle const *style = gnm_cell_get_style (cell);
@@ -856,7 +855,6 @@ odf_write_cell (GnmOOExport *state, GnmCell *cell, GnmRange const *merge_range,
break;
case VALUE_STRING:
- write_rendered_string = FALSE;
gsf_xml_out_add_cstr_unchecked (state->xml,
OFFICE "value-type", "string");
break;
@@ -875,35 +873,39 @@ odf_write_cell (GnmOOExport *state, GnmCell *cell, GnmRange const *merge_range,
}
- g_object_get (G_OBJECT (state->xml), "pretty-print", &pp, NULL);
- g_object_set (G_OBJECT (state->xml), "pretty-print", FALSE, NULL);
- if (write_rendered_string || (VALUE_FMT (cell->value) == NULL)) {
- char *rendered_string = gnm_cell_get_rendered_text (cell);
- gboolean white_written = TRUE;
-
- if (*rendered_string != '\0') {
+ if (cell->value != NULL) {
+ g_object_get (G_OBJECT (state->xml), "pretty-print", &pp, NULL);
+ g_object_set (G_OBJECT (state->xml), "pretty-print", FALSE, NULL);
+ if ((VALUE_FMT (cell->value) == NULL)
+ || (!VALUE_IS_STRING (cell->value))
+ || (!go_format_is_markup (VALUE_FMT (cell->value)))) {
+ char *rendered_string = gnm_cell_get_rendered_text (cell);
+ gboolean white_written = TRUE;
+
+ if (*rendered_string != '\0') {
+ gsf_xml_out_start_element (state->xml, TEXT "p");
+ odf_add_chars (state, rendered_string,
+ strlen (rendered_string),
+ &white_written);
+ gsf_xml_out_end_element (state->xml); /* p */
+ }
+
+ g_free (rendered_string);
+ } else {
+ GString *str = g_string_new ("");
+ const PangoAttrList * markup;
+
+ value_get_as_gstring (cell->value, str, NULL);
+ markup = go_format_get_markup (VALUE_FMT (cell->value));
+
gsf_xml_out_start_element (state->xml, TEXT "p");
- odf_add_chars (state, rendered_string,
- strlen (rendered_string),
- &white_written);
+ odf_new_markup (state, markup, str->str);
gsf_xml_out_end_element (state->xml); /* p */
- }
-
- g_free (rendered_string);
- } else if ((cell->value != NULL) && (VALUE_FMT (cell->value) != NULL)) {
- GString *str = g_string_new ("");
- const PangoAttrList * markup;
-
- value_get_as_gstring (cell->value, str, NULL);
- markup = go_format_get_markup (VALUE_FMT (cell->value));
-
- gsf_xml_out_start_element (state->xml, TEXT "p");
- odf_new_markup (state, markup, str->str);
- gsf_xml_out_end_element (state->xml); /* p */
-
- g_string_free (str, TRUE);
- }
- g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
+
+ g_string_free (str, TRUE);
+ }
+ g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
+ }
}
if (cc != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]