Commit e7c690d0 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

add a convenience routine to be safe. (ms_read_OBJ) : Use it here.

2002-08-21  Jody Goldberg <jody@gnome.org>

	* ms-obj.c (ms_obj_new) : add a convenience routine to be safe.
	(ms_read_OBJ) : Use it here.

2002-08-23  Jody Goldberg <jody@gnome.org>

	* xmldocs.make (uninstall) : install docs where libgnome expects them
parent 873fcca5
......@@ -12,6 +12,9 @@ Jody:
Includes some format transfer and uses the wordperfect
charset map from kword (thanks to Ariya Hidayat)
* Cull out a pile of special iconv code in favour of glib
* Fix documentation installtion to match libgnome's expectations
* locale -> utf8 conversion for lotus wk1 importer
* support for BITAND and BITOR in lotus wk1 importer
Jukka:
* Solver improvements:
......
......@@ -4,9 +4,9 @@ AC_INIT(gnumeric, 1.1.8,
http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric)
AC_CONFIG_SRCDIR(src/sheet.h)
AM_CONFIG_HEADER(gnumeric-config.h)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(gnumeric-config.h)
AM_MAINTAINER_MODE
......@@ -652,14 +652,13 @@ dnl ====================================
dnl = End tests for jw
dnl ====================================
AC_OUTPUT([
AC_CONFIG_FILES([
gnumeric.spec
GNOME_Gnumeric.server.in
Makefile
src/Makefile
icons/Makefile
idl/Makefile
src/Makefile
src/dialogs/Makefile
src/pixmaps/Makefile
src/widgets/Makefile
......@@ -681,6 +680,7 @@ doc/pt/Makefile
doc/ru/Makefile
doc/sk/Makefile
doc/sv/Makefile
doc/developer/Makefile
omf-install/Makefile
plugins/Makefile
plugins/numtheory/Makefile
......@@ -729,6 +729,7 @@ templates/english/Makefile
templates/autoformat/Makefile
stamp.h
])
AC_OUTPUT
echo "
......
2002-08-23 Jody Goldberg <jody@gnome.org>
* xmldocs.make (uninstall) : install docs where libgnome expects them
2002-08-12 Jody Goldberg <jody@gnome.org>
* Release 1.1.7
......
......@@ -32,7 +32,7 @@
# dist-hook: app-dist-hook
#
docdir = $(datadir)/gnome/help/$(docname)/$(lang)
docdir = $(gnumeric_datadir)/gnome/help/$(docname)/$(lang)
xml_files = $(entities) $(docname).xml
......
2002-08-21 Jody Goldberg <jody@gnome.org>
* ms-obj.c (ms_obj_new) : add a convenience routine to be safe.
(ms_read_OBJ) : Use it here.
2002-08-19 Jon K Hellan <hellan@acm.org>
* ms-biff.c (ms_biff_query_peek_next, ms_biff_put_var_seekto,
......
......@@ -50,7 +50,7 @@ gint ms_excel_chart_debug = 0;
/* Enables debugging mesgs while writing excel workbooks */
gint ms_excel_write_debug = 0;
/* Enables debugging mesgs while reading excel objects */
gint ms_excel_object_debug = 0;
gint ms_excel_object_debug = 10;
MsExcelReadGbFn ms_excel_read_gb = NULL;
......
......@@ -89,7 +89,7 @@ static void
ms_escher_header_release (MSEscherHeader *h)
{
if (h->attrs != NULL) {
ms_object_attr_bag_destroy (h->attrs);
ms_obj_attr_bag_destroy (h->attrs);
h->attrs = NULL;
}
}
......@@ -98,8 +98,8 @@ static void
ms_escher_header_add_attr (MSEscherHeader *h, MSObjAttr *attr)
{
if (h->attrs == NULL)
h->attrs = ms_object_attr_bag_new ();
ms_object_attr_bag_insert (h->attrs, attr);
h->attrs = ms_obj_attr_bag_new ();
ms_obj_attr_bag_insert (h->attrs, attr);
}
static MSEscherBlip *
......@@ -655,10 +655,10 @@ ms_escher_read_Sp (MSEscherState * state, MSEscherHeader * h)
););
if (flags & 0x40)
ms_escher_header_add_attr (h,
ms_object_attr_new_flag (MS_OBJ_ATTR_FLIP_H));
ms_obj_attr_new_flag (MS_OBJ_ATTR_FLIP_H));
if (flags & 0x80)
ms_escher_header_add_attr (h,
ms_object_attr_new_flag (MS_OBJ_ATTR_FLIP_V));
ms_obj_attr_new_flag (MS_OBJ_ATTR_FLIP_V));
} else
return TRUE;
......@@ -706,7 +706,7 @@ ms_escher_read_ClientAnchor (MSEscherState *state, MSEscherHeader *h)
memcpy (anchor, data, MS_ANCHOR_SIZE);
ms_escher_header_add_attr (h,
ms_object_attr_new_ptr (MS_OBJ_ATTR_ANCHOR,
ms_obj_attr_new_ptr (MS_OBJ_ATTR_ANCHOR,
anchor));
if (needs_free)
......@@ -1730,10 +1730,10 @@ ms_escher_read_OPT (MSEscherState *state, MSEscherHeader *h)
if (id & MS_OBJ_ATTR_IS_INT_MASK)
ms_escher_header_add_attr (h,
ms_object_attr_new_uint (id, val));
ms_obj_attr_new_uint (id, val));
else if (id != MS_OBJ_ATTR_NONE)
ms_escher_header_add_attr (h,
ms_object_attr_new_flag (id));
ms_obj_attr_new_flag (id));
}
if (needs_free)
g_free ((guint8 *)data);
......
......@@ -178,7 +178,7 @@ static StyleColor *
ms_sheet_map_color (ExcelSheet const *esheet, MSObj const *obj, MSObjAttrID id)
{
gushort r, g, b;
MSObjAttr *attr = ms_object_attr_bag_lookup (obj->attrs, id);
MSObjAttr *attr = ms_obj_attr_bag_lookup (obj->attrs, id);
if (attr == NULL)
return NULL;
......@@ -198,13 +198,13 @@ static SheetObject *
ms_sheet_create_image (MSObj *obj, MSEscherBlip *blip)
{
SheetObject *so;
MSObjAttr *crop_left_attr = ms_object_attr_bag_lookup
MSObjAttr *crop_left_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_LEFT);
MSObjAttr *crop_top_attr = ms_object_attr_bag_lookup
MSObjAttr *crop_top_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_TOP);
MSObjAttr *crop_right_attr = ms_object_attr_bag_lookup
MSObjAttr *crop_right_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_RIGHT);
MSObjAttr *crop_bottom_attr = ms_object_attr_bag_lookup
MSObjAttr *crop_bottom_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_BOTTOM);
double crop_left_val = 0.0;
double crop_top_val = 0.0;
......@@ -318,7 +318,7 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
g_return_val_if_fail (container != NULL, TRUE);
esheet = (ExcelSheet *)container;
anchor = ms_object_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_ANCHOR);
anchor = ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_ANCHOR);
if (anchor == NULL) {
printf ("MISSING anchor for obj %p\n", (void *)obj);
return TRUE;
......@@ -335,8 +335,8 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
SO_ANCHOR_PERCENTAGE_FROM_COLROW_START
};
MSObjAttr *flip_h = ms_object_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FLIP_H);
MSObjAttr *flip_v = ms_object_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FLIP_V);
MSObjAttr *flip_h = ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FLIP_H);
MSObjAttr *flip_v = ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FLIP_V);
SheetObjectDirection direction =
((flip_h == NULL) ? SO_DIR_RIGHT : 0) |
((flip_v == NULL) ? SO_DIR_DOWN : 0);
......@@ -352,15 +352,15 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
/* can not be done until we have set the sheet */
if (obj->excel_type == 0x0B) {
sheet_widget_checkbox_set_link (SHEET_OBJECT (obj->gnum_obj),
ms_object_attr_get_expr (obj, MS_OBJ_ATTR_CHECKBOX_LINK, NULL));
ms_obj_attr_get_expr (obj, MS_OBJ_ATTR_CHECKBOX_LINK, NULL));
} else if (obj->excel_type == 0x11) {
sheet_widget_scrollbar_set_details (SHEET_OBJECT (obj->gnum_obj),
ms_object_attr_get_expr (obj, MS_OBJ_ATTR_SCROLLBAR_LINK, NULL),
ms_obj_attr_get_expr (obj, MS_OBJ_ATTR_SCROLLBAR_LINK, NULL),
0,
ms_object_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_MIN, 0),
ms_object_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_MAX, 100),
ms_object_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_INC, 1),
ms_object_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_PAGE, 10));
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_MIN, 0),
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_MAX, 100),
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_INC, 1),
ms_obj_attr_get_int (obj, MS_OBJ_ATTR_SCROLLBAR_PAGE, 10));
}
}
......@@ -385,7 +385,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
switch (obj->excel_type) {
case 0x01: { /* Line */
StyleColor *color;
MSObjAttr *is_arrow = ms_object_attr_bag_lookup (obj->attrs,
MSObjAttr *is_arrow = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_ARROW_END);
so = sheet_object_line_new (is_arrow != NULL); break;
......@@ -401,7 +401,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
StyleColor *outline_color;
so = sheet_object_box_new (obj->excel_type == 3);
if (ms_object_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FILLED))
if (ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FILLED))
fill_color = ms_sheet_map_color (esheet, obj,
MS_OBJ_ATTR_FILL_COLOR);
outline_color = ms_sheet_map_color (esheet, obj,
......@@ -433,7 +433,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
case 0x07: so = g_object_new (sheet_widget_button_get_type (), NULL);
break;
case 0x08: { /* Picture */
MSObjAttr *blip_id = ms_object_attr_bag_lookup (obj->attrs,
MSObjAttr *blip_id = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_ID);
if (blip_id != NULL) {
......@@ -452,7 +452,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
}
case 0x09: so = g_object_new (sheet_object_polygon_get_type (), NULL);
sheet_object_polygon_set_points (SHEET_OBJECT (so),
ms_object_attr_get_array (obj, MS_OBJ_ATTR_POLYGON_COORDS, NULL));
ms_obj_attr_get_array (obj, MS_OBJ_ATTR_POLYGON_COORDS, NULL));
sheet_object_polygon_fill_color_set (so,
ms_sheet_map_color (esheet, obj, MS_OBJ_ATTR_FILL_COLOR));
sheet_object_polygon_outline_color_set (so,
......
......@@ -59,7 +59,7 @@
#define GR_COMMON_OBJ_DATA 0x15
MSObjAttr *
ms_object_attr_new_flag (MSObjAttrID id)
ms_obj_attr_new_flag (MSObjAttrID id)
{
MSObjAttr *res = g_new (MSObjAttr, 1);
......@@ -70,7 +70,7 @@ ms_object_attr_new_flag (MSObjAttrID id)
}
MSObjAttr *
ms_object_attr_new_uint (MSObjAttrID id, guint32 val)
ms_obj_attr_new_uint (MSObjAttrID id, guint32 val)
{
MSObjAttr *res = g_new (MSObjAttr, 1);
......@@ -82,7 +82,7 @@ ms_object_attr_new_uint (MSObjAttrID id, guint32 val)
return res;
}
MSObjAttr *
ms_object_attr_new_ptr (MSObjAttrID id, gpointer val)
ms_obj_attr_new_ptr (MSObjAttrID id, gpointer val)
{
MSObjAttr *res = g_new (MSObjAttr, 1);
......@@ -95,7 +95,7 @@ ms_object_attr_new_ptr (MSObjAttrID id, gpointer val)
}
MSObjAttr *
ms_object_attr_new_array (MSObjAttrID id, GArray *array)
ms_obj_attr_new_array (MSObjAttrID id, GArray *array)
{
MSObjAttr *res = g_new (MSObjAttr, 1);
......@@ -108,7 +108,7 @@ ms_object_attr_new_array (MSObjAttrID id, GArray *array)
}
MSObjAttr *
ms_object_attr_new_expr (MSObjAttrID id, GnmExpr const *expr)
ms_obj_attr_new_expr (MSObjAttrID id, GnmExpr const *expr)
{
MSObjAttr *res = g_new (MSObjAttr, 1);
......@@ -121,77 +121,77 @@ ms_object_attr_new_expr (MSObjAttrID id, GnmExpr const *expr)
}
guint32
ms_object_attr_get_uint (MSObj *obj, MSObjAttrID id, guint32 default_value)
ms_obj_attr_get_uint (MSObj *obj, MSObjAttrID id, guint32 default_value)
{
MSObjAttr *attr;
g_return_val_if_fail (obj != NULL, default_value);
g_return_val_if_fail (id & MS_OBJ_ATTR_IS_INT_MASK, default_value);
attr = ms_object_attr_bag_lookup (obj->attrs, id);
attr = ms_obj_attr_bag_lookup (obj->attrs, id);
if (attr == NULL)
return default_value;
return attr->v.v_uint;
}
gint32
ms_object_attr_get_int (MSObj *obj, MSObjAttrID id, gint32 default_value)
ms_obj_attr_get_int (MSObj *obj, MSObjAttrID id, gint32 default_value)
{
MSObjAttr *attr;
g_return_val_if_fail (obj != NULL, default_value);
g_return_val_if_fail (id & MS_OBJ_ATTR_IS_INT_MASK, default_value);
attr = ms_object_attr_bag_lookup (obj->attrs, id);
attr = ms_obj_attr_bag_lookup (obj->attrs, id);
if (attr == NULL)
return default_value;
return attr->v.v_int;
}
gpointer
ms_object_attr_get_ptr (MSObj *obj, MSObjAttrID id, gpointer default_value)
ms_obj_attr_get_ptr (MSObj *obj, MSObjAttrID id, gpointer default_value)
{
MSObjAttr *attr;
g_return_val_if_fail (obj != NULL, default_value);
g_return_val_if_fail (id & MS_OBJ_ATTR_IS_PTR_MASK, default_value);
attr = ms_object_attr_bag_lookup (obj->attrs, id);
attr = ms_obj_attr_bag_lookup (obj->attrs, id);
if (attr == NULL)
return default_value;
return attr->v.v_ptr;
}
GArray *
ms_object_attr_get_array (MSObj *obj, MSObjAttrID id, GArray *default_value)
ms_obj_attr_get_array (MSObj *obj, MSObjAttrID id, GArray *default_value)
{
MSObjAttr *attr;
g_return_val_if_fail (obj != NULL, default_value);
g_return_val_if_fail (id & MS_OBJ_ATTR_IS_GARRAY_MASK, default_value);
attr = ms_object_attr_bag_lookup (obj->attrs, id);
attr = ms_obj_attr_bag_lookup (obj->attrs, id);
if (attr == NULL)
return default_value;
return attr->v.v_array;
}
GnmExpr const *
ms_object_attr_get_expr (MSObj *obj, MSObjAttrID id, GnmExpr const *default_value)
ms_obj_attr_get_expr (MSObj *obj, MSObjAttrID id, GnmExpr const *default_value)
{
MSObjAttr *attr;
g_return_val_if_fail (obj != NULL, default_value);
g_return_val_if_fail (id & MS_OBJ_ATTR_IS_EXPR_MASK, default_value);
attr = ms_object_attr_bag_lookup (obj->attrs, id);
attr = ms_obj_attr_bag_lookup (obj->attrs, id);
if (attr == NULL)
return default_value;
return attr->v.v_expr;
}
static void
ms_object_attr_destroy (MSObjAttr *attr)
ms_obj_attr_destroy (MSObjAttr *attr)
{
if (attr != NULL) {
if ((attr->id & MS_OBJ_ATTR_IS_PTR_MASK) &&
......@@ -224,35 +224,35 @@ cb_ms_obj_attr_cmp (gconstpointer a, gconstpointer b)
}
MSObjAttrBag *
ms_object_attr_bag_new (void)
ms_obj_attr_bag_new (void)
{
return g_hash_table_new (cb_ms_obj_attr_hash, cb_ms_obj_attr_cmp);
}
static void
cb_ms_object_attr_destroy (gpointer key, gpointer value, gpointer ignored)
cb_ms_obj_attr_destroy (gpointer key, gpointer value, gpointer ignored)
{
ms_object_attr_destroy (value);
ms_obj_attr_destroy (value);
}
void
ms_object_attr_bag_destroy (MSObjAttrBag *attrs)
ms_obj_attr_bag_destroy (MSObjAttrBag *attrs)
{
if (attrs != NULL) {
g_hash_table_foreach (attrs, cb_ms_object_attr_destroy, NULL);
g_hash_table_foreach (attrs, cb_ms_obj_attr_destroy, NULL);
g_hash_table_destroy (attrs);
}
}
void
ms_object_attr_bag_insert (MSObjAttrBag *attrs, MSObjAttr *attr)
ms_obj_attr_bag_insert (MSObjAttrBag *attrs, MSObjAttr *attr)
{
g_return_if_fail (!g_hash_table_lookup (attrs, attr));
g_hash_table_insert (attrs, attr, attr);
}
MSObjAttr *
ms_object_attr_bag_lookup (MSObjAttrBag *attrs, MSObjAttrID id)
ms_obj_attr_bag_lookup (MSObjAttrBag *attrs, MSObjAttrID id)
{
if (attrs != NULL) {
MSObjAttr attr;
......@@ -264,6 +264,22 @@ ms_object_attr_bag_lookup (MSObjAttrBag *attrs, MSObjAttrID id)
/********************************************************************************/
MSObj *
ms_obj_new (MSObjAttrBag *attrs)
{
MSObj *obj = g_new0 (MSObj, 1);
obj->excel_type = (unsigned)-1; /* Set to undefined */
obj->excel_type_name = NULL;
obj->id = -1;
obj->gnum_obj = NULL;
obj->attrs = (attrs != NULL) ? attrs : ms_obj_attr_bag_new ();
obj->ignore_combo_in_filter = FALSE;
obj->is_linked = FALSE;
return obj;
}
void
ms_obj_delete (MSObj *obj)
{
......@@ -273,7 +289,7 @@ ms_obj_delete (MSObj *obj)
obj->gnum_obj = NULL;
}
if (obj->attrs) {
ms_object_attr_bag_destroy (obj->attrs);
ms_obj_attr_bag_destroy (obj->attrs);
obj->attrs = NULL;
}
g_free (obj);
......@@ -393,8 +409,8 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
#endif
guint8 *anchor = g_malloc (MS_ANCHOR_SIZE);
memcpy (anchor, q->data+8, MS_ANCHOR_SIZE);
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_ptr (MS_OBJ_ATTR_ANCHOR, anchor));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_ptr (MS_OBJ_ATTR_ANCHOR, anchor));
obj->excel_type = GSF_LE_GET_GUINT16(q->data + 4);
obj->id = GSF_LE_GET_GUINT32(q->data + 6);
......@@ -402,11 +418,11 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
switch (obj->excel_type) {
case 9: /* polygon */
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_uint (MS_OBJ_ATTR_FILL_COLOR,
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_FILL_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+35)));
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_uint (MS_OBJ_ATTR_OUTLINE_COLOR,
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_OUTLINE_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+38)));
if (ms_biff_query_peek_next (q, &peek_op) &&
......@@ -426,8 +442,8 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
}
g_array_index (array, double, i) = g_array_index (array, double, 0);
g_array_index (array, double, i+1) = g_array_index (array, double, 1);
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_array (MS_OBJ_ATTR_POLYGON_COORDS, array));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_array (MS_OBJ_ATTR_POLYGON_COORDS, array));
}
break;
......@@ -497,23 +513,24 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
break;
case GR_PICTURE_OPTIONS :
{
guint16 pict_opt;
g_return_val_if_fail (len == 2, TRUE);
pict_opt = GSF_LE_GET_GUINT16(data+4);
if (len == 2) {
guint16 opt = GSF_LE_GET_GUINT16 (data + 4);
obj->is_linked = (opt & 0x2) ? TRUE : FALSE;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_object_debug >= 1) {
printf ("{ /* PictOpt */\n");
printf ("value = %d;\n", pict_opt);
printf ("}; /* PictOpt */\n");
}
if (ms_excel_object_debug >= 1) {
printf ("{ /* PictOpt */\n");
printf ("value = %x;\n", opt);
printf ("}; /* PictOpt */\n");
}
#endif
} else {
/* no docs on this so be careful */
g_warning ("PictOpt record with size other than 2");
}
next_biff_record_maybe_imdata = TRUE;
break;
}
case GR_PICTURE_FORMULA :
ms_obj_dump (data, len, data_len_left, "PictFormula");
......@@ -528,20 +545,20 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
break;
case GR_SCROLLBAR : {
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_VALUE,
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_VALUE,
GSF_LE_GET_GUINT16 (data+8)));
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MIN,
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MIN,
GSF_LE_GET_GUINT16 (data+10)));
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MAX,
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MAX,
GSF_LE_GET_GUINT16 (data+12)));
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_INC,
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_INC,
GSF_LE_GET_GUINT16 (data+14)));
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_PAGE,
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_PAGE,
GSF_LE_GET_GUINT16 (data+16)));
ms_obj_dump (data, len, data_len_left, "ScrollBar");
break;
......@@ -555,8 +572,8 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
guint16 const expr_len = GSF_LE_GET_GUINT16 (data+4);
GnmExpr const *ref = ms_container_parse_expr (container, data+10, expr_len);
if (ref != NULL)
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_expr (MS_OBJ_ATTR_SCROLLBAR_LINK, ref));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_SCROLLBAR_LINK, ref));
ms_obj_dump (data, len, data_len_left, "ScrollbarFmla");
break;
}
......@@ -593,8 +610,8 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
guint16 const expr_len = GSF_LE_GET_GUINT16 (data+4);
GnmExpr const *ref = ms_container_parse_expr (container, data+10, expr_len);
if (ref != NULL)
ms_object_attr_bag_insert (obj->attrs,
ms_object_attr_new_expr (MS_OBJ_ATTR_CHECKBOX_LINK, ref));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_CHECKBOX_LINK, ref));
ms_obj_dump (data, len, data_len_left, "CheckBoxFmla");
break;
}
......@@ -711,7 +728,7 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
* @attrs : an OPTIONAL hash of object attributes.
*/
void
ms_read_OBJ (BiffQuery *q, MSContainer *container, GHashTable *attrs)
ms_read_OBJ (BiffQuery *q, MSContainer *container, MSObjAttrBag *attrs)
{
static char const * const object_type_names[] =
{
......@@ -743,14 +760,7 @@ ms_read_OBJ (BiffQuery *q, MSContainer *container, GHashTable *attrs)
};
gboolean errors;
MSObj *obj = g_new0 (MSObj, 1);
obj->excel_type = (unsigned)-1; /* Set to undefined */
obj->excel_type_name = NULL;
obj->id = -1;
obj->gnum_obj = NULL;
obj->attrs = (attrs != NULL) ? attrs : ms_object_attr_bag_new ();
obj->ignore_combo_in_filter = FALSE;
MSObj *obj = ms_obj_new (attrs);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_object_debug > 0)
......
......@@ -70,29 +70,28 @@ typedef struct {
} v;
} MSObjAttr;
MSObjAttr *ms_object_attr_new_flag (MSObjAttrID id);
MSObjAttr *ms_object_attr_new_uint (MSObjAttrID id, guint32 val);
MSObjAttr *ms_object_attr_new_int (MSObjAttrID id, gint32 val);
MSObjAttr *ms_object_attr_new_ptr (MSObjAttrID id, gpointer val);
MSObjAttr *ms_object_attr_new_array (MSObjAttrID id, GArray *array);
MSObjAttr *ms_object_attr_new_expr (MSObjAttrID id, GnmExpr const *expr);
guint32 ms_object_attr_get_uint (MSObj *obj, MSObjAttrID id, guint32 default_value);
gint32 ms_object_attr_get_int (MSObj *obj, MSObjAttrID id, gint32 default_value);
gpointer ms_object_attr_get_ptr (MSObj *obj, MSObjAttrID id, gpointer default_value);
GArray *ms_object_attr_get_array (MSObj *obj, MSObjAttrID id, GArray *default_value);
GnmExpr const *ms_object_attr_get_expr (MSObj *obj, MSObjAttrID id, GnmExpr const *default_value);
MSObjAttr *ms_obj_attr_new_flag (MSObjAttrID id);
MSObjAttr *ms_obj_attr_new_uint (MSObjAttrID id, guint32 val);
MSObjAttr *ms_obj_attr_new_int (MSObjAttrID id, gint32 val);
MSObjAttr *ms_obj_attr_new_ptr (MSObjAttrID id, gpointer val);
MSObjAttr *ms_obj_attr_new_array (MSObjAttrID id, GArray *array);
MSObjAttr *ms_obj_attr_new_expr (MSObjAttrID id, GnmExpr const *expr);
guint32 ms_obj_attr_get_uint (MSObj *obj, MSObjAttrID id, guint32 default_value);
gint32 ms_obj_attr_get_int (MSObj *obj, MSObjAttrID id, gint32 default_value);
gpointer ms_obj_attr_get_ptr (MSObj *obj, MSObjAttrID id, gpointer default_value);
GArray *ms_obj_attr_get_array (MSObj *obj, MSObjAttrID id, GArray *default_value);
GnmExpr const *ms_obj_attr_get_expr (MSObj *obj, MSObjAttrID id, GnmExpr const *default_value);
typedef GHashTable MSObjAttrBag;
MSObjAttrBag *ms_object_attr_bag_new (void);
void ms_object_attr_bag_destroy (MSObjAttrBag *attrs);
void ms_object_attr_bag_insert (MSObjAttrBag *attrs,
MSObjAttr *attr);
MSObjAttr *ms_object_attr_bag_lookup (MSObjAttrBag *attrs,
MSObjAttrID id);
struct _MSObj
{
MSObjAttrBag *ms_obj_attr_bag_new (void);
void ms_obj_attr_bag_destroy (MSObjAttrBag *attrs);
void ms_obj_attr_bag_insert (MSObjAttrBag *attrs,
MSObjAttr *attr);
MSObjAttr *ms_obj_attr_bag_lookup (MSObjAttrBag *attrs,
MSObjAttrID id);
struct _MSObj {
int id;
/* Type specific parameters */
......@@ -100,12 +99,13 @@ struct _MSObj
int excel_type;
char const *excel_type_name;
gboolean ignore_combo_in_filter;
gboolean ignore_combo_in_filter : 1;
gboolean is_linked : 1;
GHashTable *attrs;
};
void ms_read_OBJ (BiffQuery *q, MSContainer *container,
GHashTable *attrs);
MSObjAttrBag *attrs);
void ms_obj_delete (MSObj *obj);
char *ms_read_TXO (BiffQuery *q);
......
......@@ -1615,6 +1615,8 @@ scg_mode_edit_object (SheetControlGUI *scg, SheetObject *so)
scg_set_display_cursor (scg);
}
g_object_unref (G_OBJECT (so));
puts (g_type_name_from_instance (so));
}
/**
......
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