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



commit 2995f556a69931845edc21ed09daff1f63484c4e
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun Mar 22 15:34:03 2015 -0600

    Improve ODF import/export of additional axes. [#746321]
    
    2015-03-22  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (odf_write_attached_axes): avoid
        pre-mature exit on missing axes.

 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |   31 ++++++++++++++-----------------
 2 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 409ffb7..28ab6fe 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2015-03-22  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-write.c (odf_write_attached_axes): avoid
+       pre-mature exit on missing axes.
+
+2015-03-22  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-write.c (odf_write_attached_axis): new
        (odf_write_attached_axes): new
        (odf_write_standard_series): call odf_write_attached_axes
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index a719102..2ac3ce3 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -6540,28 +6540,25 @@ odf_write_attached_axes (GnmOOExport *state, GogObject *series)
        GogAxis *axis = gog_plot_get_axis (plot, GOG_AXIS_X);
        int id;
 
-       if (NULL != axis) {
-               id = gog_object_get_id (GOG_OBJECT (axis));
-               if (id != 1)
-                       odf_write_attached_axis (state, "X-Axis", id);
-                   else {
-                       axis = gog_plot_get_axis (plot, GOG_AXIS_Z);
+       id = (NULL != axis) ? gog_object_get_id (GOG_OBJECT (axis)) : 0;
+       if (id > 1)
+               odf_write_attached_axis (state, "X-Axis", id);
+       else {
+               axis = gog_plot_get_axis (plot, GOG_AXIS_Z);
+               id = (NULL != axis) ? gog_object_get_id (GOG_OBJECT (axis)) : 0;
+               if (id > 1)
+                       odf_write_attached_axis (state, "Z-Axis", id);
+               else {
+                       axis = gog_plot_get_axis (plot, GOG_AXIS_Y);
                        if (NULL != axis) {
                                id = gog_object_get_id (GOG_OBJECT (axis));
-                               if (id != 1)
-                                       odf_write_attached_axis (state, "Z-Axis", id);
-                               else {
-                                       axis = gog_plot_get_axis (plot, GOG_AXIS_Y);
-                                       if (NULL != axis) {
-                                               id = gog_object_get_id (GOG_OBJECT (axis));
-                                               odf_write_attached_axis (state, "Y-Axis", id);
-                                       }                               
-                               }
-                       }                       
+                               odf_write_attached_axis (state, "Y-Axis", id);
+                       }                               
                }
-       }
+       }                       
 }
 
+
 static void
 odf_write_standard_series (GnmOOExport *state, GSList const *series, char const* class)
 {


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