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

Support XL's 1904 date convention

2003-01-02  Jody Goldberg <jody@gnome.org>

	* ms-excel-read.c (excel_read_1904) : Enable 1904 support.
	* ms-excel-write.c (write_workbook) : Set 1904 flag as necessary.

2003-01-02  Jody Goldberg <jody@gnome.org>

	* openoffice-read.c (oo_date_convention) : support 1904 date
	  convention.

2003-01-02  Jody Goldberg <jody@gnome.org>

	* applix-read.c (applix_parse_cellref) : warning.

2003-01-02  Jody Goldberg <jody@gnome.org>

	* src/xml-io.c (xml_workbook_write) : export quick hack for 1904 date
	  convention.  The positioning is silly.
	(xml_workbook_read) : read it back.

2003-01-01  Jody Goldberg <jody@gnome.org>

	* gnumeric.desktop.in : Add StartupNotify=true
parent a989175b
......@@ -130,6 +130,7 @@ Functions
YIELDDISC (test fails by alot)
Convert the code from sc to use our more accurate date routines
WORKDAY Add holiday support
YEARFRAC Implement
UTF-8:
- Window titles.
......
2003-01-02 Jody Goldberg <jody@gnome.org>
* src/xml-io.c (xml_workbook_write) : export quick hack for 1904 date
convention. The positioning is silly.
(xml_workbook_read) : read it back.
2003-01-01 Jody Goldberg <jody@gnome.org>
* gnumeric.desktop.in : Add StartupNotify=true
2003-01-02 Morten Welinder <terra@diku.dk>
* src/regression.c (matrix_invert): New function.
......
Gnumeric 1.1.16
Jody:
* Support Mac Office style 1904 date convention.
Morten:
* Fix MDETERM.
* Lower number of matrix LU-decomposition routines from three to
......
2003-01-02 Jody Goldberg <jody@gnome.org>
* src/xml-io.c (xml_workbook_write) : export quick hack for 1904 date
convention. The positioning is silly.
(xml_workbook_read) : read it back.
2003-01-01 Jody Goldberg <jody@gnome.org>
* gnumeric.desktop.in : Add StartupNotify=true
2003-01-02 Morten Welinder <terra@diku.dk>
* src/regression.c (matrix_invert): New function.
......
2003-01-02 Jody Goldberg <jody@gnome.org>
* src/xml-io.c (xml_workbook_write) : export quick hack for 1904 date
convention. The positioning is silly.
(xml_workbook_read) : read it back.
2003-01-01 Jody Goldberg <jody@gnome.org>
* gnumeric.desktop.in : Add StartupNotify=true
2003-01-02 Morten Welinder <terra@diku.dk>
* src/regression.c (matrix_invert): New function.
......
......@@ -7,6 +7,7 @@ Icon=gnome-gnumeric.png
Terminal=false
Type=Application
Categories=Application;Office;Spreadsheet;
StartupNotify=true
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnumeric
X-GNOME-Bugzilla-Component=
2003-01-02 Jody Goldberg <jody@gnome.org>
* applix-read.c (applix_parse_cellref) : warning.
2002-12-31 Jody Goldberg <jody@gnome.org>
* Release 1.1.15
......
......@@ -849,7 +849,7 @@ applix_parse_cellref (ApplixReadState *state, unsigned char *buffer,
/* Get cell addr */
if (*sheet) {
buffer = cellpos_parse (buffer, pos, FALSE);
buffer = (unsigned char *)cellpos_parse (buffer, pos, FALSE);
if (buffer)
return buffer;
}
......@@ -1036,8 +1036,8 @@ applix_read_cells (ApplixReadState *state)
return -1;
if (!val_is_string)
/* Does it match any formats */
val = format_match (ptr, NULL);
/* Does it match any formats (use default date convention) */
val = format_match (ptr, NULL, NULL);
if (val == NULL)
/* TODO : Could this happen ? */
......@@ -1137,9 +1137,9 @@ applix_read_cells (ApplixReadState *state)
#if 0
printf ("\"%s\" %d\n", ptr, val_is_string);
#endif
/* Does it match any formats */
/* Does it match any formats (use default date convention) */
if (!val_is_string)
val = format_match (ptr, NULL);
val = format_match (ptr, NULL, NULL);
if (val == NULL)
val = value_new_string (ptr);
......
2003-01-02 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (excel_read_1904) : Enable 1904 support.
* ms-excel-write.c (write_workbook) : Set 1904 flag as necessary.
2002-12-31 Jody Goldberg <jody@gnome.org>
* Release 1.1.15
......
......@@ -938,8 +938,7 @@ static void
excel_read_1904 (BiffQuery *q, ExcelWorkbook *ewb)
{
if (GSF_LE_GET_GUINT16 (q->data) == 1)
gnm_io_warning_unsupported_feature (ewb->context,
_("Workbook uses unsupported 1904 Date System, Dates will be incorrect"));
workbook_set_1904 (ewb->gnum_wb, TRUE);
}
static void
......
......@@ -3975,10 +3975,12 @@ write_workbook (ExcelWriteState *ewb)
GSF_LE_SET_GUINT16 (data, 0x0);
ms_biff_put_commit (bp);
/* See: S59D54.HTM */
data = ms_biff_put_len_next (bp, BIFF_1904, 2);
GSF_LE_SET_GUINT16 (data, 0x0);
ms_biff_put_commit (bp);
{
GnmDateConventions const *conv = workbook_date_conv (ewb->gnum_wb);
data = ms_biff_put_len_next (bp, BIFF_1904, 2);
GSF_LE_SET_GUINT16 (data, conv->use_1904 ? 1 : 0);
ms_biff_put_commit (bp);
}
/* See: S59DCE.HTM */
data = ms_biff_put_len_next (bp, BIFF_PRECISION, 2);
......
......@@ -33,6 +33,8 @@
#include <value.h>
#include <mathfunc.h>
#include <format.h>
#include <workbook.h>
#include <sheet.h>
#include <math.h>
#include <string.h>
......@@ -45,6 +47,7 @@
GNUMERIC_MODULE_PLUGIN_INFO_DECL;
#define DAY_SECONDS (3600*24)
#define DATE_CONV(ep) workbook_date_conv (ep->sheet->workbook)
static Value *
make_date (Value *res)
......@@ -81,6 +84,7 @@ gnumeric_date (FunctionEvalInfo *ei, Value **argv)
{
int year, month, day;
GDate date;
GnmDateConventions const *conv = DATE_CONV (ei->pos);
year = value_get_as_int (argv [0]);
month = value_get_as_int (argv [1]);
......@@ -112,10 +116,11 @@ gnumeric_date (FunctionEvalInfo *ei, Value **argv)
if (!g_date_valid (&date))
goto error;
if (g_date_get_year (&date) < 1900 || g_date_get_year (&date) >= 11900)
if (g_date_get_year (&date) < gnm_date_convention_base (conv) ||
g_date_get_year (&date) >= 11900)
goto error;
return make_date (value_new_int (datetime_g_to_serial (&date)));
return make_date (value_new_int (datetime_g_to_serial (&date, conv)));
error:
return value_new_error_NUM (ei->pos);
......@@ -148,7 +153,7 @@ gnumeric_unix2date (FunctionEvalInfo *ei, Value **argv)
if (gnumabs (futime - utime) >= 1.0)
return value_new_error_VALUE (ei->pos);
return make_date (value_new_float (datetime_timet_to_serial_raw (utime) +
return make_date (value_new_float (datetime_timet_to_serial_raw (utime, DATE_CONV (ei->pos)) +
(futime - utime)));
}
......@@ -175,7 +180,7 @@ gnumeric_date2unix (FunctionEvalInfo *ei, Value **argv)
{
gnm_float fserial = value_get_as_float (argv [0]);
int serial = (int)fserial;
time_t utime = datetime_serial_to_timet (serial);
time_t utime = datetime_serial_to_timet (serial, DATE_CONV (ei->pos));
/* Check for overflow. */
if (gnumabs (fserial - serial) >= 1.0 || utime == (time_t)-1)
......@@ -205,7 +210,7 @@ static char const *help_datevalue = {
static Value *
gnumeric_datevalue (FunctionEvalInfo *ei, Value **argv)
{
return value_new_int (datetime_value_to_serial (argv[0]));
return value_new_int (datetime_value_to_serial (argv[0], DATE_CONV (ei->pos)));
}
/***************************************************************************/
......@@ -327,6 +332,7 @@ gnumeric_datedif (FunctionEvalInfo *ei, Value **argv)
int date1, date2;
char const *opt;
GDate d1, d2;
GnmDateConventions const *conv = DATE_CONV (ei->pos);
date1 = floorgnum (value_get_as_float (argv [0]));
date2 = floorgnum (value_get_as_float (argv [1]));
......@@ -337,8 +343,8 @@ gnumeric_datedif (FunctionEvalInfo *ei, Value **argv)
if (!strcmp (opt, "d"))
return value_new_int (date2 - date1);
datetime_serial_to_g (&d1, date1);
datetime_serial_to_g (&d2, date2);
datetime_serial_to_g (&d1, date1, conv);
datetime_serial_to_g (&d2, date2, conv);
if (!g_date_valid (&d1) || !g_date_valid (&d2))
return value_new_error_VALUE (ei->pos);
......@@ -384,11 +390,12 @@ gnumeric_edate (FunctionEvalInfo *ei, Value **argv)
int serial, months;
GDate date;
Value *res;
GnmDateConventions const *conv = DATE_CONV (ei->pos);
serial = value_get_as_int(argv[0]);
months = value_get_as_int(argv[1]);
datetime_serial_to_g (&date, serial);
datetime_serial_to_g (&date, serial, conv);
if (!g_date_valid (&date))
return value_new_error_VALUE (ei->pos);
......@@ -400,7 +407,7 @@ gnumeric_edate (FunctionEvalInfo *ei, Value **argv)
if (!g_date_valid (&date))
return value_new_error_NUM (ei->pos);
res = value_new_int (datetime_g_to_serial (&date));
res = value_new_int (datetime_g_to_serial (&date, conv));
value_set_fmt (res, style_format_default_date ());
return res;
}
......@@ -425,7 +432,7 @@ static char const *help_today = {
static Value *
gnumeric_today (FunctionEvalInfo *ei, Value **argv)
{
return make_date (value_new_int (datetime_timet_to_serial (time (NULL))));
return make_date (value_new_int (datetime_timet_to_serial (time (NULL), DATE_CONV (ei->pos))));
}
/***************************************************************************/
......@@ -456,7 +463,7 @@ static char const *help_now = {
static Value *
gnumeric_now (FunctionEvalInfo *ei, Value **argv)
{
return value_new_float (datetime_timet_to_serial_raw (time (NULL)));
return value_new_float (datetime_timet_to_serial_raw (time (NULL), DATE_CONV (ei->pos)));
}
/***************************************************************************/
......@@ -509,7 +516,7 @@ static char const *help_timevalue = {
static Value *
gnumeric_timevalue (FunctionEvalInfo *ei, Value **argv)
{
gnm_float raw = datetime_value_to_serial_raw (argv[0]);
gnm_float raw = datetime_value_to_serial_raw (argv[0], DATE_CONV (ei->pos));
return value_new_float (raw - (int)raw);
}
......@@ -628,7 +635,7 @@ gnumeric_year (FunctionEvalInfo *ei, Value **argv)
int res = 1900;
GDate date;
if (datetime_value_to_g (&date, argv[0]))
if (datetime_value_to_g (&date, argv[0], DATE_CONV (ei->pos)))
res = g_date_get_year (&date);
return value_new_int (res);
}
......@@ -659,7 +666,7 @@ gnumeric_month (FunctionEvalInfo *ei, Value **argv)
int res = 1;
GDate date;
if (datetime_value_to_g (&date, argv[0]))
if (datetime_value_to_g (&date, argv[0], DATE_CONV (ei->pos)))
res = g_date_get_month (&date);
return value_new_int (res);
}
......@@ -690,7 +697,7 @@ gnumeric_day (FunctionEvalInfo *ei, Value **argv)
int res = 1;
GDate date;
if (datetime_value_to_g (&date, argv[0]))
if (datetime_value_to_g (&date, argv[0], DATE_CONV (ei->pos)))
res = g_date_get_day (&date);
return value_new_int (res);
}
......@@ -732,7 +739,7 @@ gnumeric_weekday (FunctionEvalInfo *ei, Value **argv)
if (method < 1 || method > 3)
return value_new_error_VALUE (ei->pos);
if (!datetime_value_to_g (&date, argv[0]))
if (!datetime_value_to_g (&date, argv[0], DATE_CONV (ei->pos)))
return value_new_error_VALUE (ei->pos);
switch (method) {
......@@ -785,9 +792,10 @@ gnumeric_days360 (FunctionEvalInfo *ei, Value **argv)
GDate date1, date2;
int day1, day2, month1, month2, year1, year2, result;
gboolean flipped;
GnmDateConventions const *conv = DATE_CONV (ei->pos);
gnm_float serial1 = datetime_value_to_serial (argv[0]);
gnm_float serial2 = datetime_value_to_serial (argv[1]);
gnm_float serial1 = datetime_value_to_serial (argv[0], conv);
gnm_float serial2 = datetime_value_to_serial (argv[1], conv);
int imethod = argv[2] ? value_get_as_int (argv[2]) : 0;
method = (imethod >= 0 && imethod <= METHOD_US_SANE)
......@@ -800,8 +808,8 @@ gnumeric_days360 (FunctionEvalInfo *ei, Value **argv)
serial2 = tmp;
}
datetime_serial_to_g (&date1, serial1);
datetime_serial_to_g (&date2, serial2);
datetime_serial_to_g (&date1, serial1, conv);
datetime_serial_to_g (&date2, serial2, conv);
day1 = g_date_get_day (&date1);
day2 = g_date_get_day (&date2);
month1 = g_date_get_month (&date1);
......@@ -869,8 +877,9 @@ gnumeric_eomonth (FunctionEvalInfo *ei, Value **argv)
Value *res;
int months = 0;
GDate date;
GnmDateConventions const *conv = DATE_CONV (ei->pos);
datetime_value_to_g (&date, argv[0]);
datetime_value_to_g (&date, argv[0], conv);
if (!g_date_valid (&date))
return value_new_error_VALUE (ei->pos);
......@@ -886,7 +895,7 @@ gnumeric_eomonth (FunctionEvalInfo *ei, Value **argv)
g_date_get_days_in_month (g_date_get_month (&date),
g_date_get_year (&date)));
res = value_new_int (datetime_g_to_serial (&date));
res = value_new_int (datetime_g_to_serial (&date, conv));
value_set_fmt (res, style_format_default_date ());
return res;
}
......@@ -918,8 +927,9 @@ gnumeric_workday (FunctionEvalInfo *ei, Value **argv)
int days;
GDateWeekday weekday;
GDate date;
GnmDateConventions const *conv = DATE_CONV (ei->pos);
datetime_value_to_g (&date, argv[0]);
datetime_value_to_g (&date, argv[0], conv);
if (!g_date_valid (&date))
return value_new_error_VALUE (ei->pos);
weekday = g_date_get_weekday (&date);
......@@ -955,7 +965,7 @@ gnumeric_workday (FunctionEvalInfo *ei, Value **argv)
++days;
}
return value_new_int (datetime_g_to_serial (&date));
return value_new_int (datetime_g_to_serial (&date, conv));
}
/***************************************************************************/
......@@ -984,13 +994,13 @@ static char const *help_networkdays = {
* Returns -1 on error
*/
static int
get_serial_weekday (int serial, int * offset)
get_serial_weekday (int serial, int *offset, GnmDateConventions const *conv)
{
GDate date;
if (serial <= 0)
return serial;
datetime_serial_to_g (&date, serial);
datetime_serial_to_g (&date, serial, conv);
if (g_date_valid (&date)) {
/* Jan 1 1900 was a monday so we won't go < 0 */
*offset = (int)g_date_get_weekday (&date) - 1;
......@@ -1016,17 +1026,18 @@ networkdays_holiday_callback (Value const *v, EvalPos const *ep,
(networkdays_holiday_closure *)user_data;
int serial;
GDate date;
GnmDateConventions const *conv = DATE_CONV (ep);
if (v->type == VALUE_ERROR)
return value_duplicate (v);
serial = datetime_value_to_serial (v);
serial = datetime_value_to_serial (v, conv);
if (serial <= 0)
return value_new_error_NUM (ep);
if (serial < close->start_serial || close->end_serial < serial)
return NULL;
datetime_serial_to_g (&date, serial);
datetime_serial_to_g (&date, serial, conv);
if (!g_date_valid (&date))
return value_new_error_NUM (ep);
if (g_date_get_weekday (&date) < G_DATE_SATURDAY)
......@@ -1042,9 +1053,10 @@ gnumeric_networkdays (FunctionEvalInfo *ei, Value **argv)
int start_offset, end_offset, res;
networkdays_holiday_closure close;
GDate start_date;
GnmDateConventions const *conv = DATE_CONV (ei->pos);
start_serial = datetime_value_to_serial (argv[0]);
end_serial = datetime_value_to_serial (argv[1]);
start_serial = datetime_value_to_serial (argv[0], conv);
end_serial = datetime_value_to_serial (argv[1], conv);
/* Swap if necessary */
if (start_serial > end_serial) {
......@@ -1053,14 +1065,14 @@ gnumeric_networkdays (FunctionEvalInfo *ei, Value **argv)
end_serial = tmp;
}
datetime_serial_to_g (&start_date, start_serial);
datetime_serial_to_g (&start_date, start_serial, DATE_CONV (ei->pos));
close.start_serial = start_serial;
close.end_serial = end_serial;
close.res = 0;
/* Move to mondays, and check for problems */
start_serial = get_serial_weekday (start_serial, &start_offset);
end_serial = get_serial_weekday (end_serial, &end_offset);
start_serial = get_serial_weekday (start_serial, &start_offset, conv);
end_serial = get_serial_weekday (end_serial, &end_offset, conv);
if (start_serial < 0 || end_serial < 0)
return value_new_error_NUM (ei->pos);
......@@ -1109,7 +1121,7 @@ static Value *
gnumeric_isoweeknum (FunctionEvalInfo *ei, Value **argv)
{
GDate date;
datetime_value_to_g (&date, argv[0]);
datetime_value_to_g (&date, argv[0], DATE_CONV (ei->pos));
if (!g_date_valid (&date))
return value_new_error_VALUE (ei->pos);
......@@ -1148,7 +1160,7 @@ gnumeric_isoyear (FunctionEvalInfo *ei, Value **argv)
int month;
int isoweeknum;
datetime_value_to_g (&date, argv[0]);
datetime_value_to_g (&date, argv[0], DATE_CONV (ei->pos));
if (!g_date_valid (&date))
return value_new_error_VALUE (ei->pos);
......@@ -1201,7 +1213,7 @@ gnumeric_weeknum (FunctionEvalInfo *ei, Value **argv)
method == WEEKNUM_METHOD_ISO))
return value_new_error_VALUE (ei->pos);
datetime_value_to_g (&date, argv[0]);
datetime_value_to_g (&date, argv[0], DATE_CONV (ei->pos));
if (!g_date_valid (&date))
return value_new_error_VALUE (ei->pos);
......
This diff is collapsed.
......@@ -1733,7 +1733,8 @@ gnumeric_n (FunctionEvalInfo *ei, Value **argv)
return value_new_error_NUM (ei->pos);
str = value_peek_string (argv[0]);
v = format_match_number (str, NULL);
v = format_match_number (str, NULL,
workbook_date_conv (ei->pos->sheet->workbook));
if (v != NULL)
return v;
return value_new_float (0);
......
......@@ -28,6 +28,7 @@
#include <cell.h>
#include <sheet.h>
#include <workbook.h>
#include <mathfunc.h>
#include <rangefunc.h>
#include <collect.h>
......@@ -550,7 +551,8 @@ gnumeric_countif (FunctionEvalInfo *ei, Value **argv)
items.test_value = argv[1];
} else {
parse_criteria (value_peek_string (argv[1]),
&items.fun, &items.test_value);
&items.fun, &items.test_value,
workbook_date_conv (ei->pos->sheet->workbook));
tmpval = items.test_value;
}
......@@ -672,7 +674,8 @@ gnumeric_sumif (FunctionEvalInfo *ei, Value **argv)
items.test_value = argv[1];
} else {
parse_criteria (value_peek_string (argv[1]),
&items.fun, &items.test_value);
&items.fun, &items.test_value,
workbook_date_conv (ei->pos->sheet->workbook));
tmpval = items.test_value;
}
......
......@@ -32,6 +32,7 @@
#include <format.h>
#include <str.h>
#include <sheet.h>
#include <workbook.h>
#include <value.h>
#include <expr.h>
#include <number-match.h>
......@@ -193,7 +194,7 @@ gnumeric_unicode (FunctionEvalInfo *ei, Value **argv)
char const *s = value_peek_string (argv[0]);
if (*s == 0)
value_new_error_VALUE (ei->pos);
return value_new_error_VALUE (ei->pos);
else
return value_new_int (g_utf8_get_char (s));
}
......@@ -793,9 +794,11 @@ gnumeric_text (FunctionEvalInfo *ei, Value **args)
Value *res, *tmp = NULL;
Value const *arg = args[0];
gboolean ok = FALSE;
GnmDateConventions const *conv =
workbook_date_conv (ei->pos->sheet->workbook);
if (arg->type == VALUE_STRING) {
Value *match = format_match (value_peek_string (arg), NULL);
Value *match = format_match (value_peek_string (arg), NULL, conv);
ok = (match != NULL);
if (ok)
tmp = match;
......@@ -805,7 +808,7 @@ gnumeric_text (FunctionEvalInfo *ei, Value **args)
if (ok) {
char *str = format_value (format,
(tmp != NULL) ? tmp : arg,
NULL, -1);
NULL, -1, conv);
res = value_new_string_nocopy (str);
} else
res = value_new_error (ei->pos, _("Type mismatch"));
......@@ -902,7 +905,8 @@ gnumeric_value (FunctionEvalInfo *ei, Value **argv)
for (p = arg; *p && g_unichar_isspace (g_utf8_get_char (p));
p = g_utf8_next_char (p))
;
v = format_match_number (p, NULL);
v = format_match_number (p, NULL,
workbook_date_conv (ei->pos->sheet->workbook));
if (v != NULL)
return v;
......@@ -1038,7 +1042,8 @@ gnumeric_dollar (FunctionEvalInfo *ei, Value **argv)
p10 = gpow10 (decimals);
number = gnumeric_fake_round (number * p10) / p10;
v = value_new_float (number);
s = format_value (sf, v, NULL, -1);
s = format_value (sf, v, NULL, -1,
workbook_date_conv (ei->pos->sheet->workbook));
value_release (v);
style_format_unref (sf);
......
2003-01-02 Jody Goldberg <jody@gnome.org>
* openoffice-read.c (oo_date_convention) : support 1904 date
convention.
2002-12-31 Jody Goldberg <jody@gnome.org>
* Release 1.1.15
......
......@@ -221,6 +221,18 @@ oo_attr_enum (OOParseState *state, xmlChar const * const *attrs,
/****************************************************************************/
static void
oo_date_convention (GsfXmlSAXState *gsf_state, xmlChar const **attrs)
{
/* <table:null-date table:date-value="1904-01-01"/> */
OOParseState *state = (OOParseState *)gsf_state;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (!strcmp (attrs[0], "table:date-value")) {
if (!strncmp (attrs[1], "1904", 4))
workbook_set_1904 (state->pos.wb, TRUE);
}
}
static void
oo_table_start (GsfXmlSAXState *gsf_state, xmlChar const **attrs)
{
......@@ -403,7 +415,8 @@ oo_cell_start (GsfXmlSAXState *gsf_state, xmlChar const **attrs)
GDate date;
g_date_set_dmy (&date, d, m, y);
if (g_date_valid (&date))
val = value_new_int (datetime_g_to_serial (&date));
val = value_new_int (datetime_g_to_serial (&date,
workbook_date_conv (state->pos.wb)));
}
} else if (!strcmp (attrs[0], "table:string-value"))
val = value_new_string (attrs[1]);
......@@ -768,6 +781,8 @@ GSF_XML_SAX_NODE (START, OFFICE, "office:document-content", FALSE, NULL, NULL, 0
GSF_XML_SAX_NODE (OFFICE, OFFICE_BODY, "office:body", FALSE, NULL, NULL, 0),
GSF_XML_SAX_NODE (OFFICE_BODY, TABLE_CALC_SETTINGS, "table:calculation-settings", FALSE, NULL, NULL, 0),
GSF_XML_SAX_NODE (TABLE_CALC_SETTINGS, DATE_CONVENTION, "table:null-date", FALSE, oo_date_convention, NULL, 0),
GSF_XML_SAX_NODE (OFFICE_BODY, TABLE, "table:table", FALSE, &oo_table_start, NULL, 0),
GSF_XML_SAX_NODE (TABLE, TABLE_COL, "table:table-column", FALSE, &oo_col_start, NULL, 0),
GSF_XML_SAX_NODE (TABLE, TABLE_ROW, "table:table-row", FALSE, &oo_row_start, NULL, 0),
......
......@@ -113,7 +113,8 @@ xbase_field_as_value (gchar *content, XBfield *field, XBfile *file)
int year, month, day;
if (sscanf (s, "%4d%2d%2d", &year, &month, &day) == 3) {
GDate *date = g_date_new_dmy (day, month, year);
val = value_new_int (datetime_g_to_serial (date));
/* Use default date convention */
val = value_new_int (datetime_g_to_serial (date, NULL));
g_date_free (date);
} else
val = value_new_string (s);
......
......@@ -218,7 +218,8 @@ cell_set_text (Cell *cell, char const *text)
g_return_if_fail (!cell_is_partial_array (cell));
parse_text_value_or_expr (parse_pos_init_cell (&pos, cell),
text, &val, &expr, mstyle_get_format (cell_get_mstyle (cell)));
text, &val, &expr, mstyle_get_format (cell_get_mstyle (cell)),
workbook_date_conv (cell->base.sheet->workbook));
if (val != NULL) { /* String was a value */
cell_cleanout (cell);
......
......@@ -15,6 +15,8 @@
#include "expr.h"
#include "expr-impl.h"
#include "datetime.h"
#include "workbook.h"
#include "sheet.h"
/* ------------------------------------------------------------------------- */
......@@ -24,6 +26,7 @@ typedef struct {
guint count;
CollectFlags flags;
GSList *info;
GnmDateConventions const *date_conv;
} collect_floats_t;
static Value *
......@@ -72,7 +75,7 @@ callback_function_collect (EvalPos const *ep, Value *value, void *closure)
case VALUE_STRING:
if (cl->flags & COLLECT_DATES) {
x = datetime_value_to_serial (value);
x = datetime_value_to_serial (value, cl->date_conv);
if (x == 0)
return value_new_error_VALUE (ep);
} else if (cl->flags & COLLECT_IGNORE_STRINGS)
......@@ -159,6 +162,7 @@ collect_floats (GnmExprList *exprlist, EvalPos const *ep, CollectFlags flags,
cl.count = 0;
cl.flags = flags;
cl.info = NULL;
cl.date_conv = workbook_date_conv (ep->sheet->workbook);
err = function_iterate_argument_values (ep, &callback_function_collect,
&cl, exprlist, TRUE, iter_flags);
......
......@@ -3542,7 +3542,8 @@ cmd_search_replace_do_cell (CmdSearchReplace *me, EvalPos *ep,
parse_pos_init_evalpos (&pp, ep);
parse_text_value_or_expr (&pp, cell_res.new_text, &val, &expr,
mstyle_get_format (cell_get_mstyle (cell_res.cell)));
mstyle_get_format (cell_get_mstyle (cell_res.cell)),
workbook_date_conv (cell_res.cell->base.sheet->workbook));
/*
* FIXME: this is a hack, but parse_text_value_or_expr
......
......@@ -22,8 +22,16 @@ libfoocanvas_a_LIBADD = \
libfoocanvasincludedir = $(includedir)/libfoocanvas-1.0/libfoocanvas
marshal_sources = \
foo-canvas-marshal.c \
foo-canvas-marshal.h
BUILT_SOURCES = \
$(marshal_sources)
libfoocanvas_a_SOURCES = \
$(BUILT_SOURCES) \
foo-canvas-i18n.h \
foo-canvas-line.c \
foo-canvas-pixbuf.c \
......@@ -37,16 +45,9 @@ libfoocanvas_a_SOURCES = \
$(libfoocanvas_2_a_OBJECTS): $(marshal_sources)
marshal_sources = \
foo-canvas-marshal.c \
foo-canvas-marshal.h
BUILT_SOURCES = \
$(marshal_sources)
foo-canvas-marshal.h: foo-canvas-marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --header --prefix=foo_canvas_marshal > $@
foo-canvas-marshal.c: foo-canvas-marshal.list $(GLIB_GENMARSHAL)
foo-canvas-marshal.c: foo-canvas-marshal.list $(GLIB_GENMARSHAL) foo-canvas-marshal.h
$(GLIB_GENMARSHAL) $< --body --prefix=foo_canvas_marshal > $@
EXTRA_DIST = \
......