[gnumeric] sc: better fix for 641581.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] sc: better fix for 641581.
- Date: Sat, 5 Feb 2011 16:44:08 +0000 (UTC)
commit bb7bbea2c88df9950deeeab5b3344aa64382e22d
Author: Morten Welinder <terra gnome org>
Date: Sat Feb 5 11:43:45 2011 -0500
sc: better fix for 641581.
plugins/sc/ChangeLog | 5 ++++-
plugins/sc/sc.c | 33 ++++++++++++++++++++-------------
2 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/plugins/sc/ChangeLog b/plugins/sc/ChangeLog
index 00f4647..c9778a5 100644
--- a/plugins/sc/ChangeLog
+++ b/plugins/sc/ChangeLog
@@ -1,6 +1,9 @@
2011-02-05 Morten Welinder <terra gnome org>
- * sc.c (sc_file_open): Support columns up to ZZ. Fixes #641581.
+ * sc.c (sc_parse_format_set_width): Enlarge sheet if needed.
+ Fixes #641581.
+ (enlarge): New function, split from...
+ (sc_sheet_cell_fetch): ...here.
2011-02-02 Morten Welinder <terra gnome org>
diff --git a/plugins/sc/sc.c b/plugins/sc/sc.c
index 050f116..64b01cd 100644
--- a/plugins/sc/sc.c
+++ b/plugins/sc/sc.c
@@ -132,8 +132,8 @@ sc_warning (ScParseState *state, char const *fmt, ...)
return FALSE; /* convenience */
}
-static GnmCell *
-sc_sheet_cell_fetch (ScParseState *state, int col, int row)
+static gboolean
+enlarge (ScParseState *state, int col, int row)
{
GnmSheetSize const *size = gnm_sheet_get_size (state->sheet);
gboolean err = FALSE;
@@ -152,6 +152,15 @@ sc_sheet_cell_fetch (ScParseState *state, int col, int row)
if (goundo) g_object_unref (goundo);
}
+ return err;
+}
+
+
+static GnmCell *
+sc_sheet_cell_fetch (ScParseState *state, int col, int row)
+{
+ gboolean err = enlarge (state, col, row);
+
if (err) {
sc_warning (state, _("The cell in row %i and column %i is beyond "
"Gnumeric's maximum sheet size."),
@@ -369,10 +378,18 @@ sc_parse_format_set_width (ScParseState *state, int len, int col_from, int col_t
int width;
int col;
GnmStyle *mstyle;
+ gboolean err;
if (len < 1)
return;
+ err = enlarge (state, col_to, 0);
+ if (err) {
+ sc_warning (state, _("The sheet is wider than "
+ "Gnumeric can handle."));
+ return;
+ }
+
mstyle = gnm_style_new_default ();
style_font = gnm_style_get_font
(mstyle, state->sheet->rendered_values->context);
@@ -994,20 +1011,10 @@ sc_file_open (GOFileOpener const *fo, GOIOContext *io_context,
char *name;
GOErrorInfo *error;
ScParseState state;
- int cols, rows;
wb = wb_view_get_workbook (wb_view);
name = workbook_sheet_get_free_name (wb, "SC", FALSE, TRUE);
-
- /*
- * A through ZZ although the source suggests that a few are not
- * actually valid. "PI", for example.
- */
- cols = 702;
- rows = 65536;
- gnm_sheet_suggest_size (&cols, &rows);
- state.sheet = sheet_new (wb, name, cols, rows);
-
+ state.sheet = sheet_new (wb, name, 256, 65536);
g_free (name);
workbook_sheet_attach (wb, state.sheet);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]