[gnumeric] don't crash on chart-tests
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] don't crash on chart-tests
- Date: Wed, 18 Aug 2010 00:24:41 +0000 (UTC)
commit 34915e5830b51cc67810185a9b6eae1c87a78d7b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Tue Aug 17 18:24:16 2010 -0600
don't crash on chart-tests
2010-08-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_axis_grid): check for NULL axis
(odf_write_axis): only consider non-NULL axes
(odf_write_generic_axis): NULL-axes case
(odf_write_plot): use odf_write_generic_axis if appropriate
plugins/openoffice/ChangeLog | 7 +++++++
plugins/openoffice/openoffice-write.c | 19 ++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 7b92c83..4510c97 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,12 @@
2010-08-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-write.c (odf_write_axis_grid): check for NULL axis
+ (odf_write_axis): only consider non-NULL axes
+ (odf_write_generic_axis): NULL-axes case
+ (odf_write_plot): use odf_write_generic_axis if appropriate
+
+2010-08-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-write.c (odf_write_one_axis_grid): new
(odf_write_axis_grid): new
(odf_write_axis): call odf_write_axis_grid
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 17786c7..052587f 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3772,6 +3772,7 @@ odf_write_one_axis_grid (GnmOOExport *state, GogObject const *axis,
static void
odf_write_axis_grid (GnmOOExport *state, GogObject const *axis)
{
+ g_return_if_fail (axis != NULL);
odf_write_one_axis_grid (state, axis, "MajorGrid", "major");
odf_write_one_axis_grid (state, axis, "MinorGrid", "minor");
}
@@ -3788,7 +3789,7 @@ odf_write_axis (GnmOOExport *state, GogObject const *chart, char const *axis_rol
return;
axis = gog_object_get_child_by_name (chart, axis_role);
- if (axis != NULL || (gtype == ODF_CIRCLE && *dimension == 'y') || (gtype == ODF_RING)) {
+ if (axis != NULL) {
gsf_xml_out_start_element (state->xml, CHART "axis");
gsf_xml_out_add_cstr (state->xml, CHART "dimension", dimension);
gsf_xml_out_add_cstr (state->xml, CHART "style-name", style_label);
@@ -3798,6 +3799,18 @@ odf_write_axis (GnmOOExport *state, GogObject const *chart, char const *axis_rol
}
static void
+odf_write_generic_axis (GnmOOExport *state, GogObject const *chart, char const *axis_role,
+ char const *style_label,
+ char const *dimension, odf_chart_type_t gtype, GSList const *series)
+{
+ gsf_xml_out_start_element (state->xml, CHART "axis");
+ gsf_xml_out_add_cstr (state->xml, CHART "dimension", dimension);
+ gsf_xml_out_add_cstr (state->xml, CHART "style-name", style_label);
+ gsf_xml_out_end_element (state->xml); /* </chart:axis> */
+}
+
+
+static void
odf_write_axis_ring (GnmOOExport *state, GogObject const *chart, char const *axis_role,
char const *style_label,
char const *dimension, odf_chart_type_t gtype, GSList const *series)
@@ -3938,7 +3951,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
{ "GogPiePlot", CHART "circle", ODF_CIRCLE,
5., "X-Axis", "Y-Axis", NULL, odf_write_circle_axes_styles,
odf_write_pie_plot_style, NULL, odf_write_standard_series, NULL,
- odf_write_axis, odf_write_axis, odf_write_axis},
+ odf_write_axis, odf_write_generic_axis, odf_write_axis},
{ "GogRadarPlot", CHART "radar", ODF_RADAR,
10., "Circular-Axis", "Radial-Axis", NULL, odf_write_radar_axes_styles,
NULL, NULL, odf_write_standard_series, NULL,
@@ -3950,7 +3963,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
{ "GogRingPlot", CHART "ring", ODF_RING,
10., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
NULL, odf_write_ring_plot_style, odf_write_standard_series, NULL,
- odf_write_axis_ring, odf_write_axis, NULL},
+ odf_write_axis_ring, odf_write_generic_axis, NULL},
{ "GogXYPlot", CHART "scatter", ODF_SCATTER,
20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
odf_write_scatter_chart_style, NULL, odf_write_standard_series,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]