[gnumeric] Write the formatted text of sheet objects to ODF.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Write the formatted text of sheet objects to ODF.
- Date: Wed, 16 May 2012 15:48:29 +0000 (UTC)
commit f31c1ae941c5ca03dddbc0f70514831e36ec8024
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed May 16 09:46:54 2012 -0600
Write the formatted text of sheet objects to ODF.
2012-05-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_new_markup): handle NULL markup or text
(odf_write_comment): let odf_new_markup handle the NULL cases
(odf_write_so_filled): write a correct text:p element
(odf_write_cell): ODF does not allow negative times, write these
as floats
NEWS | 1 +
plugins/openoffice/ChangeLog | 8 +++++++
plugins/openoffice/openoffice-write.c | 37 +++++++++++++++++++++++---------
3 files changed, 35 insertions(+), 11 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1b04c48..20bcdfa 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Andreas:
* Fix loading of ellipse objects defined in ODF's shape section. [#676064]
* Fix loading of line objects defined in ODF's shape section. [#676063]
* Add underline button to formatted text dialog for sheet objects, commemts, etc.
+ * Write the formatted text of sheet objects to ODF.
Jean:
* Fix graph series headers when a multiple selection is used. [#675913]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 8e1f825..23dbbc0 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-write.c (odf_new_markup): handle NULL markup or text
+ (odf_write_comment): let odf_new_markup handle the NULL cases
+ (odf_write_so_filled): write a correct text:p element
+ (odf_write_cell): ODF does not allow negative times, write these
+ as floats
+
2012-05-14 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_table_end): retain the anchor direction
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 9215e30..6aa5ec2 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -481,12 +481,18 @@ odf_new_markup (GnmOOExport *state, const PangoAttrList *markup, char const *tex
int handled = 0;
PangoAttrIterator * iter;
int from, to;
- int len = strlen (text);
+ int len = text ? strlen (text) : 0;
/* Since whitespace at the beginning of a <text:p> will be deleted upon */
/* reading, we need to behave as if we have already written whitespace and */
/* use <text:s> if necessary */
gboolean white_written = TRUE;
+ if (len == 0)
+ return;
+ if (markup == NULL) {
+ odf_add_chars (state, text, len, &white_written);
+ return;
+ }
iter = pango_attr_list_get_iterator ((PangoAttrList *) markup);
@@ -2669,15 +2675,12 @@ odf_write_comment (GnmOOExport *state, GnmComment const *cc)
if (text != NULL) {
g_object_set (G_OBJECT (state->xml), "pretty-print", FALSE, NULL);
gsf_xml_out_start_element (state->xml, TEXT "p");
- if (markup != NULL) {
- odf_new_markup (state, markup, text);
- pango_attr_list_unref (markup);
- } else {
- gboolean white_written = TRUE;
- odf_add_chars (state, text, strlen (text), &white_written);
- }
+ odf_new_markup (state, markup, text);
gsf_xml_out_end_element (state->xml); /* p */
g_free (text);
+ if (markup != NULL)
+ pango_attr_list_unref (markup);
+
}
g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
gsf_xml_out_end_element (state->xml); /* OFFICE "annotation" */
@@ -2846,17 +2849,29 @@ odf_write_so_filled (GnmOOExport *state, SheetObject *so)
char const *element;
gboolean is_oval = FALSE;
gchar *text = NULL;
+ PangoAttrList * markup = NULL;
gchar const *style_name = g_hash_table_lookup (state->so_styles, so);
+ gboolean pp = TRUE;
- g_object_get (G_OBJECT (so), "is-oval", &is_oval, "text", &text, NULL);
+ g_object_get (G_OBJECT (so), "is-oval", &is_oval, "text", &text, "markup", &markup, NULL);
element = is_oval ? DRAW "ellipse" : DRAW "rect";
gsf_xml_out_start_element (state->xml, element);
if (style_name != NULL)
gsf_xml_out_add_cstr (state->xml, DRAW "style-name", style_name);
odf_write_frame_size (state, so);
- gsf_xml_out_simple_element (state->xml, TEXT "p", text);
+
+ g_object_get (G_OBJECT (state->xml), "pretty-print", &pp, NULL);
+ g_object_set (G_OBJECT (state->xml), "pretty-print", FALSE, NULL);
+ gsf_xml_out_start_element (state->xml, TEXT "p");
+ odf_new_markup (state, markup, text);
+ gsf_xml_out_end_element (state->xml); /* p */
+ g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
+
g_free (text);
+ if (markup)
+ pango_attr_list_unref (markup);
+
gsf_xml_out_end_element (state->xml); /* DRAW "rect" or "ellipse" */
}
@@ -3117,7 +3132,7 @@ odf_write_cell (GnmOOExport *state, GnmCell *cell, GnmRange const *merge_range,
gsf_xml_out_add_cstr (state->xml, OFFICE "date-value", str);
}
g_free (str);
- } else if (go_format_is_time (fmt)) {
+ } else if (go_format_is_time (fmt) && (value_get_as_float (cell->value) >= 0.)) {
char *str;
gsf_xml_out_add_cstr_unchecked (state->xml,
OFFICE "value-type", "time");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]