[gnumeric] Fix loading of ODF files with named expressions. [#690925]



commit 418ecf79619cf597f64d44faebf03a50705d34a2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Dec 31 11:50:27 2012 -0700

    Fix loading of ODF files with named expressions. [#690925]
    
    2012-12-31  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_fix_en_collect): we have to remove all
    	non-alphanumerics to get expression names acceptable to Gnumeric

 NEWS                                 |    1 +
 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |   11 +++++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 4a79481..7902b75 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Alexandre Rostovtsev:
 Andreas:
 	* Some documentation fixes.
 	* Show argument names for python functions. [#690681]
+	* Fix loading of ODF files with named expressions. [#690925]
 
 Morten:
 	* Fix a few compiler warnings.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index f064ab2..20e5cd2 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-31  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-read.c (odf_fix_en_collect): we have to remove all
+	non-alphanumerics to get expression names acceptable to Gnumeric
+
 2012-12-18  Morten Welinder <terra gnome org>
 
 	* Release 1.12.0
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 45399f9..ab4f842 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -1808,8 +1808,15 @@ odf_fix_en_collect (gchar const *key, G_GNUC_UNUSED GnmNamedExpr *nexpr, odf_fix
 	if (NULL != g_hash_table_lookup (fen->orig2fixed, key))
 		return;
 	str = g_string_new (key);
-	while ((here = strchr (str->str, '.')) != NULL)
-		*here = '_';
+
+	for (here = str->str; *here; here = g_utf8_next_char (here)) {
+		if (!g_unichar_isalnum (g_utf8_get_char (here)) &&
+		    here[0] != '_') {
+			int i, limit = g_utf8_next_char (here) - here;
+			for (i = 0; i<limit;i++)
+				here[i] = '_';
+		}	
+	}
 	while (!odf_fix_en_validate (str->str, fen))
 		g_string_append_c (str, '_');
 	odf_fix_expr_names_t_add (fen, key, g_string_free (str, FALSE));



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