[gnumeric] ODF: improve legend import/export (font size and friends)
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ODF: improve legend import/export (font size and friends)
- Date: Mon, 6 Sep 2010 17:38:23 +0000 (UTC)
commit 4297a1bbad33326560b706e4e785ac073eb9012d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Mon Sep 6 11:34:12 2010 -0600
ODF: improve legend import/export (font size and friends)
2010-09-06 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_legend): read style-name
* openoffice-write.c (odf_write_plot): write style-name
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-read.c | 20 ++++++++++++++++++--
plugins/openoffice/openoffice-write.c | 6 ++++++
3 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 956f040..9672770 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
2010-09-06 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (oo_legend): read style-name
+ * openoffice-write.c (odf_write_plot): write style-name
+
+2010-09-06 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (odf_get_formula_type): new
(oo_cell_start): use odf_get_formula_type
(oo_plot_series): fix handling of series label
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 1a08bff..d58eb7b 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -5813,16 +5813,32 @@ oo_legend (GsfXMLIn *xin, xmlChar const **attrs)
GogObjectPosition align = GOG_POSITION_ALIGN_CENTER;
GogObject *legend;
int tmp;
+ char const *style_name;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (oo_attr_enum (xin, attrs, OO_NS_CHART, "legend-position", positions, &tmp))
pos = tmp;
else if (oo_attr_enum (xin, attrs, OO_NS_CHART, "legend-align", alignments, &tmp))
align = tmp;
+ else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_CHART, "style-name"))
+ style_name = g_strdup (CXML2C (attrs[1]));
legend = gog_object_add_by_name ((GogObject *)state->chart.chart, "Legend", NULL);
- gog_object_set_position_flags (legend, pos | align,
- GOG_POSITION_COMPASS | GOG_POSITION_ALIGNMENT);
+ if (legend != NULL) {
+ gog_object_set_position_flags (legend, pos | align,
+ GOG_POSITION_COMPASS | GOG_POSITION_ALIGNMENT);
+ if (style_name) {
+ GOStyle *style = NULL;
+ g_object_get (G_OBJECT (legend), "style", &style, NULL);
+ if (style != NULL) {
+ OOChartStyle *chart_style = g_hash_table_lookup
+ (state->chart.graph_styles, style_name);
+ odf_apply_style_props (xin, chart_style->style_props, style);
+ g_object_unref (style);
+ }
+ }
+ }
+
}
static void
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 7610b08..2b15a40 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -5227,11 +5227,17 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
if (legend != NULL) {
GogObjectPosition flags;
+ char *style_name = odf_get_gog_style_name_from_obj
+ (legend);
flags = gog_object_get_position_flags
(legend, GOG_POSITION_COMPASS);
gsf_xml_out_start_element (state->xml, CHART "legend");
+ gsf_xml_out_add_cstr (state->xml,
+ CHART "style-name",
+ style_name);
+ g_free (style_name);
if (flags) {
GString *compass = g_string_new (NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]