Commit 4d72a2e6 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Split from cell_set_expr.


2000-05-06  Jody Goldberg <jgoldberg@home.com>

	* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.

	* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.

	* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
	  initialization we may also need to render some unrendered values.
parent 9f058999
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.
* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.
2000-05-06 Almer. S. Tigelaar. <almer1@dds.nl>
* src/stf-parse.c (stf_parse_is_valid_data) : Add
......@@ -32,6 +38,9 @@
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
initialization we may also need to render some unrendered values.
* src/parse-util.c (parse_text_value_or_expr) : Be sure the clear the
expr if we are returning a value.
......
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.
* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.
2000-05-06 Almer. S. Tigelaar. <almer1@dds.nl>
* src/stf-parse.c (stf_parse_is_valid_data) : Add
......@@ -32,6 +38,9 @@
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
initialization we may also need to render some unrendered values.
* src/parse-util.c (parse_text_value_or_expr) : Be sure the clear the
expr if we are returning a value.
......
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.
* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.
2000-05-06 Almer. S. Tigelaar. <almer1@dds.nl>
* src/stf-parse.c (stf_parse_is_valid_data) : Add
......@@ -32,6 +38,9 @@
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
initialization we may also need to render some unrendered values.
* src/parse-util.c (parse_text_value_or_expr) : Be sure the clear the
expr if we are returning a value.
......
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.
* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.
2000-05-06 Almer. S. Tigelaar. <almer1@dds.nl>
* src/stf-parse.c (stf_parse_is_valid_data) : Add
......@@ -32,6 +38,9 @@
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
initialization we may also need to render some unrendered values.
* src/parse-util.c (parse_text_value_or_expr) : Be sure the clear the
expr if we are returning a value.
......
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.
* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.
2000-05-06 Almer. S. Tigelaar. <almer1@dds.nl>
* src/stf-parse.c (stf_parse_is_valid_data) : Add
......@@ -32,6 +38,9 @@
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
initialization we may also need to render some unrendered values.
* src/parse-util.c (parse_text_value_or_expr) : Be sure the clear the
expr if we are returning a value.
......
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.
* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.
2000-05-06 Almer. S. Tigelaar. <almer1@dds.nl>
* src/stf-parse.c (stf_parse_is_valid_data) : Add
......@@ -32,6 +38,9 @@
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
initialization we may also need to render some unrendered values.
* src/parse-util.c (parse_text_value_or_expr) : Be sure the clear the
expr if we are returning a value.
......
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_set_expr_unsafe) : Split from cell_set_expr.
* src/eval.c (invalidate_refs) : Use cell_set_expr_unsafe.
2000-05-06 Almer. S. Tigelaar. <almer1@dds.nl>
* src/stf-parse.c (stf_parse_is_valid_data) : Add
......@@ -32,6 +38,9 @@
2000-05-06 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_set_zoom_factor) : Depending on the order of
initialization we may also need to render some unrendered values.
* src/parse-util.c (parse_text_value_or_expr) : Be sure the clear the
expr if we are returning a value.
......
......@@ -772,6 +772,17 @@ make_function (ParseList **stack, int fn_idx, int numargs)
return FALSE ;
}
/**
* ms_excel_dump_cellname : internal utility to dump the current location safely.
*/
static void
ms_excel_dump_cellname (ExcelSheet *sheet, int fn_col, int fn_row)
{
if (sheet && sheet->gnum_sheet && sheet->gnum_sheet->name_unquoted)
printf ("%s!", sheet->gnum_sheet->name_unquoted);
printf ("%s%d : ", col_name(fn_col), fn_row+1);
}
/**
* Parse that RP Excel formula, see S59E2B.HTM
* Return a dynamicly allocated ExprTree containing the formula, or NULL
......@@ -1156,11 +1167,11 @@ ms_excel_parse_formula (ExcelWorkbook *wb, ExcelSheet *sheet, guint8 const *mem,
guint16 w = MS_OLE_GET_GUINT16(cur+1) ;
ptg_length = 3 ;
if (grbit == 0x00) {
static gboolean need_warn = TRUE;
if (need_warn) {
printf ("pgtAttr grbits == 0 ?? What is this, it is not documented.\n") ;
need_warn = FALSE;
}
ms_excel_dump_cellname (sheet, fn_col, fn_row);
printf ("Hmm, ptgAttr with flag of 0 ??\n"
"This appears to indicate a 1x1 array formula, what do the flags mean.\n"
"I have seen flags of 0x3, and 0xA. What values does this one have ?\n"
"flags = 0x%X\n", w);
} else if (grbit & 0x01) {
#ifndef NO_DEBUG_EXCEL
if (ms_excel_formula_debug > 0) {
......@@ -1243,10 +1254,8 @@ ms_excel_parse_formula (ExcelWorkbook *wb, ExcelSheet *sheet, guint8 const *mem,
;
#endif
} else {
if (sheet && sheet->gnum_sheet && sheet->gnum_sheet->name_unquoted)
printf ("%s!", sheet->gnum_sheet->name_unquoted);
printf ("%s%d : Unknown PTG Attr gr = 0x%x, w = 0x%x ptg = 0x%x\n",
col_name(fn_col), fn_row+1, grbit, w, ptg) ;
ms_excel_dump_cellname (sheet, fn_col, fn_row);
printf ("Unknown PTG Attr gr = 0x%x, w = 0x%x ptg = 0x%x\n", grbit, w, ptg) ;
error = TRUE ;
}
}
......
......@@ -461,7 +461,7 @@ cell_set_expr_and_value (Cell *cell, ExprTree *expr, Value *v)
* - render value, calc dimension, compute spans
* - link the expression into the master list.
*/
static void
void
cell_set_expr_internal (Cell *cell, ExprTree *expr, char const *optional_format)
{
StyleFormat * fmt;
......@@ -481,9 +481,9 @@ cell_set_expr_internal (Cell *cell, ExprTree *expr, char const *optional_format)
}
/*
* cell_set_expr : A routine that stores and references the supplied
* expression. It marks the sheet as dirty. Intented for use by
* import routines that do bulk assignment.
* cell_set_expr_unsafe : Stores and references the supplied expression. It
* marks the sheet as dirty. Intented for use by import routines that
* do bulk assignment.
*
* The cell IS marked for recalc.
*
......@@ -491,20 +491,31 @@ cell_set_expr_internal (Cell *cell, ExprTree *expr, char const *optional_format)
*
* 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.
* It also DOES NOT CHECK FOR ARRAY DIVISION. Be very careful
* using this.
*/
void
cell_set_expr (Cell *cell, ExprTree *expr, char const *optional_format)
cell_set_expr_unsafe (Cell *cell, ExprTree *expr, char const *optional_format)
{
g_return_if_fail (cell != NULL);
g_return_if_fail (expr != NULL);
g_return_if_fail (!cell_is_partial_array (cell));
cell_set_expr_internal (cell, expr, optional_format);
cell_formula_changed (cell, TRUE);
}
/**
* cell_set_expr : A utility wrapper for cell_set_expr_unsafe. That adds
* checks for array subdivision.
*/
void
cell_set_expr (Cell *cell, ExprTree *expr, char const *optional_format)
{
g_return_if_fail (!cell_is_partial_array (cell));
cell_set_expr_unsafe (cell, expr, optional_format);
}
/**
* cell_set_array_formula:
* @sheet: The sheet to set the formula to.
......
......@@ -73,6 +73,8 @@ void cell_set_value (Cell *cell,
void cell_set_expr_and_value (Cell *cell, ExprTree *expr, Value *v);
void cell_set_expr (Cell *cell, ExprTree *formula,
char const * optional_format);
void cell_set_expr_unsafe (Cell *cell, ExprTree *expr,
char const *optional_format);
void cell_set_array_formula (Sheet *sheet, int rowa, int cola,
int rowb, int colb,
ExprTree *formula,
......
......@@ -224,11 +224,18 @@ invalidate_refs (Cell *cell, ExprRewriteInfo *rwinfo)
* ( ie. serious breakage ) or we had a duplicate reference
* and we have already removed it.
*/
/* fprintf (stderr, "Invalidating to #REF! in %s!%s %p\n",
cell->sheet->name_quoted, cell_name (cell), newtree); */
g_return_if_fail (newtree != NULL);
sheet_cell_set_expr (cell, newtree);
#if 0
fprintf (stderr, "Invalidating to #REF! in %s!%s %p\n",
cell->sheet->name_quoted, cell_name (cell), newtree);
#endif
/*
* Explicitly do not check for array subdivision, we may be replacing
* the corner of an array.
*/
cell_set_expr_unsafe (cell, newtree, NULL);
}
static void
......@@ -249,7 +256,7 @@ do_deps_destroy (Sheet *sheet, ExprRewriteInfo *rwinfo)
if (deps->range_hash) {
g_hash_table_foreach (deps->range_hash,
&cb_range_hash_to_list, &c);
while (c.cell_list) {
invalidate_refs (c.cell_list->data, rwinfo);
c.cell_list = g_slist_remove (c.cell_list, c.cell_list->data);
......@@ -267,7 +274,7 @@ do_deps_destroy (Sheet *sheet, ExprRewriteInfo *rwinfo)
if (deps->single_hash) {
g_hash_table_foreach (deps->single_hash,
&cb_single_hash_to_list, &c);
while (c.cell_list) {
invalidate_refs (c.cell_list->data, rwinfo);
c.cell_list = g_slist_remove (c.cell_list, c.cell_list->data);
......@@ -294,7 +301,7 @@ sheet_deps_destroy (Sheet *sheet)
rwinfo.type = EXPR_REWRITE_SHEET;
rwinfo.u.sheet = sheet;
do_deps_destroy (sheet, &rwinfo);
}
......@@ -693,12 +700,12 @@ handle_tree_deps (Cell *cell, ExprTree *tree, DepOperation operation)
/**
* cell_add_dependencies:
* @cell:
*
* @cell:
*
* This registers the dependencies for this cell
* by scanning all of the references made in the
* parsed expression.
*
*
**/
void
cell_add_dependencies (Cell *cell)
......@@ -730,8 +737,8 @@ cell_add_explicit_dependency (Cell *cell, const CellRef *ref)
/**
* cell_drop_dependencies:
* @cell:
*
* @cell:
*
* Remove the Cell from the DependencyRange hash tables
**/
void
......
......@@ -224,11 +224,18 @@ invalidate_refs (Cell *cell, ExprRewriteInfo *rwinfo)
* ( ie. serious breakage ) or we had a duplicate reference
* and we have already removed it.
*/
/* fprintf (stderr, "Invalidating to #REF! in %s!%s %p\n",
cell->sheet->name_quoted, cell_name (cell), newtree); */
g_return_if_fail (newtree != NULL);
sheet_cell_set_expr (cell, newtree);
#if 0
fprintf (stderr, "Invalidating to #REF! in %s!%s %p\n",
cell->sheet->name_quoted, cell_name (cell), newtree);
#endif
/*
* Explicitly do not check for array subdivision, we may be replacing
* the corner of an array.
*/
cell_set_expr_unsafe (cell, newtree, NULL);
}
static void
......@@ -249,7 +256,7 @@ do_deps_destroy (Sheet *sheet, ExprRewriteInfo *rwinfo)
if (deps->range_hash) {
g_hash_table_foreach (deps->range_hash,
&cb_range_hash_to_list, &c);
while (c.cell_list) {
invalidate_refs (c.cell_list->data, rwinfo);
c.cell_list = g_slist_remove (c.cell_list, c.cell_list->data);
......@@ -267,7 +274,7 @@ do_deps_destroy (Sheet *sheet, ExprRewriteInfo *rwinfo)
if (deps->single_hash) {
g_hash_table_foreach (deps->single_hash,
&cb_single_hash_to_list, &c);
while (c.cell_list) {
invalidate_refs (c.cell_list->data, rwinfo);
c.cell_list = g_slist_remove (c.cell_list, c.cell_list->data);
......@@ -294,7 +301,7 @@ sheet_deps_destroy (Sheet *sheet)
rwinfo.type = EXPR_REWRITE_SHEET;
rwinfo.u.sheet = sheet;
do_deps_destroy (sheet, &rwinfo);
}
......@@ -693,12 +700,12 @@ handle_tree_deps (Cell *cell, ExprTree *tree, DepOperation operation)
/**
* cell_add_dependencies:
* @cell:
*
* @cell:
*
* This registers the dependencies for this cell
* by scanning all of the references made in the
* parsed expression.
*
*
**/
void
cell_add_dependencies (Cell *cell)
......@@ -730,8 +737,8 @@ cell_add_explicit_dependency (Cell *cell, const CellRef *ref)
/**
* cell_drop_dependencies:
* @cell:
*
* @cell:
*
* Remove the Cell from the DependencyRange hash tables
**/
void
......
......@@ -457,8 +457,10 @@ sheet_set_zoom_factor (Sheet *sheet, double const f)
/*
* The font size does not scale linearly with the zoom factor
* we will need to recalculate the pixel sizes of all cells.
* We also need to render any cells which have not yet been
* rendered.
*/
sheet_calc_spans (sheet, SPANCALC_SIMPLE);
sheet_calc_spans (sheet, SPANCALC_RESIZE|SPANCALC_RENDER);
sheet_update_zoom_controls (sheet);
}
......
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