[goffice] handle pi-fractions in ODF export



commit 76a29f51be39dd83e1d2be382cd1622e2de24870
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Sep 4 15:34:06 2011 -0600

    handle pi-fractions in ODF export
    
    2011-09-04  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c (go_format_output_fraction_to_odf):
    	handle pi-fraction

 ChangeLog                 |    5 +++++
 goffice/utils/go-format.c |   11 +++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8aefd26..740c13f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
 	* goffice/canvas/goc-widget.c (goc_offscreen_box_draw): enhance widget
 	rendering.
 
+2011-09-04  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* goffice/utils/go-format.c (go_format_output_fraction_to_odf):
+	handle pi-fraction
+
 2011-09-04  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/canvas/goc-widget.c: make sheet widgets scalable. [#605434]
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index d3d3c84..72d0e2f 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -6709,6 +6709,7 @@ go_format_output_fraction_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 	gboolean fraction_completed = FALSE;
 	gboolean string_is_open = FALSE;
 	gboolean color_completed = FALSE;
+	gboolean pi_scale = FALSE;
 
 
 	gsf_xml_out_start_element (xout, NUMBER "number-style");
@@ -6820,6 +6821,9 @@ go_format_output_fraction_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 			/* integer part. In ODF 1.1 we used a foreign element: gnm:no-integer-part=true */
 			gsf_xml_out_add_int (xout, NUMBER "min-numerator-digits",
 					     min_numerator_digits);
+			if (pi_scale && with_extension) {
+				gsf_xml_out_add_cstr_unchecked (xout, GNMSTYLE "display-factor", "pi");
+			}
 			gsf_xml_out_end_element (xout); /* </number:fraction> */
 			fraction_completed = TRUE;
 			fraction_in_progress = FALSE;
@@ -6902,6 +6906,13 @@ go_format_output_fraction_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 			g_string_append_c (accum, '.');
 			break;
 
+		case 'p':
+			if (fraction_in_progress && g_str_has_prefix (token, "pi/")) {
+				pi_scale = TRUE;
+				xl++;
+				break;
+			}
+			/* no break */
 		default:
 			ODF_OPEN_STRING;
 			g_string_append_c (accum, t);



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