[goffice] make the format interpretation look more like XL



commit ea080437091c904a668f1034235e316075e2526b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Sep 6 15:49:09 2011 -0600

    make the format interpretation look more like XL
    
    2011-09-06  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c (go_format_parse_number_E): make sure to
    	fail on '00E00' and '00E +00'
    	(go_format_execute): keep the leading whitespace

 ChangeLog                 |    6 ++++++
 goffice/utils/go-format.c |   11 +++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7fe4797..3b81925 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-09-06  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* goffice/utils/go-format.c (go_format_parse_number_E): make sure to
+	fail on '00E00' and '00E +00'
+	(go_format_execute): keep the leading whitespace
+
+2011-09-06  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* goffice/utils/go-format.c (go_format_execute): conditionalize denominator
 	simplification (and disable)
 	(go_format_parse_number_fraction): ditto
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index fb86b18..baf68ba 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -59,6 +59,9 @@
 /* Define ALLOW_DENOM_REMOVAL to remove /1s. This is not XL compatible.*/
 #undef ALLOW_DENOM_REMOVAL
 
+/* Define ALLOW_NO_SIGN_AFTER_E to permit formats such as '00E00' and '00E +00' */
+#undef ALLOW_NO_SIGN_AFTER_E 
+
 /* Note that the header file contains ALLOW_EE_MARKUP ALLOW_SI_APPEND ALLOW_PI_SLASH */
 
 /* ------------------------------------------------------------------------- */
@@ -1857,6 +1860,10 @@ go_format_parse_number_E (GOFormatParseState *pstate)
 		pstate->forced_exponent_sign = TRUE;
 		break;
 	default:
+#ifndef ALLOW_NO_SIGN_AFTER_E
+		if (!use_markup && !append_SI)
+			return NULL;
+#endif
 		break;
 	}
 
@@ -2846,10 +2853,6 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
 
 		switch (op) {
 		case OP_END:
-			while (dst->str[0] == ' ') {
-				g_string_erase (dst, 0, 1);
-				go_pango_attr_list_erase (attrs, 0, 1);
-			}
 			if (layout) {
 				pango_layout_set_text (layout, dst->str, -1);
 				if (attrs) {



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