Commit 3a70f9f1 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

support data tables. ditto. ditto. ditto.

2005-08-29  Jody Goldberg <jody@gnome.org>

	* ms-formula-read.c (excel_parse_formula) : support data tables.
	* ms-excel-read.c (excel_formula_shared) : ditto.
	* ms-formula-write.c (write_node) : ditto.
	* ms-excel-write.c (excel_write_FORMULA) : ditto.

2005-08-27  Jody Goldberg <jody@gnome.org>

	* ms-obj.c (ms_obj_map_forms_obj) : no need to warn about record with
	  no expressions. (Wallenbach/Formulas-2003/chap05/character\ set.xls)

2005-08-27  Jody Goldberg <jody@gnome.org>

	* src/workbook.c (workbook_dispose) : Looks like this patch got
	  munged. Make it sane.
parent 31f29c9c
......@@ -8,6 +8,10 @@ release, and longer term bugs.
Release Critical
----------------
- Patch for non-gconf gnm-config
- Patches for Maemo
- crash on sheet delete for 314207
Worries
-------
: provide undo for dropped objects from sheet_objects_clear
......@@ -18,9 +22,6 @@ Worries
: editing text boxes (do a derived FooCanvasEditableTextItem)
we can steal some of the xim support from item-edit.
http://bugzilla.gnome.org/show_bug.cgi?id=151610
: No longer crashes, but we mis-import multiple axis sets
http://bugzilla.gnome.org/show_bug.cgi?id=144112
: fraction matching
......@@ -59,7 +60,7 @@ Architecture Changes
1.2.1.2) sax-out (DONE)
1.2.1.3) dom-in
1.2.1.4) dom-out (DONE)
1.2.2) doc meta data dialog
1.2.2) doc meta data dialog {Trelane and etrunko}
1.3) Insert hyperlink dialog
1.3.1) Integration with evo address book
2) Font handling (move to GOFont)
......
......@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
......@@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
......
2005-08-27 Jody Goldberg <jody@gnome.org>
* src/workbook.c (workbook_dispose) : Looks like this patch got
munged. Make it sane.
2005-08-29 Stepan Kasal <kasal@ucw.cz>
* src/ssconvert.c (convert): If output file name was not given,
......
2005-08-27 Jody Goldberg <jody@gnome.org>
* src/workbook.c (workbook_dispose) : Looks like this patch got
munged. Make it sane.
2005-08-29 Stepan Kasal <kasal@ucw.cz>
* src/ssconvert.c (convert): If output file name was not given,
......
2005-08-29 Jody Goldberg <jody@gnome.org>
* ms-formula-read.c (excel_parse_formula) : support data tables.
* ms-excel-read.c (excel_formula_shared) : ditto.
* ms-formula-write.c (write_node) : ditto.
* ms-excel-write.c (excel_write_FORMULA) : ditto.
2005-08-27 Jody Goldberg <jody@gnome.org>
* ms-obj.c (ms_obj_map_forms_obj) : no need to warn about record with
no expressions. (Wallenbach/Formulas-2003/chap05/character\ set.xls)
2005-08-28 Morten Welinder <terra@gnome.org>
* Release 1.5.5
......
......@@ -82,7 +82,7 @@
#define BIFF_PRINTSIZE 0x033 /* Undocumented */
#define BIFF_TABLE_v0 0x036
#define BIFF_TABLE_v2 0x236
#define BIFF_TABLE2 0x037 /* Undocumented */
#define BIFF_TABLE2 0x037 /* OOo has docs */
#define BIFF_WNDESK 0x038 /* Undocumented */
#define BIFF_ZOOM 0x039 /* Undocumented */
#define BIFF_BEGINPREF 0x03a /* Undocumented */
......
......@@ -51,7 +51,7 @@ gint ms_excel_read_debug = 0;
gint ms_excel_pivot_debug = 0;
gint ms_excel_escher_debug = 0;
gint ms_excel_formula_debug = 0;
gint ms_excel_chart_debug = 0;
gint ms_excel_chart_debug = 10;
gint ms_excel_write_debug = 0;
gint ms_excel_object_debug = 0;
......
......@@ -291,11 +291,11 @@ BC_R(ai)(XLChartHandler const *handle,
GSF_LE_GET_GUINT16 (q->data + 4));
d (2, fputs ("Has Custom number format;\n", stderr););
if (fmt != NULL) {
char *desc = style_format_as_XL (fmt, FALSE);
char *desc = go_format_as_XL (fmt, FALSE);
d (2, fprintf (stderr, "Format = '%s';\n", desc););
g_free (desc);
style_format_unref (fmt);
go_format_unref (fmt);
}
} else {
d (2, fputs ("Uses number format from data source;\n", stderr););
......@@ -1083,7 +1083,7 @@ BC_R(ifmt)(XLChartHandler const *handle,
GSF_LE_GET_GUINT16 (q->data));
if (fmt != NULL) {
char *desc = style_format_as_XL (fmt, FALSE);
char *desc = go_format_as_XL (fmt, FALSE);
if (s->axis != NULL)
g_object_set (G_OBJECT (s->axis),
......@@ -1091,7 +1091,7 @@ BC_R(ifmt)(XLChartHandler const *handle,
NULL);
d (0, fprintf (stderr, "Format = '%s';\n", desc););
g_free (desc);
style_format_unref (fmt);
go_format_unref (fmt);
}
return FALSE;
......
......@@ -122,6 +122,9 @@ ms_container_set_blips (MSContainer *container, GPtrArray *blips)
void
ms_container_add_obj (MSContainer *container, MSObj *obj)
{
#if 0
g_warning ("registered obj %d\n", obj->id);
#endif
container->obj_queue = g_slist_prepend (container->obj_queue, obj);
}
......
......@@ -210,7 +210,7 @@ excel_wb_get_fmt (GnmXLImporter *importer, unsigned idx)
fprintf (stderr,"Unknown format: 0x%x\n", idx);
if (ans)
return style_format_new_XL (ans, FALSE);
return go_format_new_from_XL (ans, FALSE);
else
return NULL;
}
......@@ -671,14 +671,6 @@ excel_shared_formula_free (XLSharedFormula *sf)
g_free (sf);
}
}
static void
excel_data_table_free (XLDataTable *dt)
{
if (dt != NULL) {
g_free (dt->data);
g_free (dt);
}
}
static ExcelReadSheet *
excel_sheet_new (GnmXLImporter *importer, char const *sheet_name, GnmSheetType type)
......@@ -714,7 +706,7 @@ excel_sheet_new (GnmXLImporter *importer, char const *sheet_name, GnmSheetType t
NULL, (GDestroyNotify) &excel_shared_formula_free);
esheet->tables = g_hash_table_new_full (
(GHashFunc)&cellpos_hash, (GCompareFunc)&cellpos_equal,
NULL, (GDestroyNotify) &excel_data_table_free);
NULL, (GDestroyNotify) g_free);
esheet->biff2_prev_xf_index = -1;
excel_init_margins (esheet);
......@@ -934,7 +926,7 @@ excel_read_LABEL_markup (BiffQuery *q, ExcelReadSheet *esheet,
txo_run.last = txo_run.first;
}
}
return style_format_new_markup (txo_run.accum, FALSE);
return go_format_new_markup (txo_run.accum, FALSE);
}
/*
......@@ -1003,7 +995,7 @@ sst_read_string (BiffQuery *q, MSContainer const *c,
txo_run.last = G_MAXINT;
pango_attr_list_filter (prev_markup,
(PangoAttrFilterFunc) append_markup, &txo_run);
res->markup = style_format_new_markup (txo_run.accum, FALSE);
res->markup = go_format_new_markup (txo_run.accum, FALSE);
total_end_len -= 4*total_n_markup;
}
......@@ -2258,7 +2250,7 @@ static void
biff_xf_data_destroy (BiffXFData *xf)
{
if (xf->style_format) {
style_format_unref (xf->style_format);
go_format_unref (xf->style_format);
xf->style_format = NULL;
}
if (xf->mstyle) {
......@@ -2279,24 +2271,41 @@ excel_formula_shared (BiffQuery *q, ExcelReadSheet *esheet, GnmCell *cell)
XLSharedFormula *sf;
if (!ms_biff_query_peek_next (q, &opcode) ||
(opcode != BIFF_SHRFMLA &&
opcode != BIFF_ARRAY_v0 &&
opcode != BIFF_ARRAY_v2)) {
!(opcode == BIFF_SHRFMLA ||
opcode == BIFF_ARRAY_v0 || opcode == BIFF_ARRAY_v2 ||
opcode == BIFF_TABLE_v0 || opcode == BIFF_TABLE_v2)) {
g_warning ("EXCEL: unexpected record '0x%x' after a formula in '%s'.",
opcode, cell_name (cell));
return NULL;
}
ms_biff_query_next (q);
d (2, range_dump (&r, " <-- shared fmla in\n"););
is_array = (q->opcode != BIFF_SHRFMLA);
r.start.row = GSF_LE_GET_GUINT16 (q->data + 0);
r.end.row = GSF_LE_GET_GUINT16 (q->data + 2);
r.start.col = GSF_LE_GET_GUINT8 (q->data + 4);
r.end.col = GSF_LE_GET_GUINT8 (q->data + 5);
if (opcode == BIFF_TABLE_v0 || opcode == BIFF_TABLE_v2) {
XLDataTable *dt = g_new0 (XLDataTable, 1);
guint16 const flags = GSF_LE_GET_GUINT16 (q->data + 6);
d (-2, range_dump (&r, " <-- contains data table\n"););
gsf_mem_dump (q->data, q->length);
dt->table = r;
g_hash_table_insert (esheet->tables, &dt->table.start, dt);
expr = gnm_expr_new_funcall (gnm_func_lookup ("table", NULL), NULL);
cell_set_array_formula (esheet->sheet,
r.start.col, r.start.row,
r.end.col, r.end.row, expr);
return expr;
}
d (2, range_dump (&r, " <-- contains a shared formula\n"););
is_array = (q->opcode != BIFF_SHRFMLA);
if (esheet_ver (esheet) > MS_BIFF_V4) {
data = q->data + (is_array ? 14 : 10);
data_len = GSF_LE_GET_GUINT16 (q->data + (is_array ? 12 : 8));
......@@ -2304,9 +2313,8 @@ excel_formula_shared (BiffQuery *q, ExcelReadSheet *esheet, GnmCell *cell)
data = q->data + 10;
data_len = GSF_LE_GET_GUINT16 (q->data + 8);
}
expr = excel_parse_formula (
&esheet->container, esheet, r.start.col, r.start.row,
data, data_len, !is_array, NULL);
expr = excel_parse_formula (&esheet->container, esheet,
r.start.col, r.start.row, data, data_len, !is_array, NULL);
sf = g_new (XLSharedFormula, 1);
......@@ -2905,7 +2913,7 @@ gnm_xl_importer_free (GnmXLImporter *importer)
while (i-- > 0) {
g_free (importer->sst[i].str);
if (importer->sst[i].markup != NULL)
style_format_unref (importer->sst[i].markup);
go_format_unref (importer->sst[i].markup);
}
g_free (importer->sst);
}
......@@ -5381,7 +5389,7 @@ excel_read_LABEL (BiffQuery *q, ExcelReadSheet *esheet, gboolean has_markup)
v = value_new_string_nocopy (txt);
if (fmt != NULL) {
value_set_fmt (v, fmt);
style_format_unref (fmt);
go_format_unref (fmt);
}
cell_set_value (sheet_cell_fetch (esheet->sheet, col, row), v);
}
......@@ -6206,10 +6214,10 @@ excel_read_workbook (IOContext *context, WorkbookView *wb_view, GsfInput *input,
void
excel_read_init (void)
{
excel_builtin_formats [0x0e] = cell_formats [FMT_DATE][0];
excel_builtin_formats [0x0f] = cell_formats [FMT_DATE][2];
excel_builtin_formats [0x10] = cell_formats [FMT_DATE][4];
excel_builtin_formats [0x16] = cell_formats [FMT_DATE][20];
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];
}
void
......
......@@ -55,9 +55,8 @@ typedef struct {
} XLSharedFormula;
typedef struct {
GnmCellPos key;
guint8 *data;
guint32 data_len;
GnmRange table;
GnmCellPos c_in, r_in;
} XLDataTable;
/* Use the upper left corner as the key to a collection of shared formulas */
......
......@@ -1935,7 +1935,7 @@ after_put_format (GOFormat *format, gboolean was_added, gint index,
if (was_added) {
d (2, fprintf (stderr, tmpl, index, format););
} else {
style_format_unref (format);
go_format_unref (format);
}
}
......@@ -1947,7 +1947,7 @@ formats_init (ExcelWriteState *ewb)
ewb->formats.two_way_table
= two_way_table_new (g_direct_hash, g_direct_equal, 0,
(GDestroyNotify)style_format_unref);
(GDestroyNotify)go_format_unref);
/* Add built-in formats to format table */
for (i = 0; i < EXCEL_BUILTIN_FORMAT_LEN; i++) {
......@@ -1955,7 +1955,7 @@ formats_init (ExcelWriteState *ewb)
if (!fmt || strlen (fmt) == 0)
fmt = "General";
two_way_table_put (ewb->formats.two_way_table,
style_format_new_XL (fmt, FALSE),
go_format_new_from_XL (fmt, FALSE),
FALSE, /* Not unique */
(AfterPutFunc) after_put_format,
"Magic format %d - 0x%x\n");
......@@ -1985,12 +1985,10 @@ formats_get_index (ExcelWriteState *ewb, GOFormat const *format)
static void
put_format (GnmStyle *mstyle, gconstpointer dummy, ExcelWriteState *ewb)
{
GOFormat *fmt = gnm_style_get_format (mstyle);
style_format_ref (fmt);
two_way_table_put (ewb->formats.two_way_table,
(gpointer)fmt, TRUE,
(AfterPutFunc) after_put_format,
"Found unique format %d - 0x%x\n");
go_format_ref (gnm_style_get_format (mstyle)), TRUE,
(AfterPutFunc) after_put_format,
"Found unique format %d - 0x%x\n");
}
static void
......@@ -1999,7 +1997,7 @@ excel_write_FORMAT (ExcelWriteState *ewb, int fidx)
guint8 data[64];
GOFormat const *sf = formats_get_format (ewb, fidx);
char *format = style_format_as_XL (sf, FALSE);
char *format = go_format_as_XL (sf, FALSE);
d (1, fprintf (stderr, "Writing format 0x%x: %s\n", fidx, format););
......@@ -2153,7 +2151,7 @@ cb_cell_pre_pass (gpointer ignored, GnmCell const *cell, ExcelWriteState *ewb)
/* Collect unique fonts in rich text */
if (cell->value->type == VALUE_STRING &&
style_format_is_markup (fmt)) {
go_format_is_markup (fmt)) {
GArray *txo = txomarkup_new (ewb,
fmt->markup, style);
......@@ -2166,7 +2164,7 @@ cb_cell_pre_pass (gpointer ignored, GnmCell const *cell, ExcelWriteState *ewb)
* imaginary styles with the value format substituted into the
* current style. Otherwise an entry like '10:00' gets loaded
* as a raw number. */
else if (style_format_is_general (gnm_style_get_format (style))) {
else if (go_format_is_general (gnm_style_get_format (style))) {
style = gnm_style_dup (style);
gnm_style_set_format (style, fmt);
g_hash_table_insert (ewb->xf.value_fmt_styles,
......@@ -2356,7 +2354,7 @@ log_xf_data (ExcelWriteState *ewb, BiffXFData *xfd, int idx)
ExcelWriteFont *f = fonts_get_font (ewb, xfd->font_idx);
/* Formats are saved using the 'C' locale number format */
char * desc = style_format_as_XL (xfd->style_format, FALSE);
char * desc = go_format_as_XL (xfd->style_format, FALSE);
fprintf (stderr, "Writing xf 0x%x : font 0x%x (%s), format 0x%x (%s)\n",
idx, xfd->font_idx, excel_font_to_string (f),
......@@ -2940,22 +2938,35 @@ excel_write_FORMULA (ExcelWriteState *ewb, ExcelWriteSheet *esheet, GnmCell cons
if (expr->any.oper == GNM_EXPR_OP_ARRAY &&
expr->array.x == 0 && expr->array.y == 0) {
ms_biff_put_var_next (ewb->bp, BIFF_ARRAY_v2);
GSF_LE_SET_GUINT16 (data+0, cell->pos.row);
GSF_LE_SET_GUINT16 (data+2, cell->pos.row + expr->array.rows-1);
GSF_LE_SET_GUINT16 (data+4, cell->pos.col);
GSF_LE_SET_GUINT16 (data+5, cell->pos.col + expr->array.cols-1);
GSF_LE_SET_GUINT16 (data+6, 0x0); /* alwaysCalc & calcOnLoad */
GSF_LE_SET_GUINT32 (data+8, 0);
GSF_LE_SET_GUINT16 (data+12, 0); /* bogus len, fill in later */
ms_biff_put_var_write (ewb->bp, data, 14);
len = excel_write_formula (ewb, expr->array.corner.expr,
esheet->gnum_sheet, col, row, EXCEL_CALLED_FROM_ARRAY);
ms_biff_put_var_seekto (ewb->bp, 12);
GSF_LE_SET_GUINT16 (lendat, len);
ms_biff_put_var_write (ewb->bp, lendat, 2);
ms_biff_put_commit (ewb->bp);
GnmCellPos r_input, c_input;
if (gnm_expr_is_data_table (expr, &r_input, &c_input)) {
guint16 flags = 0;
guint8 *data = ms_biff_put_len_next (ewb->bp, BIFF_TABLE_v2, 16);
GSF_LE_SET_GUINT16 (data+0, cell->pos.row);
GSF_LE_SET_GUINT16 (data+2, cell->pos.row + expr->array.rows-1);
GSF_LE_SET_GUINT16 (data+4, cell->pos.col);
GSF_LE_SET_GUINT16 (data+5, cell->pos.col + expr->array.cols-1);
GSF_LE_SET_GUINT16 (data+6, flags);
#warning FINISH THIS
ms_biff_put_commit (ewb->bp);
} else {
ms_biff_put_var_next (ewb->bp, BIFF_ARRAY_v2);
GSF_LE_SET_GUINT16 (data+0, cell->pos.row);
GSF_LE_SET_GUINT16 (data+2, cell->pos.row + expr->array.rows-1);
GSF_LE_SET_GUINT16 (data+4, cell->pos.col);
GSF_LE_SET_GUINT16 (data+5, cell->pos.col + expr->array.cols-1);
GSF_LE_SET_GUINT16 (data+6, 0x0); /* alwaysCalc & calcOnLoad */
GSF_LE_SET_GUINT32 (data+8, 0);
GSF_LE_SET_GUINT16 (data+12, 0); /* bogus len, fill in later */
ms_biff_put_var_write (ewb->bp, data, 14);
len = excel_write_formula (ewb, expr->array.corner.expr,
esheet->gnum_sheet, col, row, EXCEL_CALLED_FROM_ARRAY);
ms_biff_put_var_seekto (ewb->bp, 12);
GSF_LE_SET_GUINT16 (lendat, len);
ms_biff_put_var_write (ewb->bp, lendat, 2);
ms_biff_put_commit (ewb->bp);
}
}
if (string_result) {
......@@ -3084,7 +3095,7 @@ excel_write_cell (ExcelWriteState *ewb, ExcelWriteSheet *esheet,
else if ((v = cell->value) != NULL) {
if (v->type == VALUE_STRING &&
VALUE_FMT (v) != NULL &&
style_format_is_markup (VALUE_FMT (v)))
go_format_is_markup (VALUE_FMT (v)))
excel_write_RSTRING (ewb, cell, xf);
else
excel_write_value (ewb, cell->value, cell->pos.col, cell->pos.row, xf);
......@@ -5348,14 +5359,14 @@ extract_gog_object_style (ExcelWriteState *ewb, GogObject *obj)
char *fmt_str;
g_object_get (G_OBJECT (obj), "assigned-format-string-XL", &fmt_str, NULL);
if (fmt_str != NULL) {
GOFormat *fmt = style_format_new_XL (fmt_str, FALSE);
if (!style_format_is_general (fmt))
GOFormat *fmt = go_format_new_from_XL (fmt_str, FALSE);
if (!go_format_is_general (fmt))
two_way_table_put (ewb->formats.two_way_table,
(gpointer)fmt, TRUE,
(AfterPutFunc) after_put_format,
"Found unique format %d - 0x%x\n");
else
style_format_unref (fmt);
go_format_unref (fmt);
}
g_free (fmt_str);
}
......
......@@ -901,7 +901,7 @@ excel_parse_formula (MSContainer const *container,
GnmCellPos top_left;
top_left.row = GSF_LE_GET_GUINT16 (cur+0);
top_left.col = GSF_LE_GET_GUINT16 (cur+2);
top_left.col = (ver >= MS_BIFF_V3) ? GSF_LE_GET_GUINT16 (cur+2) : GSF_LE_GET_GUINT8 (cur+2);
sf = excel_sheet_shared_formula (esheet, &top_left);
if (sf == NULL) {
......@@ -936,9 +936,28 @@ excel_parse_formula (MSContainer const *container,
break;
}
case FORMULA_PTG_TBL :
ptg_length = 4;
break;
case FORMULA_PTG_TBL : {
XLDataTable *dt;
GnmCellPos top_left;
top_left.row = GSF_LE_GET_GUINT16 (cur+0);
top_left.col = (ver >= MS_BIFF_V3) ? GSF_LE_GET_GUINT16 (cur+2) : GSF_LE_GET_GUINT8 (cur+2);
dt = excel_sheet_data_table (esheet, &top_left);
if (dt == NULL) {
if (top_left.col != fn_col || top_left.row != fn_row) {
g_warning ("Unknown data table (key = %s) in ", cellpos_as_string (&top_left));
ms_excel_dump_cellname (container->importer, esheet, fn_col, fn_row);
}
} else if (array_element != NULL) {
*array_element = TRUE;
} else {
g_warning ("EXCEL : unexpected table\n");
}
parse_list_free (&stack);
return NULL;
}
case FORMULA_PTG_ADD : case FORMULA_PTG_SUB :
case FORMULA_PTG_MULT : case FORMULA_PTG_DIV :
......
......@@ -635,6 +635,19 @@ excel_formula_write_NAME_v7 (PolishData *pd, GnmExpr const *expr,
}
}
gboolean
gnm_expr_is_data_table (GnmExpr const *expr, GnmCellPos *c_in, GnmCellPos *r_in)
{
if (expr->any.oper == GNM_EXPR_OP_FUNCALL) {
char const *name = gnm_func_get_name (expr->func.func);
if (name && 0 == strcmp (name, "table")) {
return TRUE;
}
}
return FALSE;
}
static void
write_node (PolishData *pd, GnmExpr const *expr, int paren_level,
XLOpType target_type)
......@@ -813,7 +826,10 @@ write_node (PolishData *pd, GnmExpr const *expr, int paren_level,
case GNM_EXPR_OP_ARRAY : {
GnmExprArray const *array = &expr->array;
guint8 data[5];
GSF_LE_SET_GUINT8 (data, FORMULA_PTG_EXPR);
if (gnm_expr_is_data_table (expr, NULL, NULL))
GSF_LE_SET_GUINT8 (data, FORMULA_PTG_TBL);
else
GSF_LE_SET_GUINT8 (data, FORMULA_PTG_EXPR);
GSF_LE_SET_GUINT16 (data+1, pd->row - array->y);
GSF_LE_SET_GUINT16 (data+3, pd->col - array->x);
ms_biff_put_var_write (pd->ewb->bp, data, 5);
......
......@@ -851,6 +851,9 @@ ms_obj_map_forms_obj (MSObj *obj, MSContainer *c, guint8 const *data, gint32 len
int i = G_N_ELEMENTS (map_forms);
char const *key;
int key_len = 0;
guint8 const *ptr;
guint16 expr_len;
GnmExpr const *ref;
if (obj->excel_type != 8 || len <= 27 ||
strncmp ((char *)(data+21), "Forms.", 6))
......@@ -865,21 +868,25 @@ ms_obj_map_forms_obj (MSObj *obj, MSContainer *c, guint8 const *data, gint32 len
break;
}
if (i >= 0) {
obj->excel_type = map_forms [i].excel_type;
if (map_forms [i].offset_to_link != 0) {
guint8 const *ptr = data + 27 + key_len + map_forms [i].offset_to_link;
guint16 expr_len;
GnmExpr const *ref;
g_return_if_fail (ptr + 2 <= (data + len));
expr_len = GSF_LE_GET_GUINT16 (ptr);
g_return_if_fail (ptr + 2 + expr_len <= (data + len));
ref = ms_container_parse_expr (c, ptr + 6, expr_len);
if (ref != NULL)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_LINKED_TO_CELL, ref));
}
}
if (i < 0)
return;
obj->excel_type = map_forms [i].excel_type;
if (map_forms [i].offset_to_link == 0)
return;
ptr = data + 27 + key_len + map_forms [i].offset_to_link;
if (ptr + 2 > (data + len))
return;
expr_len = GSF_LE_GET_GUINT16 (ptr);
g_return_if_fail (ptr + 2 + expr_len <= (data + len));
ref = ms_container_parse_expr (c, ptr + 6, expr_len);
if (ref != NULL)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_LINKED_TO_CELL, ref));
}
static gboolean
......@@ -1230,15 +1237,13 @@ ms_read_OBJ (BiffQuery *q, MSContainer *c, MSObjAttrBag *attrs)
obj->gnum_obj = (*c->vtbl->create_obj) (c, obj);
/* Chart, There should be a BOF next */
if (obj->excel_type == 0x5 &&
ms_excel_chart_read_BOF (q, c, obj->gnum_obj)) {
ms_obj_delete (obj);
return;
if (obj->excel_type == 0x5) {
if (ms_excel_chart_read_BOF (q, c, obj->gnum_obj)) {
ms_obj_delete (obj);
return;
}
}
#if 0
g_warning ("registered obj %d\n", obj->id);
#endif
ms_container_add_obj (c, obj);
}
......@@ -1297,8 +1302,3 @@ ms_objv8_write_listbox (BiffPut *bp, gboolean filtered)
GSF_LE_SET_GUINT16 (buf + 14, 0xa);
ms_biff_put_var_write (bp, buf, sizeof data);
}
void
ms_objv8_write_chart (BiffPut *bp, SheetObject *sog)
{
}
......@@ -139,6 +139,5 @@ char *ms_read_TXO (BiffQuery *q, MSContainer *c, PangoAttrList **markup);
void ms_objv8_write_common (BiffPut *bp, int id, int type, guint16 flags);
void ms_objv8_write_scrollbar (BiffPut *bp);
void ms_objv8_write_listbox (BiffPut *bp, gboolean filtered);
void ms_objv8_write_chart (BiffPut *bp, SheetObject *sog);
#endif /* GNM_MS_OBJ_H */
......@@ -51,7 +51,7 @@ GNM_PLUGIN_MODULE_HEADER;
static GnmValue *
make_date (GnmValue *res)
{
value_set_fmt (res, style_format_default_date ());
value_set_fmt (res, go_format_default_date ());
return res;
}
......@@ -428,7 +428,7 @@ gnumeric_edate (FunctionEvalInfo *ei, GnmValue const * const *argv)
return value_new_error_NUM (ei->pos);
res = value_new_int (datetime_g_to_serial (&date, conv));
value_set_fmt (res, style_format_default_date ());
value_set_fmt (res, go_format_default_date ());
return res;
}
......@@ -820,7 +820,7 @@ static GnmFuncHelp const help_days360[] = {
"* If @method is 1, the European method will be used. In this "
"case, if the day of the month is 31 it will be considered as 30."
"\n"
"* If @method is 0 or omitted, the XL US method will be used. "
"* If @method is 0 or omitted, the MS Excel (tm) US method will be used. "
"This is a somewhat complicated industry standard method "
"where the last day of February is considered to be the 30th day "
"of the month, but only for the first date."
......@@ -911,7 +911,7 @@ gnumeric_eomonth (FunctionEvalInfo *ei, GnmValue const * const *argv)
g_date_get_year (&date)));
res = value_new_int (datetime_g_to_serial (&date, conv));
value_set_fmt (res, style_format_default_date ());
value_set_fmt (res, go_format_default_date ());
return res;
}
......
......@@ -3565,7 +3565,7 @@ static GnmValue *
gnumeric_coupncd (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
GnmValue *res = func_coup (ei, argv, coupncd);
value_set_fmt (res, style_format_default_date ());
value_set_fmt (res, go_format_default_date ());
return res;
}
......@@ -3615,7 +3615,7 @@ static GnmValue *
gnumeric_couppcd (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
GnmValue *res = func_coup (ei, argv, couppcd);
value_set_fmt (res, style_format_default_date ());
value_set_fmt (res, go_format_default_date ());
return res;
}
......