[gnumeric] Improve ODF import/export of additional axes. [#746321]



commit b1c74e4217d4ba2355e134b28f5055c6665a8dfc
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue Mar 17 20:25:05 2015 -0600

    Improve ODF import/export of additional axes. [#746321]
    
    2015-03-17  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (oo_chart_axis): determine the axis id from the sequence
        unless we stored it
        (oo_plot_area): reset new axes counters

 NEWS                                 |    2 +-
 plugins/openoffice/ChangeLog         |    8 +++++++-
 plugins/openoffice/openoffice-read.c |   31 +++++++++++++++++++++++++++++--
 3 files changed, 37 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 56f0976..36f3483 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
 Gnumeric 1.12.22
 
 Andreas:
-       * Improve ODF export of additional axislines. [#746321]
+       * Improve ODF import/export of additional axes. [#746321]
 
 Morten:
        * xlsx import/export of log axis.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 581cfbd..ecaa2d1 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,4 +1,10 @@
-2015-02-25  Andreas J. Guelzow <aguelzow pyrshep ca>
+2015-03-17  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (oo_chart_axis): determine the axis id from the sequence
+       unless we stored it
+       (oo_plot_area): reset new axes counters
+
+2015-03-17  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-write.c (odf_write_axis_full): the ODF schema allows multiple
        chart:axis with the same dimension
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 36e4b75..e4513d9 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -246,6 +246,9 @@ typedef struct {
        unsigned         series_count;  /* reset for each plotarea */
        unsigned         domain_count;  /* reset for each series */
        unsigned         data_pt_count; /* reset for each series */
+       unsigned         x_axis_count;  /* reset for each plotarea */
+       unsigned         y_axis_count;  /* reset for each plotarea */
+       unsigned         z_axis_count;  /* reset for each plotarea */
 
        GogObject       *axis;
        xmlChar         *cat_expr;
@@ -8586,7 +8589,8 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
        OOChartStyle *style = NULL;
        gchar const *style_name = NULL;
        GogAxisType  axis_type;
-       int tmp, gnm_id = 1;
+       int tmp;
+       int gnm_id = 0;
        OOEnum const *axes_types;
 
        switch (state->chart.plot_type) {
@@ -8613,7 +8617,27 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
                else if (oo_attr_enum (xin, attrs, OO_NS_CHART, "dimension", axes_types, &tmp))
                        axis_type = tmp;
                else if (oo_attr_int_range (xin, attrs, OO_GNUM_NS_EXT, "id", &gnm_id, 1, INT_MAX))
-                       ;
+                       ;
+       
+       if (gnm_id == 0) {
+               switch (axis_type) {
+               case GOG_AXIS_X:
+                       gnm_id = ++(state->chart.x_axis_count);
+                       break;
+               case GOG_AXIS_Y:
+                       gnm_id = ++(state->chart.y_axis_count);
+                       break;
+               case GOG_AXIS_Z:
+                       gnm_id = ++(state->chart.z_axis_count);
+                       break;
+               case GOG_AXIS_CIRCULAR:
+               case GOG_AXIS_RADIAL:
+               case GOG_AXIS_UNKNOWN:
+               default:
+                       gnm_id = 1;
+                       break;
+               }
+       }
 
        axes = gog_chart_get_axes (state->chart.chart, axis_type);
        for (l = axes; NULL != l; l = l->next) {
@@ -8979,6 +9003,9 @@ oo_plot_area (GsfXMLIn *xin, xmlChar const **attrs)
        state->chart.src_label_set = FALSE;
        state->chart.series = NULL;
        state->chart.series_count = 0;
+       state->chart.x_axis_count = 0;
+       state->chart.y_axis_count = 0;
+       state->chart.z_axis_count = 0;
        state->chart.list = NULL;
        if (NULL != source_range_str) {
                GnmParsePos pp;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]