[gnumeric] Export legends and chart titles to ODF.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Export legends and chart titles to ODF.
- Date: Tue, 17 Aug 2010 00:27:43 +0000 (UTC)
commit 4e0e464e7c590cf871b677b155d7a8221032572e
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Mon Aug 16 18:14:03 2010 -0600
Export legends and chart titles to ODF.
2010-08-16 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_plot): export chart title
NEWS | 1 +
doc/developer/odf-foreign.txt | 3 ++
plugins/openoffice/ChangeLog | 4 +++
plugins/openoffice/openoffice-write.c | 42 +++++++++++++++++++++++++++++++++
4 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index a77bcc4..3120fae 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ Andreas:
* Export images to ODF.
* Fix import of graphs from rich ODF files. [#626961]
* Some ring and pie plot ODF export improvements.
+ * Export legends and chart titles to ODF.
Jean:
* Import Guppi graphs from gnumeric-1.0.x files. [#567953]
diff --git a/doc/developer/odf-foreign.txt b/doc/developer/odf-foreign.txt
index 7697e70..283336b 100644
--- a/doc/developer/odf-foreign.txt
+++ b/doc/developer/odf-foreign.txt
@@ -45,6 +45,9 @@ These are attributes for the plot-style gnm:box
gnm:default-separation
This is an attribute for the plot-style chart:circle
+gnm:expression
+Attribute used where ODF restricts expressions to be cell references via table:cell-range-address fore xample chart titles.
+
3) Plot Styles added by Gnumeric:
gnm:box
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index ec0219f..2d34fcb 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -9,6 +9,10 @@
2010-08-16 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-write.c (odf_write_plot): export chart title
+
+2010-08-16 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-write.c (odf_write_plot): export legend position
2010-08-16 Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index b0c9a6c..69178bb 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3784,6 +3784,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
int i;
GogObject const *wall = gog_object_get_child_by_name (plot, "Backplane");
GogObject const *legend = gog_object_get_child_by_name (chart, "Legend");
+ GogObject const *title = gog_object_get_child_by_name (chart, "Title");
static struct {
char const * type;
@@ -3974,6 +3975,47 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
}
gsf_xml_out_end_element (state->xml); /* </chart:plot_area> */
+ /* Set up title */
+
+ if (title != NULL) {
+ GOData const *dat = gog_dataset_get_dim (GOG_DATASET(title),0);
+ if (dat != NULL) {
+ GnmExprTop const *texpr = gnm_go_data_get_expr (dat);
+ if (texpr != NULL) {
+ GnmParsePos pp;
+ char *formula;
+ parse_pos_init_sheet (&pp, state->sheet);
+ formula = gnm_expr_top_as_string (texpr, &pp, state->conv);
+
+ gsf_xml_out_start_element (state->xml, CHART "title");
+
+ if (gnm_expr_top_is_rangeref (texpr)) {
+ gsf_xml_out_add_cstr (state->xml, TABLE "cell-range-address",
+ odf_strip_brackets (formula));
+ } else if (GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_CONSTANT
+ && texpr->expr->constant.value->type == VALUE_STRING) {
+ gboolean white_written = TRUE;
+ char const *str;
+ 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);
+ gsf_xml_out_end_element (state->xml); /* </text:p> */
+ } else {
+ gboolean white_written = TRUE;
+ if (state->with_extension)
+ gsf_xml_out_add_cstr (state->xml, GNMSTYLE "expression",
+ formula);
+ gsf_xml_out_start_element (state->xml, TEXT "p");
+ odf_add_chars (state, formula, strlen (formula),
+ &white_written);
+ gsf_xml_out_end_element (state->xml); /* </text:p> */
+ }
+ gsf_xml_out_end_element (state->xml); /* </chart:title> */
+ g_free (formula);
+ }
+ }
+ }
+
/* Set up legend if appropriate*/
if (legend != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]