Commit 547a0fe4 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Take a sheet argument. All callers changed. Fixes #577675.

2009-04-02  Morten Welinder  <terra@gnome.org>

	* src/ranges.c (range_init_full_sheet): Take a sheet argument.
	All callers changed.  Fixes #577675.


svn path=/trunk/; revision=17283
parent cb51e5e3
2009-04-02 Morten Welinder <terra@gnome.org>
* src/ranges.c (range_init_full_sheet): Take a sheet argument.
All callers changed. Fixes #577675.
2009-04-01 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/wbc-gtk.c (wbcg_sheet_focus): scg might be NULL
......
......@@ -6118,8 +6118,8 @@ excel_read_sheet (BiffQuery *q, GnmXLImporter *importer,
excel_get_xf (esheet, 15));
if (mstyle != NULL) {
GnmRange r;
sheet_style_set_range (esheet->sheet,
range_init_full_sheet (&r), mstyle);
range_init_full_sheet (&r, esheet->sheet);
sheet_style_set_range (esheet->sheet, &r, mstyle);
}
}
......
......@@ -4005,8 +4005,8 @@ xlsx_wb_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
if (NULL != (style = g_hash_table_lookup(state->cell_styles, "0"))) {
GnmRange r;
gnm_style_ref (style);
sheet_style_set_range (state->sheet,
range_init_full_sheet (&r), style);
range_init_full_sheet (&r, state->sheet);
sheet_style_set_range (state->sheet, &r, style);
}
xlsx_parse_rel_by_id (xin, part_id, xlsx_sheet_dtd, xlsx_ns);
......
......@@ -653,8 +653,8 @@ sylk_rtd_f_parse (SylkReader *state, char *str)
} else if (NULL != style) {
if (is_default_style) {
GnmRange r;
sheet_style_apply_range (state->pp.sheet,
range_init_full_sheet (&r), style);
range_init_full_sheet (&r, state->pp.sheet);
sheet_style_apply_range (state->pp.sheet, &r, style);
} else
sheet_style_apply_pos (state->pp.sheet,
state->pp.eval.col, state->pp.eval.row, style);
......
......@@ -2880,7 +2880,7 @@ gnm_expr_top_relocate_sheet (GnmExprTop const *texpr,
rinfo.origin_sheet = (Sheet *)src;
rinfo.target_sheet = (Sheet *)dst;
rinfo.col_offset = rinfo.row_offset = 0;
range_init_full_sheet (&rinfo.origin);
range_init_full_sheet (&rinfo.origin, src);
/* Not sure what sheet to use, but it doesn't seem to matter. */
parse_pos_init_sheet (&rinfo.pos, rinfo.target_sheet);
......
......@@ -519,7 +519,7 @@ gnm_pane_colrow_key_press (SheetControlGUI *scg, GdkEventKey *event,
if (event->state & GDK_SHIFT_MASK) {
if (event->state & GDK_CONTROL_MASK) /* full sheet */
/* TODO : How to handle ctrl-A too ? */
range_init_full_sheet (&target);
range_init_full_sheet (&target, sv->sheet);
else { /* full row */
target.start.col = 0;
target.end.col = gnm_sheet_get_max_cols (sv->sheet) - 1;
......
......@@ -1102,7 +1102,10 @@ item_grid_init (ItemGrid *ig)
ig->selecting = ITEM_GRID_NO_SELECTION;
ig->gc.fill = ig->gc.cell = ig->gc.empty = ig->gc.bound = NULL;
range_init_full_sheet (&ig->bound);
/* We need something at least as big as any sheet. */
ig->bound.start.col = ig->bound.start.row = 0;
ig->bound.end.col = GNM_MAX_COLS - 1;
ig->bound.end.row = GNM_MAX_ROWS - 1;
ig->cursor_timer = 0;
ig->cur_link = NULL;
ig->tip_timer = 0;
......
......@@ -680,7 +680,8 @@ hf_render_info_new (void)
hfi = g_new0 (HFRenderInfo, 1);
hfi->date_time = value_new_float (
datetime_timet_to_serial_raw (time (NULL), NULL));
range_init_full_sheet (&hfi->page_area);
#warning "FIXME: We cannot use NULL here."
range_init_full_sheet (&hfi->page_area, NULL);
hfi->top_repeating.col = 0;
hfi->top_repeating.row = 0;
......
......@@ -33,12 +33,12 @@
#undef RANGE_DEBUG
GnmRange *
range_init_full_sheet (GnmRange *r)
range_init_full_sheet (GnmRange *r, Sheet *sheet)
{
r->start.col = 0;
r->start.row = 0;
r->end.col = G_MAXINT / 2;
r->end.row = G_MAXINT / 2;
r->end.col = gnm_sheet_get_last_col (sheet);
r->end.row = gnm_sheet_get_last_row (sheet);
return r;
}
......
......@@ -58,7 +58,7 @@ guint gnm_range_hash (const GnmRange *r);
#define range_valid(r) ((r)->start.col <= (r)->end.col && \
(r)->start.row <= (r)->end.row)
GnmRange *range_init_full_sheet (GnmRange *r);
GnmRange *range_init_full_sheet (GnmRange *r, Sheet *sheet);
GnmRange *range_init_cols (GnmRange *r, int start_col, int end_col);
GnmRange *range_init_rows (GnmRange *r, int start_row, int end_row);
GnmRange *range_init_rangeref (GnmRange *r, GnmRangeRef const *rr);
......
......@@ -1256,7 +1256,7 @@ sv_selection_walk_step (SheetView *sv, gboolean forward, gboolean horizontal)
if (sv->sheet->is_protected &&
(sv->sheet->protected_allow.select_locked_cells ^
sv->sheet->protected_allow.select_unlocked_cells))
range_init_full_sheet (&bound);
range_init_full_sheet (&bound, sv->sheet);
else if (horizontal)
range_init_rows (&bound, ss->start.row, ss->start.row);
else
......
......@@ -1970,8 +1970,9 @@ sheet_style_get_extent (Sheet const *sheet, GnmRange *res,
/* This could easily be optimized */
data.res = res;
data.most_common_in_cols = most_common_in_cols;
range_init_full_sheet (&r, sheet);
foreach_tile (sheet->style_data->styles,
sheet->tile_top_level, 0, 0, range_init_full_sheet(&r),
sheet->tile_top_level, 0, 0, &r,
cb_style_extent, &data);
}
......
......@@ -142,7 +142,9 @@ sheet_set_direction (Sheet *sheet, gboolean text_is_rtl)
sheet->text_is_rtl = text_is_rtl;
sheet->priv->reposition_objects.col = 0;
sheet_range_calc_spans (sheet, range_init_full_sheet (&r), GNM_SPANCALC_RE_RENDER);
sheet_range_calc_spans (sheet,
range_init_full_sheet (&r, sheet),
GNM_SPANCALC_RE_RENDER);
}
static void
......@@ -648,7 +650,7 @@ gnm_sheet_constructor (GType type,
g_ptr_array_set_size (sheet->rows.info,
COLROW_SEGMENT_INDEX (sheet->max_rows - 1) + 1);
range_init_full_sheet (&sheet->priv->unhidden_region);
range_init_full_sheet (&sheet->priv->unhidden_region, sheet);
sheet_style_init (sheet);
sheet->deps = gnm_dep_container_new (sheet);
......@@ -677,7 +679,7 @@ gnm_sheet_constructor (GType type,
expr_name_perm_add (sheet, "Sheet_Title",
texpr, FALSE);
range_init_full_sheet (&r);
range_init_full_sheet (&r, sheet);
texpr = gnm_expr_top_new_constant (value_new_cellrange_r (sheet, &r));
expr_name_perm_add (sheet, "Print_Area",
texpr, TRUE);
......@@ -1825,7 +1827,7 @@ sheet_get_extent (Sheet const *sheet, gboolean spans_and_merges_extend)
}
GnmRange
sheet_get_nominal_printarea (Sheet const *sheet)
sheet_get_nominal_printarea (Sheet const *sheet)
{
GnmNamedExpr *nexpr;
GnmParsePos pos;
......@@ -1833,7 +1835,7 @@ sheet_get_nominal_printarea (Sheet const *sheet)
GnmRangeRef const *r_ref;
GnmRange print_area;
range_init_full_sheet (&print_area);
range_init_full_sheet (&print_area, sheet);
g_return_val_if_fail (IS_SHEET (sheet), print_area);
......@@ -2194,9 +2196,11 @@ sheet_range_set_text (GnmParsePos const *pos, GnmRange const *r, char const *str
NULL /* TODO : Use edit_pos format ?? */,
workbook_date_conv (pos->sheet->workbook));
if (closure.texpr)
if (closure.texpr) {
range_init_full_sheet (&closure.expr_bound, pos->sheet);
gnm_expr_top_get_boundingbox (closure.texpr,
range_init_full_sheet (&closure.expr_bound));
&closure.expr_bound);
}
/* Store the parsed result creating any cells necessary */
sheet_foreach_cell_in_range (pos->sheet, CELL_ITER_ALL,
......@@ -3268,7 +3272,7 @@ sheet_cells (Sheet *sheet, gboolean comments)
GnmRange r;
GSList *scomments, *ptr;
range_init_full_sheet (&r);
range_init_full_sheet (&r, sheet);
scomments = sheet_objects_get (sheet, &r, CELL_COMMENT_TYPE);
for (ptr = scomments; ptr; ptr = ptr->next) {
GnmComment *c = ptr->data;
......@@ -5041,7 +5045,7 @@ sheet_dup_styles (Sheet const *src, Sheet *dst)
sheet_style_set_auto_pattern_color (
dst, sheet_style_get_auto_pattern_color (src));
styles = sheet_style_get_list (src, range_init_full_sheet (&r));
styles = sheet_style_get_list (src, range_init_full_sheet (&r, src));
sheet_style_set_list (dst, &corner, FALSE, styles);
style_list_free (styles);
}
......
......@@ -249,7 +249,7 @@ static GNM_ACTION_DEF (cb_file_print_area_clear)
GnmRange r;
Sheet *sheet = wbcg_cur_sheet (wbcg);
range_init_full_sheet (&r);
range_init_full_sheet (&r, sheet);
parse_pos_init_sheet (&pp, sheet);
cmd_define_name (WORKBOOK_CONTROL (wbcg), "Print_Area", &pp,
gnm_expr_top_new_constant
......
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