gnumeric r16536 - in branches/gnumeric-1-8: plugins/excel src
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16536 - in branches/gnumeric-1-8: plugins/excel src
- Date: Tue, 29 Apr 2008 16:16:04 +0100 (BST)
Author: mortenw
Date: Tue Apr 29 15:16:03 2008
New Revision: 16536
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16536&view=rev
Log:
More SHEET_MAX_foo updates.
Modified:
branches/gnumeric-1-8/plugins/excel/ms-excel-read.c
branches/gnumeric-1-8/src/sheet-style.c
branches/gnumeric-1-8/src/sheet.c
branches/gnumeric-1-8/src/xml-sax-read.c
Modified: branches/gnumeric-1-8/plugins/excel/ms-excel-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/excel/ms-excel-read.c (original)
+++ branches/gnumeric-1-8/plugins/excel/ms-excel-read.c Tue Apr 29 15:16:03 2008
@@ -270,15 +270,17 @@
excel_cell_fetch (BiffQuery *q, ExcelReadSheet *esheet)
{
unsigned col, row;
+ Sheet *sheet = esheet->sheet;
XL_CHECK_CONDITION_VAL (q->length >= 4, NULL);
col = XL_GETCOL (q);
row = XL_GETROW (q);
- XL_CHECK_CONDITION_VAL (col < SHEET_MAX_COLS && row < SHEET_MAX_ROWS, NULL);
+ XL_CHECK_CONDITION_VAL (col < gnm_sheet_get_max_cols (sheet), NULL);
+ XL_CHECK_CONDITION_VAL (row < gnm_sheet_get_max_rows (sheet), NULL);
- return sheet_cell_fetch (esheet->sheet, col, row);
+ return sheet_cell_fetch (sheet, col, row);
}
static GnmExprTop const *
@@ -1965,19 +1967,21 @@
unsigned col, row;
BiffXFData const *xf;
GnmStyle *mstyle;
+ Sheet *sheet = esheet->sheet;
XL_CHECK_CONDITION_VAL (q->length >= 6, NULL);
col = XL_GETCOL (q);
row = XL_GETROW (q);
xf = excel_get_xf (esheet, GSF_LE_GET_GUINT16 (q->data + 4));
- XL_CHECK_CONDITION_VAL (col < SHEET_MAX_COLS && row < SHEET_MAX_ROWS, xf);
+ XL_CHECK_CONDITION_VAL (col < gnm_sheet_get_max_cols (sheet), xf);
+ XL_CHECK_CONDITION_VAL (row < gnm_sheet_get_max_rows (sheet), xf);
mstyle = excel_get_style_from_xf (esheet, xf);
- d (3, fprintf (stderr,"%s!%s%d = xf(0x%hx) = style (%p) [LEN = %u]\n", esheet->sheet->name_unquoted,
+ d (3, fprintf (stderr,"%s!%s%d = xf(0x%hx) = style (%p) [LEN = %u]\n", sheet->name_unquoted,
col_name (col), row + 1, GSF_LE_GET_GUINT16 (q->data + 4), mstyle, q->length););
if (mstyle != NULL)
- sheet_style_set_pos (esheet->sheet, col, row, mstyle);
+ sheet_style_set_pos (sheet, col, row, mstyle);
return xf;
}
@@ -2770,12 +2774,17 @@
excel_read_NOTE (BiffQuery *q, ExcelReadSheet *esheet)
{
GnmCellPos pos;
+ Sheet *sheet = esheet->sheet;
+ unsigned row, col;
XL_CHECK_CONDITION (q->length >= 4);
+ row = XL_GETROW (q);
+ col = XL_GETCOL (q);
+ XL_CHECK_CONDITION (col < gnm_sheet_get_max_cols (sheet));
+ XL_CHECK_CONDITION (row < gnm_sheet_get_max_rows (sheet));
pos.row = XL_GETROW (q);
pos.col = XL_GETCOL (q);
- XL_CHECK_CONDITION (pos.col < SHEET_MAX_COLS && pos.row < SHEET_MAX_ROWS);
if (esheet_ver (esheet) >= MS_BIFF_V8) {
guint16 options, obj_id;
@@ -2810,7 +2819,7 @@
} else {
/* hmm, how did this happen ? we should have seen
* some escher records earlier */
- cell_set_comment (esheet->sheet, &pos, author, NULL);
+ cell_set_comment (sheet, &pos, author, NULL);
}
g_free (author);
} else {
@@ -2842,7 +2851,7 @@
d (2, fprintf (stderr,"Comment in %s%d: '%s'\n",
col_name (pos.col), pos.row + 1, comment->str););
- cell_set_comment (esheet->sheet, &pos, NULL, comment->str);
+ cell_set_comment (sheet, &pos, NULL, comment->str);
g_string_free (comment, TRUE);
}
}
@@ -3745,7 +3754,8 @@
if (flags & 0x80) {
if (xf != 0)
- excel_set_xf_segment (esheet, 0, SHEET_MAX_COLS - 1,
+ excel_set_xf_segment (esheet,
+ 0, gnm_sheet_get_max_cols (esheet->sheet) - 1,
row, row, xf);
d (1, fprintf (stderr,"row %d has flags 0x%x a default style %hd;\n",
row + 1, flags, xf););
@@ -3815,7 +3825,7 @@
unsigned const outline_level = (unsigned)((options >> 8) & 0x7);
XL_font_width const *spec = xl_find_fontspec (esheet, &scale);
- XL_CHECK_CONDITION (firstcol < SHEET_MAX_COLS);
+ XL_CHECK_CONDITION (firstcol < gnm_sheet_get_max_cols (esheet->sheet));
g_return_if_fail (spec != NULL);
/* Widths appear to be quoted including margins and the leading
@@ -3849,8 +3859,8 @@
});
/* NOTE: seems like this is inclusive firstcol, inclusive lastcol */
- if (lastcol >= SHEET_MAX_COLS)
- lastcol = SHEET_MAX_COLS - 1;
+ if (lastcol >= gnm_sheet_get_max_cols (esheet->sheet))
+ lastcol = gnm_sheet_get_max_cols (esheet->sheet) - 1;
for (i = firstcol; i <= lastcol; i++) {
/* Kludge : we should really use
* hard_size == customWidth && !bestFit
@@ -3864,7 +3874,7 @@
if (xf != 0)
excel_set_xf_segment (esheet, firstcol, lastcol,
- 0, SHEET_MAX_ROWS - 1, xf);
+ 0, gnm_sheet_get_max_rows (esheet->sheet) - 1, xf);
if (hidden)
colrow_set_visibility (esheet->sheet, TRUE, FALSE,
Modified: branches/gnumeric-1-8/src/sheet-style.c
==============================================================================
--- branches/gnumeric-1-8/src/sheet-style.c (original)
+++ branches/gnumeric-1-8/src/sheet-style.c Tue Apr 29 15:16:03 2008
@@ -494,7 +494,7 @@
}
#endif
- if (SHEET_MAX_COLS > 364238) {
+ if (gnm_sheet_get_max_cols (sheet) > 364238) {
/* Oh, yeah? */
g_warning (_("This is a special version of Gnumeric. It has been compiled\n"
"with support for a very large number of columns. Access to the\n"
@@ -1513,7 +1513,7 @@
/* 2.2 bottom outer */
r.end.row++;
- if (r.end.row < (SHEET_MAX_ROWS-1)) {
+ if (r.end.row < (gnm_sheet_get_max_rows (sheet)-1)) {
r.start.row = r.end.row;
apply_border (sheet, &r, GNM_STYLE_BORDER_TOP,
gnm_style_border_none ());
@@ -1545,7 +1545,7 @@
/* 4.2 right outer */
r.end.col++;
- if (r.end.col < (SHEET_MAX_COLS-1)) {
+ if (r.end.col < (gnm_sheet_get_max_cols (sheet)-1)) {
r.start.col = r.end.col;
apply_border (sheet, &r, GNM_STYLE_BORDER_LEFT,
gnm_style_border_none ());
@@ -1724,7 +1724,7 @@
if (r->start.col > 0)
start_col--;
end_col = r->end.col;
- if (r->end.col < SHEET_MAX_COLS)
+ if (r->end.col < gnm_sheet_get_max_cols (sheet))
end_col++;
/* allocate then alias the arrays for easy access */
@@ -1781,7 +1781,7 @@
}
/* merge the top of the next row */
- if (r->end.row < (SHEET_MAX_ROWS-1)) {
+ if (r->end.row < (gnm_sheet_get_max_rows (sheet)-1)) {
sr.row = r->end.row + 1;
sheet_style_get_row (sheet, &sr);
}
@@ -1845,7 +1845,7 @@
col = 0;
corner.row = 0;
styles = sheet_style_get_list (rinfo->origin_sheet,
- range_init (&r, col, 0, col, SHEET_MAX_ROWS-1));
+ range_init_cols (&r, col, col));
if (o > 0)
for (ptr = styles ; ptr != NULL ; ptr = ptr->next)
((GnmStyleRegion *)ptr->data)->range.end.col = o;
@@ -1857,7 +1857,7 @@
row = 0;
corner.col = 0;
styles = sheet_style_get_list (rinfo->origin_sheet,
- range_init (&r, 0, row, SHEET_MAX_COLS-1, row));
+ range_init_rows (&r, row, row));
if (o > 0)
for (ptr = styles ; ptr != NULL ; ptr = ptr->next)
((GnmStyleRegion *)ptr->data)->range.end.row = o;
@@ -1958,8 +1958,8 @@
if (most_common_in_cols != NULL) {
unsigned i;
- for (i = 0; i < SHEET_MAX_COLS ; i++)
- most_common_in_cols [i] = sheet_style_most_common_in_col (sheet, i);
+ for (i = 0; i < gnm_sheet_get_max_cols (sheet); i++)
+ most_common_in_cols[i] = sheet_style_most_common_in_col (sheet, i);
}
/* This could easily be optimized */
@@ -2437,8 +2437,7 @@
GHashTable *accumulator;
GnmRange r;
- r.start.col = r.end.col = col;
- r.start.row = 0; r.end.row = SHEET_MAX_ROWS-1;
+ range_init_cols (&r, col, col);
accumulator = g_hash_table_new (gnm_style_hash, (GCompareFunc) gnm_style_equal);
foreach_tile (sheet->style_data->styles,
TILE_TOP_LEVEL, 0, 0, &r,
Modified: branches/gnumeric-1-8/src/sheet.c
==============================================================================
--- branches/gnumeric-1-8/src/sheet.c (original)
+++ branches/gnumeric-1-8/src/sheet.c Tue Apr 29 15:16:03 2008
@@ -589,8 +589,8 @@
/* Init, focus, and load handle setting these if/when necessary */
sheet->priv->recompute_visibility = TRUE;
sheet->priv->recompute_spans = TRUE;
- sheet->priv->reposition_objects.row = SHEET_MAX_ROWS;
- sheet->priv->reposition_objects.col = SHEET_MAX_COLS;
+ sheet->priv->reposition_objects.row = gnm_sheet_get_max_rows (sheet);
+ sheet->priv->reposition_objects.col = gnm_sheet_get_max_cols (sheet);
range_init_full_sheet (&sheet->priv->unhidden_region);
@@ -629,12 +629,12 @@
sheet->cols.max_used = -1;
g_ptr_array_set_size (sheet->cols.info = g_ptr_array_new (),
- COLROW_SEGMENT_INDEX (SHEET_MAX_COLS - 1) + 1);
+ COLROW_SEGMENT_INDEX (gnm_sheet_get_max_cols (sheet) - 1) + 1);
sheet_col_set_default_size_pts (sheet, 48);
sheet->rows.max_used = -1;
g_ptr_array_set_size (sheet->rows.info = g_ptr_array_new (),
- COLROW_SEGMENT_INDEX (SHEET_MAX_ROWS - 1) + 1);
+ COLROW_SEGMENT_INDEX (gnm_sheet_get_max_rows (sheet) - 1) + 1);
sheet_row_set_default_size_pts (sheet, 12.75);
sheet->print_info = print_info_new (FALSE);
Modified: branches/gnumeric-1-8/src/xml-sax-read.c
==============================================================================
--- branches/gnumeric-1-8/src/xml-sax-read.c (original)
+++ branches/gnumeric-1-8/src/xml-sax-read.c Tue Apr 29 15:16:03 2008
@@ -445,6 +445,22 @@
}
static void
+xml_sax_wb_sheetsize (GsfXMLIn *xin, xmlChar const **attrs)
+{
+ XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
+ int tmpi;
+
+ for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
+ if (gnm_xml_attr_int (attrs, "gnm:Cols", &tmpi))
+ state->array_cols = tmpi;
+ else if (gnm_xml_attr_int (attrs, "gnm:Rows", &tmpi))
+ state->array_rows = tmpi;
+ else
+ unknown_attr (xin, attrs);
+ }
+}
+
+static void
xml_sax_wb_sheetname (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
@@ -632,7 +648,6 @@
*/
if (state->version >= GNM_XML_V7) {
sheet = workbook_sheet_by_name (state->wb, content);
-
if (!sheet) {
gnumeric_io_error_string (state->context,
_("File has inconsistent SheetNameIndex element."));
@@ -2298,7 +2313,7 @@
GSF_XML_IN_NODE (WB_SUMMARY_ITEM, WB_SUMMARY_ITEM_VALUE_INT, GNM, "val-int", GSF_XML_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (WB, WB_SHEETNAME_INDEX, GNM, "SheetNameIndex", GSF_XML_NO_CONTENT, NULL, NULL),
- GSF_XML_IN_NODE (WB_SHEETNAME_INDEX, WB_SHEETNAME, GNM, "SheetName", GSF_XML_CONTENT, NULL, &xml_sax_wb_sheetname),
+ GSF_XML_IN_NODE (WB_SHEETNAME_INDEX, WB_SHEETNAME, GNM, "SheetName", GSF_XML_CONTENT, &xml_sax_wb_sheetsize, &xml_sax_wb_sheetname),
GSF_XML_IN_NODE (WB, WB_NAMED_EXPRS, GNM, "Names", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (WB_NAMED_EXPRS, WB_NAMED_EXPR, GNM, "Name", GSF_XML_NO_CONTENT, NULL, &xml_sax_named_expr_end),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]