[gnumeric] Some ring and pie plot ODF export improvements.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Some ring and pie plot ODF export improvements.
- Date: Mon, 16 Aug 2010 02:29:18 +0000 (UTC)
commit 62e7803f4bc50d1cf4871363e03a9999baaf8e9a
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sun Aug 15 20:28:42 2010 -0600
Some ring and pie plot ODF export improvements.
2010-08-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_attr_percent): new
(od_style_prop_chart): add more attributes
* openoffice-write.c (odf_write_pie_plot_style): new
(odf_write_ring_plot_style): extent
(odf_write_plot): connect odf_write_pie_plot_style
2010-08-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* developer/odf-foreign.txt: update
NEWS | 1 +
doc/ChangeLog | 4 ++++
doc/developer/odf-foreign.txt | 5 ++++-
plugins/openoffice/ChangeLog | 10 +++++++++-
plugins/openoffice/openoffice-read.c | 29 +++++++++++++++++++++++++++++
plugins/openoffice/openoffice-write.c | 30 ++++++++++++++++++++++++++++--
6 files changed, 75 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5552c2c..fca8224 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ Andreas:
* Fix column and row fitting on paste. [#359404][#611181]
* Export images to ODF.
* Fix import of graphs from rich ODF files. [#626961]
+ * Some ring and pie plot ODF export improvements.
Jean:
* Import Guppi graphs from gnumeric-1.0.x files. [#567953]
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 31525d7..10f3ecc 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * developer/odf-foreign.txt: update
+
2010-08-11 Andreas J. Guelzow <aguelzow pyrshep ca>
* developer/odf-foreign.txt: update
diff --git a/doc/developer/odf-foreign.txt b/doc/developer/odf-foreign.txt
index 6676f5c..7697e70 100644
--- a/doc/developer/odf-foreign.txt
+++ b/doc/developer/odf-foreign.txt
@@ -40,7 +40,10 @@ These are attributes of the <style:table-cell-properties> giving the input title
gnm:outliers
gnm:radius-ratio
-These are attributes for the plot-style gnm:boxplot
+These are attributes for the plot-style gnm:box
+
+gnm:default-separation
+This is an attribute for the plot-style chart:circle
3) Plot Styles added by Gnumeric:
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 379420a..607617f 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,4 +1,12 @@
-2010-08-14 Andreas J. Guelzow <aguelzow pyrshep ca>
+2010-08-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (oo_attr_percent): new
+ (od_style_prop_chart): add more attributes
+ * openoffice-write.c (odf_write_pie_plot_style): new
+ (odf_write_ring_plot_style): extent
+ (odf_write_plot): connect odf_write_pie_plot_style
+
+2010-08-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (od_draw_frame): rename to od_draw_frame_start,
initialize chart.so
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 9e87d73..819114d 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -387,6 +387,29 @@ oo_attr_float (GsfXMLIn *xin, xmlChar const * const *attrs,
return TRUE;
}
+static gboolean
+oo_attr_percent (GsfXMLIn *xin, xmlChar const * const *attrs,
+ int ns_id, char const *name, gnm_float *res)
+{
+ char *end;
+ double tmp;
+
+ g_return_val_if_fail (attrs != NULL, FALSE);
+ g_return_val_if_fail (attrs[0] != NULL, FALSE);
+ g_return_val_if_fail (attrs[1] != NULL, FALSE);
+
+ if (!gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), ns_id, name))
+ return FALSE;
+
+ tmp = gnm_strto (CXML2C (attrs[1]), &end);
+ if (*end != '%' || *(end + 1))
+ return oo_warning (xin,
+ "Invalid attribute '%s', expected percentage,"
+ " received '%s'",
+ name, attrs[1]);
+ *res = tmp/100.;
+ return TRUE;
+}
static GnmColor *magic_transparent;
static GnmColor *
@@ -3027,6 +3050,12 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
} else if (oo_attr_float (xin, attrs, OO_GNUM_NS_EXT, "radius-ratio", &ftmp)) {
style->plot_props = g_slist_prepend (style->plot_props,
oo_prop_new_float ("radius-ratio", ftmp));
+ } else if (oo_attr_percent (xin, attrs, OO_GNUM_NS_EXT, "default-separation", &ftmp)) {
+ style->plot_props = g_slist_prepend (style->plot_props,
+ oo_prop_new_float ("default-separation", ftmp));
+ } else if (oo_attr_percent (xin, attrs, OO_NS_CHART, "hole-size", &ftmp)) {
+ style->plot_props = g_slist_prepend (style->plot_props,
+ oo_prop_new_float ("center-size", ftmp));
} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "reverse-direction", &btmp)) {
style->axis_props = g_slist_prepend (style->axis_props,
oo_prop_new_bool ("invert-axis", btmp));
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 18d178b..73f24a5 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3581,6 +3581,20 @@ odf_write_bar_col_plot_style (GnmOOExport *state, G_GNUC_UNUSED GogObject const
}
static void
+odf_write_pie_plot_style (GnmOOExport *state, G_GNUC_UNUSED GogObject const *chart, GogObject const *plot)
+{
+ double default_separation = 0.;
+ g_object_get (G_OBJECT (plot),
+ "default-separation", &default_separation,
+ NULL);
+ if (state->with_extension)
+ odf_add_percent (state->xml, GNMSTYLE "default-separation",
+ default_separation);
+}
+
+
+
+static void
odf_write_box_plot_style (GnmOOExport *state, G_GNUC_UNUSED GogObject const *chart, GogObject const *plot)
{
gboolean vertical = FALSE;
@@ -3605,7 +3619,19 @@ odf_write_box_plot_style (GnmOOExport *state, G_GNUC_UNUSED GogObject const *cha
static void
odf_write_ring_plot_style (GnmOOExport *state, G_GNUC_UNUSED GogObject const *chart, G_GNUC_UNUSED GogObject const *plot)
{
- odf_add_percent (state->xml, CHART "hole-size", 0.5);
+ double default_separation, centre_size;
+
+ g_object_get (G_OBJECT (plot),
+ "default-separation", &default_separation,
+ "center-size", ¢re_size,
+ NULL);
+
+ if (state->with_extension)
+ odf_add_percent (state->xml,
+ GNMSTYLE "default-separation",
+ default_separation);
+
+ odf_add_percent (state->xml, CHART "hole-size", centre_size);
}
static void
@@ -3795,7 +3821,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
NULL, NULL, odf_write_min_max_series, NULL},
{ "GogPiePlot", CHART "circle", ODF_CIRCLE,
5., "X-Axis", "Y-Axis", NULL, odf_write_circle_axes_styles,
- NULL, NULL, odf_write_standard_series, NULL},
+ odf_write_pie_plot_style, NULL, odf_write_standard_series, NULL},
{ "GogRadarPlot", CHART "radar", ODF_RADAR,
10., "Circular-Axis", "Radial-Axis", NULL, odf_write_radar_axes_styles,
NULL, NULL, odf_write_standard_series, NULL},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]