[gnumeric] Sheet objects: import object names.



commit a5d681aac109d6e22903c78839a5dd45daf13468
Author: Morten Welinder <terra gnome org>
Date:   Fri Oct 2 13:10:43 2009 -0400

    Sheet objects: import object names.

 plugins/excel/ChangeLog       |    6 ++++++
 plugins/excel/ms-escher.c     |    4 +++-
 plugins/excel/ms-excel-read.c |   14 +++++++++++---
 3 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 71e2218..2d9853a 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,11 @@
 2009-10-02  Morten Welinder  <terra gnome org>
 
+	* ms-excel-read.c (ms_sheet_realize_obj): Set object name if we
+	have it.
+
+	* ms-escher.c (ms_escher_read_OPT): Assume pointers are UTF-16
+	strings, not UTF-8.  Fits objs.xls
+
 	* ms-excel-write.c (excel_sheet_new): Don't complain over filter
 	combos.  They are handled, but differently.
 
diff --git a/plugins/excel/ms-escher.c b/plugins/excel/ms-escher.c
index ff3a962..6771b68 100644
--- a/plugins/excel/ms-escher.c
+++ b/plugins/excel/ms-escher.c
@@ -1907,8 +1907,10 @@ ms_escher_read_OPT (MSEscherState *state, MSEscherHeader *h)
 				g_free (name);
 			});
 			if (id & MS_OBJ_ATTR_IS_PTR_MASK) {
+				char *s = g_utf16_to_utf8 ((gunichar2*)extra, val / 2,
+							   NULL, NULL, NULL);
 				ms_escher_header_add_attr (h,
-					ms_obj_attr_new_ptr (id, g_strndup (extra, val)));
+					ms_obj_attr_new_ptr (id, s));
 				id = MS_OBJ_ATTR_NONE;
 			}
 			extra += val;
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index fa93aa9..f3ece31 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -451,7 +451,6 @@ static gboolean
 ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
 {
 	float offsets[4];
-	gpointer label;
 	PangoAttrList *markup;
 	GnmRange range;
 	ExcelReadSheet *esheet;
@@ -498,8 +497,17 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
 	}
 	sheet_object_set_sheet (so, esheet->sheet);
 
-	if (ms_obj_attr_get_ptr (obj->attrs, MS_OBJ_ATTR_TEXT, &label, FALSE))
-		g_object_set (G_OBJECT (so), "text", label, NULL);
+	{
+		gpointer label;
+		if (ms_obj_attr_get_ptr (obj->attrs, MS_OBJ_ATTR_TEXT, &label, FALSE))
+			g_object_set (G_OBJECT (so), "text", label, NULL);
+	}
+
+	{
+		gpointer name;
+		if (ms_obj_attr_get_ptr (obj->attrs, MS_OBJ_ATTR_OBJ_NAME, &name, FALSE))
+			g_object_set (G_OBJECT (so), "name", name, NULL);
+	}
 
 	markup = ms_obj_attr_get_markup (obj->attrs, MS_OBJ_ATTR_MARKUP, NULL, FALSE);
 	if (markup != NULL)



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