gnumeric r17283 - in trunk: . plugins/excel plugins/sylk src



Author: mortenw
Date: Thu Apr  2 12:54:07 2009
New Revision: 17283
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17283&view=rev

Log:
2009-04-02  Morten Welinder  <terra gnome org>

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



Modified:
   trunk/ChangeLog
   trunk/plugins/excel/ms-excel-read.c
   trunk/plugins/excel/xlsx-read.c
   trunk/plugins/sylk/sylk.c
   trunk/src/expr.c
   trunk/src/gnm-pane.c
   trunk/src/item-grid.c
   trunk/src/print-info.c
   trunk/src/ranges.c
   trunk/src/ranges.h
   trunk/src/selection.c
   trunk/src/sheet-style.c
   trunk/src/sheet.c
   trunk/src/wbc-gtk-actions.c

Modified: trunk/plugins/excel/ms-excel-read.c
==============================================================================
--- trunk/plugins/excel/ms-excel-read.c	(original)
+++ trunk/plugins/excel/ms-excel-read.c	Thu Apr  2 12:54:07 2009
@@ -6118,8 +6118,8 @@
 			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);
 		}
 	}
 

Modified: trunk/plugins/excel/xlsx-read.c
==============================================================================
--- trunk/plugins/excel/xlsx-read.c	(original)
+++ trunk/plugins/excel/xlsx-read.c	Thu Apr  2 12:54:07 2009
@@ -4005,8 +4005,8 @@
 		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);

Modified: trunk/plugins/sylk/sylk.c
==============================================================================
--- trunk/plugins/sylk/sylk.c	(original)
+++ trunk/plugins/sylk/sylk.c	Thu Apr  2 12:54:07 2009
@@ -653,8 +653,8 @@
 	} 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);

Modified: trunk/src/expr.c
==============================================================================
--- trunk/src/expr.c	(original)
+++ trunk/src/expr.c	Thu Apr  2 12:54:07 2009
@@ -2880,7 +2880,7 @@
 	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);
 

Modified: trunk/src/gnm-pane.c
==============================================================================
--- trunk/src/gnm-pane.c	(original)
+++ trunk/src/gnm-pane.c	Thu Apr  2 12:54:07 2009
@@ -519,7 +519,7 @@
 	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;

Modified: trunk/src/item-grid.c
==============================================================================
--- trunk/src/item-grid.c	(original)
+++ trunk/src/item-grid.c	Thu Apr  2 12:54:07 2009
@@ -1102,7 +1102,10 @@
 
 	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;

Modified: trunk/src/print-info.c
==============================================================================
--- trunk/src/print-info.c	(original)
+++ trunk/src/print-info.c	Thu Apr  2 12:54:07 2009
@@ -680,7 +680,8 @@
 	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;
 

Modified: trunk/src/ranges.c
==============================================================================
--- trunk/src/ranges.c	(original)
+++ trunk/src/ranges.c	Thu Apr  2 12:54:07 2009
@@ -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;
 }
 

Modified: trunk/src/ranges.h
==============================================================================
--- trunk/src/ranges.h	(original)
+++ trunk/src/ranges.h	Thu Apr  2 12:54:07 2009
@@ -58,7 +58,7 @@
 #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);

Modified: trunk/src/selection.c
==============================================================================
--- trunk/src/selection.c	(original)
+++ trunk/src/selection.c	Thu Apr  2 12:54:07 2009
@@ -1256,7 +1256,7 @@
 		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

Modified: trunk/src/sheet-style.c
==============================================================================
--- trunk/src/sheet-style.c	(original)
+++ trunk/src/sheet-style.c	Thu Apr  2 12:54:07 2009
@@ -1970,8 +1970,9 @@
 	/* 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);
 }
 

Modified: trunk/src/sheet.c
==============================================================================
--- trunk/src/sheet.c	(original)
+++ trunk/src/sheet.c	Thu Apr  2 12:54:07 2009
@@ -142,7 +142,9 @@
 
 	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 @@
 	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 @@
 		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 @@
 }
 
 GnmRange
-sheet_get_nominal_printarea	(Sheet const *sheet)
+sheet_get_nominal_printarea (Sheet const *sheet)
 {
 	GnmNamedExpr *nexpr;
 	GnmParsePos pos;
@@ -1833,7 +1835,7 @@
 	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 @@
 		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 @@
 		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_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);
 }

Modified: trunk/src/wbc-gtk-actions.c
==============================================================================
--- trunk/src/wbc-gtk-actions.c	(original)
+++ trunk/src/wbc-gtk-actions.c	Thu Apr  2 12:54:07 2009
@@ -249,7 +249,7 @@
 	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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]