gnumeric r17211 - in trunk: . plugins/excel src



Author: mortenw
Date: Sun Mar 15 19:10:00 2009
New Revision: 17211
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17211&view=rev

Log:
2009-03-15  Morten Welinder  <terra gnome org>

	* src/number-match.c (format_match): Use
	go_format_default_accounting.

	* src/wbc-gtk-actions.c (cb_format_as_accounting): Ditto.

2009-03-15  Morten Welinder  <terra gnome org>

	* ms-excel-read.c (excel_read_init): Do not localize formats 14,
	15, 16, and 22.



Modified:
   trunk/ChangeLog
   trunk/plugins/excel/ChangeLog
   trunk/plugins/excel/ms-excel-read.c
   trunk/src/number-match.c
   trunk/src/wbc-gtk-actions.c

Modified: trunk/plugins/excel/ms-excel-read.c
==============================================================================
--- trunk/plugins/excel/ms-excel-read.c	(original)
+++ trunk/plugins/excel/ms-excel-read.c	Sun Mar 15 19:10:00 2009
@@ -159,15 +159,15 @@
 /* 0x0b */	"0.00E+00",
 /* 0x0c */	"# ?/?",
 /* 0x0d */	"# ?" "?/?" "?",  /* Don't accidentally use trigraph.  */
-/* 0x0e		"m/d/yy" */ NULL,	/* locale specific, set in */
-/* 0x0f		"d-mmm-yy", */ NULL,	/* excel_read_init */
-/* 0x10		"d-mmm", */ NULL,
+/* 0x0e	*/	"m/d/yy",
+/* 0x0f	*/	"d-mmm-yy",
+/* 0x10	*/	"d-mmm",
 /* 0x11 */	"mmm-yy",
 /* 0x12 */	"h:mm AM/PM",
 /* 0x13 */	"h:mm:ss AM/PM",
 /* 0x14 */	"h:mm",
 /* 0x15 */	"h:mm:ss",
-/* 0x16		"m/d/yy h:mm", */ NULL,
+/* 0x16	*/	"m/d/yy h:mm",
 /* 0x17 */	NULL, /* 0x17-0x24 reserved for intl versions */
 /* 0x18 */	NULL,
 /* 0x19 */	NULL,
@@ -6788,10 +6788,25 @@
 {
 	int i;
 
-	excel_builtin_formats [0x0e] = go_format_builtins [GO_FORMAT_DATE][0];
-	excel_builtin_formats [0x0f] = go_format_builtins [GO_FORMAT_DATE][2];
-	excel_builtin_formats [0x10] = go_format_builtins [GO_FORMAT_DATE][4];
-	excel_builtin_formats [0x16] = go_format_builtins [GO_FORMAT_DATE][20];
+#if 0
+	/*
+	 * All the references I can find say this is wrong.
+	 *
+	 * http://openiso.org/Ecma/376/Part4/3.8.30
+	 * http://www.roseindia.net/java/poi/setFullListDataFormat.shtml
+	 * https://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFDataFormat.java
+	 *
+	 * WARNING: if it becomes necessary to reinstate, make sure not to
+	 * access gXXo_format_builtins anymore.  Its content will change
+	 * going forward.
+	 *
+	 * ("XX" to fool grep.)
+	 */	
+	excel_builtin_formats[0x0e] = gXXo_format_builtins [GO_FORMAT_DATE][0];
+	excel_builtin_formats[0x0f] = gXXo_format_builtins [GO_FORMAT_DATE][2];
+	excel_builtin_formats[0x10] = gXXo_format_builtins [GO_FORMAT_DATE][4];
+	excel_builtin_formats[0x16] = gXXo_format_builtins [GO_FORMAT_DATE][20];
+#endif
 
 	excel_func_by_name = g_hash_table_new (g_str_hash, g_str_equal);
 	for (i = 0; i < excel_func_desc_size; i++) {

Modified: trunk/src/number-match.c
==============================================================================
--- trunk/src/number-match.c	(original)
+++ trunk/src/number-match.c	Sun Mar 15 19:10:00 2009
@@ -1160,15 +1160,9 @@
 		case GO_FORMAT_CURRENCY:
 			set_money_format (v);
 			break;
-		case GO_FORMAT_ACCOUNTING: {
-			GOFormat *fmt =
-				go_format_new_from_XL
-				(go_format_builtins[fam][2]);
-			value_set_fmt (v, fmt);
-			go_format_unref (fmt);
+		case GO_FORMAT_ACCOUNTING:
+			value_set_fmt (v, go_format_default_accounting ());
 			break;
-		}
-
 		default:
 			; /* Nothing */
 		}

Modified: trunk/src/wbc-gtk-actions.c
==============================================================================
--- trunk/src/wbc-gtk-actions.c	(original)
+++ trunk/src/wbc-gtk-actions.c	Sun Mar 15 19:10:00 2009
@@ -1410,15 +1410,14 @@
 static GNM_ACTION_DEF (cb_format_as_currency)
 {
 	GOFormat *fmt = go_format_new_from_XL (go_format_builtins[GO_FORMAT_CURRENCY][0]);
-	apply_number_format (wbcg, fmt, _("Format as Currency"));
 	go_format_unref (fmt);
 }
 
 static GNM_ACTION_DEF (cb_format_as_accounting)
 {
-	GOFormat *fmt = go_format_new_from_XL (go_format_builtins[GO_FORMAT_ACCOUNTING][2]);
-	apply_number_format (wbcg, fmt, _("Format as Accounting"));
-	go_format_unref (fmt);
+	apply_number_format (wbcg,
+			     go_format_default_accounting (),
+			     _("Format as Accounting"));
 }
 
 static GNM_ACTION_DEF (cb_format_as_percentage)



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