Commit 547e2c6c authored by Morten Welinder's avatar Morten Welinder

Excel: fix problem with object export.

parent feeadd1f
......@@ -24,6 +24,7 @@ Morten:
* Fix printing of coloured sheet objects.
* Fix printing of lines and arrows.
* Fix sheet object/clipboard related critical on exit. [#596509]
* Fix Excel-crashing export problem with objects. [#596886]
--------------------------------------------------------------------------
Gnumeric 1.9.13
......
2009-10-01 Morten Welinder <terra@gnome.org>
* ms-excel-write.c (excel_sheet_new): Exclude GNM_SO_FILLED_TYPE
objects with no text as we do not export them right. [#596886]
2009-09-20 Morten Welinder <terra@gnome.org>
* Release 1.9.13
......
......@@ -2044,11 +2044,13 @@ ms_escher_read_container (MSEscherState *state, MSEscherHeader *container,
g_free ((void *)data);
/*
* Lets double check that the data we just read makes sense.
* If problems arise in the next tests it probably indicates that
* the PRECEDING record length was invalid. Check that it included the header */
* Let's double check that the data we just read makes sense.
* If problems arise in the next tests it probably indicates
* that the PRECEDING record length was invalid. Check that
* it included the header.
*/
if ((h.fbt & (~0x1ff)) != 0xf000) {
printf ("EXCEL : Invalid fbt = 0x%x\n", h.fbt);
g_warning ("Invalid fbt = 0x%x\n", h.fbt);
ms_escher_header_release (&h);
return TRUE;
}
......
......@@ -4174,7 +4174,8 @@ excel_write_ClientTextbox (ExcelWriteState *ewb, SheetObject *so)
GSF_LE_SET_GUINT16 (buf, 0x212); /* end */
g_object_get (G_OBJECT (so), "text", &label, NULL);
if (!label) {
g_warning ("Not sure why label is NULL here.");
g_warning ("Not sure why label is NULL here for %s at %p.",
g_type_name (G_OBJECT_TYPE (so)), so);
label = g_strdup ("");
}
char_len = excel_strlen (label, NULL);
......@@ -5003,7 +5004,7 @@ excel_sheet_new (ExcelWriteState *ewb, Sheet *sheet,
gnm_sheet_get_max_cols (sheet));
ExcelWriteSheet *esheet = g_new0 (ExcelWriteSheet, 1);
GnmRange extent;
GSList *objs, *img;
GSList *objs, *l;
g_return_val_if_fail (sheet, NULL);
g_return_val_if_fail (ewb, NULL);
......@@ -5042,25 +5043,57 @@ excel_sheet_new (ExcelWriteState *ewb, Sheet *sheet,
esheet->blips = NULL;
objs = sheet_objects_get (sheet, NULL, SHEET_OBJECT_IMAGE_TYPE);
for (img = objs ; img != NULL ; img = img->next) {
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (img->data);
for (l = objs ; l; l = l->next) {
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (l->data);
BlipInf *bi = blipinf_new (soi);
/* Images we can't export have a NULL BlipInf */
if (NULL!= bi)
if (!bi)
continue;
esheet->blips = g_slist_prepend (esheet->blips, bi);
}
esheet->blips = g_slist_reverse (esheet->blips);
esheet->num_objs += g_slist_length (esheet->blips);
g_slist_free (objs);
/* ---------------------------------------- */
/* Text boxes & comments */
esheet->textboxes = NULL;
objs = sheet_objects_get (sheet, NULL, CELL_COMMENT_TYPE);
esheet->textboxes = g_slist_concat (objs,
sheet_objects_get (sheet, NULL, GNM_SO_FILLED_TYPE));
esheet->comments = NULL; /* gets populated with obj_ids later */
for (l = objs; l; l = l->next) {
GnmComment *obj = l->data;
esheet->textboxes = g_slist_prepend (esheet->textboxes, obj);
}
g_slist_free (objs);
objs = sheet_objects_get (sheet, NULL, GNM_SO_FILLED_TYPE);
for (l = objs; l; l = l->next) {
SheetObject *obj = l->data;
char *label = NULL;
g_object_get (G_OBJECT (obj), "text", &label, NULL);
if (!label) {
g_printerr ("Dropping object of type %s\n",
g_type_name (G_OBJECT_TYPE (obj)));
continue;
}
g_free (label);
esheet->textboxes = g_slist_prepend (esheet->textboxes, obj);
}
g_slist_free (objs);
esheet->textboxes = g_slist_reverse (esheet->textboxes);
esheet->num_objs += g_slist_length (esheet->textboxes);
/* ---------------------------------------- */
esheet->comments = NULL; /* gets populated with obj_ids later */
/* ---------------------------------------- */
/* And the autofilters (only 1 per sheet in XL) */
if (sheet->filters != NULL) {
GnmFilter const *filter = sheet->filters->data;
......
No preview for this file type
......@@ -511,12 +511,12 @@ gnm_so_filled_class_init (GObjectClass *gobject_class)
g_object_class_install_property (gobject_class, SOF_PROP_IS_OVAL,
g_param_spec_boolean ("is-oval", NULL, NULL, FALSE,
GSF_PARAM_STATIC | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, SOF_PROP_MARKUP,
g_param_spec_boxed ("markup", NULL, NULL, PANGO_TYPE_ATTR_LIST,
GSF_PARAM_STATIC | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, SOF_PROP_TEXT,
g_param_spec_string ("text", NULL, NULL, NULL,
GSF_PARAM_STATIC | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, SOF_PROP_MARKUP,
g_param_spec_boxed ("markup", NULL, NULL, PANGO_TYPE_ATTR_LIST,
GSF_PARAM_STATIC | G_PARAM_READWRITE));
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment