[gnumeric] Improve contour plot export/import to/from ODF. [#788728]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve contour plot export/import to/from ODF. [#788728]
- Date: Tue, 10 Oct 2017 17:22:57 +0000 (UTC)
commit b680cb6b13e7afb2fa54b1a766e4c80bb834d463
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Tue Oct 10 11:23:28 2017 -0600
Improve contour plot export/import to/from ODF. [#788728]
2017-10-10 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_chart_axis): handle PSEUDO_3D axis and colormap
(oo_chart): read theme name
* openoffice-write.c (odf_write_axis_full): write color map for PSEUDO_3D axis
(odf_write_plot): write PSEUDO_3D axis
NEWS | 2 +-
plugins/openoffice/ChangeLog | 9 ++++++++-
plugins/openoffice/openoffice-read.c | 28 +++++++++++++++++++++++++++-
plugins/openoffice/openoffice-write.c | 12 ++++++++++--
4 files changed, 46 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0eef30f..6f30e60 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
Gnumeric 1.12.36
Andreas:
- * Fix contour plot import from ODF. [#788728]
+ * Improve contour plot export/import to/from ODF. [#788728]
Morten:
* Convert all xpm files to png.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 0363770..0c2a2d5 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,4 +1,11 @@
-2017-01-30 Andreas J. Guelzow <aguelzow pyrshep ca>
+2017-10-10 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (oo_chart_axis): handle PSEUDO_3D axis and colormap
+ (oo_chart): read theme name
+ * openoffice-write.c (odf_write_axis_full): write color map for PSEUDO_3D axis
+ (odf_write_plot): write PSEUDO_3D axis
+
+2017-10-09 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_series_domain): fix series order #788728
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 9483cc8..3f2074d 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -8757,6 +8757,12 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
{ "z", GOG_AXIS_Z },
{ NULL, 0 },
};
+ static OOEnum const types_contour[] = {
+ { "x", GOG_AXIS_X },
+ { "y", GOG_AXIS_Y },
+ { "z", GOG_AXIS_PSEUDO_3D },
+ { NULL, 0 },
+ };
static OOEnum const types_radar[] = {
{ "x", GOG_AXIS_CIRCULAR },
{ "y", GOG_AXIS_RADIAL },
@@ -8768,6 +8774,7 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
OOChartStyle *style = NULL;
gchar const *style_name = NULL;
gchar const *chart_name = NULL;
+ gchar const *color_map_name = NULL;
GogAxisType axis_type;
int tmp;
int gnm_id = 0;
@@ -8788,6 +8795,12 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
case OO_PLOT_CIRCLE:
case OO_PLOT_RING:
return;
+ case OO_PLOT_CONTOUR:
+ if (oo_style_has_property (state->chart.i_plot_styles, "multi-series", FALSE)
+ || oo_style_has_property (state->chart.i_plot_styles, "three-dimensional", FALSE))
+ axes_types = types;
+ else axes_types = types_contour;
+ break;
default:
axes_types = types;
break;
@@ -8803,6 +8816,8 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
axis_type = tmp;
else if (oo_attr_int_range (xin, attrs, OO_GNUM_NS_EXT, "id", &gnm_id, 1, INT_MAX))
;
+ else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_GNUM_NS_EXT, "color-map-name"))
+ color_map_name = CXML2C (attrs[1]);
if (gnm_id == 0) {
switch (axis_type) {
@@ -8877,6 +8892,8 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
g_hash_table_replace (state->chart.named_axes,
g_strdup (chart_name),
state->chart.axis);
+ if (NULL != color_map_name && NULL != state->chart.axis)
+ g_object_set (G_OBJECT(state->chart.axis), "color-map-name", color_map_name, NULL);
}
static void
@@ -9909,7 +9926,7 @@ oo_chart (GsfXMLIn *xin, xmlChar const **attrs)
OOParseState *state = (OOParseState *)xin->user_state;
int tmp;
OOPlotType type = OO_PLOT_UNKNOWN;
- OOChartStyle *style = NULL;
+ OOChartStyle *style = NULL;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (oo_attr_enum (xin, attrs, OO_NS_CHART, "class", odf_chart_classes, &tmp))
@@ -9918,6 +9935,15 @@ oo_chart (GsfXMLIn *xin, xmlChar const **attrs)
OO_NS_CHART, "style-name"))
style = g_hash_table_lookup
(state->chart.graph_styles, CXML2C (attrs[1]));
+ else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
+ OO_GNUM_NS_EXT, "theme-name")) {
+ GValue *val = g_value_init (g_new0 (GValue, 1), G_TYPE_STRING);
+ g_value_set_string (val, CXML2C (attrs[0]));
+ g_object_set_property (G_OBJECT (state->chart.graph), "theme-name", val);
+ g_value_unset (val);
+ g_free (val);
+ }
+
state->chart.plot_type = type;
state->chart.chart = GOG_CHART (gog_object_add_by_name (
GOG_OBJECT (state->chart.graph), "Chart", NULL));
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index fc957a7..f33754f 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -7983,6 +7983,14 @@ odf_write_axis_full (GnmOOExport *state,
if (name != NULL)
gsf_xml_out_add_cstr (state->xml, CHART "style-name", name);
g_free (name);
+ if (state->with_extension && 0 == strcmp (axis_role,"Pseudo-3D-Axis")) {
+ char *color_map_name = NULL;
+ g_object_get (G_OBJECT (axis), "color-map-name", &color_map_name, NULL);
+ if (color_map_name) {
+ gsf_xml_out_add_cstr (state->xml, GNMSTYLE "color-map-name",
color_map_name);
+ g_free (color_map_name);
+ }
+ }
odf_write_label (state, axis);
if (include_cats)
odf_write_axis_categories (state, series);
@@ -8129,9 +8137,9 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
odf_write_standard_series,
odf_write_axis, odf_write_axis, odf_write_axis},
{ "GogContourPlot", CHART "surface", ODF_SURF,
- 20., "X-Axis", "Y-Axis", NULL,
+ 20., "X-Axis", "Y-Axis", "Pseudo-3D-Axis",
odf_write_bubble_series,
- odf_write_axis, odf_write_axis, odf_write_axis},
+ odf_write_axis, odf_write_axis, odf_write_axis_no_cats},
{ "GogXYZContourPlot", GNMSTYLE "xyz-surface", ODF_XYZ_SURF,
20., "X-Axis", "Y-Axis", NULL,
odf_write_bubble_series,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]