Commit 167c36d3 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

don't actually store the value, just start editing with it.

2002-02-03  Jody Goldberg <jody@gnome.org>

	* src/workbook-control-gui.c (cb_insert_current_date) : don't actually
	  store the value, just start editing with it.
	(cb_insert_current_time) : ditto.

2002-02-03  Jody Goldberg <jody@gnome.org>

	* src/value.c (value_new_*) : init Value*::fmt
	(value_duplicate) : ref the fmt too.
	(value_set_fmt) : new.

	* src/cell.c (cell_cleanout) : no more format.
	(cell_copy) : ditto.
	(cell_set_text) : ditto.
	(cell_set_expr_internal) : ditto.
	(cell_set_expr_unsafe) : ditto.
	(cell_get_format) : ditto.

	Change all callers.
	* src/sheet.c (sheet_cell_set_value) : remove format assingment.
	* src/cell.c (cell_set_expr_and_value) : remove format assignment.
	(cell_assign_value) : ditto.
	(cell_set_value) : ditto.
	(cell_set_expr) : ditto.
	* src/parser.y (expr_parse_str) : remove arg to return the suggested
	  format.  That will be handled at run time.
	* src/number-match.c (format_match) : remove arg to return the parse
	  formula.  Store it in the value instead.
parent 61fa98f6
2002-02-03 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_insert_current_date) : don't actually
store the value, just start editing with it.
(cb_insert_current_time) : ditto.
2002-02-03 Jody Goldberg <jody@gnome.org>
* src/value.c (value_new_*) : init Value*::fmt
(value_duplicate) : ref the fmt too.
(value_set_fmt) : new.
* src/cell.c (cell_cleanout) : no more format.
(cell_copy) : ditto.
(cell_set_text) : ditto.
(cell_set_expr_internal) : ditto.
(cell_set_expr_unsafe) : ditto.
(cell_get_format) : ditto.
Change all callers.
* src/sheet.c (sheet_cell_set_value) : remove format assingment.
* src/cell.c (cell_set_expr_and_value) : remove format assignment.
(cell_assign_value) : ditto.
(cell_set_value) : ditto.
(cell_set_expr) : ditto.
* src/parser.y (expr_parse_str) : remove arg to return the suggested
format. That will be handled at run time.
* src/number-match.c (format_match) : remove arg to return the parse
formula. Store it in the value instead.
2002-02-02 Jody Goldberg <jody@gnome.org>
* src/main.c (main) : disable the removal of Shift as an accelerator
......
2002-02-03 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_insert_current_date) : don't actually
store the value, just start editing with it.
(cb_insert_current_time) : ditto.
2002-02-03 Jody Goldberg <jody@gnome.org>
* src/value.c (value_new_*) : init Value*::fmt
(value_duplicate) : ref the fmt too.
(value_set_fmt) : new.
* src/cell.c (cell_cleanout) : no more format.
(cell_copy) : ditto.
(cell_set_text) : ditto.
(cell_set_expr_internal) : ditto.
(cell_set_expr_unsafe) : ditto.
(cell_get_format) : ditto.
Change all callers.
* src/sheet.c (sheet_cell_set_value) : remove format assingment.
* src/cell.c (cell_set_expr_and_value) : remove format assignment.
(cell_assign_value) : ditto.
(cell_set_value) : ditto.
(cell_set_expr) : ditto.
* src/parser.y (expr_parse_str) : remove arg to return the suggested
format. That will be handled at run time.
* src/number-match.c (format_match) : remove arg to return the parse
formula. Store it in the value instead.
2002-02-02 Jody Goldberg <jody@gnome.org>
* src/main.c (main) : disable the removal of Shift as an accelerator
......
2002-02-03 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_insert_current_date) : don't actually
store the value, just start editing with it.
(cb_insert_current_time) : ditto.
2002-02-03 Jody Goldberg <jody@gnome.org>
* src/value.c (value_new_*) : init Value*::fmt
(value_duplicate) : ref the fmt too.
(value_set_fmt) : new.
* src/cell.c (cell_cleanout) : no more format.
(cell_copy) : ditto.
(cell_set_text) : ditto.
(cell_set_expr_internal) : ditto.
(cell_set_expr_unsafe) : ditto.
(cell_get_format) : ditto.
Change all callers.
* src/sheet.c (sheet_cell_set_value) : remove format assingment.
* src/cell.c (cell_set_expr_and_value) : remove format assignment.
(cell_assign_value) : ditto.
(cell_set_value) : ditto.
(cell_set_expr) : ditto.
* src/parser.y (expr_parse_str) : remove arg to return the suggested
format. That will be handled at run time.
* src/number-match.c (format_match) : remove arg to return the parse
formula. Store it in the value instead.
2002-02-02 Jody Goldberg <jody@gnome.org>
* src/main.c (main) : disable the removal of Shift as an accelerator
......
......@@ -959,8 +959,7 @@ applix_read_cells (ApplixReadState *state)
content_type = *ptr;
switch (content_type) {
case ';' : /* First of a shared formula */
case '.' : /* instance of a shared formula */
{
case '.' : { /* instance of a shared formula */
ParsePos pos;
ExprTree *expr;
Value *val = NULL;
......@@ -975,7 +974,7 @@ applix_read_cells (ApplixReadState *state)
if (!val_is_string)
/* Does it match any formats */
val = format_match (ptr, NULL, NULL);
val = format_match (ptr, NULL);
if (val == NULL)
/* TODO : Could this happen ? */
......@@ -1024,7 +1023,7 @@ applix_read_cells (ApplixReadState *state)
parse_pos_init_cell (&pos, cell),
GNM_PARSER_USE_APPLIX_REFERENCE_CONVENTIONS |
GNM_PARSER_CREATE_PLACEHOLDER_FOR_UNKNOWN_FUNC,
NULL, NULL);
NULL);
if (expr == NULL) {
(void) applix_parse_error (state, "Invalid expression");
continue;
......@@ -1036,9 +1035,9 @@ applix_read_cells (ApplixReadState *state)
r.start.col, r.start.row,
r.end.col, r.end.row,
expr);
cell_assign_value (cell, val, NULL);
cell_assign_value (cell, val);
} else
cell_set_expr_and_value (cell, expr, val, NULL, TRUE);
cell_set_expr_and_value (cell, expr, val, TRUE);
if (!applix_get_line (state) ||
strncmp (state->buffer, "Formula: ", 9)) {
......@@ -1057,13 +1056,12 @@ applix_read_cells (ApplixReadState *state)
printf ("shared '%s'\n", expr_string);
#endif
expr = g_hash_table_lookup (state->exprs, expr_string);
cell_set_expr_and_value (cell, expr, val, NULL, TRUE);
cell_set_expr_and_value (cell, expr, val, TRUE);
}
break;
}
case ':' : /* simple value */
{
case ':' : { /* simple value */
Value *val = NULL;
ptr += 2;
......@@ -1074,14 +1072,14 @@ applix_read_cells (ApplixReadState *state)
#endif
/* Does it match any formats */
if (!val_is_string)
val = format_match (ptr, NULL, NULL);
val = format_match (ptr, NULL);
if (val == NULL)
val = value_new_string (ptr);
if (cell_is_array (cell))
cell_assign_value (cell, val, NULL);
cell_assign_value (cell, val);
else
cell_set_value (cell, val, NULL);
cell_set_value (cell, val);
break;
}
......
2002-02-03 Jody Goldberg <jody@gnome.org>
* ms-excel-write.c (pre_cell) : adjust to Cell::format moving into the
value.
2002-01-31 Jody Goldberg <jody@gnome.org>
* ms-excel-util.c (init_xl_font_widths) : add Helv.
......
......@@ -1355,6 +1355,7 @@ ms_excel_set_xf (ExcelSheet *esheet, int col, int row, guint16 xfidx)
d (2, printf ("%s!%s%d = xf(%d)\n", esheet->gnum_sheet->name_unquoted,
col_name (col), row + 1, xfidx););
#warning there is a big optimization here if we do not apply the sheet/col/row default
sheet_style_set_pos (esheet->gnum_sheet, col, row, mstyle);
}
......@@ -1720,7 +1721,7 @@ ms_excel_sheet_insert (ExcelSheet *esheet, int xfidx,
if (text) {
cell = sheet_cell_fetch (esheet->gnum_sheet, col, row);
cell_set_value (cell, value_new_string (text), NULL);
cell_set_value (cell, value_new_string (text));
}
}
......@@ -1834,14 +1835,14 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *esheet)
printf ("FIXME: serious formula error: "
"invalid FORMULA (0x%x) record with length %d (should >= 22)\n",
q->opcode, q->length);
cell_set_value (cell, value_new_error (NULL, "Formula Error"), NULL);
cell_set_value (cell, value_new_error (NULL, "Formula Error"));
return;
}
if (q->length < (unsigned)(22 + MS_OLE_GET_GUINT16 (q->data + 20))) {
printf ("FIXME: serious formula error: "
"supposed length 0x%x, real len 0x%x\n",
MS_OLE_GET_GUINT16 (q->data + 20), q->length);
cell_set_value (cell, value_new_error (NULL, "Formula Error"), NULL);
cell_set_value (cell, value_new_error (NULL, "Formula Error"));
return;
}
......@@ -1965,11 +1966,11 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *esheet)
if (expr == NULL && !array_elem) {
g_warning ("EXCEL: How does cell %s have an array expression ?",
cell_name (cell));
cell_set_value (cell, val, NULL);
cell_set_value (cell, val);
} else
cell_assign_value (cell, val, NULL);
cell_assign_value (cell, val);
} else if (!cell_has_expr (cell)) {
cell_set_expr_and_value (cell, expr, val, NULL, TRUE);
cell_set_expr_and_value (cell, expr, val, TRUE);
expr_tree_unref (expr);
} else {
/*
......@@ -1978,7 +1979,7 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *esheet)
*/
g_warning ("EXCEL: Shared formula problems in %s!%s",
cell->base.sheet->name_quoted, cell_name (cell));
cell_set_value (cell, val, NULL);
cell_set_value (cell, val);
}
/*
......@@ -2398,7 +2399,6 @@ static void
ms_excel_sheet_insert_val (ExcelSheet *esheet, int xfidx,
int col, int row, Value *v)
{
Cell *cell;
BiffXFData const *xf = ms_excel_get_xf (esheet, xfidx);
g_return_if_fail (v);
......@@ -2406,8 +2406,8 @@ ms_excel_sheet_insert_val (ExcelSheet *esheet, int xfidx,
g_return_if_fail (xf);
ms_excel_set_xf (esheet, col, row, xfidx);
cell = sheet_cell_fetch (esheet->gnum_sheet, col, row);
cell_set_value (cell, v, xf->style_format);
value_set_fmt (v, xf->style_format);
cell_set_value (sheet_cell_fetch (esheet->gnum_sheet, col, row), v);
}
static void
......
......@@ -1628,11 +1628,12 @@ pre_cell (gconstpointer dummy, Cell *cell, ExcelSheet *esheet)
/* For the general format XL assigns the parse format */
cell_style = cell_get_mstyle (cell);
if (cell->format != NULL &&
!style_format_is_general (cell->format) &&
if (cell->value != NULL &&
VALUE_FMT (cell->value) != NULL &&
!style_format_is_general (VALUE_FMT (cell->value)) &&
style_format_is_general (mstyle_get_format (cell_style))) {
cell_style = mstyle_copy (cell_style);
mstyle_set_format (cell_style, cell->format);
mstyle_set_format (cell_style, VALUE_FMT (cell->value));
c->xf = put_mstyle (esheet->wb, cell_style);
mstyle_ref (cell_style);
} else
......
......@@ -222,7 +222,7 @@ parse_criteria (char const *criteria, criteria_test_fun_t *fun,
len = 0;
}
*test_value = format_match (criteria + len, NULL, NULL);
*test_value = format_match (criteria + len, NULL);
if (*test_value == NULL)
*test_value = value_new_string (criteria + len);
}
......
......@@ -940,7 +940,7 @@ gnumeric_n (FunctionEvalInfo *ei, Value **argv)
return value_new_error (ei->pos, gnumeric_err_NUM);
str = value_peek_string (argv[0]);
v = format_match_number (str, NULL, NULL);
v = format_match_number (str, NULL);
if (v != NULL)
return v;
return value_new_float (0);
......
......@@ -685,7 +685,7 @@ gnumeric_text (FunctionEvalInfo *ei, Value **args)
gboolean ok = FALSE;
if (arg->type == VALUE_STRING) {
Value *match = format_match (value_peek_string (arg), NULL, NULL);
Value *match = format_match (value_peek_string (arg), NULL);
ok = (match != NULL);
if (ok)
tmp = match;
......@@ -787,7 +787,7 @@ gnumeric_value (FunctionEvalInfo *ei, Value **argv)
for (p = arg ; *p && isspace (*p) ; ++p)
;
v = format_match_number ((char *)p, NULL, NULL);
v = format_match_number ((char *)p, NULL);
g_free (arg);
if (v != NULL)
......
......@@ -171,7 +171,7 @@ insert_value (Sheet *sheet, guint32 col, guint32 row, Value *val)
cell = sheet_cell_fetch (sheet, col, row);
cell_set_value (cell, val, NULL);
cell_set_value (cell, val);
#if LOTUS_DEBUG > 0
printf ("Inserting value at %s:\n",
......@@ -224,17 +224,16 @@ read_workbook (Workbook *wb, FILE *f)
}
switch (r->type) {
case LOTUS_BOF:
case LOTUS_BOF :
if (sheetidx > 1)
sheet = attach_sheet (wb, sheetidx++);
break;
case LOTUS_EOF:
case LOTUS_EOF :
sheet = NULL;
break;
case LOTUS_INTEGER:
{
case LOTUS_INTEGER : {
Value *v = value_new_int (gnumeric_get_le_int16 (r->data + 5));
int i = gnumeric_get_le_uint16 (r->data + 1);
int j = gnumeric_get_le_uint16 (r->data + 3);
......@@ -245,8 +244,7 @@ read_workbook (Workbook *wb, FILE *f)
cell_set_format_from_lotus_format (cell, fmt);
break;
}
case LOTUS_NUMBER:
{
case LOTUS_NUMBER : {
Value *v = value_new_float (gnumeric_get_le_double (r->data + 5));
int i = gnumeric_get_le_uint16 (r->data + 1);
int j = gnumeric_get_le_uint16 (r->data + 3);
......@@ -257,8 +255,7 @@ read_workbook (Workbook *wb, FILE *f)
cell_set_format_from_lotus_format (cell, fmt);
break;
}
case LOTUS_LABEL:
{
case LOTUS_LABEL : {
/* one of '\', '''', '"', '^' */
/* gchar format_prefix = *(r->data + 5);*/
Value *v = value_new_string (r->data + 6); /* FIXME unsafe */
......@@ -270,8 +267,7 @@ read_workbook (Workbook *wb, FILE *f)
cell_set_format_from_lotus_format (cell, fmt);
break;
}
case LOTUS_FORMULA:
{
case LOTUS_FORMULA : {
/* 5-12 = value */
/* 13-14 = formula r->length */
Value *v = value_new_float (gnumeric_get_le_double (r->data + 5));
......@@ -280,11 +276,10 @@ read_workbook (Workbook *wb, FILE *f)
fmt = *(guint8 *)(r->data);
cell = insert_value (sheet, i, j, v);
if (cell) {
ExprTree *f =
lotus_parse_formula (sheet, i, j,
r->data + 15, /* FIXME: unsafe */
gnumeric_get_le_int16 (r->data + 13));
cell_set_expr (cell, f, NULL);
ExprTree *f = lotus_parse_formula (sheet, i, j,
r->data + 15, /* FIXME: unsafe */
gnumeric_get_le_int16 (r->data + 13));
cell_set_expr (cell, f);
expr_tree_unref (f);
cell_set_format_from_lotus_format (cell, fmt);
}
......
......@@ -165,7 +165,7 @@ static void
mps_set_cell (Sheet *sh, int col, int row, const gchar *str)
{
Cell *cell = sheet_cell_fetch (sh, col, row);
sheet_cell_set_value (cell, value_new_string (str), NULL);
sheet_cell_set_value (cell, value_new_string (str));
}
/* Writes a float into a cell. */
......@@ -173,7 +173,7 @@ static void
mps_set_cell_float (Sheet *sh, int col, int row, const gnum_float f)
{
Cell *cell = sheet_cell_fetch (sh, col, row);
sheet_cell_set_value (cell, value_new_float (f), NULL);
sheet_cell_set_value (cell, value_new_float (f));
}
/* Callback for the hash table mapping. */
......
......@@ -210,7 +210,7 @@ oleo_parse_formula (char const *text, Sheet *sheet, int col, int row)
expr = expr_parse_str (oleo_get_gnumeric_expr (gnumeric_text,
text, &pos),
&pos, GNM_PARSER_DEFAULT,
NULL, parse_error_init (&error));
parse_error_init (&error));
if (error.id!=PERR_NONE) {
g_warning ("%s \"%s\" at %s!%s\n", error.message, gnumeric_text,
......@@ -287,9 +287,9 @@ oleo_deal_with_cell (char *str, Sheet *sheet, MStyle *style, int *ccol, int *cro
}
if (expr != NULL)
cell_set_expr_and_value (cell, expr, val, NULL, TRUE);
cell_set_expr_and_value (cell, expr, val, TRUE);
else
cell_set_value (cell, val, NULL);
cell_set_value (cell, val);
if (style != NULL)
oleo_set_style (sheet, *ccol, *crow, style);
......@@ -300,7 +300,7 @@ oleo_deal_with_cell (char *str, Sheet *sheet, MStyle *style, int *ccol, int *cro
#endif
/* We can still store the expression, even if the value is missing */
if (expr != NULL)
cell_set_expr (cell, expr, NULL);
cell_set_expr (cell, expr);
}
if (expr)
expr_tree_unref (expr);
......
......@@ -308,7 +308,7 @@ sc_parse_let (sc_file_state_t *src, const char *cmd, const char *str, int col, i
if (!v)
return FALSE;
cell_set_value (cell, v, NULL);
cell_set_value (cell, v);
return TRUE;
}
......
......@@ -248,9 +248,8 @@ sylk_rtd_c_parse (sylk_file_state_t *src, const char *str)
v = value_new_int (src->val_l);
g_assert (v);
cell_set_value (cell, v, NULL);
cell_set_value (cell, v);
}
}
src->val_type = VALUE_EMPTY;
......
......@@ -195,7 +195,8 @@ xbase_file_open (GnumFileOpener const *fo, IOContext *io_context,
val = xbase_field_as_value (
record_get_field (record, i), field);
cell = sheet_cell_fetch (sheet, i, row);
cell_set_value (cell, val, field->fmt);
value_set_fmt (val, field->fmt);
cell_set_value (cell, val);
}
row++;
} while (record_seek (record, SEEK_CUR, 1));
......
2002-02-03 Jody Goldberg <jody@gnome.org>
* xml-sax-read.c (xml_sax_cell) : store the value_fmt as a
StyleFormat.
2002-01-23 Jody Goldberg <jody@gnome.org>
* xml-sax-read.c (xml_sax_free_arg_list) : delete.
......
......@@ -456,7 +456,7 @@ typedef struct _XMLSaxParseState
CellPos cell;
int expr_id, array_rows, array_cols;
int value_type;
unsigned char const *value_fmt;
StyleFormat *value_fmt;
GString *content;
......@@ -1204,7 +1204,7 @@ xml_sax_cell (XMLSaxParseState *state, xmlChar const **attrs)
int row = -1, col = -1;
int rows = -1, cols = -1;
int value_type = -1;
unsigned char const *value_fmt = NULL;
StyleFormat *value_fmt = NULL;
int expr_id = -1;
g_return_if_fail (state->cell.row == -1);
......@@ -1222,7 +1222,7 @@ xml_sax_cell (XMLSaxParseState *state, xmlChar const **attrs)
else if (xml_sax_attr_int (attrs, "ExprID", &expr_id)) ;
else if (xml_sax_attr_int (attrs, "ValueType", &value_type)) ;
else if (!strcmp (attrs[0], "ValueFormat"))
value_fmt = attrs[1];
value_fmt = style_format_new_XL ((char *)attrs[1], FALSE);
else
xml_sax_unknown_attr (state, attrs, "Cell");
}
......@@ -1330,7 +1330,7 @@ xml_sax_cell_content (XMLSaxParseState *state)
int const array_rows = state->array_rows;
int const expr_id = state->expr_id;
int const value_type = state->value_type;
unsigned char const *value_fmt =state->value_fmt;
StyleFormat *value_fmt = state->value_fmt;
gpointer const id = GINT_TO_POINTER (expr_id);
gpointer expr = NULL;
......@@ -1367,11 +1367,8 @@ xml_sax_cell_content (XMLSaxParseState *state)
} else if (state->version >= GNUM_XML_V3 ||
xml_not_used_old_array_spec (cell, content)) {
if (value_type > 0) {
Value *v = value_new_from_string (value_type, content);
StyleFormat *sf = (value_fmt != NULL)
? style_format_new_XL ((char *)value_fmt, FALSE)
: NULL;
cell_set_value (cell, v, sf);
Value *v = value_new_from_string (value_type, content, value_fmt);
cell_set_value (cell, v);
} else
cell_set_text (cell, content);
}
......@@ -1394,7 +1391,7 @@ xml_sax_cell_content (XMLSaxParseState *state)
GINT_TO_POINTER (expr_id));
if (expr != NULL)
cell_set_expr (cell, expr, NULL);
cell_set_expr (cell, expr);
else
g_warning ("XML-IO : Missing shared expression");
} else if (is_new_cell)
......@@ -1403,7 +1400,10 @@ xml_sax_cell_content (XMLSaxParseState *state)
* If it was created by a previous array
* we do not want to erase it.
*/
cell_set_value (cell, value_new_empty (), NULL);
cell_set_value (cell, value_new_empty ());
if (value_fmt != NULL)
style_format_unref (value_fmt);
}
static void
......
......@@ -549,7 +549,7 @@ set_cell_value (data_analysis_output_t *dao, int col, int row, Value *v)
cell = sheet_cell_fetch (dao->sheet, dao->start_col + col,
dao->start_row + row);
sheet_cell_set_value (cell, v, NULL);
sheet_cell_set_value (cell, v);
}
......@@ -674,7 +674,7 @@ WriteData_ForeachCellCB (Sheet *sheet, int col, int row,
cell = sheet_cell_new (sheet, col, row);
x = g_array_index (data, gnum_float, 0);
g_array_remove_index (data, 0);
sheet_cell_set_value (cell, value_new_float (x), NULL);
sheet_cell_set_value (cell, value_new_float (x));
return NULL;
}
......
......@@ -76,10 +76,6 @@ cell_cleanout (Cell *cell)
rendered_value_destroy (cell->rendered_value);
cell->rendered_value = NULL;
}
if (cell->format) {
style_format_unref (cell->format);
cell->format = NULL;
}
cell_dirty (cell);
}
......@@ -118,9 +114,6 @@ cell_copy (Cell const *cell)
? value_duplicate (new_cell->value)
: value_new_empty ();
if (cell->format)
style_format_ref (cell->format);
return new_cell;
}
......@@ -333,7 +326,6 @@ cell_relocate (Cell *cell, ExprRewriteInfo *rwinfo)
void
cell_set_text (Cell *cell, char const *text)
{
StyleFormat *format;
ExprTree *expr;
Value *val;
ParsePos pos;
......@@ -342,19 +334,16 @@ cell_set_text (Cell *cell, char const *text)
g_return_if_fail (text != NULL);
g_return_if_fail (!cell_is_partial_array (cell));
format = parse_text_value_or_expr (parse_pos_init_cell (&pos, cell),
parse_text_value_or_expr (parse_pos_init_cell (&pos, cell),
text, &val, &expr, mstyle_get_format (cell_get_mstyle (cell)));
if (val != NULL) { /* String was a value */
cell_cleanout (cell);
cell->value = val;
/* parse_text already refed the format */
cell->format = format;
cell_render_value (cell, TRUE);
} else { /* String was an expression */
cell_set_expr (cell, expr, format);
cell_set_expr (cell, expr);
expr_tree_unref (expr);
style_format_unref (format);
}
}
......@@ -366,8 +355,6 @@ cell_set_text (Cell *cell, char const *text)
*
* The value is rendered but spans are not calculated.
*
* If an optional format is supplied it is stored for later use.
*
* WARNING : This is an internal routine that does not queue redraws,
* does not auto-resize, does not calculate spans, does
* not mark anything as dirty.
......@@ -375,17 +362,11 @@ cell_set_text (Cell *cell, char const *text)
* NOTE : This DOES NOT check for array partitioning.
*/
void
cell_assign_value (Cell *cell, Value *v, StyleFormat *opt_fmt)
cell_assign_value (Cell *cell, Value *v)
{
g_return_if_fail (cell);
g_return_if_fail (v);
if (opt_fmt)
style_format_ref (opt_fmt);
if (cell->format)
style_format_unref (cell->format);
cell->format = opt_fmt;
if (cell->value != NULL)
value_release (cell->value);
cell->value = v;
......@@ -399,28 +380,19 @@ cell_assign_value (Cell *cell, Value *v, StyleFormat *opt_fmt)
* The value is rendered but spans are not calculated, then the rendered string
* is stored as if that is what the user had entered.
*
* If an optional format is supplied it is stored for later use.
*
* WARNING : This is an internal routine that does not queue redraws,
* does not auto-resize, and does not calculate spans.
*
* NOTE : This DOES check for array partitioning.
*/
void
cell_set_value (Cell *cell, Value *v, StyleFormat *opt_fmt)
cell_set_value (Cell *cell, Value *v)
{
g_return_if_fail (cell);
g_return_if_fail (v);
g_return_if_fail (cell != NULL);
g_return_if_fail (v != NULL);
g_return_if_fail (!cell_is_partial_array (cell));
if (opt_fmt)
style_format_ref (opt_fmt);
cell_cleanout (cell);
/* TODO : It would be nice to standardize on NULL == General */
cell->format = (opt_fmt == NULL || style_format_is_general (opt_fmt))
? NULL : opt_fmt;
cell->value = v;
}
......@@ -430,8 +402,6 @@ cell_set_value (Cell *cell, Value *v, StyleFormat *opt_fmt)
* list. It marks the sheet as dirty. It is intended for use by import
* routines or operations that do bulk assignment.
*
* If an optional format is supplied it is stored for later use.
*
* WARNING : This is an internal routine that does not queue redraws,
* does not auto-resize, does not calculate spans, and does
* not render the value.
......@@ -440,7 +410,7 @@ cell_set_value (Cell *cell, Value *v, StyleFormat *opt_fmt)
*/
void
cell_set_expr_and_value (Cell *cell, ExprTree *expr, Value *v,
StyleFormat *opt_fmt, gboolean link_expr)
gboolean link_expr)
{
g_return_if_fail (cell != NULL);
g_return_if_fail (expr != NULL);
......@@ -448,12 +418,8 @@ cell_set_expr_and_value (Cell *cell, ExprTree *expr, Value *v,
/* Repeat after me. Ref before unref. */
expr_tree_ref (expr);
if (opt_fmt != NULL)
style_format_ref (opt_fmt);
cell_cleanout (cell);
cell->format = opt_fmt;
cell->base.expression = expr;
cell->base.flags |= CELL_HAS_EXPRESSION;
cell->value = v;
......@@ -465,7 +431,6 @@ cell_set_expr_and_value (Cell *cell, ExprTree *expr, Value *v,
* cell_set_expr_internal:
* @cell: the cell to set the formula to
* @expr: an expression tree with the formula
* opt_fmt: an optional format to apply to the cell.
*