[gnumeric] Handle ODF import/export of surface plots originally created in XL [#594041]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Handle ODF import/export of surface plots originally created in XL [#594041]
- Date: Fri, 4 Sep 2009 00:20:06 +0000 (UTC)
commit 22a415c4db91f2bde65f8f9242c303e0bb3e3916
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Thu Sep 3 18:19:33 2009 -0600
Handle ODF import/export of surface plots originally created in XL [#594041]
2009-09-03 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_prop_list_has_multi_series): new
(oo_style_have_multi_series): new
(oo_plot_area): use XLSurfacePlot in case of multiseries
* openoffice-write.c (odf_write_xl_surface_chart_style): new
(odf_write_plot): handle XLSurfacePlot
NEWS | 2 +
plugins/openoffice/ChangeLog | 8 +++++++
plugins/openoffice/openoffice-read.c | 34 ++++++++++++++++++++++++++++++++-
plugins/openoffice/openoffice-write.c | 11 ++++++++++
4 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 8000840..6c68aa9 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Andreas:
* Fix ODF background colour export. [#593816]
* Handle super/subscript in html export. [#593851]
* Fix crash on unknown chart type. [#594041]
+ * Handle ODF import/export of surface plots originally created in
+ XL [#594041]
Morten:
* Fix menu sensitivity problem. [#593624]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 275c1aa..dba909d 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,13 @@
2009-09-03 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (oo_prop_list_has_multi_series): new
+ (oo_style_have_multi_series): new
+ (oo_plot_area): use XLSurfacePlot in case of multiseries
+ * openoffice-write.c (odf_write_xl_surface_chart_style): new
+ (odf_write_plot): handle XLSurfacePlot
+
+2009-09-03 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-write.c (odf_graph_get_series): make sure texpr is non-NULL
(odf_write_plot): check the correct end of array marker
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 6d3998d..5d40286 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -128,6 +128,7 @@ typedef enum {
OO_PLOT_SCATTER_COLOUR,
OO_PLOT_XYZ_SURFACE,
OO_PLOT_SURFACE,
+ OO_PLOT_XL_SURFACE,
OO_PLOT_UNKNOWN
} OOPlotType;
@@ -2898,6 +2899,30 @@ oo_style_have_three_dimensional (GSList *styles)
}
static void
+oo_prop_list_has_multi_series (GSList *props, gboolean *threed)
+{
+ GSList *ptr;
+ for (ptr = props; ptr; ptr = ptr->next) {
+ OOProp *prop = ptr->data;
+ if (0 == strcmp (prop->name, "multi-series") && g_value_get_boolean (&prop->value))
+ *threed = TRUE;
+ }
+}
+
+static gboolean
+oo_style_have_multi_series (GSList *styles)
+{
+ GSList *l;
+ gboolean is_multi_series = FALSE;
+ for (l = styles; l != NULL; l = l->next) {
+ OOChartStyle *style = l->data;
+ oo_prop_list_has_multi_series (style->other_props,
+ &is_multi_series);
+ }
+ return is_multi_series;
+}
+
+static void
od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
{
OOParseState *state = (OOParseState *)xin->user_state;
@@ -2956,6 +2981,9 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "three-dimensional", &btmp))
style->other_props = g_slist_prepend (style->other_props,
oo_prop_new_bool ("three-dimensional", btmp));
+ else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "multi-series", &btmp))
+ style->other_props = g_slist_prepend (style->other_props,
+ oo_prop_new_bool ("multi-series", btmp));
}
if (draw_stroke_set && !default_style_has_lines_set)
@@ -3538,7 +3566,10 @@ oo_plot_area (GsfXMLIn *xin, xmlChar const **attrs)
case OO_PLOT_SCATTER: type = "GogXYPlot"; break;
case OO_PLOT_STOCK: type = "GogMinMaxPlot"; break; /* This is not quite right! */
case OO_PLOT_CONTOUR:
- if (oo_style_have_three_dimensional (state->chart.these_plot_styles)) {
+ if (oo_style_have_multi_series (state->chart.these_plot_styles)) {
+ type = "XLSurfacePlot";
+ state->chart.plot_type = OO_PLOT_XL_SURFACE;
+ } else if (oo_style_have_three_dimensional (state->chart.these_plot_styles)) {
type = "GogSurfacePlot";
state->chart.plot_type = OO_PLOT_SURFACE;
} else
@@ -3557,6 +3588,7 @@ oo_plot_area (GsfXMLIn *xin, xmlChar const **attrs)
case OO_PLOT_XYZ_SURFACE: type = "GogXYZSurfacePlot"; break;
case OO_PLOT_SURFACE: type = "GogSurfacePlot"; break;
case OO_PLOT_SCATTER_COLOUR: type = "GogXYColorPlot"; break;
+ case OO_PLOT_XL_SURFACE: type = "XLSurfacePlot"; break;
default: return;
}
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 5fc396b..74f26c3 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3375,6 +3375,14 @@ static void
odf_write_surface_chart_style (GnmOOExport *state, G_GNUC_UNUSED GogObject const *chart, G_GNUC_UNUSED GogObject const *plot)
{
odf_add_bool (state->xml, CHART "three-dimensional", TRUE);
+ odf_add_bool (state->xml, GNMSTYLE "multi-series", FALSE);
+}
+
+static void
+odf_write_xl_surface_chart_style (GnmOOExport *state, G_GNUC_UNUSED GogObject const *chart, G_GNUC_UNUSED GogObject const *plot)
+{
+ odf_add_bool (state->xml, CHART "three-dimensional", TRUE);
+ odf_add_bool (state->xml, GNMSTYLE "multi-series", TRUE);
}
static void
@@ -3568,6 +3576,9 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
{ "GogXYColorPlot", "gnm:scatter-color", ODF_SCATTER_COLOUR,
20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
NULL, NULL, odf_write_bubble_series, NULL},
+ { "XLSurfacePlot", "chart:surface", ODF_GNM_SURF,
+ 20., "X-Axis", "Y-Axis", "Z-Axis", odf_write_surface_axes_styles,
+ odf_write_xl_surface_chart_style, NULL, odf_write_standard_series, NULL},
{ NULL, NULL, 0,
20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
NULL, NULL, odf_write_standard_series, NULL}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]