[gnumeric] Correctly write rich-text graph titles. [Part of #675821]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Correctly write rich-text graph titles. [Part of #675821]
- Date: Fri, 11 May 2012 06:18:53 +0000 (UTC)
commit 1a80bab8989b46b259ccb6b3e3d4d79b45b49298
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Fri May 11 00:18:23 2012 -0600
Correctly write rich-text graph titles. [Part of #675821]
2012-05-11 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_manifest): do not write an entry
for "Pictures/" itself
(odf_write_title): write markup if necessary
(odf_write_plot): write characters styles that may be needed for
titles and labels
NEWS | 1 +
plugins/openoffice/ChangeLog | 8 +++++++
plugins/openoffice/openoffice-write.c | 36 ++++++++++++++++++++++++--------
3 files changed, 36 insertions(+), 9 deletions(-)
---
diff --git a/NEWS b/NEWS
index f6a0207..3b31655 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Andreas:
* Export/Import validation error message to/from ODF.
* Export in-cell font colours. [#675210]
* Fix warning on column insertion. [#675224]
+ * Correctly write rich-text graph titles. [Part of #675821]
Morten:
* Minor doc improvement for non-C locales. [Part of #675000]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 1da999e..e2a1cd7 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-11 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-write.c (odf_write_manifest): do not write an entry
+ for "Pictures/" itself
+ (odf_write_title): write markup if necessary
+ (odf_write_plot): write characters styles that may be needed for
+ titles and labels
+
2012-05-10 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (od_draw_text_frame_end): check for empty
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 3648751..6503c6b 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -5721,10 +5721,6 @@ odf_write_manifest (GnmOOExport *state, GsfOutput *child)
odf_file_entry (xml, "text/xml", "meta.xml");
odf_file_entry (xml, "text/xml", "settings.xml");
- if (g_hash_table_size (state->graphs) > 0 ||
- g_hash_table_size (state->images) > 0)
- odf_file_entry (xml, "", "Pictures/");
-
state->xml = xml;
g_hash_table_foreach (state->graphs, (GHFunc) odf_write_graph_manifest, state);
g_hash_table_foreach (state->images, (GHFunc) odf_write_image_manifest, state);
@@ -6534,9 +6530,11 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
if (dat != NULL) {
GnmExprTop const *texpr = gnm_go_data_get_expr (dat);
if (texpr != NULL) {
- GnmParsePos pp;
+ GnmParsePos ppos;
char *formula;
char *name;
+ gboolean pp = TRUE;
+ g_object_get (G_OBJECT (state->xml), "pretty-print", &pp, NULL);
gsf_xml_out_start_element (state->xml, id);
@@ -6548,8 +6546,8 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
g_free (name);
}
- parse_pos_init (&pp, WORKBOOK (state->wb), NULL, 0,0 );
- formula = gnm_expr_top_as_string (texpr, &pp, state->conv);
+ parse_pos_init (&ppos, WORKBOOK (state->wb), NULL, 0,0 );
+ formula = gnm_expr_top_as_string (texpr, &ppos, state->conv);
if (gnm_expr_top_is_rangeref (texpr)) {
char *f = odf_strip_brackets (formula);
@@ -6563,11 +6561,28 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
&& allow_content) {
gboolean white_written = TRUE;
char const *str;
+ GogText *text;
+ g_object_set (G_OBJECT (state->xml), "pretty-print", FALSE, NULL);
gsf_xml_out_start_element (state->xml, TEXT "p");
str = value_peek_string (texpr->expr->constant.value);
- odf_add_chars (state, str, strlen (str),
- &white_written);
+ if (GOG_IS_TEXT (title) &&
+ (text = GOG_TEXT (title))->allow_markup) {
+ PangoAttrList *attr_list = NULL;
+ char *text_clean = NULL;
+ if (pango_parse_markup (str, -1, 0,
+ &attr_list,
+ &text_clean, NULL, NULL)) {
+ odf_new_markup (state, attr_list, text_clean);
+ g_free (text_clean);
+ pango_attr_list_unref (attr_list);
+ } else
+ odf_add_chars (state, str,strlen (str),
+ &white_written);
+ } else
+ odf_add_chars (state, str,strlen (str),
+ &white_written);
gsf_xml_out_end_element (state->xml); /* </text:p> */
+ g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
} else {
gboolean white_written = TRUE;
if (state->with_extension)
@@ -6575,6 +6590,7 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
GNMSTYLE "expression",
formula);
if (allow_content) {
+ g_object_set (G_OBJECT (state->xml), "pretty-print", FALSE, NULL);
gsf_xml_out_start_element
(state->xml, TEXT "p");
odf_add_chars (state, formula,
@@ -6582,6 +6598,7 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
&white_written);
gsf_xml_out_end_element (state->xml);
/* </text:p> */
+ g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
}
}
gsf_xml_out_end_element (state->xml); /* </chart:title> */
@@ -7244,6 +7261,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
series = gog_plot_get_series (GOG_PLOT (plot));
gsf_xml_out_start_element (state->xml, OFFICE "automatic-styles");
+ odf_write_character_styles (state);
if (this_plot->odf_write_axes_styles != NULL)
this_plot->odf_write_axes_styles (state, chart, plot,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]