[gnumeric] Some chart export to ODF fixes.



commit 438175eb728cd52a799e1359217d122f1227f6e9
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Aug 17 12:26:40 2010 -0600

    Some chart export to ODF fixes.
    
    2010-08-17  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_write_axis_ring): strip brackets
    	(odf_write_plot): make sure we export the elements in the correct order.

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    5 ++
 plugins/openoffice/openoffice-write.c |   95 +++++++++++++++++----------------
 3 files changed, 55 insertions(+), 46 deletions(-)
---
diff --git a/NEWS b/NEWS
index 8b0c2a7..3793c70 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.10.10
 
 Andreas:
 	* Export and import chart titles and subtitles to and from ODF.
+	* Some chart export to ODF fixes.
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.9
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index f284423..9c5ade8 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2010-08-17  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-write.c (odf_write_axis_ring): strip brackets
+	(odf_write_plot): make sure we export the elements in the correct order.
+
+2010-08-17  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (oo_cell_start): be more careful with the
 	  size of array functions. They could reach beyond the current 
 	  sheet size.
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 0eaae99..370ebca 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3794,7 +3794,8 @@ odf_write_axis_ring (GnmOOExport *state, GogObject const *chart, char const *axi
 				char *cra = gnm_expr_top_as_string (texpr, &pp, state->conv);
 
 				gsf_xml_out_start_element (state->xml, CHART "categories");
-				gsf_xml_out_add_cstr (state->xml, TABLE "cell-range-address", cra);
+				gsf_xml_out_add_cstr (state->xml, TABLE "cell-range-address", 
+						      odf_strip_brackets (cra));
 				gsf_xml_out_end_element (state->xml); /* </chart:categories> */
 
 				g_free (cra);
@@ -4043,51 +4044,6 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 		gsf_xml_out_add_cstr (state->xml, XLINK "href", "..");
 	gsf_xml_out_add_cstr (state->xml, CHART "class", this_plot->odf_plot_type);
 	gsf_xml_out_add_cstr (state->xml, CHART "style-name", "plotstyle");
-	gsf_xml_out_start_element (state->xml, CHART "plot-area");
-	gsf_xml_out_add_cstr (state->xml, CHART "style-name", "plotarea");
-	if (get_gsf_odf_version () <= 101) {
-		for ( l = series; NULL != l ; l = l->next) {
-			GOData const *dat = gog_dataset_get_dim
-				(GOG_DATASET (l->data), GOG_MS_DIM_VALUES);
-			if (NULL != dat) {
-				GnmExprTop const *texpr = gnm_go_data_get_expr (dat);
-				if (NULL != texpr) {
-					GnmParsePos pp;
-					char *str;
-					parse_pos_init (&pp, WORKBOOK (state->wb), NULL, 0,0 );
-					str = gnm_expr_top_as_string (texpr, &pp, state->conv);
-					gsf_xml_out_add_cstr (state->xml, TABLE "cell-range-address",
-							      odf_strip_brackets (str));
-					g_free (str);
-					break;
-				}
-			}
-		}
-	}
-
-	if (this_plot->odf_write_z_axis)
-		this_plot->odf_write_z_axis 
-			(state, chart, this_plot->z_axis_name, "zaxis", "z", 
-			 this_plot->gtype, series);
-	if (this_plot->odf_write_y_axis)
-		this_plot->odf_write_y_axis 
-			(state, chart, this_plot->y_axis_name, "yaxis", "y", 
-			 this_plot->gtype, series);
-	if (this_plot->odf_write_x_axis)
-		this_plot->odf_write_x_axis 
-			(state, chart, this_plot->x_axis_name, "xaxis", "x", 
-			 this_plot->gtype, series);
-
-	if (this_plot->odf_write_series != NULL)
-		this_plot->odf_write_series (state, series);
-
-	if (wall != NULL) {
-		gsf_xml_out_start_element (state->xml, CHART "wall");
-		odf_add_pt (state->xml, SVG "width", res_pts[2] - res_pts[0] - 2 * this_plot->pad);
-		gsf_xml_out_add_cstr (state->xml, CHART "style-name", "wallstyle");
-		gsf_xml_out_end_element (state->xml); /* </chart:wall> */
-	}
-	gsf_xml_out_end_element (state->xml); /* </chart:plot_area> */
 
 	/* Set up title */
 
@@ -4140,6 +4096,53 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 		gsf_xml_out_end_element (state->xml); /* </chart:legend> */
 	}
 
+	gsf_xml_out_start_element (state->xml, CHART "plot-area");
+	gsf_xml_out_add_cstr (state->xml, CHART "style-name", "plotarea");
+	if (get_gsf_odf_version () <= 101) {
+		for ( l = series; NULL != l ; l = l->next) {
+			GOData const *dat = gog_dataset_get_dim
+				(GOG_DATASET (l->data), GOG_MS_DIM_VALUES);
+			if (NULL != dat) {
+				GnmExprTop const *texpr = gnm_go_data_get_expr (dat);
+				if (NULL != texpr) {
+					GnmParsePos pp;
+					char *str;
+					parse_pos_init (&pp, WORKBOOK (state->wb), NULL, 0,0 );
+					str = gnm_expr_top_as_string (texpr, &pp, state->conv);
+					gsf_xml_out_add_cstr (state->xml, TABLE "cell-range-address",
+							      odf_strip_brackets (str));
+					g_free (str);
+					break;
+				}
+			}
+		}
+	}
+
+	if (this_plot->odf_write_z_axis)
+		this_plot->odf_write_z_axis 
+			(state, chart, this_plot->z_axis_name, "zaxis", "z", 
+			 this_plot->gtype, series);
+	if (this_plot->odf_write_y_axis)
+		this_plot->odf_write_y_axis 
+			(state, chart, this_plot->y_axis_name, "yaxis", "y", 
+			 this_plot->gtype, series);
+	if (this_plot->odf_write_x_axis)
+		this_plot->odf_write_x_axis 
+			(state, chart, this_plot->x_axis_name, "xaxis", "x", 
+			 this_plot->gtype, series);
+
+	if (this_plot->odf_write_series != NULL)
+		this_plot->odf_write_series (state, series);
+
+	if (wall != NULL) {
+		gsf_xml_out_start_element (state->xml, CHART "wall");
+		odf_add_pt (state->xml, SVG "width", res_pts[2] - res_pts[0] - 2 * this_plot->pad);
+		gsf_xml_out_add_cstr (state->xml, CHART "style-name", "wallstyle");
+		gsf_xml_out_end_element (state->xml); /* </chart:wall> */
+	}
+	gsf_xml_out_end_element (state->xml); /* </chart:plot_area> */
+
+
 	gsf_xml_out_end_element (state->xml); /* </chart:chart> */
 	gsf_xml_out_end_element (state->xml); /* </office:chart> */
 	gsf_xml_out_end_element (state->xml); /* </office:body> */



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