[gnumeric] Permit the sc import of tables with many rows and columns.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Permit the sc import of tables with many rows and columns.
- Date: Thu, 7 Oct 2010 22:51:04 +0000 (UTC)
commit 7d3bf92ada2096de9eb18cca8ecfbb94c99c0c37
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Oct 7 16:51:14 2010 -0600
Permit the sc import of tables with many rows and columns.
2010-10-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* sc.c: pass all calls to sheet_cell_fetch via sc_sheet_cell_fetch
(sc_sheet_cell_fetch): new
(sc_parse_cell_name_list): check for NULL cell
NEWS | 1 +
plugins/sc/ChangeLog | 6 ++++++
plugins/sc/sc.c | 40 ++++++++++++++++++++++++++++++++++++----
3 files changed, 43 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9b7498c..701620b 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Andreas:
rather than index. [#629333]
* Fix manual pagebreak handling when printing. [#631570]
* Add menu items to remove and add manual page breaks.
+ * Permit the sc import of tables with many rows and columns.
--------------------------------------------------------------------------
Gnumeric 1.10.11
diff --git a/plugins/sc/ChangeLog b/plugins/sc/ChangeLog
index 3ec2cc6..ae15757 100644
--- a/plugins/sc/ChangeLog
+++ b/plugins/sc/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * sc.c: pass all calls to sheet_cell_fetch via sc_sheet_cell_fetch
+ (sc_sheet_cell_fetch): new
+ (sc_parse_cell_name_list): check for NULL cell
+
2010-10-01 Morten Welinder <terra gnome org>
* Release 1.10.11
diff --git a/plugins/sc/sc.c b/plugins/sc/sc.c
index 2223922..c13b735 100644
--- a/plugins/sc/sc.c
+++ b/plugins/sc/sc.c
@@ -52,6 +52,37 @@ typedef enum {
RIGHTSTRING
} sc_string_cmd_t;
+static GnmCell *
+sc_sheet_cell_fetch (Sheet *sheet, int col, int row)
+{
+ GnmSheetSize const *size = gnm_sheet_get_size (sheet);
+ gboolean err = FALSE;
+
+ if (col >= size->max_cols
+ || row >= size->max_rows) {
+ GOUndo * goundo;
+ int cols_needed = (col >= size->max_cols) ? col + 1
+ : size->max_cols;
+ int rows_needed = (row >= size->max_rows) ? row + 1
+ : size->max_rows;
+ gnm_sheet_suggest_size (&cols_needed, &rows_needed);
+
+ goundo = gnm_sheet_resize
+ (sheet, cols_needed, rows_needed, NULL, &err);
+ if (goundo) g_object_unref (goundo);
+ }
+
+ if (err) {
+ g_warning (_("The cell in row %i and column %i is beyond "
+ "Gnumeric's maximum sheet size."),
+ row, col);
+
+ return NULL;
+ } else
+ return sheet_cell_fetch (sheet, col, row);
+}
+
+
/* we can't use cellpos_parse b/c it doesn't support 0 bases (A0, B0, ...) */
static gboolean
@@ -200,7 +231,7 @@ sc_parse_label (ScParseState *state, char const *cmd, char const *str,
tmpout--;
*tmpout = 0;
- cell = sheet_cell_fetch (state->sheet, pos->col, pos->row);
+ cell = sc_sheet_cell_fetch (state->sheet, pos->col, pos->row);
if (!cell)
goto err_out;
@@ -254,8 +285,9 @@ sc_parse_cell_name_list (Sheet *sheet, char const *cell_name_str,
return NULL;
}
- cell = sheet_cell_fetch (sheet, pos.col, pos.row);
- cells = g_slist_append (cells, (gpointer) cell);
+ cell = sc_sheet_cell_fetch (sheet, pos.col, pos.row);
+ if (cell != NULL)
+ cells = g_slist_append (cells, (gpointer) cell);
n = 0;
} else
buf [n++] = cell_name_str [i];
@@ -384,7 +416,7 @@ sc_parse_let (ScParseState *state, char const *cmd, char const *str,
g_return_val_if_fail (cmd, FALSE);
g_return_val_if_fail (str, FALSE);
- cell = sheet_cell_fetch (state->sheet, pos->col, pos->row);
+ cell = sc_sheet_cell_fetch (state->sheet, pos->col, pos->row);
if (!cell)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]