[gnumeric] gnm_so_polygon_write_xml_sax: implement.



commit e685e32db80daad3158d1be931cb6dd3b3b32b01
Author: Morten Welinder <terra gnome org>
Date:   Wed May 6 11:33:34 2009 -0400

    gnm_so_polygon_write_xml_sax: implement.
---
 ChangeLog            |    3 +++
 NEWS                 |    1 +
 src/gnm-so-polygon.c |   20 ++++++++++++++++++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5dc3df0..ed16b53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-05-06  Morten Welinder  <terra gnome org>
 
+	* src/gnm-so-polygon.c (gnm_so_polygon_write_xml_sax): Implement.
+	Untested, but fixes #581394.
+
 	* src/sheet-autofill.c (afc_set_cell_hint): Don't use the target
 	cell for conventions -- it can be NULL.  Fixes #581589.
 
diff --git a/NEWS b/NEWS
index 5ebd308..67bc9ac 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,7 @@ Morten:
 	* Fix xls export performance problem.  [#581378]
 	* Fix xls export issue that made files readable by Gnumeric only.
 	* Fix autofill crash.  [#581589]
+	* Fix gnumeric crash exporting polygons.  [#581394]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.6
diff --git a/src/gnm-so-polygon.c b/src/gnm-so-polygon.c
index 7e2ae0a..97d77cc 100644
--- a/src/gnm-so-polygon.c
+++ b/src/gnm-so-polygon.c
@@ -25,7 +25,9 @@
 #include "gnm-so-polygon.h"
 #include "sheet-object-impl.h"
 #include "xml-io.h"
+#include "parse-util.h"
 
+#include <goffice/utils/go-persist.h>
 #include <goffice/utils/go-libxml-extras.h>
 #include <goffice/utils/go-color.h>
 #include <goffice/utils/go-style.h>
@@ -226,8 +228,22 @@ static void
 gnm_so_polygon_write_xml_sax (SheetObject const *so, GsfXMLOut *output,
 			      GnmConventions const *convs)
 {
-	/* TODO */
-	gnm_so_polygon_parent_class->write_xml_sax (so, output, convs);
+	GnmSOPolygon const *sop = GNM_SO_POLYGON (so);
+	unsigned int ui;
+	int prec = convs ? convs->output.decimal_digits : -1;
+
+	for (ui = 0; ui + 1 < (sop->points ? sop->points->len : 0); ui += 2) {
+		double x = g_array_index (sop->points, double, ui);
+		double y = g_array_index (sop->points, double, ui + 1);
+		gsf_xml_out_start_element (output, "Point");
+		gsf_xml_out_add_float (output, "x", x, prec);
+		gsf_xml_out_add_float (output, "y", y, prec);
+		gsf_xml_out_end_element (output); /* </Point> */
+	}
+
+	gsf_xml_out_start_element (output, "Style");
+	go_persist_sax_save (GO_PERSIST (sop->style), output);
+	gsf_xml_out_end_element (output); /* </Style> */
 }
 
 static void



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