[gnumeric] Use GnmSheetSize, not Sheet, in parsing functions for sheet size.



commit 85dc1abb224f6fd218ddc8657c70be025f11d145
Author: Morten Welinder <terra gnome org>
Date:   Mon Apr 27 14:37:23 2009 -0400

    Use GnmSheetSize, not Sheet, in parsing functions for sheet size.
---
 ChangeLog                            |   14 +++++
 NEWS                                 |    1 +
 plugins/applix/applix-read.c         |   42 ++++++--------
 plugins/excel/xlsx-read.c            |   12 ++--
 plugins/fn-lookup/functions.c        |    3 +-
 plugins/openoffice/openoffice-read.c |    7 ++-
 plugins/sc/sc.c                      |    9 ++-
 src/expr-name.c                      |    2 +-
 src/parse-util.c                     |  108 ++++++++++++++++-----------------
 src/parse-util.h                     |    8 +-
 src/position.c                       |   56 +++++++++++++----
 src/position.h                       |   11 +++-
 src/print.c                          |    2 +-
 src/ranges.c                         |    6 +-
 src/ranges.h                         |    2 +-
 src/workbook.c                       |   14 +++++
 src/workbook.h                       |    2 +
 src/xml-io.c                         |   12 ++--
 src/xml-sax-read.c                   |   23 +++-----
 19 files changed, 195 insertions(+), 139 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c277677..edd1e19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2009-04-27  Morten Welinder  <terra gnome org>
 
+	* src/position.c (gnm_rangeref_normalize_pp): New function
+	extracted from gnm_rangeref_normalize.
+
+	* src/parse-util.c (col_parse, row_parse, cellpos_parse,
+	cellref_parse, cellref_a1_get, r1c1_get_index, cellref_r1c1_get):
+	Change from Sheet argument to GnmSheetSize argument.  All callers
+	changed.
+	(std_sheet_name_quote): Eliminate the use of MAGIC_MAX_SHEET.
+	(rangeref_as_string): Use gnm_rangeref_normalize_pp.  Fixes
+	#580360.
+
+	src/ranges.c (range_parse): Change from Sheet argument to
+	GnmSheetSize argument.  All callers changed.
+
 	* src/sheet.c (gnm_sheet_get_size): New function replacing
 	gnm_sheet_get_max_cols and gnm_sheet_get_max_rows.  Turn those
 	into macros.
