[gnumeric] xlsx: better backplane handling.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xlsx: better backplane handling.
- Date: Sun, 5 Apr 2015 18:12:18 +0000 (UTC)
commit 646b53a2f27a2b35b98b95dde7046e0c12169396
Author: Morten Welinder <terra gnome org>
Date: Sun Apr 5 14:12:05 2015 -0400
xlsx: better backplane handling.
plugins/excel/ChangeLog | 5 ++++
plugins/excel/xlsx-read-drawing.c | 42 ++++++++++++++++++------------------
2 files changed, 26 insertions(+), 21 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 328754b..be35e2c 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-05 Morten Welinder <terra gnome org>
+
+ * xlsx-read-drawing.c (xlsx_chart_add_plot): Add backplane here.
+ (xlsx_plot_area): Not here, but push a dummy object.
+
2015-04-04 Morten Welinder <terra gnome org>
* xlsx-read-drawing.c (xlsx_plot_area_end): Get rid of the
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 9504448..3e95de7 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -615,10 +615,28 @@ static void
xlsx_chart_add_plot (GsfXMLIn *xin, char const *type)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
- if (NULL != (state->plot = (GogPlot*) gog_plot_new_by_name (type)))
+ if (NULL != (state->plot = (GogPlot*) gog_plot_new_by_name (type))) {
/* Add _before_ setting styles so theme does not override */
gog_object_add_by_name (GOG_OBJECT (state->chart),
"Plot", GOG_OBJECT (state->plot));
+
+ if (state->cur_obj == NULL) {
+ /* Add a backplane if compatible with plot. */
+
+ const char *bp_name = "Backplane";
+ GogObjectRole const *role =
+ gog_object_find_role_by_name (GOG_OBJECT (state->chart),
+ bp_name);
+ if (role->can_add (GOG_OBJECT (state->chart))) {
+ GogObject *bp = gog_object_add_by_name (GOG_OBJECT (state->chart),
+ bp_name,
+ NULL);
+ /* Replace dummy object. */
+ xlsx_chart_pop_obj (state);
+ xlsx_chart_push_obj (state, bp);
+ }
+ }
+ }
}
/* shared with pie of pie, and bar of pie */
@@ -2086,33 +2104,15 @@ static void
xlsx_plot_area (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
- GogObject *backplane = gog_object_add_by_name (
- GOG_OBJECT (state->chart), "Backplane", NULL);
- xlsx_chart_push_obj (state, backplane);
+ /* Push a NULL object for backplane. */
+ xlsx_chart_push_obj (state, NULL);
}
static void
xlsx_plot_area_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
- GogObject *bp = g_object_ref (state->cur_obj);
- gboolean remove_backplane;
-
xlsx_chart_pop_obj (state);
-
- /*
- * We added a backplane. For pie and ring charts we don't need it.
- * We might want to see if we can wait and only add it for plots
- * that need it.
- */
- remove_backplane =
- gog_chart_axis_set_is_valid (state->chart, GOG_AXIS_SET_NONE);
- if (remove_backplane) {
- gog_object_clear_parent (bp);
- g_object_unref (bp);
- }
-
- g_object_unref (bp);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]