[goffice] Fix output of scientific number formats with EE to ODF.



commit 8c08c5ab2ef56b452c87e8e217985f333320e05b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Aug 5 13:00:04 2011 -0600

    Fix output of scientific number formats with EE to ODF.
    
    2011-08-05  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c
    	(go_format_output_scientific_number_element_to_odf): add arguments re
    	literal_E and change caller
    	(go_format_output_scientific_number_to_odf): handle EE or ee

 ChangeLog                 |    7 +++++++
 NEWS                      |    1 +
 goffice/utils/go-format.c |   25 ++++++++++++++++++++-----
 3 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5fb79f2..eda275d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-05  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* goffice/utils/go-format.c
+	(go_format_output_scientific_number_element_to_odf): add arguments re
+	literal_E and change caller
+	(go_format_output_scientific_number_to_odf): handle EE or ee
+
 2011-08-05  Morten Welinder  <terra gnome org>
 
 	* goffice/utils/go-format.c (go_format_get_details): Deduce
diff --git a/NEWS b/NEWS
index 33fe4c8..bb707eb 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.9.0:
 
 Andreas:
 	* Use pango attributes for formatting. [#584380][#651561]
+	* Fix output of scientific number formats with EE to ODF.
 
 Jean:
 	* Port to gtk+-3.0.
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 995ca49..9fd890b 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -6720,15 +6720,19 @@ go_format_output_scientific_number_element_to_odf (GsfXMLOut *xout,
 						   int min_decimal_digits,
 						   int min_exponent_digits,
 						   gboolean comma_seen,
-						   gboolean engineering)
+						   gboolean engineering,
+						   gboolean use_literal_E,
+						   gboolean with_extension)
 {
 	gsf_xml_out_start_element (xout, NUMBER "scientific-number");
 	gsf_xml_out_add_int (xout, NUMBER "decimal-places", min_decimal_digits);
 	odf_add_bool (xout, NUMBER "grouping", comma_seen);
 	gsf_xml_out_add_int (xout, NUMBER "min-integer-digits", min_integer_digits);
 	gsf_xml_out_add_int (xout, NUMBER "min-exponent-digits", min_exponent_digits);
-	if (engineering)
-		odf_add_bool (xout, GNMSTYLE "engineering", TRUE);
+	if (with_extension) {
+		odf_add_bool (xout, GNMSTYLE "engineering", engineering);
+		odf_add_bool (xout, GNMSTYLE "literal-E", use_literal_E);
+	}
 	gsf_xml_out_end_element (xout); /* </number:number> */
 }
 
@@ -6805,18 +6809,29 @@ go_format_output_scientific_number_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 			break;
 
 		case 'e':
-		case 'E':
+		case 'E': {
+			gboolean use_literal_E;
+
 			if (number_completed)
 				break;
+
+			if (*xl == 'e' || *xl == 'E') {
+				xl++;
+				use_literal_E = FALSE;
+			} else
+				use_literal_E = TRUE;
+			
 			while (*xl == '0' || *xl == '+' || *xl == '-')
 				if (*xl++ == '0')
 					min_exponent_digits++;
 			go_format_output_scientific_number_element_to_odf
 				(xout, min_integer_digits, min_decimal_digits,
 				 min_exponent_digits, comma_seen,
-				 with_extension && hashes > 0 && (hashes + min_integer_digits == 3));
+				 hashes > 0 && (hashes + min_integer_digits == 3),
+				 use_literal_E, with_extension);
 			number_completed = TRUE;
 			break;
+		}
 
 		case TOK_COLOR: {
 			GOColor color;



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