[gnumeric] Fix segfault on loading of gnumeric generated contour plot.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix segfault on loading of gnumeric generated contour plot.
- Date: Thu, 12 Oct 2017 19:38:08 +0000 (UTC)
commit 418939a7e5318356cfc9ee14ebb27a73f7b31665
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Thu Oct 12 13:38:58 2017 -0600
Fix segfault on loading of gnumeric generated contour plot.
2017-10-12 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (od_style_prop_chart): We cannot depend on "multi-series"
(oo_plot_series): switch plot types upon analyisis of the first series.
plugins/openoffice/ChangeLog | 9 ++++-
plugins/openoffice/openoffice-read.c | 52 +++++++++++++++++++++++----------
2 files changed, 43 insertions(+), 18 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 0d7d5de..9ece8fc 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,12 +1,17 @@
+2017-10-12 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (od_style_prop_chart): We cannot depend on "multi-series"
+ (oo_plot_series): switch plot types upon analyisis of the first series.
+
2017-10-12 Morten Welinder <terra gnome org>
* openoffice-read.c (oo_named_expr_common): Deal with bogus
Print_Area in XL generated files.
-2017-10-10 Andreas J. Guelzow <aguelzow pyrshep ca>
+2017-10-11 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_plot_series): instead of glueing value ranges together use
- Gnuemric's XLSurfacePlot and XLContourPlot
+ Gnumeric's XLSurfacePlot and XLContourPlot
2017-10-10 Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 3fd312a..71508bd 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -7396,9 +7396,6 @@ 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));
else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_DRAW, "fill"))
style->style_props = g_slist_prepend
(style->style_props,
@@ -8804,9 +8801,9 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
case OO_PLOT_CIRCLE:
case OO_PLOT_RING:
return;
+ case OO_PLOT_XL_CONTOUR:
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))
+ if (oo_style_has_property (state->chart.i_plot_styles, "three-dimensional", FALSE))
axes_types = types;
else axes_types = types_contour;
break;
@@ -9126,16 +9123,7 @@ static gchar const
case OO_PLOT_SCATTER: return "GogXYPlot"; break;
case OO_PLOT_STOCK: return "GogMinMaxPlot"; break; /* This is not quite right! */
case OO_PLOT_CONTOUR:
- if (oo_style_has_property (state->chart.i_plot_styles, "multi-series", TRUE)) {
- if (oo_style_has_property (state->chart.i_plot_styles,
- "three-dimensional", FALSE)) {
- *oo_type = OO_PLOT_XL_SURFACE;
- return "XLSurfacePlot";
- } else {
- *oo_type = OO_PLOT_XL_CONTOUR;
- return "XLContourPlot";
- }
- } else if (oo_style_has_property (state->chart.i_plot_styles,
+ if (oo_style_has_property (state->chart.i_plot_styles,
"three-dimensional", FALSE)) {
*oo_type = OO_PLOT_SURFACE;
return "GogSurfacePlot";
@@ -9458,6 +9446,38 @@ oo_plot_series (GsfXMLIn *xin, xmlChar const **attrs)
else
plot = state->chart.plot;
+ general_expression = (NULL != cell_range_expression);
+
+ if (ignore_type_change && !general_expression && state->chart.series_count == 1 && NULL !=
cell_range_address) {
+ /* We need to check whether this is type 2 of the contour/surface plots. */
+ GnmExprTop const *texpr;
+ texpr = odf_parse_range_address_or_expr (xin, cell_range_address);
+ if (NULL != texpr) {
+ GnmValue *val = gnm_expr_top_get_range (texpr);
+ if (val != NULL) {
+ GnmSheetRange r;
+ gnm_sheet_range_from_value (&r, val);
+ value_release (val);
+ if ((range_width (&r.range) == 1) || (range_height (&r.range) == 1)) {
+ if (state->chart.plot_type == OO_PLOT_SURFACE)
+ plot_type = state->chart.plot_type_default =
state->chart.plot_type
+ = OO_PLOT_XL_SURFACE;
+ else
+ plot_type = state->chart.plot_type_default =
state->chart.plot_type
+ = OO_PLOT_XL_CONTOUR;
+ /* We need to get rid of the original state->chart.plot */
+ plot = state->chart.plot;
+ state->chart.plot= odf_create_plot (state, &state->chart.plot_type);
+ gog_object_clear_parent (GOG_OBJECT (plot));
+ g_object_unref (G_OBJECT (plot));
+ plot = state->chart.plot;
+ plot_type_set = TRUE;
+ }
+ }
+ gnm_expr_top_unref (texpr);
+ }
+ }
+
/* Create the series */
switch (plot_type) {
case OO_PLOT_STOCK: /* We need to construct the series later. */
@@ -9488,7 +9508,7 @@ oo_plot_series (GsfXMLIn *xin, xmlChar const **attrs)
if (NULL != attached_axis && NULL != plot)
gog_plot_set_axis (plot, GOG_AXIS (attached_axis));
- if ((general_expression = (NULL != cell_range_expression)))
+ if (general_expression)
cell_range_address = cell_range_expression;
if (NULL != cell_range_address) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]