diff --git a/NEWS b/NEWS
index 9c9d4b5..ceb0b01 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Morten:
 	* Fix xls save problem with sheets that are too big for the format.
 	* Fix global-name .gnumeric warning.  [#580227]
 	* Fix tooltip positioning.  [#580358]
+	* Fix xlst export problem.  [#580360]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.6
diff --git a/plugins/applix/applix-read.c b/plugins/applix/applix-read.c
index a334e53..5571707 100644
--- a/plugins/applix/applix-read.c
+++ b/plugins/applix/applix-read.c
@@ -170,6 +170,11 @@ applix_parse_value (char *buf, char **follow)
 
 /* A..Z, AA..ZZ */
 #define APPLIX_SHEET_MAX_COLS 702
+#define APPLIX_SHEET_MAX_ROWS 65536
+
+static const GnmSheetSize applix_sheet_size = {
+  APPLIX_SHEET_MAX_COLS, APPLIX_SHEET_MAX_ROWS
+};
 
 static gboolean
 valid_col (Sheet const *sheet, int c)
@@ -194,23 +199,13 @@ valid_cellpos (Sheet const *sheet, const GnmCellPos *cpos)
 static char const *
 applix_col_parse (char const *str, int *res, unsigned char *relative)
 {
-	char const *ptr, *start = str;
-	int col = -1;
-
-	if (!(*relative = (*start != '$')))
-		start++;
-
-	for (ptr = start; col < APPLIX_SHEET_MAX_COLS ; ptr++)
-		if (('a' <= *ptr && *ptr <= 'z'))
-			col = 26 * (col + 1) + (*ptr - 'a');
-		else if (('A' <= *ptr && *ptr <= 'Z'))
-			col = 26 * (col + 1) + (*ptr - 'A');
-		else if (ptr != start) {
-			*res = col;
-			return ptr;
-		} else
-			return NULL;
-	return NULL;
+	return col_parse (str, &applix_sheet_size, res, relative);
+}
+
+static char const *
+applix_row_parse (char const *str, int *res, unsigned char *relative)
+{
+	return row_parse (str, &applix_sheet_size, res, relative);
 }
 
 static char const *
@@ -223,8 +218,7 @@ applix_cellpos_parse (char const *cell_str, Sheet const *sheet,
 	if (!cell_str)
 		return NULL;
 
-	cell_str = row_parse (cell_str, sheet,
-			      &res->row, &dummy_relative);
+	cell_str = applix_row_parse (cell_str, &res->row, &dummy_relative);
 	if (!cell_str)
 		return NULL;
 
@@ -272,10 +266,10 @@ applix_rangeref_parse (GnmRangeRef *res, char const *start, GnmParsePos const *p
 	if (ptr == NULL)
 		return start; /* TODO error unknown sheet */
 	if (*ptr == ':') ptr++;
-	tmp1 = col_parse (ptr, pp->sheet, &res->a.col, &res->a.col_relative);
+	tmp1 = applix_col_parse (ptr, &res->a.col, &res->a.col_relative);
 	if (!tmp1)
 		return start;
-	tmp2 = row_parse (tmp1, pp->sheet, &res->a.row, &res->a.row_relative);
+	tmp2 = applix_row_parse (tmp1, &res->a.row, &res->a.row_relative);
 	if (!tmp2)
 		return start;
 	if (res->a.col_relative)
@@ -292,10 +286,10 @@ applix_rangeref_parse (GnmRangeRef *res, char const *start, GnmParsePos const *p
 	if (ptr == NULL)
 		return start; /* TODO error unknown sheet */
 	if (*ptr == ':') ptr++;
-	tmp1 = col_parse (ptr, pp->sheet, &res->b.col, &res->b.col_relative);
+	tmp1 = applix_col_parse (ptr, &res->b.col, &res->b.col_relative);
 	if (!tmp1)
 		return start;
-	tmp2 = row_parse (tmp1, pp->sheet, &res->b.row, &res->b.row_relative);
+	tmp2 = applix_row_parse (tmp1, &res->b.row, &res->b.row_relative);
 	if (!tmp2)
 		return start;
 	if (res->b.col_relative)
@@ -1070,7 +1064,7 @@ applix_read_view (ApplixReadState *state, unsigned char *buffer)
 			unsigned char dummy;
 
 			do {
-				ptr = col_parse (tmp = ptr + 1, sheet, &col, &dummy);
+				ptr = applix_col_parse (tmp = ptr + 1, &col, &dummy);
 				if (!ptr || *ptr != ':')
 					return applix_parse_error (state, "Invalid column");
 				width = a_strtol (tmp = ptr + 1, (char **)&ptr);
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 228c0f0..7dc8514 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -480,7 +480,7 @@ attr_pos (GsfXMLIn *xin, xmlChar const **attrs,
 	if (strcmp (attrs[0], target))
 		return FALSE;
 
-	end = cellpos_parse (attrs[1], state->sheet, &tmp, TRUE);
+	end = cellpos_parse (attrs[1], gnm_sheet_get_size (state->sheet), &tmp, TRUE);
 	if (NULL == end || *end != '\0')
 		return xlsx_warning (xin,
 			_("Invalid cell position '%s' for attribute %s"),
@@ -503,7 +503,7 @@ attr_range (GsfXMLIn *xin, xmlChar const **attrs,
 	if (strcmp (attrs[0], target))
 		return FALSE;
 
-	if (!range_parse (res, attrs[1], state->sheet))
+	if (!range_parse (res, attrs[1], gnm_sheet_get_size (state->sheet)))
 		xlsx_warning (xin, _("Invalid range '%s' for attribute %s"),
 			attrs[1], target);
 	return TRUE;
@@ -844,7 +844,7 @@ xlsx_parse_sqref (GsfXMLIn *xin, xmlChar const *refs)
 	GSList	 *res = NULL;
 
 	while (NULL != refs && *refs) {
-		if (NULL == (tmp = cellpos_parse (refs, state->sheet, &r.start, FALSE))) {
+		if (NULL == (tmp = cellpos_parse (refs, gnm_sheet_get_size (state->sheet), &r.start, FALSE))) {
 			xlsx_warning (xin, "unable to parse reference list '%s'", refs);
 			return res;
 		}
@@ -853,7 +853,7 @@ xlsx_parse_sqref (GsfXMLIn *xin, xmlChar const *refs)
 		if (*refs == '\0' || *refs == ' ')
 			r.end = r.start;
 		else if (*refs != ':' ||
-			 NULL == (tmp = cellpos_parse (refs + 1, state->sheet, &r.end, FALSE))) {
+			 NULL == (tmp = cellpos_parse (refs + 1, gnm_sheet_get_size (state->sheet), &r.end, FALSE))) {
 			xlsx_warning (xin, "unable to parse reference list '%s'", refs);
 			return res;
 		}
@@ -3553,13 +3553,13 @@ xlsx_CT_Selection (GsfXMLIn *xin, xmlChar const **attrs)
 		return;
 
 	for (i = 0 ; NULL != refs && *refs ; i++) {
-		if (NULL == (refs = cellpos_parse (refs, state->sheet, &r.start, FALSE)))
+		if (NULL == (refs = cellpos_parse (refs, gnm_sheet_get_size (state->sheet), &r.start, FALSE)))
 			return;
 
 		if (*refs == '\0' || *refs == ' ')
 			r.end = r.start;
 		else if (*refs != ':' ||
-			 NULL == (refs = cellpos_parse (refs + 1, state->sheet, &r.end, FALSE)))
+			 NULL == (refs = cellpos_parse (refs + 1, gnm_sheet_get_size (state->sheet), &r.end, FALSE)))
 			return;
 
 		if (i == 0)
diff --git a/plugins/fn-lookup/functions.c b/plugins/fn-lookup/functions.c
index 669de9f..9b26ce5 100644
--- a/plugins/fn-lookup/functions.c
+++ b/plugins/fn-lookup/functions.c
@@ -1354,7 +1354,8 @@ gnumeric_columnnumber (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 	char const *name = value_peek_string (args[0]);
 	int colno;
 	unsigned char relative;
-	char const *after = col_parse (name, ei->pos->sheet,
+	char const *after = col_parse (name,
+				       gnm_sheet_get_size (ei->pos->sheet),
 				       &colno, &relative);
 
 	if (after == NULL || *after)
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index e6fd077..556d9aa 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -786,6 +786,7 @@ static char const *
 oo_cellref_parse (GnmCellRef *ref, char const *start, GnmParsePos const *pp)
 {
 	char const *tmp1, *tmp2, *ptr = start;
+	GnmSheetSize const *ss;
 
 	if (*ptr != '.') {
 		char *name, *accum;
@@ -852,10 +853,12 @@ two_quotes :
 		ref->sheet = NULL;
 	}
 
-	tmp1 = col_parse (ptr, pp->sheet, &ref->col, &ref->col_relative);
+	ss = gnm_sheet_get_size (pp->sheet);
+
+	tmp1 = col_parse (ptr, ss, &ref->col, &ref->col_relative);
 	if (!tmp1)
 		return start;
-	tmp2 = row_parse (tmp1, pp->sheet, &ref->row, &ref->row_relative);
+	tmp2 = row_parse (tmp1, ss, &ref->row, &ref->row_relative);
 	if (!tmp2)
 		return start;
 
diff --git a/plugins/sc/sc.c b/plugins/sc/sc.c
index 6236af4..1e7f543 100644
--- a/plugins/sc/sc.c
+++ b/plugins/sc/sc.c
@@ -305,13 +305,15 @@ sc_rangeref_parse (GnmRangeRef *res, char const *start, GnmParsePos const *pp,
 		   G_GNUC_UNUSED GnmConventions const *convs)
 {
 	char const *ptr = start, *tmp1, *tmp2;
+	GnmSheetSize const *ss;
 
 	g_return_val_if_fail (start != NULL, start);
 	g_return_val_if_fail (pp != NULL, start);
 
+	ss = gnm_sheet_get_size (pp->sheet);
+
 	res->a.sheet = NULL;
-	tmp1 = col_parse (ptr, pp->sheet,
-			  &res->a.col, &res->a.col_relative);
+	tmp1 = col_parse (ptr, ss, &res->a.col, &res->a.col_relative);
 	if (!tmp1)
 		return start;
 	tmp2 = sc_row_parse (tmp1, pp->sheet, &res->a.row, &res->a.row_relative);
@@ -328,8 +330,7 @@ sc_rangeref_parse (GnmRangeRef *res, char const *start, GnmParsePos const *pp,
 		return tmp2;
 
 	start = tmp2;
-	tmp1 = col_parse (start+1, pp->sheet,
-			  &res->b.col, &res->b.col_relative);
+	tmp1 = col_parse (start+1, ss, &res->b.col, &res->b.col_relative);
 	if (!tmp1)
 		return start;
 	tmp2 = sc_row_parse (tmp1, pp->sheet, &res->b.row, &res->b.row_relative);
diff --git a/src/expr-name.c b/src/expr-name.c
index 44b4b67..0b606f4 100644
--- a/src/expr-name.c
+++ b/src/expr-name.c
@@ -52,7 +52,7 @@ expr_name_validate (const char *name, Sheet *sheet)
 		return FALSE;
 
 	/* What about R1C1?  */
-	if (cellpos_parse (name, sheet, &cp, TRUE))
+	if (cellpos_parse (name, gnm_sheet_get_size (sheet), &cp, TRUE))
 		return FALSE;
 
 	/* Hmm...   Now what?  */
diff --git a/src/parse-util.c b/src/parse-util.c
index 5f96bde..15370e5 100644
--- a/src/parse-util.c
+++ b/src/parse-util.c
@@ -47,12 +47,6 @@
 #include <glib.h>
 #include <string.h>
 
-/*
- * This constant should not escape this file.  It represents a sheet whose
- * dimensions are maximal in all directions.
- */
-#define MAGIC_MAX_SHEET ((Sheet*)GUINT_TO_POINTER(1))
-
 static void
 col_name_internal (GString *target, int col)
 {
@@ -116,14 +110,12 @@ cols_name (int start_col, int end_col)
 }
 
 char const *
-col_parse (char const *str, Sheet const *sheet,
+col_parse (char const *str, GnmSheetSize const *ss,
 	   int *res, unsigned char *relative)
 {
 	char const *ptr, *start = str;
 	int col = -1;
-	int max = (sheet == MAGIC_MAX_SHEET)
-		? GNM_MAX_COLS
-		: gnm_sheet_get_max_cols (sheet);
+	int max = ss->max_cols;
 
 	if (!(*relative = (*start != '$')))
 		start++;
@@ -180,14 +172,12 @@ rows_name (int start_row, int end_row)
 }
 
 char const *
-row_parse (char const *str, Sheet const *sheet,
+row_parse (char const *str, GnmSheetSize const *ss,
 	   int *res, unsigned char *relative)
 {
 	char const *end, *ptr = str;
 	long int row;
-	int max = (sheet == MAGIC_MAX_SHEET)
-		? GNM_MAX_ROWS
-		: gnm_sheet_get_max_rows (sheet);
+	int max = ss->max_rows;
 
 	if (!(*relative = (*ptr != '$')))
 		ptr++;
@@ -305,11 +295,14 @@ rangeref_as_string (GnmConventionsOut *out, GnmRangeRef const *ref)
 {
 	GnmRange r;
 	GString *target = out->accum;
-	GnmEvalPos ep;
 	Sheet *start_sheet, *end_sheet;
+	GnmSheetSize const *end_ss;
+
+	gnm_rangeref_normalize_pp (ref, out->pp, &start_sheet, &end_sheet, &r);
 
-	eval_pos_init_pos (&ep, out->pp->sheet, &out->pp->eval);
-	gnm_rangeref_normalize (ref, &ep, &start_sheet, &end_sheet, &r);
+	end_ss = end_sheet
+		? gnm_sheet_get_size (end_sheet)
+		: workbook_get_sheet_size (out->pp->wb);
 
 	if (ref->a.sheet) {
 		if (NULL != out->pp->wb && ref->a.sheet->workbook != out->pp->wb) {
@@ -334,14 +327,14 @@ rangeref_as_string (GnmConventionsOut *out, GnmRangeRef const *ref)
 
 	if (out->convs->r1c1_addresses) { /* R1C1 handler */
 		/* be sure to use else if so that a1:iv65535 does not vanish */
-		if (r.start.col == 0 && r.end.col == gnm_sheet_get_last_col (end_sheet)) {
+		if (r.start.col == 0 && r.end.col == end_ss->max_cols - 1) {
 			r1c1_add_index (target, 'R', ref->a.row, ref->a.row_relative);
 			if (ref->a.row != ref->b.row ||
 			    ref->a.row_relative != ref->b.row_relative) {
 				g_string_append_c (target, ':');
 				r1c1_add_index (target, 'R', ref->b.row, ref->b.row_relative);
 			}
-		} else if (r.start.row == 0 && r.end.row == gnm_sheet_get_last_row (end_sheet)) {
+		} else if (r.start.row == 0 && r.end.row == end_ss->max_rows - 1) {
 			r1c1_add_index (target, 'C', ref->a.col, ref->a.col_relative);
 			if (ref->a.col != ref->b.col ||
 			    ref->a.col_relative != ref->b.col_relative) {
@@ -362,7 +355,7 @@ rangeref_as_string (GnmConventionsOut *out, GnmRangeRef const *ref)
 		}
 	} else {
 		/* be sure to use else if so that a1:iv65535 does not vanish */
-		if (r.start.col == 0 && r.end.col == gnm_sheet_get_last_col (end_sheet)) {
+		if (r.start.col == 0 && r.end.col == end_ss->max_cols - 1) {
 			if (!ref->a.row_relative)
 				g_string_append_c (target, '$');
 			row_name_internal (target, r.start.row);
@@ -370,7 +363,7 @@ rangeref_as_string (GnmConventionsOut *out, GnmRangeRef const *ref)
 			if (!ref->b.row_relative)
 				g_string_append_c (target, '$');
 			row_name_internal (target, r.end.row);
-		} else if (r.start.row == 0 && r.end.row == gnm_sheet_get_last_row (end_sheet)) {
+		} else if (r.start.row == 0 && r.end.row == end_ss->max_rows - 1) {
 			if (!ref->a.col_relative)
 				g_string_append_c (target, '$');
 			col_name_internal (target, r.start.col);
@@ -418,11 +411,9 @@ gnm_1_0_rangeref_as_string (GnmConventionsOut *out, GnmRangeRef const *ref)
 {
 	GnmRange r;
 	GString *target = out->accum;
-	GnmEvalPos ep;
 	Sheet *start_sheet, *end_sheet;
 
-	eval_pos_init_pos (&ep, out->pp->sheet, &out->pp->eval);
-	gnm_rangeref_normalize (ref, &ep, &start_sheet, &end_sheet, &r);
+	gnm_rangeref_normalize_pp (ref, out->pp, &start_sheet, &end_sheet, &r);
 
 	if (ref->a.sheet) {
 		if (NULL != out->pp->wb && ref->a.sheet->workbook != out->pp->wb) {
@@ -467,7 +458,7 @@ gnm_1_0_rangeref_as_string (GnmConventionsOut *out, GnmRangeRef const *ref)
 }
 
 static char const *
-cellref_a1_get (GnmCellRef *out, Sheet const *sheet,
+cellref_a1_get (GnmCellRef *out, GnmSheetSize const *ss,
 		char const *in, GnmCellPos const *pos)
 {
 	int col;
@@ -476,11 +467,11 @@ cellref_a1_get (GnmCellRef *out, Sheet const *sheet,
 	g_return_val_if_fail (in != NULL, NULL);
 	g_return_val_if_fail (out != NULL, NULL);
 
-	in = col_parse (in, sheet, &col, &out->col_relative);
+	in = col_parse (in, ss, &col, &out->col_relative);
 	if (!in)
 		return NULL;
 
-	in = row_parse (in, sheet, &row, &out->row_relative);
+	in = row_parse (in, ss, &row, &out->row_relative);
 	if (!in)
 		return NULL;
 
@@ -502,7 +493,7 @@ cellref_a1_get (GnmCellRef *out, Sheet const *sheet,
 
 /* skip first character (which was R or C) */
 static char const *
-r1c1_get_index (char const *str, Sheet const *sheet,
+r1c1_get_index (char const *str, GnmSheetSize const *ss,
 		int *num, unsigned char *relative, gboolean is_col)
 {
 	char *end;
@@ -532,7 +523,8 @@ r1c1_get_index (char const *str, Sheet const *sheet,
 			return NULL;
 		return end + 1;
 	} else {
-		if (*num <= 0 || *num > colrow_max (is_col, sheet))
+		int max = is_col ? ss->max_cols : ss->max_rows;
+		if (*num <= 0 || *num > max)
 			return NULL;
 		(*num)--;
 	}
@@ -540,19 +532,19 @@ r1c1_get_index (char const *str, Sheet const *sheet,
 }
 
 static char const *
-cellref_r1c1_get (GnmCellRef *out, Sheet const *sheet,
+cellref_r1c1_get (GnmCellRef *out, GnmSheetSize const *ss,
 		  char const *in, GnmCellPos const *pos)
 {
 	out->sheet = NULL;
 	if (*in != 'R' && *in != 'r')
 		return NULL;
-	if (NULL == (in = r1c1_get_index (in, sheet,
+	if (NULL == (in = r1c1_get_index (in, ss,
 					  &out->row, &out->row_relative,
 					  FALSE)))
 		return NULL;
 	if (*in != 'C' && *in != 'c')
 		return NULL;
-	if (NULL == (in = r1c1_get_index (in, sheet,
+	if (NULL == (in = r1c1_get_index (in, ss,
 					  &out->col, &out->col_relative,
 					  TRUE)))
 		return NULL;
@@ -574,7 +566,7 @@ cellref_r1c1_get (GnmCellRef *out, Sheet const *sheet,
  * Return value: a pointer to the character following the cellref.
  **/
 char const *
-cellref_parse (GnmCellRef *out, Sheet const *sheet,
+cellref_parse (GnmCellRef *out, GnmSheetSize const *ss,
 	       char const *in, GnmCellPos const *pos)
 {
 	char const *res;
@@ -582,10 +574,10 @@ cellref_parse (GnmCellRef *out, Sheet const *sheet,
 	g_return_val_if_fail (in != NULL, NULL);
 	g_return_val_if_fail (out != NULL, NULL);
 
-	res = cellref_a1_get (out, sheet, in, pos);
+	res = cellref_a1_get (out, ss, in, pos);
 	if (res != NULL)
 		return res;
-	return cellref_r1c1_get (out, sheet, in, pos);
+	return cellref_r1c1_get (out, ss, in, pos);
 }
 
 /****************************************************************************/
@@ -656,18 +648,16 @@ cell_name (GnmCell const *cell)
  * (In the strict case, that would be a pointer to the \0 or NULL.)
  */
 char const *
-cellpos_parse (char const *cell_str, Sheet const *sheet,
+cellpos_parse (char const *cell_str, GnmSheetSize const *ss,
 	       GnmCellPos *res, gboolean strict)
 {
 	unsigned char dummy_relative;
 
-	cell_str = col_parse (cell_str, sheet,
-			      &res->col, &dummy_relative);
+	cell_str = col_parse (cell_str, ss, &res->col, &dummy_relative);
 	if (!cell_str)
 		return NULL;
 
-	cell_str = row_parse (cell_str, sheet,
-			      &res->row, &dummy_relative);
+	cell_str = row_parse (cell_str, ss, &res->row, &dummy_relative);
 	if (!cell_str)
 		return NULL;
 
@@ -955,7 +945,7 @@ r1c1_rangeref_parse (GnmRangeRef *res, char const *ptr, GnmParsePos const *pp)
 	char const *tmp;
 
 	if (*ptr == 'R' || *ptr == 'r') {
-		ptr = r1c1_get_index (ptr, pp->sheet,
+		ptr = r1c1_get_index (ptr, gnm_sheet_get_size (pp->sheet),
 				      &res->a.row, &res->a.row_relative,
 				      FALSE);
 		if (!ptr)
@@ -970,14 +960,14 @@ r1c1_rangeref_parse (GnmRangeRef *res, char const *ptr, GnmParsePos const *pp)
 			res->b.col = gnm_sheet_get_last_col (res->b.sheet);
 			if (ptr[0] != ':' || (ptr[1] != 'R' && ptr[1] != 'r'))
 				return ptr;
-			tmp = r1c1_get_index (ptr+1, res->b.sheet,
+			tmp = r1c1_get_index (ptr+1, gnm_sheet_get_size (res->b.sheet),
 					      &res->b.row, &res->b.row_relative,
 					      FALSE);
 			if (!tmp)
 				return ptr; /* fallback to just the initial R */
 			return tmp;
 		} else {
-			ptr = r1c1_get_index (ptr, pp->sheet,
+			ptr = r1c1_get_index (ptr, gnm_sheet_get_size (pp->sheet),
 					      &res->a.col, &res->a.col_relative,
 					      TRUE);
 			if (!ptr)
@@ -986,13 +976,16 @@ r1c1_rangeref_parse (GnmRangeRef *res, char const *ptr, GnmParsePos const *pp)
 
 		res->b = res->a;
 		if (ptr[0] != ':' || (ptr[1] != 'R' && ptr[1] != 'r') ||
-		    NULL == (tmp = r1c1_get_index (ptr+1, res->b.sheet, &res->b.row, &res->b.row_relative, FALSE)) ||
+		    NULL == (tmp = r1c1_get_index (ptr+1, gnm_sheet_get_size (res->b.sheet),
+						   &res->b.row, &res->b.row_relative, FALSE)) ||
 		    (*tmp != 'C' && *tmp != 'c') ||
-		    NULL == (tmp = r1c1_get_index (tmp, res->b.sheet, &res->b.col, &res->b.col_relative, FALSE)))
+		    NULL == (tmp = r1c1_get_index (tmp, gnm_sheet_get_size (res->b.sheet),
+						   &res->b.col, &res->b.col_relative, FALSE)))
 			return ptr;
 		return tmp;
 	} else if (*ptr == 'C' || *ptr == 'c') {
-		if (NULL == (ptr = r1c1_get_index (ptr, pp->sheet, &res->a.col, &res->a.col_relative, TRUE)))
+		if (NULL == (ptr = r1c1_get_index (ptr, gnm_sheet_get_size (pp->sheet),
+						   &res->a.col, &res->a.col_relative, TRUE)))
 			return NULL;
 		if (g_ascii_isalpha (*ptr))
 			return NULL;
@@ -1003,7 +996,7 @@ r1c1_rangeref_parse (GnmRangeRef *res, char const *ptr, GnmParsePos const *pp)
 		res->b.row = gnm_sheet_get_last_row (res->b.sheet);
 		if (ptr[0] != ':' || (ptr[1] != 'C' && ptr[1] != 'c'))
 			return ptr;
-		tmp = r1c1_get_index (ptr, res->b.sheet,
+		tmp = r1c1_get_index (ptr, gnm_sheet_get_size (res->b.sheet),
 				      &res->b.col, &res->b.col_relative,
 				      TRUE);
 		if (!tmp)
@@ -1068,14 +1061,14 @@ rangeref_parse (GnmRangeRef *res, char const *start, GnmParsePos const *pp,
 	a_sheet = eval_sheet (res->a.sheet, pp->sheet);
 	b_sheet = eval_sheet (res->b.sheet, a_sheet);
 
-	tmp1 = col_parse (ptr, a_sheet,
+	tmp1 = col_parse (ptr, gnm_sheet_get_size (a_sheet),
 			  &res->a.col, &res->a.col_relative);
 	if (tmp1 == NULL) { /* check for row only ref 2:3 */
-		tmp1 = row_parse (ptr, a_sheet,
+		tmp1 = row_parse (ptr, gnm_sheet_get_size (a_sheet),
 				  &res->a.row, &res->a.row_relative);
 		if (!tmp1 || *tmp1++ != ':') /* row only requires : even for singleton */
 			return start;
-		tmp2 = row_parse (tmp1, b_sheet,
+		tmp2 = row_parse (tmp1, gnm_sheet_get_size (b_sheet),
 				  &res->b.row, &res->b.row_relative);
 		if (!tmp2)
 			return start;
@@ -1089,12 +1082,12 @@ rangeref_parse (GnmRangeRef *res, char const *start, GnmParsePos const *pp,
 		return tmp2;
 	}
 
-	tmp2 = row_parse (tmp1, a_sheet,
+	tmp2 = row_parse (tmp1, gnm_sheet_get_size (a_sheet),
 			  &res->a.row, &res->a.row_relative);
 	if (tmp2 == NULL) { /* check for col only ref B:C or R1C1 style */
 		if (*tmp1++ != ':') /* col only requires : even for singleton */
 			return start;
-		tmp2 = col_parse (tmp1, a_sheet,
+		tmp2 = col_parse (tmp1, gnm_sheet_get_size (a_sheet),
 				  &res->b.col, &res->b.col_relative);
 		if (!tmp2)
 			return start;
@@ -1117,11 +1110,11 @@ rangeref_parse (GnmRangeRef *res, char const *start, GnmParsePos const *pp,
 	if (*ptr != ':')
 		goto singleton;
 
-	tmp1 = col_parse (ptr+1, b_sheet,
+	tmp1 = col_parse (ptr+1, gnm_sheet_get_size (b_sheet),
 			  &res->b.col, &res->b.col_relative);
 	if (!tmp1)
 		goto singleton;	/* strange, but valid singleton */
-	tmp2 = row_parse (tmp1, b_sheet,
+	tmp2 = row_parse (tmp1, gnm_sheet_get_size (b_sheet),
 			  &res->b.row, &res->b.row_relative);
 	if (!tmp2)
 		goto singleton;	/* strange, but valid singleton */
@@ -1222,6 +1215,9 @@ std_sheet_name_quote (GnmConventions const *convs,
 	}
 
 	if (ndigits > 0) {
+		static const GnmSheetSize max_size = {
+			GNM_MAX_COLS, GNM_MAX_ROWS
+		};
 		/*
 		 * Excel also quotes things that look like cell references.
 		 * Precisely, check for a match against
@@ -1232,13 +1228,13 @@ std_sheet_name_quote (GnmConventions const *convs,
 
 		int col, row;
 		unsigned char col_relative, row_relative;
-		if (!col_parse (str, MAGIC_MAX_SHEET, &col, &col_relative))
+		if (!col_parse (str, &max_size, &col, &col_relative))
 			goto unquoted;
 
 		p = str + nletters;
 		while (*p == '0')
 			p++, ndigits--;
-		if (!row_parse (p, MAGIC_MAX_SHEET, &row, &row_relative))
+		if (!row_parse (p, &max_size, &row, &row_relative))
 			goto unquoted;
 
 		goto quoted;
diff --git a/src/parse-util.h b/src/parse-util.h
index d7a1384..f9bad48 100644
--- a/src/parse-util.h
+++ b/src/parse-util.h
@@ -9,21 +9,21 @@ G_BEGIN_DECLS
 
 char const *col_name  (int col);
 char const *cols_name (int start_col, int end_col);
-char const *col_parse (char const *str, Sheet const *sheet,
+char const *col_parse (char const *str, GnmSheetSize const *ss,
 		       int *res, unsigned char *relative);
 
 char const *row_name  (int row);
 char const *rows_name (int start_row, int end_col);
-char const *row_parse (char const *str, Sheet const *sheet,
+char const *row_parse (char const *str, GnmSheetSize const *ss,
 		       int *res, unsigned char *relative);
 
 char const *cellpos_as_string	(GnmCellPos const *pos);
-char const *cellpos_parse	(char const *cell_str, Sheet const *sheet,
+char const *cellpos_parse	(char const *cell_str, GnmSheetSize const *ss,
 				 GnmCellPos *res, gboolean strict);
 void        cellref_as_string   (GnmConventionsOut *out,
 				 GnmCellRef const *cell_ref,
 				 gboolean no_sheetname);
-char const *cellref_parse	(GnmCellRef *out, Sheet const *sheet,
+char const *cellref_parse	(GnmCellRef *out, GnmSheetSize const *ss,
 				 char const *in, GnmCellPos const *pos);
 
 void        rangeref_as_string  (GnmConventionsOut *out,
diff --git a/src/position.c b/src/position.c
index b380026..7f11769 100644
--- a/src/position.c
+++ b/src/position.c
@@ -30,6 +30,7 @@
 #include "cell.h"
 #include "value.h"
 #include "ranges.h"
+#include "workbook.h"
 
 
 GnmEvalPos *
@@ -288,20 +289,20 @@ gnm_cellref_get_row (GnmCellRef const *ref, GnmEvalPos const *ep)
 	return ref->row;
 }
 
-void
-gnm_cellpos_init_cellref (GnmCellPos *res, GnmCellRef const *cell_ref,
-			  GnmCellPos const *pos, Sheet const *base_sheet)
+static void
+gnm_cellpos_init_cellref_ss (GnmCellPos *res, GnmCellRef const *cell_ref,
+			     GnmCellPos const *pos, GnmSheetSize const *base_ss)
 {
-	Sheet const *sheet;
+	GnmSheetSize const *ss;
 
 	g_return_if_fail (cell_ref != NULL);
 	g_return_if_fail (res != NULL);
 
-	sheet = eval_sheet (cell_ref->sheet, base_sheet);
+	ss = cell_ref->sheet ? gnm_sheet_get_size (cell_ref->sheet) : base_ss;
 
 	if (cell_ref->col_relative) {
 		int col = cell_ref->col + pos->col;
-		int max = gnm_sheet_get_max_cols (sheet);
+		int max = ss->max_cols;
 		if (col < 0)
 			col += max;
 		else if (col >= max)
@@ -312,7 +313,7 @@ gnm_cellpos_init_cellref (GnmCellPos *res, GnmCellRef const *cell_ref,
 
 	if (cell_ref->row_relative) {
 		int row = cell_ref->row + pos->row;
-		int max = gnm_sheet_get_max_rows (sheet);
+		int max = ss->max_rows;
 		if (row < 0)
 			row += max;
 		else if (row >= max)
@@ -323,6 +324,14 @@ gnm_cellpos_init_cellref (GnmCellPos *res, GnmCellRef const *cell_ref,
 }
 
 void
+gnm_cellpos_init_cellref (GnmCellPos *res, GnmCellRef const *cell_ref,
+			  GnmCellPos const *pos, Sheet const *base_sheet)
+{
+	gnm_cellpos_init_cellref_ss (res, cell_ref, pos,
+				     gnm_sheet_get_size (base_sheet));
+}
+
+void
 gnm_cellref_make_abs (GnmCellRef *dest, GnmCellRef const *src, GnmEvalPos const *ep)
 {
 	GnmCellPos pos;
@@ -397,20 +406,41 @@ gnm_rangeref_dup (GnmRangeRef const *rr)
  *     by converting to absolute coords and handling inversions.
  */
 void
-gnm_rangeref_normalize (GnmRangeRef const *ref, GnmEvalPos const *ep,
-			Sheet **start_sheet, Sheet **end_sheet, GnmRange *dest)
+gnm_rangeref_normalize_pp (GnmRangeRef const *ref, GnmParsePos const *pp,
+			   Sheet **start_sheet, Sheet **end_sheet,
+			   GnmRange *dest)
 {
+	GnmSheetSize const *ss;
+
 	g_return_if_fail (ref != NULL);
-	g_return_if_fail (ep != NULL);
+	g_return_if_fail (pp != NULL);
 
-	*start_sheet = eval_sheet (ref->a.sheet, ep->sheet);
+	*start_sheet = eval_sheet (ref->a.sheet, pp->sheet);
 	*end_sheet   = eval_sheet (ref->b.sheet, *start_sheet);
 
-	gnm_cellpos_init_cellref (&dest->start, &ref->a, &ep->eval, *start_sheet);
-	gnm_cellpos_init_cellref (&dest->end, &ref->b, &ep->eval, *end_sheet);
+	ss = *start_sheet
+		? gnm_sheet_get_size (*start_sheet)
+		: workbook_get_sheet_size (pp->wb);
+	gnm_cellpos_init_cellref_ss (&dest->start, &ref->a, &pp->eval, ss);
+
+	ss = *end_sheet
+		? gnm_sheet_get_size (*end_sheet)
+		: ss;
+	gnm_cellpos_init_cellref_ss (&dest->end, &ref->b, &pp->eval, ss);
+
 	range_normalize (dest);
 }
 
+void
+gnm_rangeref_normalize (GnmRangeRef const *ref, GnmEvalPos const *ep,
+			Sheet **start_sheet, Sheet **end_sheet, GnmRange *dest)
+{
+	GnmParsePos pp;
+
+	parse_pos_init_evalpos (&pp, ep);
+	gnm_rangeref_normalize_pp (ref, &pp, start_sheet, end_sheet, dest);
+}
+
 guint
 gnm_cellpos_hash (GnmCellPos const *key)
 {
diff --git a/src/position.h b/src/position.h
index a17b898..abb5d40 100644
--- a/src/position.h
+++ b/src/position.h
@@ -71,9 +71,14 @@ int         gnm_cellref_get_row	   (GnmCellRef const *cr, GnmEvalPos const *ep);
 gboolean     gnm_rangeref_equal	   (GnmRangeRef const *a, GnmRangeRef const *b);
 guint	     gnm_rangeref_hash	   (GnmRangeRef const *cr);
 GnmRangeRef *gnm_rangeref_dup	   (GnmRangeRef const *cr);
-void         gnm_rangeref_normalize(GnmRangeRef const *rr, GnmEvalPos const *ep,
-				    Sheet **start_sheet, Sheet **end_sheet,
-				    GnmRange *dest);
+void         gnm_rangeref_normalize_pp (GnmRangeRef const *rr,
+					GnmParsePos const *pp,
+					Sheet **start_sheet, Sheet **end_sheet,
+					GnmRange *dest);
+void         gnm_rangeref_normalize (GnmRangeRef const *rr,
+				     GnmEvalPos const *ep,
+				     Sheet **start_sheet, Sheet **end_sheet,
+				     GnmRange *dest);
 
 guint gnm_cellpos_hash		(GnmCellPos const *key);
 gint  gnm_cellpos_equal		(GnmCellPos const *a, GnmCellPos const *b);
diff --git a/src/print.c b/src/print.c
index 5eb55e2..6fc49d3 100644
--- a/src/print.c
+++ b/src/print.c
@@ -874,7 +874,7 @@ compute_sheet_pages_across_then_down (PrintingInstance * pi,
 static gboolean
 load_repeat_range (char const *str, GnmRange *r, Sheet *sheet)
 {
-       return str && range_parse (r, str, sheet);
+	return str && range_parse (r, str, gnm_sheet_get_size (sheet));
 }
 
 /*
diff --git a/src/ranges.c b/src/ranges.c
index fbd4b53..fecdb55 100644
--- a/src/ranges.c
+++ b/src/ranges.c
@@ -128,9 +128,9 @@ range_init (GnmRange *r, int start_col, int start_row,
  * Returns TRUE on success.
  **/
 gboolean
-range_parse (GnmRange *r, char const *text, Sheet const *sheet)
+range_parse (GnmRange *r, char const *text, GnmSheetSize const *ss)
 {
-	text = cellpos_parse (text, sheet, &r->start, FALSE);
+	text = cellpos_parse (text, ss, &r->start, FALSE);
 	if (!text)
 		return FALSE;
 
@@ -142,7 +142,7 @@ range_parse (GnmRange *r, char const *text, Sheet const *sheet)
 	if (*text != ':')
 		return FALSE;
 
-	text = cellpos_parse (text + 1, sheet, &r->end, TRUE);
+	text = cellpos_parse (text + 1, ss, &r->end, TRUE);
 	return text != NULL;
 }
 
diff --git a/src/ranges.h b/src/ranges.h
index a3b6aae..bd6cdd6 100644
--- a/src/ranges.h
+++ b/src/ranges.h
@@ -71,7 +71,7 @@ GnmRange   *range_init_cellpos_size (GnmRange *r, GnmCellPos const *start,
 GnmRange   *range_init              (GnmRange *r, int start_col, int start_row,
 				     int end_col, int end_row);
 gboolean    range_parse 	    (GnmRange *r, char const *text,
-				     Sheet const *sheet);
+				     GnmSheetSize const *ss);
 
 void        range_list_destroy      (GSList *ranges);
 
diff --git a/src/workbook.c b/src/workbook.c
index dc1fc31..438df29 100644
--- a/src/workbook.c
+++ b/src/workbook.c
@@ -1166,6 +1166,20 @@ workbook_set_1904 (Workbook *wb, gboolean base1904)
 	workbook_set_date_conv (wb, date_conv);
 }
 
+GnmSheetSize const *
+workbook_get_sheet_size (Workbook const *wb)
+{
+	if (wb == NULL || workbook_sheet_count (wb) == 0) {
+		static const GnmSheetSize max_size = {
+			GNM_MAX_COLS, GNM_MAX_ROWS
+		};
+
+		return &max_size;
+	}
+
+	return gnm_sheet_get_size (workbook_sheet_by_index (wb, 0));
+}
+
 /* ------------------------------------------------------------------------- */
 
 typedef struct {
diff --git a/src/workbook.h b/src/workbook.h
index ae30cd0..fdb3b1b 100644
--- a/src/workbook.h
+++ b/src/workbook.h
@@ -75,6 +75,8 @@ GODateConventions const *workbook_date_conv (Workbook const *wb);
 void workbook_set_date_conv (Workbook *wb, GODateConventions const *date_conv);
 void workbook_set_1904 (Workbook *wb, gboolean base1904);
 
+GnmSheetSize const *workbook_get_sheet_size (Workbook const *wb);
+
 void workbook_attach_view (WorkbookView *wbv);
 void workbook_detach_view (WorkbookView *wbv);
 
diff --git a/src/xml-io.c b/src/xml-io.c
index 44d2ad3..5021c93 100644
--- a/src/xml-io.c
+++ b/src/xml-io.c
@@ -236,7 +236,7 @@ xml_node_get_cellpos (xmlNodePtr node, char const *name,
 	buf = xml_node_get_cstr (node, name);
 	if (val == NULL)
 		return FALSE;
-	res = cellpos_parse (CXML2C (buf), sheet, val, TRUE) != NULL;
+	res = cellpos_parse (CXML2C (buf), gnm_sheet_get_size (sheet), val, TRUE) != NULL;
 	xmlFree (buf);
 	return res;
 }
@@ -375,7 +375,7 @@ xml_read_names (XmlParseContext *ctxt, xmlNodePtr tree,
 			xmlChar *pos_txt = xml_node_get_cstr (position, NULL);
 			if (pos_txt != NULL) {
 				GnmCellRef tmp;
-				char const *res = cellref_parse (&tmp, sheet, CXML2C (pos_txt), &pp.eval);
+				char const *res = cellref_parse (&tmp, gnm_sheet_get_size (sheet), CXML2C (pos_txt), &pp.eval);
 				if (res != NULL && *res == '\0') {
 					pp.eval.col = tmp.col;
 					pp.eval.row = tmp.row;
@@ -1479,7 +1479,7 @@ xml_read_sheet_filters (XmlParseContext *ctxt, xmlNode const *container)
 		area = xml_node_get_cstr (filter_node, "Area");
 		if (area == NULL)
 			continue;
-		if (range_parse (&r, CXML2C (area), ctxt->sheet)) {
+		if (range_parse (&r, CXML2C (area), gnm_sheet_get_size (ctxt->sheet))) {
 			filter = gnm_filter_new (ctxt->sheet, &r);
 			for (field = filter_node->xmlChildrenNode; field != NULL; field = field->next)
 				if (!xmlIsBlankNode (field))
@@ -1711,7 +1711,7 @@ xml_read_sheet_object (XmlParseContext const *ctxt, xmlNodePtr tree,
 	tmp = (char *) xmlGetProp (tree, (xmlChar *)"ObjectBound");
 	if (tmp != NULL) {
 		GnmRange r;
-		if (range_parse (&r, tmp, ctxt->sheet)) {
+		if (range_parse (&r, tmp, gnm_sheet_get_size (ctxt->sheet))) {
 			/* Patch problems introduced in some 1.7.x versions that stored
 			 * comments in merged cells with the full rectangle of the merged cell
 			 * rather than just the top left corner */
@@ -1770,7 +1770,7 @@ xml_read_merged_regions (XmlParseContext const *ctxt, xmlNodePtr sheet)
 			xmlChar *content = xml_node_get_cstr (region, NULL);
 			GnmRange r;
 			if (content != NULL) {
-				if (range_parse (&r, CXML2C (content), ctxt->sheet))
+				if (range_parse (&r, CXML2C (content), gnm_sheet_get_size (ctxt->sheet)))
 					gnm_sheet_merge_add (ctxt->sheet, &r, FALSE, NULL);
 				xmlFree (content);
 			}
@@ -2202,7 +2202,7 @@ xml_cellregion_read (WorkbookControl *wbc, Sheet *sheet, const char *buffer, int
 			if (!xmlIsBlankNode (l)) {
 				GnmRange r;
 				xmlChar *content = (char *)xmlNodeGetContent (l);
-				if (range_parse (&r, CXML2C (content), ctxt->sheet))
+				if (range_parse (&r, CXML2C (content), gnm_sheet_get_size (ctxt->sheet)))
 					cr->merged = g_slist_prepend (cr->merged,
 								      range_dup (&r));
 				xmlFree (content);
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 7c6bc32..346ca31 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -220,7 +220,7 @@ xml_sax_attr_cellpos (xmlChar const * const *attrs, char const *name, GnmCellPos
 	if (strcmp (CXML2C (attrs[0]), name))
 		return FALSE;
 
-	if (cellpos_parse (CXML2C (attrs[1]), sheet, val, TRUE) == NULL) {
+	if (cellpos_parse (CXML2C (attrs[1]), gnm_sheet_get_size (sheet), val, TRUE) == NULL) {
 		g_warning ("Invalid attribute '%s', expected cellpos, received '%s'",
 			   name, attrs[1]);
 		return FALSE;
@@ -1954,7 +1954,7 @@ xml_sax_merge (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 	GnmRange r;
 	g_return_if_fail (xin->content->len > 0);
 
-	if (range_parse (&r, xin->content->str, state->sheet))
+	if (range_parse (&r, xin->content->str, gnm_sheet_get_size (state->sheet)))
 		gnm_sheet_merge_add (state->sheet, &r, FALSE,
 			GO_CMD_CONTEXT (state->context));
 }
@@ -2051,7 +2051,7 @@ xml_sax_filter_start (GsfXMLIn *xin, xmlChar const **attrs)
 
 	for (i = 0; attrs != NULL && attrs[i] && attrs[i + 1] ; i += 2)
 		if (attr_eq (attrs[i], "Area") &&
-		    range_parse (&r, CXML2C (attrs[i + 1]), state->sheet))
+		    range_parse (&r, CXML2C (attrs[i + 1]), gnm_sheet_get_size (state->sheet)))
 			state->filter = gnm_filter_new (state->sheet, &r);
 	if (NULL == state->filter)
 		gnm_io_warning (state->context, _("Invalid filter, missing Area"));
@@ -2133,7 +2133,7 @@ xml_sax_read_obj (GsfXMLIn *xin, gboolean needs_cleanup,
 
 	for (i = 0; attrs != NULL && attrs[i] && attrs[i + 1] ; i += 2) {
 		if (attr_eq (attrs[i], "ObjectBound"))
-			range_parse (&anchor_r, CXML2C (attrs[i + 1]), state->sheet);
+			range_parse (&anchor_r, CXML2C (attrs[i + 1]), gnm_sheet_get_size (state->sheet));
 		else if (attr_eq (attrs[i], "ObjectOffset") &&
 			4 == sscanf (CXML2C (attrs[i + 1]), "%g %g %g %g",
 				     f_tmp + 0, f_tmp + 1, f_tmp + 2, f_tmp + 3))
@@ -2317,19 +2317,14 @@ handle_delayed_names (XMLSaxParseState *state)
 		GnmExprTop const *texpr;
 		GnmParsePos pp;
 
-		/*
-		 * We need to parse the expression with respect to some
-		 * sheet because sheets may have different sizes.  This
-		 * isn't great, but will have to do for now.
-		 */
-		if (!sheet)
-			sheet = workbook_sheet_by_index (state->wb, 0);
-
 		parse_pos_init (&pp, state->wb, sheet, 0, 0);
 		if (pos_str) {
 			GnmCellRef tmp;
-			char const *rest =
-				cellref_parse (&tmp, sheet, pos_str, &pp.eval);
+			char const *rest;
+			GnmSheetSize const *ss = sheet
+				? gnm_sheet_get_size (sheet)
+				: workbook_get_sheet_size (state->wb);
+			rest = cellref_parse (&tmp, ss, pos_str, &pp.eval);
 			if (rest != NULL && *rest == '\0') {
 				pp.eval.col = tmp.col;
 				pp.eval.row = tmp.row;



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