[gnumeric] In ODF export keep automatic max and min for axis ranges



commit 89da0fa2434dbe8b613d45231a550a8218ca8ccd
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Mar 7 01:51:54 2012 -0700

    In ODF export keep automatic max and min for axis ranges
    
    2012-03-07  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_write_axis_style): only write user defined
    	minimum and maximum

 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |   17 +++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 836ec6a..944cca0 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2012-03-07  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-write.c (odf_write_axis_style): only write user defined
+	minimum and maximum
+
+2012-03-07  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (oo_plot_series): set interpolation-skip-invalids
 	property
 
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 57040b1..584b8e1 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -6243,10 +6243,11 @@ odf_write_axis_style (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
 		      GogObject const *axis)
 {
 	char const *type = NULL;
-	double minima = 0., maxima = 0.;
+	double tmp;
 	GObjectClass *klass = G_OBJECT_GET_CLASS (axis);
 	GParamSpec *spec;
 	GOData const *interval;
+	gboolean user_defined;
 
 	gsf_xml_out_add_cstr (state->xml, CHART "axis-position", "start");
 	odf_add_bool (state->xml, CHART "display-label", TRUE);
@@ -6258,11 +6259,15 @@ odf_write_axis_style (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
 		odf_add_bool (state->xml, CHART "logarithmic",
 			      0 != strcmp (type, "Linear"));
 	}
-	if (gog_axis_get_bounds (GOG_AXIS (axis), &minima, &maxima)) {
-		gsf_xml_out_add_float (state->xml, CHART "minimum", minima, -1);
-		gsf_xml_out_add_float (state->xml, CHART "maximum", maxima, -1);
-	}
-
+	
+	tmp = gog_axis_get_entry 
+		(GOG_AXIS (axis), GOG_AXIS_ELEM_MIN, &user_defined);
+	if (user_defined)
+		gsf_xml_out_add_float (state->xml, CHART "minimum", tmp, -1);
+	tmp = gog_axis_get_entry 
+		(GOG_AXIS (axis), GOG_AXIS_ELEM_MAX, &user_defined);
+	if (user_defined)
+		gsf_xml_out_add_float (state->xml, CHART "maximum", tmp, -1);
 
 	interval = gog_dataset_get_dim (GOG_DATASET(axis),2);
 	if (interval != NULL) {



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