gnumeric r16532 - in branches/gnumeric-1-8: . plugins/applix plugins/dif plugins/excel plugins/fn-lookup plugins/gda plugins/lotus-123 plugins/mps plugins/openoffice plugins/plan-perfect plugins/sc plugins/sylk plugins/xbase src src/dialogs src/tools src/tools/solver src/widgets
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16532 - in branches/gnumeric-1-8: . plugins/applix plugins/dif plugins/excel plugins/fn-lookup plugins/gda plugins/lotus-123 plugins/mps plugins/openoffice plugins/plan-perfect plugins/sc plugins/sylk plugins/xbase src src/dialogs src/tools src/tools/solver src/widgets
- Date: Tue, 29 Apr 2008 00:19:21 +0100 (BST)
Author: mortenw
Date: Mon Apr 28 23:19:20 2008
New Revision: 16532
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16532&view=rev
Log:
2008-04-28 Morten Welinder <terra gnome org>
* */*.c: Use gnm_sheet_get_max_cols for SHEET_MAX_COLS and
gnm_sheet_get_max_rows for SHEET_MAX_ROWS in most cases. (Adapted
from Jean's patch in #168875.)
Modified:
branches/gnumeric-1-8/ChangeLog
branches/gnumeric-1-8/plugins/applix/applix-read.c
branches/gnumeric-1-8/plugins/dif/dif.c
branches/gnumeric-1-8/plugins/excel/excel-xml-read.c
branches/gnumeric-1-8/plugins/excel/xlsx-read.c
branches/gnumeric-1-8/plugins/fn-lookup/functions.c
branches/gnumeric-1-8/plugins/gda/plugin-gda.c
branches/gnumeric-1-8/plugins/lotus-123/lotus.c
branches/gnumeric-1-8/plugins/mps/mps.c
branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c
branches/gnumeric-1-8/plugins/openoffice/openoffice-write.c
branches/gnumeric-1-8/plugins/plan-perfect/pln.c
branches/gnumeric-1-8/plugins/sc/sc.c
branches/gnumeric-1-8/plugins/sylk/sylk.c
branches/gnumeric-1-8/plugins/xbase/boot.c
branches/gnumeric-1-8/plugins/xbase/xbase.c
branches/gnumeric-1-8/src/cellspan.c
branches/gnumeric-1-8/src/clipboard.c
branches/gnumeric-1-8/src/cmd-edit.c
branches/gnumeric-1-8/src/colrow.c
branches/gnumeric-1-8/src/commands.c
branches/gnumeric-1-8/src/complete-sheet.c
branches/gnumeric-1-8/src/dependent.c
branches/gnumeric-1-8/src/dependent.h
branches/gnumeric-1-8/src/dialogs/dialog-merge.c
branches/gnumeric-1-8/src/dialogs/dialog-stf-format-page.c
branches/gnumeric-1-8/src/dialogs/dialog-stf-main-page.c
branches/gnumeric-1-8/src/expr.c
branches/gnumeric-1-8/src/gnm-pane.c
branches/gnumeric-1-8/src/item-bar.c
branches/gnumeric-1-8/src/item-cursor.c
branches/gnumeric-1-8/src/item-edit.c
branches/gnumeric-1-8/src/item-grid.c
branches/gnumeric-1-8/src/parse-util.c
branches/gnumeric-1-8/src/position.c
branches/gnumeric-1-8/src/preview-grid.c
branches/gnumeric-1-8/src/print.c
branches/gnumeric-1-8/src/ranges.c
branches/gnumeric-1-8/src/selection.c
branches/gnumeric-1-8/src/sheet-control-gui.c
branches/gnumeric-1-8/src/sheet-filter.c
branches/gnumeric-1-8/src/sheet-view.c
branches/gnumeric-1-8/src/sheet.c
branches/gnumeric-1-8/src/stf-parse.c
branches/gnumeric-1-8/src/stf.c
branches/gnumeric-1-8/src/test.c
branches/gnumeric-1-8/src/tools/dao.c
branches/gnumeric-1-8/src/tools/data-shuffling.c
branches/gnumeric-1-8/src/tools/filter.c
branches/gnumeric-1-8/src/tools/solver/reports-write.c
branches/gnumeric-1-8/src/tools/solver/solver.c
branches/gnumeric-1-8/src/tools/tabulate.c
branches/gnumeric-1-8/src/wbc-gtk-actions.c
branches/gnumeric-1-8/src/wbc-gtk.c
branches/gnumeric-1-8/src/widgets/gnumeric-expr-entry.c
branches/gnumeric-1-8/src/workbook-view.c
branches/gnumeric-1-8/src/xml-sax-write.c
Modified: branches/gnumeric-1-8/plugins/applix/applix-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/applix/applix-read.c (original)
+++ branches/gnumeric-1-8/plugins/applix/applix-read.c Mon Apr 28 23:19:20 2008
@@ -174,13 +174,13 @@
static gboolean
valid_col (int c)
{
- return c >= 0 && c < SHEET_MAX_COLS;
+ return c >= 0 && c < gnm_sheet_get_max_cols (NULL);
}
static gboolean
valid_row (int r)
{
- return r >= 0 && r < SHEET_MAX_ROWS;
+ return r >= 0 && r < gnm_sheet_get_max_rows (NULL);
}
static gboolean
Modified: branches/gnumeric-1-8/plugins/dif/dif.c
==============================================================================
--- branches/gnumeric-1-8/plugins/dif/dif.c (original)
+++ branches/gnumeric-1-8/plugins/dif/dif.c Mon Apr 28 23:19:20 2008
@@ -11,6 +11,7 @@
#include <gnumeric-config.h>
#include <glib/gi18n-lib.h>
#include <gnumeric.h>
+#include <libgnumeric.h>
#include <cell.h>
#include <sheet.h>
@@ -173,7 +174,7 @@
gnm_io_warning (ctxt->io_context,
_("Syntax error at line %d. Ignoring."),
ctxt->line_no);
- else if (col > SHEET_MAX_COLS) {
+ else if (col > gnm_sheet_get_max_cols (ctxt->sheet)) {
too_many_columns = TRUE;
break;
} else {
@@ -206,7 +207,7 @@
} else if (val_type == 1) {
if (!dif_get_line (ctxt))
return FALSE;
- if (col > SHEET_MAX_COLS) {
+ if (col > gnm_sheet_get_max_cols (ctxt->sheet)) {
too_many_columns = TRUE;
continue;
}
@@ -224,7 +225,7 @@
if (strcmp (ctxt->line, "BOT") == 0) {
col = 0;
row++;
- if (row > SHEET_MAX_ROWS) {
+ if (row > gnm_sheet_get_max_rows (ctxt->sheet)) {
too_many_rows = TRUE;
break;
}
@@ -249,11 +250,11 @@
if (too_many_rows) {
g_warning (_("DIF file has more than the maximum number of rows %d. "
- "Ignoring remaining rows."), SHEET_MAX_ROWS);
+ "Ignoring remaining rows."), gnm_sheet_get_max_rows (ctxt->sheet));
}
if (too_many_columns) {
g_warning (_("DIF file has more than the maximum number of columns %d. "
- "Ignoring remaining columns."), SHEET_MAX_COLS);
+ "Ignoring remaining columns."), gnm_sheet_get_max_cols (ctxt->sheet));
}
return TRUE;
Modified: branches/gnumeric-1-8/plugins/excel/excel-xml-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/excel/excel-xml-read.c (original)
+++ branches/gnumeric-1-8/plugins/excel/excel-xml-read.c Mon Apr 28 23:19:20 2008
@@ -318,7 +318,7 @@
r.start.col = state->pos.col;
r.end.col = state->pos.col + span - 1;
r.start.row = 0;
- r.end.row = SHEET_MAX_ROWS - 1;
+ r.end.row = gnm_sheet_get_max_rows (state->sheet) - 1;
gnm_style_ref (style);
sheet_style_set_range (state->sheet, &r, style);
}
@@ -373,7 +373,7 @@
r.start.row = state->pos.row;
r.end.row = state->pos.row + span - 1;
r.start.col = 0;
- r.end.col = SHEET_MAX_COLS - 1;
+ r.end.col = gnm_sheet_get_max_cols (state->sheet) - 1;
gnm_style_ref (style);
sheet_style_set_range (state->sheet, &r, style);
}
Modified: branches/gnumeric-1-8/plugins/excel/xlsx-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/excel/xlsx-read.c (original)
+++ branches/gnumeric-1-8/plugins/excel/xlsx-read.c Mon Apr 28 23:19:20 2008
@@ -2379,7 +2379,7 @@
GnmRange r;
r.start.row = r.end.row = row;
r.start.col = 0;
- r.end.col = SHEET_MAX_COLS - 1;
+ r.end.col = gnm_sheet_get_max_cols (state->sheet) - 1;
gnm_style_ref (style);
sheet_style_set_range (state->sheet, &r, style);
}
@@ -2426,8 +2426,8 @@
}
- if (last >= SHEET_MAX_COLS)
- last = SHEET_MAX_COLS - 1;
+ if (last >= gnm_sheet_get_max_cols (state->sheet))
+ last = gnm_sheet_get_max_cols (state->sheet) - 1;
for (i = first; i <= last; i++) {
if (width > 4)
sheet_col_set_size_pts (state->sheet, i, width,
@@ -2441,7 +2441,7 @@
r.start.col = first;
r.end.col = last;
r.start.row = 0;
- r.end.row = SHEET_MAX_ROWS - 1;
+ r.end.row = gnm_sheet_get_max_rows (state->sheet) - 1;
gnm_style_ref (style);
sheet_style_set_range (state->sheet, &r, style);
}
Modified: branches/gnumeric-1-8/plugins/fn-lookup/functions.c
==============================================================================
--- branches/gnumeric-1-8/plugins/fn-lookup/functions.c (original)
+++ branches/gnumeric-1-8/plugins/fn-lookup/functions.c Mon Apr 28 23:19:20 2008
@@ -557,9 +557,9 @@
if (err)
return value_new_error_VALUE (ei->pos);
}
- if (col < 0 || col >= SHEET_MAX_COLS)
+ if (col < 0 || col >= gnm_sheet_get_max_cols (ei->pos->sheet))
return value_new_error_VALUE (ei->pos);
- if (row < 0 || row >= SHEET_MAX_ROWS)
+ if (row < 0 || row >= gnm_sheet_get_max_rows (ei->pos->sheet))
return value_new_error_VALUE (ei->pos);
if (!out.convs->r1c1_addresses)
@@ -1246,7 +1246,7 @@
a.row += row_offset;
a.col += col_offset;
if (a.row < 0 || a.col < 0 ||
- a.row >= SHEET_MAX_ROWS || a.col >= SHEET_MAX_COLS)
+ a.row >= gnm_sheet_get_max_rows (ei->pos->sheet) || a.col >= gnm_sheet_get_max_cols (ei->pos->sheet))
return value_new_error_REF (ei->pos);
if (args[3] != NULL) {
@@ -1256,7 +1256,7 @@
b.row = a.row + tmp - 1;
} else
b.row += row_offset;
- if (b.col < 0 || b.row >= SHEET_MAX_ROWS)
+ if (b.col < 0 || b.row >= gnm_sheet_get_max_rows (ei->pos->sheet))
return value_new_error_REF (ei->pos);
if (args[4] != NULL) {
tmp = value_get_as_int (args[4]);
@@ -1265,7 +1265,7 @@
b.col = a.col + tmp - 1;
} else
b.col += col_offset;
- if (b.col < 0 || b.col >= SHEET_MAX_COLS)
+ if (b.col < 0 || b.col >= gnm_sheet_get_max_cols (ei->pos->sheet))
return value_new_error_REF (ei->pos);
return value_new_cellrange_unsafe (&a, &b);
Modified: branches/gnumeric-1-8/plugins/gda/plugin-gda.c
==============================================================================
--- branches/gnumeric-1-8/plugins/gda/plugin-gda.c (original)
+++ branches/gnumeric-1-8/plugins/gda/plugin-gda.c Mon Apr 28 23:19:20 2008
@@ -157,7 +157,7 @@
if (rowcount <= 0)
return value_new_empty ();
- if (rowcount >= SHEET_MAX_ROWS)
+ if (rowcount >= gnm_sheet_get_max_rows (ei->pos->sheet))
return value_new_error (ei->pos, _("Too much data returned"));
date_conv = workbook_date_conv (ei->pos->sheet->workbook);
Modified: branches/gnumeric-1-8/plugins/lotus-123/lotus.c
==============================================================================
--- branches/gnumeric-1-8/plugins/lotus-123/lotus.c (original)
+++ branches/gnumeric-1-8/plugins/lotus-123/lotus.c Mon Apr 28 23:19:20 2008
@@ -1157,26 +1157,26 @@
ci = 0;
for (r.range.start.col = 0;
- r.range.start.col < SHEET_MAX_COLS;
+ r.range.start.col < gnm_sheet_get_max_cols (r.sheet);
r.range.start.col = r.range.end.col + 1) {
if (ci >= rldb2->lower->len)
break;
rldb1 = g_ptr_array_index (rldb2->lower, ci);
ci++;
r.range.end.col =
- MIN (SHEET_MAX_COLS - 1,
+ MIN (gnm_sheet_get_max_cols (r.sheet) - 1,
r.range.start.col + (rldb1->rll - 1));
ri = 0;
for (r.range.start.row = 0;
- r.range.start.row < SHEET_MAX_ROWS;
+ r.range.start.row < gnm_sheet_get_max_rows (r.sheet);
r.range.start.row = r.range.end.row + 1) {
if (ri >= rldb1->lower->len)
break;
rldb0 = g_ptr_array_index (rldb1->lower, ri);
ri++;
r.range.end.row =
- MIN (SHEET_MAX_ROWS - 1,
+ MIN (gnm_sheet_get_max_rows (r.sheet) - 1,
r.range.start.row + (rldb0->rll - 1));
data = rldb0->datanode;
@@ -1204,7 +1204,7 @@
guint si, cri;
LotusRLDB *rldb1, *rldb0;
const GString *data;
- int max = iscol ? SHEET_MAX_COLS : SHEET_MAX_ROWS;
+ int max = iscol ? gnm_sheet_get_max_cols (NULL) : gnm_sheet_get_max_rows (NULL);
int start, end;
Sheet *sheet;
@@ -1356,7 +1356,7 @@
: lotus_qmps_to_points (GSF_LE_GET_GUINT32 (data + 4));
value_set = (flags & 1) != 0;
- if (end - start >= SHEET_MAX_COLS)
+ if (end - start >= gnm_sheet_get_max_cols (sheet))
sheet_col_set_default_size_pixels (sheet, size);
else {
int i;
@@ -1401,7 +1401,7 @@
: lotus_qmps_to_points (GSF_LE_GET_GUINT32 (data + 4));
value_set = (flags & 1) != 0;
- if (end - start >= SHEET_MAX_ROWS)
+ if (end - start >= gnm_sheet_get_max_rows (sheet))
sheet_row_set_default_size_pixels (sheet, size);
else {
int i;
Modified: branches/gnumeric-1-8/plugins/mps/mps.c
==============================================================================
--- branches/gnumeric-1-8/plugins/mps/mps.c (original)
+++ branches/gnumeric-1-8/plugins/mps/mps.c Mon Apr 28 23:19:20 2008
@@ -489,7 +489,7 @@
/* Autofit column A */
- i = sheet_col_size_fit_pixels (sh, 0, 0, SHEET_MAX_ROWS - 1, FALSE);
+ i = sheet_col_size_fit_pixels (sh, 0, 0, gnm_sheet_get_max_rows (ctxt->sheet) - 1, FALSE);
if (i == 0)
return;
sheet_col_set_size_pixels (sh, 0, i, TRUE);
Modified: branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c (original)
+++ branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c Mon Apr 28 23:19:20 2008
@@ -593,15 +593,15 @@
/* default cell styles are applied only to cells that are specified
* which is a performance nightmare. Instead we apply the styles to
* the entire column or row and clear the area beyond the extent here. */
- if (state->extent_style.col < SHEET_MAX_COLS) {
+ if (state->extent_style.col < gnm_sheet_get_max_cols (NULL)) {
range_init (&r, state->extent_style.col, 0,
- SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1);
+ gnm_sheet_get_max_cols (NULL)-1, gnm_sheet_get_max_rows (NULL)-1);
sheet_style_set_range (state->pos.sheet, &r,
sheet_style_default (state->pos.sheet));
}
- if (state->extent_style.row < SHEET_MAX_ROWS) {
+ if (state->extent_style.row < gnm_sheet_get_max_rows (NULL)) {
range_init (&r, 0, state->extent_style.row,
- SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1);
+ gnm_sheet_get_max_cols (NULL)-1, gnm_sheet_get_max_rows (NULL)-1);
sheet_style_set_range (state->pos.sheet, &r,
sheet_style_default (state->pos.sheet));
}
@@ -669,7 +669,7 @@
r.start.col = state->pos.eval.col;
r.end.col = state->pos.eval.col + repeat_count - 1;
r.start.row = 0;
- r.end.row = SHEET_MAX_ROWS - 1;
+ r.end.row = gnm_sheet_get_max_rows (NULL) - 1;
gnm_style_ref (style);
sheet_style_set_range (state->pos.sheet, &r, style);
}
@@ -700,8 +700,8 @@
state->pos.eval.col = 0;
- if (state->pos.eval.row >= SHEET_MAX_ROWS) {
- oo_warning (xin, _("Content past the maxium number of rows supported in this build (%u). Please recompile with larger limits."), SHEET_MAX_ROWS);
+ if (state->pos.eval.row >= gnm_sheet_get_max_rows (NULL)) {
+ oo_warning (xin, _("Content past the maxium number of rows supported in this build (%u). Please recompile with larger limits."), gnm_sheet_get_max_rows (NULL));
state->row_inc = 0;
return;
}
@@ -724,7 +724,7 @@
r.start.row = state->pos.eval.row;
r.end.row = state->pos.eval.row + repeat_count - 1;
r.start.col = 0;
- r.end.col = SHEET_MAX_COLS - 1;
+ r.end.col = gnm_sheet_get_max_cols (NULL) - 1;
gnm_style_ref (style);
sheet_style_set_range (state->pos.sheet, &r, style);
}
Modified: branches/gnumeric-1-8/plugins/openoffice/openoffice-write.c
==============================================================================
--- branches/gnumeric-1-8/plugins/openoffice/openoffice-write.c (original)
+++ branches/gnumeric-1-8/plugins/openoffice/openoffice-write.c Mon Apr 28 23:19:20 2008
@@ -401,8 +401,8 @@
{
GnmStyle *col_styles [SHEET_MAX_COLS];
GnmRange extent;
- int max_cols = SHEET_MAX_COLS;
- int max_rows = SHEET_MAX_ROWS;
+ int max_cols = gnm_sheet_get_max_cols (sheet);
+ int max_rows = gnm_sheet_get_max_rows (sheet);
int i, col, row;
int null_cell;
int covered_cell;
Modified: branches/gnumeric-1-8/plugins/plan-perfect/pln.c
==============================================================================
--- branches/gnumeric-1-8/plugins/plan-perfect/pln.c (original)
+++ branches/gnumeric-1-8/plugins/plan-perfect/pln.c Mon Apr 28 23:19:20 2008
@@ -489,8 +489,8 @@
static ErrorInfo *
pln_parse_sheet (GsfInput *input, PlanPerfectImport *state)
{
- int max_col = SHEET_MAX_COLS;
- int max_row = SHEET_MAX_ROWS;
+ int max_col = gnm_sheet_get_max_cols (state->sheet);
+ int max_row = gnm_sheet_get_max_rows (state->sheet);
int i, rcode, rlength;
guint8 const *data;
GnmValue *v;
@@ -498,7 +498,7 @@
GnmParsePos pp;
GnmRange r;
- range_init (&r, 0,0,0, SHEET_MAX_ROWS);
+ range_init (&r, 0,0,0, gnm_sheet_get_max_rows (state->sheet));
parse_pos_init_sheet (&pp, state->sheet);
data = gsf_input_read (input, 16, NULL);
Modified: branches/gnumeric-1-8/plugins/sc/sc.c
==============================================================================
--- branches/gnumeric-1-8/plugins/sc/sc.c (original)
+++ branches/gnumeric-1-8/plugins/sc/sc.c Mon Apr 28 23:19:20 2008
@@ -266,7 +266,7 @@
row = strtol (ptr, (char **)&end, 10);
if (ptr != end &&
!g_unichar_isalnum (g_utf8_get_char (end)) && *end != '_' &&
- 0 <= row && row < SHEET_MAX_ROWS) {
+ 0 <= row && row < gnm_sheet_get_max_rows (NULL)) {
*res = row;
return end;
} else
Modified: branches/gnumeric-1-8/plugins/sylk/sylk.c
==============================================================================
--- branches/gnumeric-1-8/plugins/sylk/sylk.c (original)
+++ branches/gnumeric-1-8/plugins/sylk/sylk.c Mon Apr 28 23:19:20 2008
@@ -621,7 +621,7 @@
int first, last, width;
if (3 == sscanf (str+1, "%d %d %d", &first, &last, &width)) {
/* width seems to be in characters */
- if (first <= last && first < SHEET_MAX_COLS && last < SHEET_MAX_COLS)
+ if (first <= last && first < gnm_sheet_get_max_cols (NULL) && last < gnm_sheet_get_max_cols (NULL))
while (first <= last)
sheet_col_set_size_pts (state->pp.sheet,
first++ - 1, width*7.45, TRUE);
Modified: branches/gnumeric-1-8/plugins/xbase/boot.c
==============================================================================
--- branches/gnumeric-1-8/plugins/xbase/boot.c (original)
+++ branches/gnumeric-1-8/plugins/xbase/boot.c Mon Apr 28 23:19:20 2008
@@ -204,12 +204,9 @@
record = record_new (file);
row = 1;
do {
- if (row >= SHEET_MAX_ROWS) {
- g_warning (_("This build of Gnumeric can only hold %d "
- "rows. Ignoring the rest of this file. You "
- "will need a custom build with SHEET_MAX_ROWS "
- "increased to read this file."),
- SHEET_MAX_ROWS);
+ if (row >= gnm_sheet_get_max_rows (sheet)) {
+ /* FIXME: either we need to add new rows, if posible
+ or create a larger sheet*/
break;
}
for (i = 0; i < file->fields ; i++) {
Modified: branches/gnumeric-1-8/plugins/xbase/xbase.c
==============================================================================
--- branches/gnumeric-1-8/plugins/xbase/xbase.c (original)
+++ branches/gnumeric-1-8/plugins/xbase/xbase.c Mon Apr 28 23:19:20 2008
@@ -2,10 +2,12 @@
#include <gnumeric-config.h>
#include <glib/gi18n-lib.h>
#include <gnumeric.h>
+#include <libgnumeric.h>
#include "xbase.h"
#include <gnm-format.h>
#include <gutils.h>
+#include <sheet.h>
#include <goffice/app/io-context.h>
#include <goffice/app/error-info.h>
@@ -264,7 +266,7 @@
ans->fields = 0;
ans->format = NULL;
- while (ans->fields < (SHEET_MAX_COLS-1) && (field = xbase_field_new (ans)) != NULL) {
+ while (ans->fields < (gnm_sheet_get_max_cols (NULL)-1) && (field = xbase_field_new (ans)) != NULL) {
ans->format = g_renew (XBfield *, ans->format, ans->fields + 1);
/* FIXME: allocate number of field formats from file size? */
ans->format[ans->fields++] = field;
Modified: branches/gnumeric-1-8/src/cellspan.c
==============================================================================
--- branches/gnumeric-1-8/src/cellspan.c (original)
+++ branches/gnumeric-1-8/src/cellspan.c Mon Apr 28 23:19:20 2008
@@ -256,7 +256,7 @@
gnm_sheet_merge_get_adjacent (sheet, &cell->pos, &merge_left, &merge_right);
min_col = (merge_left != NULL) ? merge_left->end.col : -1;
- max_col = (merge_right != NULL) ? merge_right->start.col : SHEET_MAX_COLS;
+ max_col = (merge_right != NULL) ? merge_right->start.col : gnm_sheet_get_max_cols (sheet);
*col1 = *col2 = cell->pos.col;
switch (h_align) {
Modified: branches/gnumeric-1-8/src/clipboard.c
==============================================================================
--- branches/gnumeric-1-8/src/clipboard.c (original)
+++ branches/gnumeric-1-8/src/clipboard.c Mon Apr 28 23:19:20 2008
@@ -420,8 +420,8 @@
return TRUE;
}
- if ((pt->range.start.col + dst_cols) > SHEET_MAX_COLS ||
- (pt->range.start.row + dst_rows) > SHEET_MAX_ROWS) {
+ if ((pt->range.start.col + dst_cols) > gnm_sheet_get_max_cols (pt->sheet) ||
+ (pt->range.start.row + dst_rows) > gnm_sheet_get_max_rows (pt->sheet)) {
go_cmd_context_error_invalid (cc,
_("Unable to paste"),
_("result passes the sheet boundary"));
@@ -906,13 +906,13 @@
next_row_check = i = 0;
while ((i += ((ColRowRLEState *)(row_state->data))->length) <= extent.start.row) {
if (NULL == (row_state = row_state->next)) {
- next_row_check = SHEET_MAX_ROWS;
+ next_row_check = gnm_sheet_get_max_rows (cr->origin_sheet);
break;
}
next_row_check = i;
}
} else
- next_row_check = SHEET_MAX_ROWS;
+ next_row_check = gnm_sheet_get_max_rows (cr->origin_sheet);
for (row = extent.start.row; row <= extent.end.row;) {
if (row >= next_row_check) {
@@ -931,13 +931,13 @@
next_col_check = i = 0;
while ((i += ((ColRowRLEState *)(col_state->data))->length) <= extent.start.col) {
if (NULL == (col_state = col_state->next)) {
- next_col_check = SHEET_MAX_COLS;
+ next_col_check = gnm_sheet_get_max_cols (cr->origin_sheet);
break;
}
next_col_check = i;
}
} else
- next_col_check = SHEET_MAX_COLS;
+ next_col_check = gnm_sheet_get_max_cols (cr->origin_sheet);
for (col = extent.start.col; col <= extent.end.col;) {
if (col == next_col_check) {
Modified: branches/gnumeric-1-8/src/cmd-edit.c
==============================================================================
--- branches/gnumeric-1-8/src/cmd-edit.c (original)
+++ branches/gnumeric-1-8/src/cmd-edit.c Mon Apr 28 23:19:20 2008
@@ -56,7 +56,7 @@
sv_selection_reset (sv);
sv_selection_add_full (sv,
sv->edit_pos.col, sv->edit_pos.row,
- 0, r.start.row, SHEET_MAX_COLS-1, r.end.row);
+ 0, r.start.row, gnm_sheet_get_max_cols (sv->sheet)-1, r.end.row);
sheet_update (sv->sheet);
}
}
@@ -76,7 +76,7 @@
sv_selection_reset (sv);
sv_selection_add_full (sv,
sv->edit_pos.col, sv->edit_pos.row,
- r.start.col, 0, r.end.col, SHEET_MAX_ROWS-1);
+ r.start.col, 0, r.end.col, gnm_sheet_get_max_rows (sv->sheet)-1);
sheet_update (sv->sheet);
}
}
@@ -399,7 +399,7 @@
rinfo.origin.start.row = start_row;
rinfo.origin.start.col = col;
rinfo.origin.end.row = end_row;
- rinfo.origin.end.col = SHEET_MAX_COLS-1;
+ rinfo.origin.end.col = gnm_sheet_get_max_cols (sheet)-1;
if (count > 0)
rinfo.origin.end.col -= count;
@@ -438,7 +438,7 @@
rinfo.origin.start.col = start_col;
rinfo.origin.start.row = row;
rinfo.origin.end.col = end_col;
- rinfo.origin.end.row = SHEET_MAX_ROWS-1;
+ rinfo.origin.end.row = gnm_sheet_get_max_rows (sheet)-1;
if (count > 0)
rinfo.origin.end.row -= count;
Modified: branches/gnumeric-1-8/src/colrow.c
==============================================================================
--- branches/gnumeric-1-8/src/colrow.c (original)
+++ branches/gnumeric-1-8/src/colrow.c Mon Apr 28 23:19:20 2008
@@ -442,19 +442,19 @@
if (is_cols) {
rles->state.size_pts = sheet_col_get_default_size_pts (sheet);
sheet_col_set_default_size_pixels (sheet, new_size);
- colrow_foreach (&sheet->cols, 0, SHEET_MAX_COLS-1,
+ colrow_foreach (&sheet->cols, 0, gnm_sheet_get_max_cols (sheet)-1,
&cb_set_colrow_size, &closure);
} else {
rles->state.size_pts = sheet_row_get_default_size_pts (sheet);
sheet_row_set_default_size_pixels (sheet, new_size);
- colrow_foreach (&sheet->rows, 0, SHEET_MAX_ROWS-1,
+ colrow_foreach (&sheet->rows, 0, gnm_sheet_get_max_rows (sheet)-1,
&cb_set_colrow_size, &closure);
}
/* force a re-render of cells with expanding formats */
if (is_cols)
sheet_foreach_cell_in_range (sheet, CELL_ITER_IGNORE_BLANK,
- 0, 0, SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1,
+ 0, 0, gnm_sheet_get_max_cols (sheet)-1, gnm_sheet_get_max_rows (sheet)-1,
(CellIterFunc) &cb_clear_variable_width_content, NULL);
/* Result is a magic 'default' record + >= 1 normal */
@@ -464,7 +464,7 @@
if (is_cols) {
/* force a re-render of cells with expanding formats */
sheet_foreach_cell_in_range (sheet, CELL_ITER_IGNORE_BLANK,
- index->first, 0, index->last, SHEET_MAX_ROWS-1,
+ index->first, 0, index->last, gnm_sheet_get_max_rows (sheet)-1,
(CellIterFunc) &cb_clear_variable_width_content, NULL);
/* In order to properly reposition cell comments in
@@ -479,8 +479,8 @@
if (tmp < 0)
/* Fall back to assigning the defaul if it is empty */
tmp = (is_cols)
- ? sheet_col_size_fit_pixels (sheet, i, 0, SHEET_MAX_ROWS - 1, FALSE)
- : sheet_row_size_fit_pixels (sheet, i, 0, SHEET_MAX_COLS - 1, FALSE);
+ ? sheet_col_size_fit_pixels (sheet, i, 0, gnm_sheet_get_max_rows (sheet) - 1, FALSE)
+ : sheet_row_size_fit_pixels (sheet, i, 0, gnm_sheet_get_max_cols (sheet) - 1, FALSE);
if (tmp > 0) {
if (is_cols)
@@ -606,7 +606,7 @@
/* force a re-render of cells with expanding formats */
if (is_cols)
sheet_foreach_cell_in_range (sheet, CELL_ITER_IGNORE_BLANK,
- index->first, 0, index->last, SHEET_MAX_ROWS-1,
+ index->first, 0, index->last, gnm_sheet_get_max_rows (sheet)-1,
(CellIterFunc) &cb_clear_variable_width_content, NULL);
colrow_state_list_destroy (ptr->data);
selection = selection->prev;
@@ -906,7 +906,7 @@
}
if (is_cols)
- sheet_queue_respan (sheet, 0, SHEET_MAX_ROWS-1);
+ sheet_queue_respan (sheet, 0, gnm_sheet_get_max_rows (sheet)-1);
if (list != NULL)
sheet_redraw_all (sheet, TRUE);
}
Modified: branches/gnumeric-1-8/src/commands.c
==============================================================================
--- branches/gnumeric-1-8/src/commands.c (original)
+++ branches/gnumeric-1-8/src/commands.c Mon Apr 28 23:19:20 2008
@@ -1878,8 +1878,8 @@
if (borders != NULL) {
if (range.start.col > 0) range.start.col--;
if (range.start.row > 0) range.start.row--;
- if (range.end.col < SHEET_MAX_COLS-1) range.end.col++;
- if (range.end.row < SHEET_MAX_ROWS-1) range.end.row++;
+ if (range.end.col < gnm_sheet_get_max_cols (me->cmd.sheet)-1) range.end.col++;
+ if (range.end.row < gnm_sheet_get_max_rows (me->cmd.sheet)-1) range.end.row++;
}
os = g_new (CmdFormatOldStyle, 1);
@@ -2188,10 +2188,10 @@
sv_selection_reset (sv);
if (me->is_cols)
sv_selection_add_full (sv, y, x, y, 0,
- y, SHEET_MAX_ROWS - 1);
+ y, gnm_sheet_get_max_rows (sheet) - 1);
else
sv_selection_add_full (sv, y, x, 0, x,
- SHEET_MAX_COLS - 1, x);
+ gnm_sheet_get_max_cols (sheet) - 1, x);
}
#endif
}
@@ -2998,9 +2998,9 @@
/* Before looking for tiling if we are not transposing,
* allow pasting a full col or row from a single cell */
n = range_width (r);
- if (n == 1 && cr->cols == SHEET_MAX_COLS) {
+ if (n == 1 && cr->cols == gnm_sheet_get_max_cols (me->cmd.sheet)) {
r->start.col = 0;
- r->end.col = SHEET_MAX_COLS-1;
+ r->end.col = gnm_sheet_get_max_cols (me->cmd.sheet)-1;
} else {
n /= cr->cols;
if (n < 1) n = 1;
@@ -3008,9 +3008,9 @@
}
n = range_height (r);
- if (n == 1 && cr->rows == SHEET_MAX_ROWS) {
+ if (n == 1 && cr->rows == gnm_sheet_get_max_rows (me->cmd.sheet)) {
r->start.row = 0;
- r->end.row = SHEET_MAX_ROWS-1;
+ r->end.row = gnm_sheet_get_max_rows (me->cmd.sheet)-1;
} else {
n /= cr->rows;
if (n < 1) n = 1;
@@ -3388,8 +3388,8 @@
src.start.col = src.end.col = (target.start.col + dx);
}
- if (src.start.col < 0 || src.start.col >= SHEET_MAX_COLS ||
- src.start.row < 0 || src.start.row >= SHEET_MAX_ROWS)
+ if (src.start.col < 0 || src.start.col >= gnm_sheet_get_max_cols (sheet) ||
+ src.start.row < 0 || src.start.row >= gnm_sheet_get_max_rows (sheet))
return FALSE;
/* Check arrays or merged regions in src or target regions */
@@ -3552,8 +3552,8 @@
/* Store the containing range to handle borders */
if (range.start.col > 0) range.start.col--;
if (range.start.row > 0) range.start.row--;
- if (range.end.col < SHEET_MAX_COLS-1) range.end.col++;
- if (range.end.row < SHEET_MAX_ROWS-1) range.end.row++;
+ if (range.end.col < gnm_sheet_get_max_cols (sv->sheet)-1) range.end.col++;
+ if (range.end.row < gnm_sheet_get_max_rows (sv->sheet)-1) range.end.row++;
os = g_new (CmdFormatOldStyle, 1);
Modified: branches/gnumeric-1-8/src/complete-sheet.c
==============================================================================
--- branches/gnumeric-1-8/src/complete-sheet.c (original)
+++ branches/gnumeric-1-8/src/complete-sheet.c Mon Apr 28 23:19:20 2008
@@ -6,7 +6,7 @@
* Miguel de Icaza (miguel gnu org)
*
* This is a pretty simple implementation, should be helpful
- * to find performance hot-spots (if you bump SEARCH_STEPS to SHEET_MAX_ROWS/2)
+ * to find performance hot-spots (if you bump SEARCH_STEPS to gnm_sheet_get_max_rows (sheet)/2)
*
* (C) 2000-2001 Ximian, Inc.
*/
Modified: branches/gnumeric-1-8/src/dependent.c
==============================================================================
--- branches/gnumeric-1-8/src/dependent.c (original)
+++ branches/gnumeric-1-8/src/dependent.c Mon Apr 28 23:19:20 2008
@@ -90,7 +90,7 @@
#define BUCKET_SIZE 128
#define BUCKET_OF_ROW(row) ((row) / BUCKET_SIZE)
-#define BUCKET_LAST (BUCKET_OF_ROW (SHEET_MAX_ROWS - 1))
+#define BUCKET_LAST (BUCKET_OF_ROW (gnm_sheet_get_max_rows (sheet) - 1))
#define BUCKET_START_ROW(b) ((b) * BUCKET_SIZE)
#define BUCKET_END_ROW(b) ((b) * BUCKET_SIZE + (BUCKET_SIZE - 1))
@@ -2646,7 +2646,7 @@
}
GnmDepContainer *
-gnm_dep_container_new (void)
+gnm_dep_container_new (Sheet *sheet)
{
GnmDepContainer *deps = g_new (GnmDepContainer, 1);
@@ -2810,6 +2810,7 @@
gnm_dep_container_dump (GnmDepContainer const *deps)
{
int i;
+ Sheet *sheet = NULL;
g_return_if_fail (deps != NULL);
Modified: branches/gnumeric-1-8/src/dependent.h
==============================================================================
--- branches/gnumeric-1-8/src/dependent.h (original)
+++ branches/gnumeric-1-8/src/dependent.h Mon Apr 28 23:19:20 2008
@@ -106,7 +106,7 @@
void dependents_revive_sheet (Sheet *sheet);
void workbook_queue_all_recalc (Workbook *wb);
-GnmDepContainer *gnm_dep_container_new (void);
+GnmDepContainer *gnm_dep_container_new (Sheet *sheet);
void gnm_dep_container_dump (GnmDepContainer const *deps);
void gnm_dep_container_sanity_check (GnmDepContainer const *deps);
Modified: branches/gnumeric-1-8/src/dialogs/dialog-merge.c
==============================================================================
--- branches/gnumeric-1-8/src/dialogs/dialog-merge.c (original)
+++ branches/gnumeric-1-8/src/dialogs/dialog-merge.c Mon Apr 28 23:19:20 2008
@@ -231,7 +231,7 @@
GSList *data_list = NULL, *field_list = NULL;
GnmValue *v_zone;
gint field_problems = 0;
- gint min_length = SHEET_MAX_ROWS;
+ gint min_length = gnm_sheet_get_max_rows (state->sheet);
gint max_length = 0;
v_zone = gnm_expr_entry_parse_as_value (state->zone, state->sheet);
Modified: branches/gnumeric-1-8/src/dialogs/dialog-stf-format-page.c
==============================================================================
--- branches/gnumeric-1-8/src/dialogs/dialog-stf-format-page.c (original)
+++ branches/gnumeric-1-8/src/dialogs/dialog-stf-format-page.c Mon Apr 28 23:19:20 2008
@@ -23,8 +23,10 @@
#include <gnumeric-config.h>
#include <glib/gi18n-lib.h>
#include <gnumeric.h>
+#include <libgnumeric.h>
#include "dialog-stf.h"
#include <gnm-format.h>
+#include <sheet.h>
#include <workbook.h>
#include <workbook-control.h>
#include <gui-util.h>
@@ -175,7 +177,7 @@
pagedata->format.col_import_count--;
format_page_update_column_selection (pagedata);
} else {
- if (pagedata->format.col_import_count < SHEET_MAX_COLS) {
+ if (pagedata->format.col_import_count < gnm_sheet_get_max_cols (NULL)) {
pagedata->format.col_import_array[i] = TRUE;
pagedata->format.col_import_count++;
format_page_update_column_selection (pagedata);
@@ -183,8 +185,8 @@
char *msg = g_strdup_printf(
ngettext("A maximum of %d column can be imported.",
"A maximum of %d columns can be imported.",
- SHEET_MAX_COLS),
- SHEET_MAX_COLS);
+ gnm_sheet_get_max_cols (NULL)),
+ gnm_sheet_get_max_cols (NULL));
gtk_toggle_button_set_active (togglebutton, FALSE);
go_gtk_notice_dialog (GTK_WINDOW (pagedata->dialog),
GTK_MESSAGE_WARNING, msg);
@@ -208,7 +210,7 @@
if (!pagedata->format.col_import_array[i]) {
GtkTreeViewColumn* column = stf_preview_get_column (pagedata->format.renderdata, i);
GtkWidget *w = g_object_get_data (G_OBJECT (column), "checkbox");
- if (!(pagedata->format.col_import_count < SHEET_MAX_COLS))
+ if (!(pagedata->format.col_import_count < gnm_sheet_get_max_cols (NULL)))
return;
gtk_widget_hide (w);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), TRUE);
@@ -496,7 +498,7 @@
pagedata->format.col_import_count++;
for (i = old_part;
i < pagedata->format.col_import_array_len; i++)
- if (pagedata->format.col_import_count < SHEET_MAX_COLS) {
+ if (pagedata->format.col_import_count < gnm_sheet_get_max_cols (NULL)) {
pagedata->format.col_import_array[i] = TRUE;
pagedata->format.col_import_count++;
} else {
@@ -508,7 +510,7 @@
if (old_part < renderdata->colcount)
msg = g_strdup_printf
(_("A maximum of %d columns can be imported."),
- SHEET_MAX_COLS);
+ gnm_sheet_get_max_cols (NULL));
for (i = old_part; i < renderdata->colcount; i++) {
GtkTreeViewColumn *column =
Modified: branches/gnumeric-1-8/src/dialogs/dialog-stf-main-page.c
==============================================================================
--- branches/gnumeric-1-8/src/dialogs/dialog-stf-main-page.c (original)
+++ branches/gnumeric-1-8/src/dialogs/dialog-stf-main-page.c Mon Apr 28 23:19:20 2008
@@ -22,8 +22,10 @@
#include <gnumeric-config.h>
#include <glib/gi18n-lib.h>
#include <gnumeric.h>
+#include <libgnumeric.h>
#include "dialog-stf.h"
#include <gui-util.h>
+#include <sheet.h>
#include <workbook.h>
#include <gtk/gtkframe.h>
#include <goffice/utils/go-glib-extras.h>
@@ -147,7 +149,7 @@
}
stoplimit = MIN ((int)renderdata->lines->len,
- startrow + (SHEET_MAX_ROWS - 1));
+ startrow + (gnm_sheet_get_max_rows (NULL) - 1));
if (stoprow > stoplimit) {
stoprow = stoplimit;
gtk_spin_button_set_value (data->main.main_stoprow, stoprow);
Modified: branches/gnumeric-1-8/src/expr.c
==============================================================================
--- branches/gnumeric-1-8/src/expr.c (original)
+++ branches/gnumeric-1-8/src/expr.c Mon Apr 28 23:19:20 2008
@@ -1739,7 +1739,7 @@
* deleting rows. Otherwise we #REF! before we can shorten
* The -1 is safe, origin.start.row == 0 is handled above */
if (rinfo->reloc_type == GNM_EXPR_RELOCATE_ROWS &&
- rinfo->row_offset >= SHEET_MAX_ROWS)
+ rinfo->row_offset >= gnm_sheet_get_max_rows (end_sheet))
rng->end.row = rinfo->origin.start.row - 1;
else
rng->end.row += rinfo->row_offset;
@@ -1759,7 +1759,7 @@
* deleting cols. Otherwise we #REF! before we can shorten.
* The -1 is safe, origin.start.col == 0 is handled above */
if (rinfo->reloc_type == GNM_EXPR_RELOCATE_COLS &&
- rinfo->col_offset >= SHEET_MAX_COLS)
+ rinfo->col_offset >= gnm_sheet_get_max_cols (end_sheet))
rng->end.col = rinfo->origin.start.col - 1;
else
rng->end.col += rinfo->col_offset;
@@ -1801,7 +1801,7 @@
res->sheet = rinfo->details->target_sheet;
if (!res->col_relative || rinfo->check_rels) {
- if (pos->col < 0 || SHEET_MAX_COLS <= pos->col)
+ if (pos->col < 0 || gnm_sheet_get_max_cols (sheet) <= pos->col)
return TRUE;
res->col = pos->col;
if (res->col_relative) {
@@ -1811,7 +1811,7 @@
}
}
if (!res->row_relative || rinfo->check_rels) {
- if (pos->row < 0 || SHEET_MAX_ROWS <= pos->row)
+ if (pos->row < 0 || gnm_sheet_get_max_rows (sheet) <= pos->row)
return TRUE;
res->row = pos->row;
if (res->row_relative) {
@@ -2119,7 +2119,7 @@
{
if (cr->col_relative) {
if (cr->col >= 0) {
- int const c = SHEET_MAX_COLS - cr->col - 1;
+ int const c = gnm_sheet_get_max_cols (cr->sheet) - cr->col - 1;
if (bound->end.col > c)
bound->end.col = c;
} else {
@@ -2130,7 +2130,7 @@
}
if (cr->row_relative) {
if (cr->row >= 0) {
- int const r = SHEET_MAX_ROWS - cr->row - 1;
+ int const r = gnm_sheet_get_max_rows (cr->sheet) - cr->row - 1;
if (bound->end.row > r)
bound->end.row = r;
} else {
Modified: branches/gnumeric-1-8/src/gnm-pane.c
==============================================================================
--- branches/gnumeric-1-8/src/gnm-pane.c (original)
+++ branches/gnumeric-1-8/src/gnm-pane.c Mon Apr 28 23:19:20 2008
@@ -325,9 +325,9 @@
(*movefn)(scg, r.end.row - sv->edit_pos.row, FALSE, FALSE);
} else {
/* do the ctrl-home jump to A1 in 2 steps */
- (*movefn)(scg, -SHEET_MAX_COLS, FALSE, TRUE);
+ (*movefn)(scg, -gnm_sheet_get_max_cols (sheet), FALSE, TRUE);
if ((event->state & GDK_CONTROL_MASK) || transition_keys)
- (*movefn)(scg, -SHEET_MAX_ROWS, FALSE, FALSE);
+ (*movefn)(scg, -gnm_sheet_get_max_rows (sheet), FALSE, FALSE);
}
break;
@@ -525,11 +525,11 @@
range_init_full_sheet (&target);
else { /* full row */
target.start.col = 0;
- target.end.col = SHEET_MAX_COLS - 1;
+ target.end.col = gnm_sheet_get_max_cols (sv->sheet) - 1;
}
} else if (event->state & GDK_CONTROL_MASK) { /* full col */
target.start.row = 0;
- target.end.row = SHEET_MAX_ROWS - 1;
+ target.end.row = gnm_sheet_get_max_rows (sv->sheet) - 1;
} else
return FALSE;
@@ -1223,11 +1223,11 @@
}
pixel += tmp;
}
- } while (++col < SHEET_MAX_COLS - 1);
+ } while (++col < gnm_sheet_get_max_cols (sheet) - 1);
if (col_origin)
*col_origin = gnm_pane_x_w2c (pane, pixel);
- return SHEET_MAX_COLS - 1;
+ return gnm_sheet_get_max_cols (sheet) - 1;
}
/**
@@ -1273,10 +1273,10 @@
}
pixel += tmp;
}
- } while (++row < SHEET_MAX_ROWS-1);
+ } while (++row < gnm_sheet_get_max_rows (sheet)-1);
if (row_origin)
*row_origin = pixel;
- return SHEET_MAX_ROWS-1;
+ return gnm_sheet_get_max_rows (sheet)-1;
}
/*
@@ -1347,11 +1347,11 @@
pixels = bound;
}
++col;
- } while (pixels < width && col < SHEET_MAX_COLS);
+ } while (pixels < width && col < gnm_sheet_get_max_cols (sheet));
- if (col >= SHEET_MAX_COLS) {
- pane->last_visible.col = SHEET_MAX_COLS-1;
- pane->last_full.col = SHEET_MAX_COLS-1;
+ if (col >= gnm_sheet_get_max_cols (sheet)) {
+ pane->last_visible.col = gnm_sheet_get_max_cols (sheet)-1;
+ pane->last_full.col = gnm_sheet_get_max_cols (sheet)-1;
}
/* Find out the last visible row and the last fully visible row */
@@ -1379,11 +1379,11 @@
pixels = bound;
}
++row;
- } while (pixels < height && row < SHEET_MAX_ROWS);
+ } while (pixels < height && row < gnm_sheet_get_max_rows (sheet));
- if (row >= SHEET_MAX_ROWS) {
- pane->last_visible.row = SHEET_MAX_ROWS-1;
- pane->last_full.row = SHEET_MAX_ROWS-1;
+ if (row >= gnm_sheet_get_max_rows (sheet)) {
+ pane->last_visible.row = gnm_sheet_get_max_rows (sheet)-1;
+ pane->last_full.row = gnm_sheet_get_max_rows (sheet)-1;
}
/* Update the scrollbar sizes for the primary pane */
@@ -1428,11 +1428,11 @@
pane->first_offset.col;
y1 = scg_colrow_distance_get (scg, FALSE, pane->first.row, tmp.start.row) +
pane->first_offset.row;
- x2 = (tmp.end.col < (SHEET_MAX_COLS-1))
+ x2 = (tmp.end.col < (gnm_sheet_get_max_cols (sheet)-1))
? 4 + 1 + x1 + scg_colrow_distance_get (scg, TRUE,
tmp.start.col, tmp.end.col+1)
: INT_MAX;
- y2 = (tmp.end.row < (SHEET_MAX_ROWS-1))
+ y2 = (tmp.end.row < (gnm_sheet_get_max_rows (sheet)-1))
? 4 + 1 + y1 + scg_colrow_distance_get (scg, FALSE,
tmp.start.row, tmp.end.row+1)
: INT_MAX;
@@ -1465,7 +1465,7 @@
}
static int
-col_scroll_step (int dx)
+col_scroll_step (int dx, Sheet *sheet)
{
/* FIXME: get from gdk. */
int dpi_x_this_screen = 90;
@@ -1473,11 +1473,11 @@
double double_dx = dpi_x_this_screen / 3.0;
double step = pow (2.0, (dx - start_x) / double_dx);
- return (int) (CLAMP (step, 1.0, SHEET_MAX_COLS / 15.0));
+ return (int) (CLAMP (step, 1.0, gnm_sheet_get_max_cols (sheet) / 15.0));
}
static int
-row_scroll_step (int dy)
+row_scroll_step (int dy, Sheet *sheet)
{
/* FIXME: get from gdk. */
int dpi_y_this_screen = 90;
@@ -1485,7 +1485,7 @@
double double_dy = dpi_y_this_screen / 8.0;
double step = pow (2.0, (dy - start_y) / double_dy);
- return (int) (CLAMP (step, 1.0, SHEET_MAX_ROWS / 15.0));
+ return (int) (CLAMP (step, 1.0, gnm_sheet_get_max_rows (sheet) / 15.0));
}
static gint
@@ -1499,6 +1499,9 @@
int col = -1, row = -1;
gboolean text_is_rtl = pane->simple.scg->sheet_control.sheet->text_is_rtl;
GnmPaneSlideInfo info;
+ Sheet *sheet = ((SheetControl *) pane->simple.scg)->sheet;
+
+
#if 0
g_warning ("slide: %d, %d", pane->sliding_dx, pane->sliding_dy);
@@ -1527,15 +1530,15 @@
if (slide_x) {
col = target_pane->last_full.col +
- col_scroll_step (pane->sliding_dx);
- if (col >= SHEET_MAX_COLS-1) {
- col = SHEET_MAX_COLS-1;
+ col_scroll_step (pane->sliding_dx, sheet);
+ if (col >= gnm_sheet_get_max_cols (sheet)-1) {
+ col = gnm_sheet_get_max_cols (sheet)-1;
slide_x = FALSE;
}
}
} else if (pane->sliding_dx < 0) {
slide_x = TRUE;
- col = pane0->first.col - col_scroll_step (-pane->sliding_dx);
+ col = pane0->first.col - col_scroll_step (-pane->sliding_dx, sheet);
if (pane1 != NULL) {
if (pane_index == 0 || pane_index == 3) {
@@ -1582,15 +1585,15 @@
if (slide_y) {
row = target_pane->last_full.row +
- row_scroll_step (pane->sliding_dy);
- if (row >= SHEET_MAX_ROWS-1) {
- row = SHEET_MAX_ROWS-1;
+ row_scroll_step (pane->sliding_dy, sheet);
+ if (row >= gnm_sheet_get_max_rows (sheet)-1) {
+ row = gnm_sheet_get_max_rows (sheet)-1;
slide_y = FALSE;
}
}
} else if (pane->sliding_dy < 0) {
slide_y = TRUE;
- row = pane0->first.row - row_scroll_step (-pane->sliding_dy);
+ row = pane0->first.row - row_scroll_step (-pane->sliding_dy, sheet);
if (pane3 != NULL) {
if (pane_index == 0 || pane_index == 1) {
Modified: branches/gnumeric-1-8/src/item-bar.c
==============================================================================
--- branches/gnumeric-1-8/src/item-bar.c (original)
+++ branches/gnumeric-1-8/src/item-bar.c Mon Apr 28 23:19:20 2008
@@ -147,9 +147,9 @@
/* 5 pixels left and right plus the width of the widest string I can think of */
if (char_label)
- pango_layout_set_text (layout, "WWWWWWWWWW", strlen (col_name (SHEET_MAX_COLS - 1)));
+ pango_layout_set_text (layout, "WWWWWWWWWW", strlen (col_name (gnm_sheet_get_max_cols (sheet) - 1)));
else
- pango_layout_set_text (layout, "8888888888", strlen (row_name (SHEET_MAX_ROWS - 1)));
+ pango_layout_set_text (layout, "8888888888", strlen (row_name (gnm_sheet_get_max_rows (sheet) - 1)));
pango_layout_get_extents (layout, NULL, &logical_rect);
ib->cell_width = 5 + 5 + PANGO_PIXELS (logical_rect.width);
@@ -374,7 +374,7 @@
}
do {
- if (col >= SHEET_MAX_COLS)
+ if (col >= gnm_sheet_get_max_cols (sheet))
return;
/* DO NOT enable resizing all until we get rid of
@@ -537,7 +537,7 @@
}
do {
- if (row >= SHEET_MAX_ROWS)
+ if (row >= gnm_sheet_get_max_rows (sheet))
return;
/* DO NOT enable resizing all until we get rid of
@@ -719,11 +719,11 @@
*the_element = -1;
for (i = 0; total < major; i++) {
if (ib->is_col_header) {
- if (i >= SHEET_MAX_COLS)
+ if (i >= gnm_sheet_get_max_cols (sheet))
return NULL;
cri = sheet_col_get_info (sheet, i);
} else {
- if (i >= SHEET_MAX_ROWS)
+ if (i >= gnm_sheet_get_max_rows (sheet))
return NULL;
cri = sheet_row_get_info (sheet, i);
}
Modified: branches/gnumeric-1-8/src/item-cursor.c
==============================================================================
--- branches/gnumeric-1-8/src/item-cursor.c (original)
+++ branches/gnumeric-1-8/src/item-cursor.c Mon Apr 28 23:19:20 2008
@@ -14,6 +14,7 @@
#include "gnm-pane-impl.h"
#include "sheet-control-gui.h"
+#include "sheet-control-priv.h"
#include "style-color.h"
#include "cell.h"
#include "clipboard.h"
@@ -721,19 +722,19 @@
int boundary_col_for_target;
int target_row;
- if (template_row < 0 || template_col >= SHEET_MAX_COLS ||
+ if (template_row < 0 || template_col >= gnm_sheet_get_max_cols (sheet) ||
sheet_is_cell_empty (sheet, template_col,
template_row)) {
template_row = ic->pos.end.row + 1;
- if (template_row >= SHEET_MAX_ROWS ||
- template_col >= SHEET_MAX_COLS ||
+ if (template_row >= gnm_sheet_get_max_rows (sheet) ||
+ template_col >= gnm_sheet_get_max_cols (sheet) ||
sheet_is_cell_empty (sheet, template_col,
template_row))
return TRUE;
}
- if (template_col >= SHEET_MAX_COLS ||
+ if (template_col >= gnm_sheet_get_max_cols (sheet) ||
sheet_is_cell_empty (sheet, template_col,
template_row))
return TRUE;
@@ -776,19 +777,19 @@
int boundary_row_for_target;
int target_col;
- if (template_col < 0 || template_row >= SHEET_MAX_ROWS ||
+ if (template_col < 0 || template_row >= gnm_sheet_get_max_rows (sheet) ||
sheet_is_cell_empty (sheet, template_col,
template_row)) {
template_col = ic->pos.end.col + 1;
- if (template_col >= SHEET_MAX_COLS ||
- template_row >= SHEET_MAX_ROWS ||
+ if (template_col >= gnm_sheet_get_max_cols (sheet) ||
+ template_row >= gnm_sheet_get_max_rows (sheet) ||
sheet_is_cell_empty (sheet, template_col,
template_row))
return TRUE;
}
- if (template_row >= SHEET_MAX_ROWS ||
+ if (template_row >= gnm_sheet_get_max_rows (sheet) ||
sheet_is_cell_empty (sheet, template_col,
template_row))
return TRUE;
@@ -1096,18 +1097,19 @@
int const w = (ic->pos.end.col - ic->pos.start.col);
int const h = (ic->pos.end.row - ic->pos.start.row);
GnmRange r;
+ Sheet *sheet = ((SheetControl *) (pane->simple.scg))->sheet;
r.start.col = info->col - ic->col_delta;
if (r.start.col < 0)
r.start.col = 0;
- else if (r.start.col >= (SHEET_MAX_COLS - w))
- r.start.col = SHEET_MAX_COLS - w - 1;
+ else if (r.start.col >= (gnm_sheet_get_max_cols (sheet) - w))
+ r.start.col = gnm_sheet_get_max_cols (sheet) - w - 1;
r.start.row = info->row - ic->row_delta;
if (r.start.row < 0)
r.start.row = 0;
- else if (r.start.row >= (SHEET_MAX_ROWS - h))
- r.start.row = SHEET_MAX_ROWS - h - 1;
+ else if (r.start.row >= (gnm_sheet_get_max_rows (sheet) - h))
+ r.start.row = gnm_sheet_get_max_rows (sheet) - h - 1;
item_cursor_tip_setlabel (ic, range_as_string (&ic->pos));
Modified: branches/gnumeric-1-8/src/item-edit.c
==============================================================================
--- branches/gnumeric-1-8/src/item-edit.c (original)
+++ branches/gnumeric-1-8/src/item-edit.c Mon Apr 28 23:19:20 2008
@@ -283,7 +283,7 @@
while (col_size < width &&
col <= pane->last_full.col &&
- col < SHEET_MAX_COLS-1) {
+ col < gnm_sheet_get_max_cols (sheet)-1) {
ci = sheet_col_get_info (sheet, ++col);
g_return_if_fail (ci != NULL);
Modified: branches/gnumeric-1-8/src/item-grid.c
==============================================================================
--- branches/gnumeric-1-8/src/item-grid.c (original)
+++ branches/gnumeric-1-8/src/item-grid.c Mon Apr 28 23:19:20 2008
@@ -813,9 +813,9 @@
pos.row = gnm_pane_find_row (pane, y, NULL);
/* GnmRange check first */
- if (pos.col >= SHEET_MAX_COLS)
+ if (pos.col >= gnm_sheet_get_max_cols (sheet))
return TRUE;
- if (pos.row >= SHEET_MAX_ROWS)
+ if (pos.row >= gnm_sheet_get_max_rows (sheet))
return TRUE;
/* A new object is ready to be realized and inserted */
Modified: branches/gnumeric-1-8/src/parse-util.c
==============================================================================
--- branches/gnumeric-1-8/src/parse-util.c (original)
+++ branches/gnumeric-1-8/src/parse-util.c Mon Apr 28 23:19:20 2008
@@ -118,7 +118,7 @@
if (!(*relative = (*start != '$')))
start++;
- for (ptr = start; col < SHEET_MAX_COLS ; ptr++)
+ for (ptr = start; col < gnm_sheet_get_max_cols (NULL) ; ptr++)
if (('a' <= *ptr && *ptr <= 'z'))
col = 26 * (col + 1) + (*ptr - 'a');
else if (('A' <= *ptr && *ptr <= 'Z'))
@@ -190,7 +190,7 @@
row = strtol (ptr, (char **)&end, 10);
if (ptr != end &&
!g_unichar_isalnum (g_utf8_get_char (end)) && *end != '_' &&
- 0 < row && row <= SHEET_MAX_ROWS) {
+ 0 < row && row <= gnm_sheet_get_max_rows (NULL)) {
*res = row - 1;
return end;
} else
@@ -205,9 +205,9 @@
int col = (ref->col_relative) ? pp->eval.col + ref->col : ref->col;
/* ICK! XL compatibility kludge */
- col %= SHEET_MAX_COLS;
+ col %= gnm_sheet_get_max_cols (ref->sheet);
if (col < 0)
- return col + SHEET_MAX_COLS;
+ return col + gnm_sheet_get_max_cols (ref->sheet);
return col;
}
@@ -217,9 +217,9 @@
int row = (ref->row_relative) ? pp->eval.row + ref->row : ref->row;
/* ICK! XL compatibility kludge */
- row %= SHEET_MAX_ROWS;
+ row %= gnm_sheet_get_max_rows (ref->sheet);
if (row < 0)
- return row + SHEET_MAX_ROWS;
+ return row + gnm_sheet_get_max_rows (ref->sheet);
return row;
}
@@ -299,9 +299,9 @@
}
/* ICK! XL compatibility kludge */
- col %= SHEET_MAX_COLS;
+ col %= gnm_sheet_get_max_cols (sheet);
if (col < 0)
- col += SHEET_MAX_COLS;
+ col += gnm_sheet_get_max_cols (sheet);
col_name_internal (target, col);
if (cell_ref->row_relative)
@@ -312,9 +312,9 @@
}
/* ICK! XL compatibility kludge */
- row %= SHEET_MAX_ROWS;
+ row %= gnm_sheet_get_max_rows (sheet);
if (row < 0)
- row += SHEET_MAX_ROWS;
+ row += gnm_sheet_get_max_rows (sheet);
row_name_internal (target, row);
}
}
@@ -359,14 +359,14 @@
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 == SHEET_MAX_COLS-1) {
+ if (r.start.col == 0 && r.end.col == gnm_sheet_get_max_cols (ref->a.sheet)-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 == SHEET_MAX_ROWS-1) {
+ } else if (r.start.row == 0 && r.end.row == gnm_sheet_get_max_rows (ref->a.sheet)-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) {
@@ -387,7 +387,7 @@
}
} else {
/* be sure to use else if so that a1:iv65535 does not vanish */
- if (r.start.col == 0 && r.end.col == SHEET_MAX_COLS-1) {
+ if (r.start.col == 0 && r.end.col == gnm_sheet_get_max_cols (ref->a.sheet)-1) {
if (!ref->a.row_relative)
g_string_append_c (target, '$');
row_name_internal (target, r.start.row);
@@ -395,7 +395,7 @@
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 == SHEET_MAX_ROWS-1) {
+ } else if (r.start.row == 0 && r.end.row == gnm_sheet_get_max_rows (ref->a.sheet)-1) {
if (!ref->a.col_relative)
g_string_append_c (target, '$');
col_name_internal (target, r.start.col);
@@ -973,7 +973,7 @@
res->a.col_relative = FALSE;
res->a.col = 0;
res->b = res->a;
- res->b.col = SHEET_MAX_COLS - 1;
+ res->b.col = gnm_sheet_get_max_cols (res->b.sheet) - 1;
if (ptr[0] != ':' || (ptr[1] != 'R' && ptr[1] != 'r'))
return ptr;
if (NULL == (tmp = r1c1_get_index (ptr+1, &res->b.row, &res->b.row_relative, FALSE)))
@@ -998,7 +998,7 @@
res->a.row_relative = FALSE;
res->a.row = 0;
res->b = res->a;
- res->b.row = SHEET_MAX_ROWS - 1;
+ res->b.row = gnm_sheet_get_max_rows (res->b.sheet) - 1;
if (ptr[0] != ':' || (ptr[1] != 'C' && ptr[1] != 'c'))
return ptr;
if (NULL == (tmp = r1c1_get_index (ptr, &res->b.col, &res->b.col_relative, TRUE)))
@@ -1068,7 +1068,7 @@
if (!tmp2)
return start;
res->a.col_relative = res->b.col_relative = FALSE;
- res->a.col = 0; res->b.col = SHEET_MAX_COLS-1;
+ res->a.col = 0; res->b.col = gnm_sheet_get_max_cols (res->b.sheet)-1;
if (res->a.row_relative)
res->a.row -= pp->eval.row;
if (res->b.row_relative)
@@ -1084,7 +1084,7 @@
if (!tmp2)
return start;
res->a.row_relative = res->b.row_relative = FALSE;
- res->a.row = 0; res->b.row = SHEET_MAX_ROWS-1;
+ res->a.row = 0; res->b.row = gnm_sheet_get_max_rows (res->b.sheet)-1;
if (res->a.col_relative)
res->a.col -= pp->eval.col;
if (res->b.col_relative)
Modified: branches/gnumeric-1-8/src/position.c
==============================================================================
--- branches/gnumeric-1-8/src/position.c (original)
+++ branches/gnumeric-1-8/src/position.c Mon Apr 28 23:19:20 2008
@@ -22,6 +22,7 @@
*/
#include <gnumeric-config.h>
#include "gnumeric.h"
+#include "libgnumeric.h"
#include "position.h"
#include "sheet.h"
@@ -262,9 +263,9 @@
g_return_val_if_fail (ep != NULL, 0);
if (ref->col_relative) {
- int res = (ep->eval.col + ref->col) % SHEET_MAX_COLS;
+ int res = (ep->eval.col + ref->col) % gnm_sheet_get_max_cols (ref->sheet);
if (res < 0)
- return res + SHEET_MAX_COLS;
+ return res + gnm_sheet_get_max_cols (ref->sheet);
return res;
}
return ref->col;
@@ -277,9 +278,9 @@
g_return_val_if_fail (ep != NULL, 0);
if (ref->row_relative) {
- int res = (ep->eval.row + ref->row) % SHEET_MAX_ROWS;
+ int res = (ep->eval.row + ref->row) % gnm_sheet_get_max_rows (ref->sheet);
if (res < 0)
- return res + SHEET_MAX_ROWS;
+ return res + gnm_sheet_get_max_rows (ref->sheet);
return res;
}
return ref->row;
@@ -293,16 +294,16 @@
g_return_if_fail (res != NULL);
if (cell_ref->col_relative) {
- res->col = (cell_ref->col + pos->col) % SHEET_MAX_COLS;
+ res->col = (cell_ref->col + pos->col) % gnm_sheet_get_max_cols (cell_ref->sheet);
if (res->col < 0)
- res->col += SHEET_MAX_COLS;
+ res->col += gnm_sheet_get_max_cols (cell_ref->sheet);
} else
res->col = cell_ref->col;
if (cell_ref->row_relative) {
- res->row = (cell_ref->row + pos->row) % SHEET_MAX_ROWS;
+ res->row = (cell_ref->row + pos->row) % gnm_sheet_get_max_rows (cell_ref->sheet);
if (res->row < 0)
- res->row += SHEET_MAX_ROWS;
+ res->row += gnm_sheet_get_max_rows (cell_ref->sheet);
} else
res->row = cell_ref->row;
}
@@ -316,15 +317,15 @@
*dest = *src;
if (src->col_relative) {
- dest->col = (dest->col + ep->eval.col) % SHEET_MAX_COLS;
+ dest->col = (dest->col + ep->eval.col) % gnm_sheet_get_max_cols (dest->sheet);
if (dest->col < 0)
- dest->col += SHEET_MAX_COLS;
+ dest->col += gnm_sheet_get_max_cols (dest->sheet);
}
if (src->row_relative) {
- dest->row = (dest->row + ep->eval.row) % SHEET_MAX_ROWS;
+ dest->row = (dest->row + ep->eval.row) % gnm_sheet_get_max_rows (dest->sheet);
if (dest->row < 0)
- dest->row += SHEET_MAX_ROWS;
+ dest->row += gnm_sheet_get_max_rows (dest->sheet);
}
dest->row_relative = dest->col_relative = FALSE;
Modified: branches/gnumeric-1-8/src/preview-grid.c
==============================================================================
--- branches/gnumeric-1-8/src/preview-grid.c (original)
+++ branches/gnumeric-1-8/src/preview-grid.c Mon Apr 28 23:19:20 2008
@@ -59,8 +59,8 @@
PreviewGridClass *klass = PREVIEW_GRID_GET_CLASS (pg);
GnmStyle *style;
- g_return_val_if_fail (col >= 0 && col < SHEET_MAX_COLS, NULL);
- g_return_val_if_fail (row >= 0 && row < SHEET_MAX_ROWS, NULL);
+ g_return_val_if_fail (col >= 0 && col < gnm_sheet_get_max_cols (pg->sheet), NULL);
+ g_return_val_if_fail (row >= 0 && row < gnm_sheet_get_max_rows (pg->sheet), NULL);
g_return_val_if_fail (klass != NULL, NULL);
if (klass->get_cell_style != NULL) {
@@ -82,8 +82,8 @@
g_return_val_if_fail (klass != NULL, NULL);
g_return_val_if_fail (pg != NULL, NULL);
- g_return_val_if_fail (col >= 0 && col < SHEET_MAX_COLS, NULL);
- g_return_val_if_fail (row >= 0 && row < SHEET_MAX_ROWS, NULL);
+ g_return_val_if_fail (col >= 0 && col < gnm_sheet_get_max_cols (pg->sheet), NULL);
+ g_return_val_if_fail (row >= 0 && row < gnm_sheet_get_max_rows (pg->sheet), NULL);
if (NULL != klass->get_cell_value)
v = (klass->get_cell_value) (pg, col, row);
@@ -122,12 +122,12 @@
return row;
}
pixel += h;
- } while (++row < SHEET_MAX_ROWS);
+ } while (++row < gnm_sheet_get_max_rows (pg->sheet));
if (row_origin)
*row_origin = pixel;
- return SHEET_MAX_ROWS - 1;
+ return gnm_sheet_get_max_rows (pg->sheet) - 1;
}
/**
@@ -154,12 +154,12 @@
return col;
}
pixel += w;
- } while (++col < SHEET_MAX_COLS);
+ } while (++col < gnm_sheet_get_max_cols (pg->sheet));
if (col_origin)
*col_origin = pixel;
- return SHEET_MAX_COLS - 1;
+ return gnm_sheet_get_max_cols (pg->sheet) - 1;
}
static void
Modified: branches/gnumeric-1-8/src/print.c
==============================================================================
--- branches/gnumeric-1-8/src/print.c (original)
+++ branches/gnumeric-1-8/src/print.c Mon Apr 28 23:19:20 2008
@@ -783,8 +783,8 @@
return min_p;
}
-#define COL_FIT(col) (col >= SHEET_MAX_COLS ? (SHEET_MAX_COLS-1) : col)
-#define ROW_FIT(row) (row >= SHEET_MAX_ROWS ? (SHEET_MAX_ROWS-1) : row)
+#define COL_FIT(col) (col >= gnm_sheet_get_max_cols (sheet) ? (gnm_sheet_get_max_cols (sheet)-1) : col)
+#define ROW_FIT(row) (row >= gnm_sheet_get_max_rows (sheet) ? (gnm_sheet_get_max_rows (sheet)-1) : row)
static void
compute_sheet_pages_add_sheet (PrintingInstance * pi, Sheet const *sheet, gboolean selection,
Modified: branches/gnumeric-1-8/src/ranges.c
==============================================================================
--- branches/gnumeric-1-8/src/ranges.c (original)
+++ branches/gnumeric-1-8/src/ranges.c Mon Apr 28 23:19:20 2008
@@ -37,8 +37,8 @@
{
r->start.col = 0;
r->start.row = 0;
- r->end.col = SHEET_MAX_COLS - 1;
- r->end.row = SHEET_MAX_ROWS - 1;
+ r->end.col = G_MAXINT / 2;
+ r->end.row = G_MAXINT / 2;
return r;
}
GnmRange *
@@ -47,7 +47,7 @@
r->start.col = start_col;
r->start.row = 0;
r->end.col = end_col;
- r->end.row = SHEET_MAX_ROWS - 1;
+ r->end.row = gnm_sheet_get_max_rows (NULL) - 1;
return r;
}
@@ -56,7 +56,7 @@
{
r->start.col = 0;
r->start.row = start_row;
- r->end.col = SHEET_MAX_COLS - 1;
+ r->end.col = gnm_sheet_get_max_cols (NULL) - 1;
r->end.row = end_row;
return r;
}
@@ -577,9 +577,9 @@
range_is_full (GnmRange const *r, gboolean horiz)
{
if (horiz)
- return (r->start.col <= 0 && r->end.col >= SHEET_MAX_COLS - 1);
+ return (r->start.col <= 0 && r->end.col >= gnm_sheet_get_max_cols (NULL) - 1);
else
- return (r->start.row <= 0 && r->end.row >= SHEET_MAX_ROWS - 1);
+ return (r->start.row <= 0 && r->end.row >= gnm_sheet_get_max_rows (NULL) - 1);
}
/**
@@ -592,9 +592,9 @@
range_make_full (GnmRange *r, gboolean full_col, gboolean full_row)
{
if (full_col)
- r->start.row = 0, r->end.row = SHEET_MAX_ROWS - 1;
+ r->start.row = 0, r->end.row = gnm_sheet_get_max_rows (NULL) - 1;
if (full_row)
- r->start.col = 0, r->end.col = SHEET_MAX_COLS - 1;
+ r->start.col = 0, r->end.col = gnm_sheet_get_max_cols (NULL) - 1;
}
/**
@@ -615,9 +615,9 @@
* using the current values as a cache
*/
extent = sheet_get_extent (sheet, FALSE);
- if (range->end.col >= SHEET_MAX_COLS - 2)
+ if (range->end.col >= gnm_sheet_get_max_cols (NULL) - 2)
range->end.col = extent.end.col;
- if (range->end.row >= SHEET_MAX_ROWS - 2)
+ if (range->end.row >= gnm_sheet_get_max_rows (NULL) - 2)
range->end.row = extent.end.row;
}
@@ -658,10 +658,10 @@
range->end.row += row_offset;
/* check for completely out of bounds */
- if (range->start.col >= SHEET_MAX_COLS || range->start.col < 0 ||
- range->start.row >= SHEET_MAX_ROWS || range->start.row < 0 ||
- range->end.col >= SHEET_MAX_COLS || range->end.col < 0 ||
- range->end.row >= SHEET_MAX_ROWS || range->end.row < 0)
+ if (range->start.col >= gnm_sheet_get_max_cols (NULL) || range->start.col < 0 ||
+ range->start.row >= gnm_sheet_get_max_rows (NULL) || range->start.row < 0 ||
+ range->end.col >= gnm_sheet_get_max_cols (NULL) || range->end.col < 0 ||
+ range->end.row >= gnm_sheet_get_max_rows (NULL) || range->end.row < 0)
return TRUE;
return FALSE;
@@ -679,12 +679,12 @@
{
if (range->start.col < 0)
range->start.col = 0;
- if (range->end.col >= SHEET_MAX_COLS)
- range->end.col = SHEET_MAX_COLS-1;
+ if (range->end.col >= gnm_sheet_get_max_cols (NULL))
+ range->end.col = gnm_sheet_get_max_cols (NULL)-1;
if (range->start.row < 0)
range->start.row = 0;
- if (range->end.row >= SHEET_MAX_ROWS)
- range->end.row = SHEET_MAX_ROWS-1;
+ if (range->end.row >= gnm_sheet_get_max_rows (NULL))
+ range->end.row = gnm_sheet_get_max_rows (NULL)-1;
}
/**
@@ -699,10 +699,10 @@
g_return_val_if_fail (range != NULL, FALSE);
g_return_val_if_fail (range->start.col >= 0, FALSE);
g_return_val_if_fail (range->end.col >= range->start.col, FALSE);
- g_return_val_if_fail (range->end.col < SHEET_MAX_COLS, FALSE);
+ g_return_val_if_fail (range->end.col < G_MAXINT / 2, FALSE);
g_return_val_if_fail (range->start.row >= 0, FALSE);
g_return_val_if_fail (range->end.row >= range->start.row, FALSE);
- g_return_val_if_fail (range->end.row < SHEET_MAX_ROWS, FALSE);
+ g_return_val_if_fail (range->end.row < G_MAXINT / 2, FALSE);
return TRUE;
}
@@ -730,9 +730,9 @@
/* Start col */
t = origin->col + (src.start.row - origin->row);
- if (t > SHEET_MAX_COLS - 1) {
+ if (t > gnm_sheet_get_max_cols (NULL) - 1) {
clipped = TRUE;
- range->start.col = SHEET_MAX_COLS - 1;
+ range->start.col = gnm_sheet_get_max_cols (NULL) - 1;
} else if (t < 0) {
clipped = TRUE;
range->start.col = 0;
@@ -741,9 +741,9 @@
/* Start row */
t = origin->row + (src.start.col - origin->col);
- if (t > SHEET_MAX_COLS - 1) {
+ if (t > gnm_sheet_get_max_cols (NULL) - 1) {
clipped = TRUE;
- range->start.row = SHEET_MAX_ROWS - 1;
+ range->start.row = gnm_sheet_get_max_rows (NULL) - 1;
} else if (t < 0) {
clipped = TRUE;
range->start.row = 0;
@@ -753,9 +753,9 @@
/* End col */
t = origin->col + (src.end.row - origin->row);
- if (t > SHEET_MAX_COLS - 1) {
+ if (t > gnm_sheet_get_max_cols (NULL) - 1) {
clipped = TRUE;
- range->end.col = SHEET_MAX_COLS - 1;
+ range->end.col = gnm_sheet_get_max_cols (NULL) - 1;
} else if (t < 0) {
clipped = TRUE;
range->end.col = 0;
@@ -764,9 +764,9 @@
/* End row */
t = origin->row + (src.end.col - origin->col);
- if (t > SHEET_MAX_COLS - 1) {
+ if (t > gnm_sheet_get_max_cols (NULL) - 1) {
clipped = TRUE;
- range->end.row = SHEET_MAX_ROWS - 1;
+ range->end.row = gnm_sheet_get_max_rows (NULL) - 1;
} else if (t < 0) {
clipped = TRUE;
range->end.row = 0;
Modified: branches/gnumeric-1-8/src/selection.c
==============================================================================
--- branches/gnumeric-1-8/src/selection.c (original)
+++ branches/gnumeric-1-8/src/selection.c Mon Apr 28 23:19:20 2008
@@ -136,12 +136,12 @@
if (is_col) {
if (ss->start.row == 0 &&
- ss->end.row >= SHEET_MAX_ROWS-1 &&
+ ss->end.row >= gnm_sheet_get_max_rows (sv->sheet)-1 &&
ss->start.col <= colrow && colrow <= ss->end.col)
return TRUE;
} else {
if (ss->start.col == 0 &&
- ss->end.col >= SHEET_MAX_COLS-1 &&
+ ss->end.col >= gnm_sheet_get_max_cols (sv->sheet)-1 &&
ss->start.row <= colrow && colrow <= ss->end.row)
return TRUE;
}
@@ -169,12 +169,12 @@
for (l = sv->selections; l != NULL; l = l->next){
GnmRange const *r = l->data;
if (is_cols) {
- if (r->start.row > 0 || r->end.row < SHEET_MAX_ROWS - 1)
+ if (r->start.row > 0 || r->end.row < gnm_sheet_get_max_rows (sv->sheet) - 1)
return FALSE;
if (r->start.col <= index && index <= r->end.col)
found = TRUE;
} else {
- if (r->start.col > 0 || r->end.col < SHEET_MAX_COLS - 1)
+ if (r->start.col > 0 || r->end.col < gnm_sheet_get_max_cols (sv->sheet) - 1)
return FALSE;
if (r->start.row <= index && index <= r->end.row)
found = TRUE;
@@ -210,7 +210,7 @@
continue;
if (sr->start.row == 0 &&
- sr->end.row == SHEET_MAX_ROWS-1)
+ sr->end.row == gnm_sheet_get_max_rows (sv->sheet)-1)
return COL_ROW_FULL_SELECTION;
ret = COL_ROW_PARTIAL_SELECTION;
@@ -245,7 +245,7 @@
continue;
if (sr->start.col == 0 &&
- sr->end.col == SHEET_MAX_COLS-1)
+ sr->end.col == gnm_sheet_get_max_cols (sv->sheet)-1)
return COL_ROW_FULL_SELECTION;
ret = COL_ROW_PARTIAL_SELECTION;
@@ -371,12 +371,12 @@
if (col < 0) {
base_col = 0;
- col = SHEET_MAX_COLS - 1;
+ col = gnm_sheet_get_max_cols (sv->sheet) - 1;
} else
base_col = sv->cursor.base_corner.col;
if (row < 0) {
base_row = 0;
- row = SHEET_MAX_ROWS - 1;
+ row = gnm_sheet_get_max_rows (sv->sheet) - 1;
} else
base_row = sv->cursor.base_corner.row;
@@ -460,8 +460,8 @@
}
/* Has the entire row been selected/unselected */
- if ((new_sel.start.row == 0 && new_sel.end.row == SHEET_MAX_ROWS-1) ^
- (old_sel.start.row == 0 && old_sel.end.row == SHEET_MAX_ROWS-1)) {
+ if ((new_sel.start.row == 0 && new_sel.end.row == gnm_sheet_get_max_rows (sv->sheet)-1) ^
+ (old_sel.start.row == 0 && old_sel.end.row == gnm_sheet_get_max_rows (sv->sheet)-1)) {
GnmRange tmp = range_union (&new_sel, &old_sel);
sv_redraw_headers (sv, TRUE, FALSE, &tmp);
} else {
@@ -493,8 +493,8 @@
}
/* Has the entire col been selected/unselected */
- if ((new_sel.start.col == 0 && new_sel.end.col == SHEET_MAX_COLS-1) ^
- (old_sel.start.col == 0 && old_sel.end.col == SHEET_MAX_COLS-1)) {
+ if ((new_sel.start.col == 0 && new_sel.end.col == gnm_sheet_get_max_cols (sv->sheet)-1) ^
+ (old_sel.start.col == 0 && old_sel.end.col == gnm_sheet_get_max_cols (sv->sheet)-1)) {
GnmRange tmp = range_union (&new_sel, &old_sel);
sv_redraw_headers (sv, FALSE, TRUE, &tmp);
} else {
@@ -853,7 +853,7 @@
case 1 : /* overlap bottom */
/* Split region */
- if (b->end.row < (SHEET_MAX_ROWS-1)) {
+ if (b->end.row < (gnm_sheet_get_max_rows (sv->sheet)-1)) {
tmp = range_dup (a);
tmp->start.col = b->start.col;
tmp->start.row = b->end.row + 1;
@@ -1322,12 +1322,12 @@
if (!expand_text)
return TRUE;
if (as_cols) {
- if (vector->end.col >= SHEET_MAX_COLS-1)
+ if (vector->end.col >= gnm_sheet_get_max_cols (sheet)-1)
return TRUE;
vector->end.col += dx;
dx = 1;
} else {
- if (vector->end.row >= SHEET_MAX_ROWS-1)
+ if (vector->end.row >= gnm_sheet_get_max_rows (sheet)-1)
return TRUE;
vector->end.row += dy;
dy = 1;
Modified: branches/gnumeric-1-8/src/sheet-control-gui.c
==============================================================================
--- branches/gnumeric-1-8/src/sheet-control-gui.c (original)
+++ branches/gnumeric-1-8/src/sheet-control-gui.c Mon Apr 28 23:19:20 2008
@@ -514,7 +514,7 @@
if (rangesel) {
scg_rangesel_bound (scg,
- 0, 0, SHEET_MAX_COLS - 1, SHEET_MAX_ROWS - 1);
+ 0, 0, gnm_sheet_get_max_cols (sheet) - 1, gnm_sheet_get_max_rows (sheet) - 1);
gnm_expr_entry_signal_update (
wbcg_get_entry_logical (scg->wbcg), TRUE);
} else if (wbc_gtk_get_guru (scg->wbcg) == NULL) {
@@ -524,7 +524,7 @@
wbcg_edit_finish (scg->wbcg, WBC_EDIT_REJECT, NULL);
sv_selection_reset (sv);
sv_selection_add_full (sv, sv->edit_pos.col, sv->edit_pos.row,
- 0, 0, SHEET_MAX_COLS - 1, SHEET_MAX_ROWS - 1);
+ 0, 0, gnm_sheet_get_max_cols (sheet) - 1, gnm_sheet_get_max_rows (sheet) - 1);
}
sheet_update (sheet);
}
@@ -559,24 +559,24 @@
if (rangesel) {
if (is_cols)
scg_rangesel_bound (scg,
- index, 0, index, SHEET_MAX_ROWS - 1);
+ index, 0, index, gnm_sheet_get_max_rows (sv->sheet) - 1);
else
scg_rangesel_bound (scg,
- 0, index, SHEET_MAX_COLS - 1, index);
+ 0, index, gnm_sheet_get_max_cols (sv->sheet) - 1, index);
} else if (is_cols) {
GnmPane *pane =
scg_pane (scg, scg->pane[3] ? 3 : 0);
sv_selection_add_full (sv,
index, pane->first.row,
index, 0,
- index, SHEET_MAX_ROWS - 1);
+ index, gnm_sheet_get_max_rows (sv->sheet) - 1);
} else {
GnmPane *pane =
scg_pane (scg, scg->pane[1] ? 1 : 0);
sv_selection_add_full (sv,
pane->first.col, index,
0, index,
- SHEET_MAX_COLS - 1, index);
+ gnm_sheet_get_max_cols (sv->sheet) - 1, index);
}
}
@@ -626,24 +626,24 @@
}
static void
-cb_hscrollbar_adjust_bounds (GtkRange *range, gdouble new_value)
+cb_hscrollbar_adjust_bounds (GtkRange *range, gdouble new_value, Sheet *sheet)
{
gdouble limit = range->adjustment->upper - range->adjustment->page_size;
- if (range->adjustment->upper < SHEET_MAX_COLS && new_value >= limit) {
+ if (range->adjustment->upper < gnm_sheet_get_max_cols (sheet) && new_value >= limit) {
range->adjustment->upper = new_value + range->adjustment->page_size + 1;
- if (range->adjustment->upper > SHEET_MAX_COLS)
- range->adjustment->upper = SHEET_MAX_COLS;
+ if (range->adjustment->upper > gnm_sheet_get_max_cols (sheet))
+ range->adjustment->upper = gnm_sheet_get_max_cols (sheet);
gtk_adjustment_changed (range->adjustment);
}
}
static void
-cb_vscrollbar_adjust_bounds (GtkRange *range, gdouble new_value)
+cb_vscrollbar_adjust_bounds (GtkRange *range, gdouble new_value, Sheet *sheet)
{
gdouble limit = range->adjustment->upper - range->adjustment->page_size;
- if (range->adjustment->upper < SHEET_MAX_ROWS && new_value >= limit) {
+ if (range->adjustment->upper < gnm_sheet_get_max_rows (sheet) && new_value >= limit) {
range->adjustment->upper = new_value + range->adjustment->page_size + 1;
- if (range->adjustment->upper > SHEET_MAX_ROWS)
- range->adjustment->upper = SHEET_MAX_ROWS;
+ if (range->adjustment->upper > gnm_sheet_get_max_rows (sheet))
+ range->adjustment->upper = gnm_sheet_get_max_rows (sheet);
gtk_adjustment_changed (range->adjustment);
}
}
@@ -725,8 +725,9 @@
{
FooCanvas *colc;
int col_offset;
+ Sheet *sheet = ((SheetControl*) pane->simple.scg)->sheet;
- g_return_val_if_fail (0 <= new_first_col && new_first_col < SHEET_MAX_COLS, 0);
+ g_return_val_if_fail (0 <= new_first_col && new_first_col < gnm_sheet_get_max_cols (sheet), 0);
col_offset = pane->first_offset.col +=
scg_colrow_distance_get (pane->simple.scg, TRUE, pane->first.col, new_first_col);
@@ -744,8 +745,10 @@
static void
gnm_pane_set_left_col (GnmPane *pane, int new_first_col)
{
+ Sheet *sheet;
g_return_if_fail (pane != NULL);
- g_return_if_fail (0 <= new_first_col && new_first_col < SHEET_MAX_COLS);
+ sheet = ((SheetControl*) pane->simple.scg)->sheet;
+ g_return_if_fail (0 <= new_first_col && new_first_col < gnm_sheet_get_max_cols (sheet));
if (pane->first.col != new_first_col) {
FooCanvas * const canvas = FOO_CANVAS (pane);
@@ -769,6 +772,8 @@
bound = &sheet->priv->unhidden_region;
if (col < bound->start.col)
col = bound->start.col;
+ else if (col >= gnm_sheet_get_max_cols (sheet))
+ col = gnm_sheet_get_max_cols (sheet) - 1;
else if (col > bound->end.col)
col = bound->end.col;
@@ -787,8 +792,9 @@
{
FooCanvas *rowc;
int row_offset;
+ Sheet *sheet = ((SheetControl*) pane->simple.scg)->sheet;
- g_return_val_if_fail (0 <= new_first_row && new_first_row < SHEET_MAX_ROWS, 0);
+ g_return_val_if_fail (0 <= new_first_row && new_first_row < gnm_sheet_get_max_rows (sheet), 0);
row_offset = pane->first_offset.row +=
scg_colrow_distance_get (pane->simple.scg, FALSE, pane->first.row, new_first_row);
@@ -804,8 +810,10 @@
static void
gnm_pane_set_top_row (GnmPane *pane, int new_first_row)
{
+ Sheet *sheet;
g_return_if_fail (pane != NULL);
- g_return_if_fail (0 <= new_first_row && new_first_row < SHEET_MAX_ROWS);
+ sheet = ((SheetControl*) pane->simple.scg)->sheet;
+ g_return_if_fail (0 <= new_first_row && new_first_row < gnm_sheet_get_max_rows (sheet));
if (pane->first.row != new_first_row) {
FooCanvas * const canvas = FOO_CANVAS(pane);
@@ -831,6 +839,8 @@
bound = &sheet->priv->unhidden_region;
if (row < bound->start.row)
row = bound->start.row;
+ else if (row >= gnm_sheet_get_max_rows (sheet))
+ row = gnm_sheet_get_max_rows (sheet) - 1;
else if (row > bound->end.row)
row = bound->end.row;
@@ -911,12 +921,12 @@
if (!GTK_WIDGET_REALIZED (pane))
return;
+ sheet = ((SheetControl *) pane->simple.scg)->sheet;
g_return_if_fail (col >= 0);
g_return_if_fail (row >= 0);
- g_return_if_fail (col < SHEET_MAX_COLS);
- g_return_if_fail (row < SHEET_MAX_ROWS);
+ g_return_if_fail (col < gnm_sheet_get_max_cols (sheet));
+ g_return_if_fail (row < gnm_sheet_get_max_rows (sheet));
- sheet = ((SheetControl *) pane->simple.scg)->sheet;
canvas = FOO_CANVAS (pane);
/* Find the new pane->first.col */
@@ -1073,7 +1083,7 @@
gnm_pane_bound_set (scg->pane[0],
br->col, br->row,
- SHEET_MAX_COLS - 1, SHEET_MAX_ROWS - 1);
+ gnm_sheet_get_max_cols (sc->sheet) - 1, gnm_sheet_get_max_rows (sc->sheet) - 1);
if (freeze_h) {
scg->active_panes = 2;
@@ -1093,7 +1103,7 @@
0, 0);
}
gnm_pane_bound_set (scg->pane[1],
- tl->col, br->row, br->col - 1, SHEET_MAX_ROWS - 1);
+ tl->col, br->row, br->col - 1, gnm_sheet_get_max_rows (sc->sheet) - 1);
}
if (freeze_h && freeze_v) {
scg->active_panes = 4;
@@ -1127,7 +1137,7 @@
0, 0);
}
gnm_pane_bound_set (scg->pane[3],
- br->col, tl->row, SHEET_MAX_COLS - 1, br->row - 1);
+ br->col, tl->row, gnm_sheet_get_max_cols (sc->sheet) - 1, br->row - 1);
}
} else {
int i;
@@ -1139,7 +1149,7 @@
scg->active_panes = 1;
gnm_pane_bound_set (scg->pane[0],
- 0, 0, SHEET_MAX_COLS - 1, SHEET_MAX_ROWS - 1);
+ 0, 0, gnm_sheet_get_max_cols (sc->sheet) - 1, gnm_sheet_get_max_rows (sc->sheet) - 1);
}
gtk_widget_show_all (GTK_WIDGET (scg->inner_table));
@@ -1438,7 +1448,7 @@
G_CALLBACK (cb_vscrollbar_value_changed), scg);
g_signal_connect (G_OBJECT (scg->vs),
"adjust_bounds",
- G_CALLBACK (cb_vscrollbar_adjust_bounds), NULL);
+ G_CALLBACK (cb_vscrollbar_adjust_bounds), sheet);
scg->ha = (GtkAdjustment *)gtk_adjustment_new (0., 0., 1, 1., 1., 1.);
scg->hs = g_object_new (GTK_TYPE_HSCROLLBAR,
@@ -1450,7 +1460,7 @@
G_CALLBACK (cb_hscrollbar_value_changed), scg);
g_signal_connect (G_OBJECT (scg->hs),
"adjust_bounds",
- G_CALLBACK (cb_hscrollbar_adjust_bounds), NULL);
+ G_CALLBACK (cb_hscrollbar_adjust_bounds), sheet);
scg->table = GTK_TABLE (gtk_table_new (4, 4, FALSE));
gtk_table_attach (scg->table, GTK_WIDGET (scg->inner_table),
@@ -1875,10 +1885,10 @@
for (l = scg_view (scg)->selections; l != NULL; l = l->next) {
GnmRange const *r = l->data;
- if (r->start.row == 0 && r->end.row == SHEET_MAX_ROWS - 1)
+ if (r->start.row == 0 && r->end.row == gnm_sheet_get_max_rows (sheet) - 1)
sensitivity_filter |= CONTEXT_DISABLE_FOR_ROWS;
- if (r->start.col == 0 && r->end.col == SHEET_MAX_COLS - 1)
+ if (r->start.col == 0 && r->end.col == gnm_sheet_get_max_cols (sheet) - 1)
sensitivity_filter |= CONTEXT_DISABLE_FOR_COLS;
if (!has_link && sheet_style_region_contains_link (sheet, r))
@@ -2599,10 +2609,10 @@
g_return_val_if_fail (from >= 0, 1);
if (is_cols) {
- g_return_val_if_fail (to <= SHEET_MAX_COLS, 1);
+ g_return_val_if_fail (to <= gnm_sheet_get_max_cols (sc->sheet), 1);
collection = &sc->sheet->cols;
} else {
- g_return_val_if_fail (to <= SHEET_MAX_ROWS, 1);
+ g_return_val_if_fail (to <= gnm_sheet_get_max_rows (sc->sheet), 1);
collection = &sc->sheet->rows;
}
@@ -2809,12 +2819,12 @@
if (col < 0) {
base_col = 0;
- col = SHEET_MAX_COLS - 1;
+ col = gnm_sheet_get_max_cols (((SheetControl*) scg)->sheet) - 1;
} else
base_col = scg->rangesel.base_corner.col;
if (row < 0) {
base_row = 0;
- row = SHEET_MAX_ROWS - 1;
+ row = gnm_sheet_get_max_rows (((SheetControl*) scg)->sheet) - 1;
} else
base_row = scg->rangesel.base_corner.row;
Modified: branches/gnumeric-1-8/src/sheet-filter.c
==============================================================================
--- branches/gnumeric-1-8/src/sheet-filter.c (original)
+++ branches/gnumeric-1-8/src/sheet-filter.c Mon Apr 28 23:19:20 2008
@@ -20,6 +20,7 @@
* USA
*/
#include <gnumeric-config.h>
+#include "libgnumeric.h"
#include "sheet-filter.h"
#include "sheet-filter-combo.h"
@@ -778,7 +779,7 @@
sheet_cell_or_one_below_is_not_empty (Sheet *sheet, int col, int row)
{
return !sheet_is_cell_empty (sheet, col, row) ||
- (row < (SHEET_MAX_ROWS - 1) &&
+ (row < (gnm_sheet_get_max_rows (sheet) - 1) &&
!sheet_is_cell_empty (sheet, col, row+1));
}
@@ -805,7 +806,7 @@
region->start.col = col - 1;
/* look for next empty column */
- for (col = start + 1; col < SHEET_MAX_COLS; col++)
+ for (col = start + 1; col < gnm_sheet_get_max_cols (sheet); col++)
if (!sheet_cell_or_one_below_is_not_empty (sheet, col, region->start.row))
break;
region->end.col = col - 1;
Modified: branches/gnumeric-1-8/src/sheet-view.c
==============================================================================
--- branches/gnumeric-1-8/src/sheet-view.c (original)
+++ branches/gnumeric-1-8/src/sheet-view.c Mon Apr 28 23:19:20 2008
@@ -477,9 +477,9 @@
g_return_if_fail (IS_SHEET_VIEW (sv));
g_return_if_fail (pos != NULL);
g_return_if_fail (pos->col >= 0);
- g_return_if_fail (pos->col < SHEET_MAX_COLS);
+ g_return_if_fail (pos->col < gnm_sheet_get_max_cols (sv->sheet));
g_return_if_fail (pos->row >= 0);
- g_return_if_fail (pos->row < SHEET_MAX_ROWS);
+ g_return_if_fail (pos->row < gnm_sheet_get_max_rows (sv->sheet));
old = sv->edit_pos;
sv->first_tab_col = -1; /* invalidate */
@@ -725,8 +725,8 @@
g_return_if_fail (unfrozen->row >= frozen->row);
/* Just in case */
- if (unfrozen->col != (SHEET_MAX_COLS-1) &&
- unfrozen->row != (SHEET_MAX_ROWS-1) &&
+ if (unfrozen->col != (gnm_sheet_get_max_cols (sv->sheet)-1) &&
+ unfrozen->row != (gnm_sheet_get_max_rows (sv->sheet)-1) &&
!gnm_cellpos_equal (frozen, unfrozen)) {
sv->frozen_top_left = *frozen;
sv->unfrozen_top_left = *unfrozen;
@@ -792,7 +792,7 @@
br.col += count;
if (tl.col > start)
tl.col += count;
- if (br.col < tl.col || br.col >= SHEET_MAX_COLS)
+ if (br.col < tl.col || br.col >= gnm_sheet_get_max_cols (sv->sheet))
return;
} else {
if (tl.col >= start)
@@ -809,7 +809,7 @@
br.row += count;
if (tl.row > start)
tl.row += count;
- if (br.row < tl.row || br.row >= SHEET_MAX_ROWS)
+ if (br.row < tl.row || br.row >= gnm_sheet_get_max_rows (sv->sheet))
return;
} else {
if (tl.row >= start)
@@ -849,8 +849,8 @@
sv_set_initial_top_left (SheetView *sv, int col, int row)
{
g_return_if_fail (IS_SHEET_VIEW (sv));
- g_return_if_fail (0 <= col && col < SHEET_MAX_COLS);
- g_return_if_fail (0 <= row && row < SHEET_MAX_ROWS);
+ g_return_if_fail (0 <= col && col < gnm_sheet_get_max_cols (sv->sheet));
+ g_return_if_fail (0 <= row && row < gnm_sheet_get_max_rows (sv->sheet));
g_return_if_fail (!sv_is_frozen (sv) ||
(sv->unfrozen_top_left.col <= col &&
sv->unfrozen_top_left.row <= row));
Modified: branches/gnumeric-1-8/src/sheet.c
==============================================================================
--- branches/gnumeric-1-8/src/sheet.c (original)
+++ branches/gnumeric-1-8/src/sheet.c Mon Apr 28 23:19:20 2008
@@ -338,10 +338,10 @@
/* Then every column and row */
closure.sheet = sheet;
closure.is_cols = TRUE;
- colrow_foreach (&sheet->cols, 0, SHEET_MAX_COLS - 1,
+ colrow_foreach (&sheet->cols, 0, gnm_sheet_get_max_cols (sheet) - 1,
(ColRowHandler)&cb_colrow_compute_pixels_from_pts, &closure);
closure.is_cols = FALSE;
- colrow_foreach (&sheet->rows, 0, SHEET_MAX_ROWS - 1,
+ colrow_foreach (&sheet->rows, 0, gnm_sheet_get_max_rows (sheet) - 1,
(ColRowHandler)&cb_colrow_compute_pixels_from_pts, &closure);
sheet_cell_foreach (sheet, (GHFunc)&cb_clear_rendered_cells, NULL);
@@ -645,7 +645,6 @@
sheet->hash_merged = g_hash_table_new ((GHashFunc)&gnm_cellpos_hash,
(GCompareFunc)&gnm_cellpos_equal);
- sheet->deps = gnm_dep_container_new ();
sheet->cell_hash = g_hash_table_new ((GHashFunc)&gnm_cellpos_hash,
(GCompareFunc)&gnm_cellpos_equal);
@@ -670,6 +669,8 @@
* override this.
*/
sheet->last_zoom_factor_used = -1;
+
+ sheet->deps = gnm_dep_container_new (sheet);
}
static void
@@ -1170,7 +1171,7 @@
ColRowSegment **segment = (ColRowSegment **)&COLROW_GET_SEGMENT (&(sheet->cols), col);
g_return_if_fail (col >= 0);
- g_return_if_fail (col < SHEET_MAX_COLS);
+ g_return_if_fail (col < gnm_sheet_get_max_cols (sheet));
if (*segment == NULL)
*segment = g_new0 (ColRowSegment, 1);
@@ -1190,7 +1191,7 @@
ColRowSegment **segment = (ColRowSegment **)&COLROW_GET_SEGMENT (&(sheet->rows), row);
g_return_if_fail (row >= 0);
- g_return_if_fail (row < SHEET_MAX_ROWS);
+ g_return_if_fail (row < gnm_sheet_get_max_rows (sheet));
if (*segment == NULL)
*segment = g_new0 (ColRowSegment, 1);
@@ -1360,11 +1361,11 @@
(p->recompute_visibility ?
SPANCALC_NO_DRAW : GNM_SPANCALC_SIMPLE));
#endif
- sheet_queue_respan (sheet, 0, SHEET_MAX_ROWS - 1);
+ sheet_queue_respan (sheet, 0, gnm_sheet_get_max_rows (sheet) - 1);
}
- if (p->reposition_objects.row < SHEET_MAX_ROWS ||
- p->reposition_objects.col < SHEET_MAX_COLS) {
+ if (p->reposition_objects.row < gnm_sheet_get_max_rows (sheet) ||
+ p->reposition_objects.col < gnm_sheet_get_max_cols (sheet)) {
SHEET_FOREACH_VIEW (sheet, sv, {
if (!p->resize && sv_is_frozen (sv)) {
if (p->reposition_objects.col < sv->unfrozen_top_left.col ||
@@ -1375,8 +1376,8 @@
}
});
sheet_reposition_objects (sheet, &p->reposition_objects);
- p->reposition_objects.row = SHEET_MAX_ROWS;
- p->reposition_objects.col = SHEET_MAX_COLS;
+ p->reposition_objects.row = gnm_sheet_get_max_rows (sheet);
+ p->reposition_objects.col = gnm_sheet_get_max_cols (sheet);
}
if (p->resize) {
@@ -1646,8 +1647,8 @@
g_return_val_if_fail (IS_SHEET (sheet), dummy);
/* FIXME : Why -2 ??? */
- closure.range.start.col = SHEET_MAX_COLS - 2;
- closure.range.start.row = SHEET_MAX_ROWS - 2;
+ closure.range.start.col = gnm_sheet_get_max_cols (sheet) - 2;
+ closure.range.start.row = gnm_sheet_get_max_rows (sheet) - 2;
closure.range.end.col = 0;
closure.range.end.row = 0;
closure.spans_and_merges_extend = spans_and_merges_extend;
@@ -1667,9 +1668,9 @@
closure.range.end.row);
}
- if (closure.range.start.col >= SHEET_MAX_COLS - 2)
+ if (closure.range.start.col >= gnm_sheet_get_max_cols (sheet) - 2)
closure.range.start.col = 0;
- if (closure.range.start.row >= SHEET_MAX_ROWS - 2)
+ if (closure.range.start.row >= gnm_sheet_get_max_rows (sheet) - 2)
closure.range.start.row = 0;
if (closure.range.end.col < 0)
closure.range.end.col = 0;
@@ -1710,13 +1711,13 @@
/* We are now trying to fix any problems with the print area */
while (print_area.start.col < 0)
- print_area.start.col += SHEET_MAX_COLS;
+ print_area.start.col += gnm_sheet_get_max_cols (sheet);
while (print_area.start.row < 0)
- print_area.start.row += SHEET_MAX_ROWS;
+ print_area.start.row += gnm_sheet_get_max_rows (sheet);
while (print_area.end.col < 0)
- print_area.end.col += SHEET_MAX_COLS;
+ print_area.end.col += gnm_sheet_get_max_cols (sheet);
while (print_area.end.row < 0)
- print_area.end.row += SHEET_MAX_ROWS;
+ print_area.end.row += gnm_sheet_get_max_rows (sheet);
if (print_area.start.col > print_area.end.col) {
int col = print_area.end.col;
@@ -1975,7 +1976,7 @@
closure.sheet = sheet;
closure.col = col;
- colrow_foreach (&sheet->rows, 0, SHEET_MAX_ROWS - 1,
+ colrow_foreach (&sheet->rows, 0, gnm_sheet_get_max_rows (sheet) - 1,
&cb_recalc_spans_in_col, &closure);
}
@@ -2390,7 +2391,7 @@
{
gboolean find_nonblank = sheet_is_cell_empty (sheet, start_col, move_row);
gboolean keep_looking = FALSE;
- int new_col, prev_col, lagged_start_col;
+ int new_col, prev_col, lagged_start_col, max_col = gnm_sheet_get_max_cols (sheet) - 1;
int iterations = 0;
GnmRange check_merge;
GnmRange const * const bound = &sheet->priv->unhidden_region;
@@ -2431,15 +2432,17 @@
++iterations;
if (new_col < bound->start.col)
- return bound->start.col;
+ return MIN (bound->start.col, max_col);
if (new_col > bound->end.col)
- return bound->end.col;
+ return MIN (bound->end.col, max_col);
keep_looking = sheet_col_is_hidden (sheet, new_col);
if (jump_to_boundaries) {
if (new_col > sheet->cols.max_used) {
if (count > 0)
- return (find_nonblank || iterations == 1) ? bound->end.col : prev_col;
+ return (find_nonblank || iterations == 1)?
+ MIN (bound->end.col, max_col):
+ MIN (prev_col, max_col);
new_col = sheet->cols.max_used;
}
@@ -2459,7 +2462,7 @@
}
} while (keep_looking);
- return new_col;
+ return MIN (new_col, max_col);
}
/*
@@ -2488,7 +2491,7 @@
{
gboolean find_nonblank = sheet_is_cell_empty (sheet, move_col, start_row);
gboolean keep_looking = FALSE;
- int new_row, prev_row, lagged_start_row;
+ int new_row, prev_row, lagged_start_row, max_row = gnm_sheet_get_max_rows (sheet) - 1;
int iterations = 0;
GnmRange check_merge;
GnmRange const * const bound = &sheet->priv->unhidden_region;
@@ -2529,15 +2532,17 @@
++iterations;
if (new_row < bound->start.row)
- return bound->start.row;
+ return MIN (bound->start.row, max_row);
if (new_row > bound->end.row)
- return bound->end.row;
+ return MIN (bound->end.row, max_row);
keep_looking = sheet_row_is_hidden (sheet, new_row);
if (jump_to_boundaries) {
if (new_row > sheet->rows.max_used) {
if (count > 0)
- return (find_nonblank || iterations == 1) ? bound->end.row : prev_row;
+ return (find_nonblank || iterations == 1)?
+ MIN (bound->end.row, max_row):
+ MIN (prev_row, max_row);
new_row = sheet->rows.max_used;
}
@@ -2557,7 +2562,7 @@
}
} while (keep_looking);
- return new_row;
+ return MIN (new_row, max_row);
}
typedef enum {
@@ -2843,7 +2848,7 @@
ColRowSegment *segment;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
- g_return_val_if_fail (pos < SHEET_MAX_COLS, NULL);
+ g_return_val_if_fail (pos < gnm_sheet_get_max_cols (sheet), NULL);
g_return_val_if_fail (pos >= 0, NULL);
segment = COLROW_GET_SEGMENT (&(sheet->cols), pos);
@@ -2863,7 +2868,7 @@
ColRowSegment *segment;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
- g_return_val_if_fail (pos < SHEET_MAX_ROWS, NULL);
+ g_return_val_if_fail (pos < gnm_sheet_get_max_rows (sheet), NULL);
g_return_val_if_fail (pos >= 0, NULL);
segment = COLROW_GET_SEGMENT (&(sheet->rows), pos);
@@ -3192,8 +3197,8 @@
static void
sheet_cell_add_to_hash (Sheet *sheet, GnmCell *cell)
{
- g_return_if_fail (cell->pos.col < SHEET_MAX_COLS);
- g_return_if_fail (cell->pos.row < SHEET_MAX_ROWS);
+ g_return_if_fail (cell->pos.col < gnm_sheet_get_max_cols (sheet));
+ g_return_if_fail (cell->pos.row < gnm_sheet_get_max_rows (sheet));
cell->base.flags |= GNM_CELL_IN_SHEET_LIST;
/* NOTE :
@@ -3302,9 +3307,9 @@
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (col >= 0, NULL);
- g_return_val_if_fail (col < SHEET_MAX_COLS, NULL);
+ g_return_val_if_fail (col < gnm_sheet_get_max_cols (sheet), NULL);
g_return_val_if_fail (row >= 0, NULL);
- g_return_val_if_fail (row < SHEET_MAX_ROWS, NULL);
+ g_return_val_if_fail (row < gnm_sheet_get_max_rows (sheet), NULL);
cell = cell_new ();
cell->base.sheet = sheet;
@@ -3408,7 +3413,7 @@
if (free_cells)
sheet_foreach_cell_in_range (sheet, CELL_ITER_IGNORE_NONEXISTENT,
- col, 0, col, SHEET_MAX_ROWS - 1,
+ col, 0, col, gnm_sheet_get_max_rows (sheet) - 1,
&cb_free_cell, NULL);
(*segment)->info[sub] = NULL;
@@ -3445,7 +3450,7 @@
if (free_cells)
sheet_foreach_cell_in_range (sheet, CELL_ITER_IGNORE_NONEXISTENT,
- 0, row, SHEET_MAX_COLS - 1, row,
+ 0, row, gnm_sheet_get_max_cols (sheet) - 1, row,
&cb_free_cell, NULL);
/* Rows have span lists, destroy them too */
@@ -3989,7 +3994,7 @@
GnmRange region;
int i;
ColRowStateList *states = NULL;
- int first = SHEET_MAX_COLS - count;
+ int first = gnm_sheet_get_max_cols (sheet) - count;
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (count > 0, TRUE);
@@ -4003,23 +4008,23 @@
}
/* 0. Check displaced region and ensure arrays aren't divided. */
- if (count < SHEET_MAX_COLS) {
- range_init (®ion, col, 0, SHEET_MAX_COLS - 1-count, SHEET_MAX_ROWS - 1);
+ if (count < gnm_sheet_get_max_cols (sheet)) {
+ range_init (®ion, col, 0, gnm_sheet_get_max_cols (sheet) - 1-count, gnm_sheet_get_max_rows (sheet) - 1);
if (sheet_range_splits_array (sheet, ®ion, NULL,
cc, _("Insert Columns")))
return TRUE;
}
/* 1. Delete all columns (and their cells) that will fall off the end */
- for (i = sheet->cols.max_used; i >= SHEET_MAX_COLS - count ; --i)
+ for (i = sheet->cols.max_used; i >= gnm_sheet_get_max_cols (sheet) - count ; --i)
sheet_col_destroy (sheet, i, TRUE);
/* 2. Fix references to and from the cells which are moving */
reloc_info.reloc_type = GNM_EXPR_RELOCATE_COLS;
reloc_info.origin.start.col = col;
reloc_info.origin.start.row = 0;
- reloc_info.origin.end.col = SHEET_MAX_COLS - 1;
- reloc_info.origin.end.row = SHEET_MAX_ROWS - 1;
+ reloc_info.origin.end.col = gnm_sheet_get_max_cols (sheet) - 1;
+ reloc_info.origin.end.row = gnm_sheet_get_max_rows (sheet) - 1;
reloc_info.origin_sheet = reloc_info.target_sheet = sheet;
reloc_info.col_offset = count;
reloc_info.row_offset = 0;
@@ -4029,7 +4034,7 @@
/* 3. Move the columns to their new location (from right to left) */
for (i = sheet->cols.max_used; i >= col ; --i)
- colrow_move (sheet, i, 0, i, SHEET_MAX_ROWS - 1,
+ colrow_move (sheet, i, 0, i, gnm_sheet_get_max_rows (sheet) - 1,
&sheet->cols, i, i + count);
solver_insert_cols (sheet, col, count);
@@ -4074,9 +4079,9 @@
reloc_info.origin.start.col = col;
reloc_info.origin.start.row = 0;
reloc_info.origin.end.col = col + count - 1;
- reloc_info.origin.end.row = SHEET_MAX_ROWS - 1;
+ reloc_info.origin.end.row = gnm_sheet_get_max_rows (sheet) - 1;
reloc_info.origin_sheet = reloc_info.target_sheet = sheet;
- reloc_info.col_offset = SHEET_MAX_COLS; /* force invalidation */
+ reloc_info.col_offset = gnm_sheet_get_max_cols (sheet); /* force invalidation */
reloc_info.row_offset = 0;
parse_pos_init_sheet (&reloc_info.pos, sheet);
@@ -4101,14 +4106,14 @@
/* 3. Fix references to and from the cells which are moving */
reloc_info.origin.start.col = col + count;
- reloc_info.origin.end.col = SHEET_MAX_COLS - 1;
+ reloc_info.origin.end.col = gnm_sheet_get_max_cols (sheet) - 1;
reloc_info.col_offset = -count;
reloc_info.row_offset = 0;
combine_undo (pundo, dependents_relocate (&reloc_info));
/* 4. Move the columns to their new location (from left to right) */
for (i = col + count ; i <= sheet->cols.max_used; ++i)
- colrow_move (sheet, i, 0, i, SHEET_MAX_ROWS - 1,
+ colrow_move (sheet, i, 0, i, gnm_sheet_get_max_rows (sheet) - 1,
&sheet->cols, i, i - count);
solver_delete_cols (sheet, col, count);
@@ -4138,7 +4143,7 @@
GnmRange region;
int i;
ColRowStateList *states = NULL;
- int first = SHEET_MAX_ROWS - count;
+ int first = gnm_sheet_get_max_rows (sheet) - count;
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (count > 0, TRUE);
@@ -4152,23 +4157,23 @@
}
/* 0. Check displaced region and ensure arrays aren't divided. */
- if (count < SHEET_MAX_ROWS) {
- range_init (®ion, 0, row, SHEET_MAX_COLS - 1, SHEET_MAX_ROWS - 1-count);
+ if (count < gnm_sheet_get_max_rows (sheet)) {
+ range_init (®ion, 0, row, gnm_sheet_get_max_cols (sheet) - 1, gnm_sheet_get_max_rows (sheet) - 1-count);
if (sheet_range_splits_array (sheet, ®ion, NULL,
cc, _("Insert Rows")))
return TRUE;
}
/* 1. Delete all rows (and their cells) that will fall off the end */
- for (i = sheet->rows.max_used; i >= SHEET_MAX_ROWS - count ; --i)
+ for (i = sheet->rows.max_used; i >= gnm_sheet_get_max_rows (sheet) - count ; --i)
sheet_row_destroy (sheet, i, TRUE);
/* 2. Fix references to and from the cells which are moving */
reloc_info.reloc_type = GNM_EXPR_RELOCATE_ROWS;
reloc_info.origin.start.col = 0;
reloc_info.origin.start.row = row;
- reloc_info.origin.end.col = SHEET_MAX_COLS - 1;
- reloc_info.origin.end.row = SHEET_MAX_ROWS - 1;
+ reloc_info.origin.end.col = gnm_sheet_get_max_cols (sheet) - 1;
+ reloc_info.origin.end.row = gnm_sheet_get_max_rows (sheet) - 1;
reloc_info.origin_sheet = reloc_info.target_sheet = sheet;
reloc_info.col_offset = 0;
reloc_info.row_offset = count;
@@ -4178,7 +4183,7 @@
/* 3. Move the rows to their new location (from last to first) */
for (i = sheet->rows.max_used; i >= row ; --i)
- colrow_move (sheet, 0, i, SHEET_MAX_COLS - 1, i,
+ colrow_move (sheet, 0, i, gnm_sheet_get_max_cols (sheet) - 1, i,
&sheet->rows, i, i + count);
solver_insert_rows (sheet, row, count);
@@ -4222,11 +4227,11 @@
reloc_info.reloc_type = GNM_EXPR_RELOCATE_ROWS;
reloc_info.origin.start.col = 0;
reloc_info.origin.start.row = row;
- reloc_info.origin.end.col = SHEET_MAX_COLS - 1;
+ reloc_info.origin.end.col = gnm_sheet_get_max_cols (sheet) - 1;
reloc_info.origin.end.row = row + count - 1;
reloc_info.origin_sheet = reloc_info.target_sheet = sheet;
reloc_info.col_offset = 0;
- reloc_info.row_offset = SHEET_MAX_ROWS; /* force invalidation */
+ reloc_info.row_offset = gnm_sheet_get_max_rows (sheet); /* force invalidation */
parse_pos_init_sheet (&reloc_info.pos, sheet);
/* 0. Walk cells in deleted rows and ensure arrays aren't divided. */
@@ -4250,14 +4255,14 @@
/* 3. Fix references to and from the cells which are moving */
reloc_info.origin.start.row = row + count;
- reloc_info.origin.end.row = SHEET_MAX_ROWS - 1;
+ reloc_info.origin.end.row = gnm_sheet_get_max_rows (sheet) - 1;
reloc_info.col_offset = 0;
reloc_info.row_offset = -count;
combine_undo (pundo, dependents_relocate (&reloc_info));
/* 4. Move the rows to their new location (from first to last) */
for (i = row + count ; i <= sheet->rows.max_used; ++i)
- colrow_move (sheet, 0, i, SHEET_MAX_COLS - 1, i,
+ colrow_move (sheet, 0, i, gnm_sheet_get_max_cols (sheet) - 1, i,
&sheet->rows, i, i - count);
solver_delete_rows (sheet, row, count);
@@ -4336,8 +4341,8 @@
* the relocation heuristics only move in 1
* dimension if possible to give us a chance to be
* smart about partial invalidations */
- reloc_info.col_offset = SHEET_MAX_COLS;
- reloc_info.row_offset = SHEET_MAX_ROWS;
+ reloc_info.col_offset = gnm_sheet_get_max_cols (rinfo->target_sheet);
+ reloc_info.row_offset = gnm_sheet_get_max_rows (rinfo->target_sheet);
if (rinfo->col_offset == 0) {
reloc_info.col_offset = 0;
reloc_info.reloc_type = GNM_EXPR_RELOCATE_ROWS;
@@ -4400,8 +4405,8 @@
cell = cells->data;
/* check for out of bounds and delete if necessary */
- if ((cell->pos.col + rinfo->col_offset) >= SHEET_MAX_COLS ||
- (cell->pos.row + rinfo->row_offset) >= SHEET_MAX_ROWS) {
+ if ((cell->pos.col + rinfo->col_offset) >= gnm_sheet_get_max_cols (rinfo->target_sheet) ||
+ (cell->pos.row + rinfo->row_offset) >= gnm_sheet_get_max_rows (rinfo->target_sheet)) {
cell_free (cell);
continue;
}
@@ -4480,7 +4485,7 @@
}
g_return_val_if_fail (from >= 0, 1.);
- g_return_val_if_fail (to <= SHEET_MAX_COLS, 1.);
+ g_return_val_if_fail (to <= gnm_sheet_get_max_cols (sheet), 1.);
/* Do not use colrow_foreach, it ignores empties */
dflt = sheet->cols.default_style.size_pts;
@@ -4517,7 +4522,7 @@
}
g_return_val_if_fail (from >= 0, 1);
- g_return_val_if_fail (to <= SHEET_MAX_COLS, 1);
+ g_return_val_if_fail (to <= gnm_sheet_get_max_cols (sheet), 1);
/* Do not use colrow_foreach, it ignores empties */
dflt = sheet->cols.default_style.size_pts;
@@ -4660,7 +4665,7 @@
}
g_return_val_if_fail (from >= 0, 1.);
- g_return_val_if_fail (to <= SHEET_MAX_ROWS, 1.);
+ g_return_val_if_fail (to <= gnm_sheet_get_max_rows (sheet), 1.);
/* Do not use colrow_foreach, it ignores empties.
* Optimize this so that long jumps are not quite so horrific
@@ -4821,13 +4826,15 @@
sheet_dup_colrows (Sheet const *src, Sheet *dst)
{
closure_clone_colrow closure;
+ int max_col = MIN (gnm_sheet_get_max_cols (src), gnm_sheet_get_max_cols (dst)),
+ max_row = MIN (gnm_sheet_get_max_rows (src), gnm_sheet_get_max_rows (dst));
closure.sheet = dst;
closure.is_column = TRUE;
- colrow_foreach (&src->cols, 0, SHEET_MAX_COLS - 1,
+ colrow_foreach (&src->cols, 0, max_col - 1,
&sheet_clone_colrow_info_item, &closure);
closure.is_column = FALSE;
- colrow_foreach (&src->rows, 0, SHEET_MAX_ROWS - 1,
+ colrow_foreach (&src->rows, 0, max_row - 1,
&sheet_clone_colrow_info_item, &closure);
sheet_col_set_default_size_pixels (dst,
Modified: branches/gnumeric-1-8/src/stf-parse.c
==============================================================================
--- branches/gnumeric-1-8/src/stf-parse.c (original)
+++ branches/gnumeric-1-8/src/stf-parse.c Mon Apr 28 23:19:20 2008
@@ -840,7 +840,7 @@
if (parseoptions->parsetype != PARSE_TYPE_CSV)
src.position += compare_terminator (src.position, parseoptions);
- if (++row == SHEET_MAX_ROWS)
+ if (++row == gnm_sheet_get_max_rows (NULL))
break;
}
@@ -1203,7 +1203,7 @@
if (parseoptions->col_import_array == NULL ||
parseoptions->col_import_array_len <= lcol ||
parseoptions->col_import_array[lcol]) {
- if (col >= SHEET_MAX_COLS) {
+ if (col >= gnm_sheet_get_max_cols (sheet)) {
if (!parseoptions->cols_exceeded) {
g_warning (_("There are more columns of data than "
"there is room for in the sheet. Extra "
Modified: branches/gnumeric-1-8/src/stf.c
==============================================================================
--- branches/gnumeric-1-8/src/stf.c (original)
+++ branches/gnumeric-1-8/src/stf.c Mon Apr 28 23:19:20 2008
@@ -211,7 +211,7 @@
nameutf8, data, data_len);
if (dialogresult != NULL && stf_store_results (dialogresult, sheet, 0, 0)) {
workbook_recalc_all (book);
- sheet_queue_respan (sheet, 0, SHEET_MAX_ROWS-1);
+ sheet_queue_respan (sheet, 0, gnm_sheet_get_max_rows (sheet)-1);
} else {
/* the user has cancelled */
/* the caller should notice that we have no sheets */
@@ -374,7 +374,7 @@
if (stf_parse_sheet (po, utf8data, NULL, sheet, 0, 0)) {
workbook_recalc_all (book);
- sheet_queue_respan (sheet, 0, SHEET_MAX_ROWS-1);
+ sheet_queue_respan (sheet, 0, gnm_sheet_get_max_rows (sheet)-1);
if (po->cols_exceeded) {
/* Using go_cmd_context_error_import will destroy the successfully imported portion */
/* go_cmd_context_error_import (GO_CMD_CONTEXT (context), */
Modified: branches/gnumeric-1-8/src/test.c
==============================================================================
--- branches/gnumeric-1-8/src/test.c (original)
+++ branches/gnumeric-1-8/src/test.c Mon Apr 28 23:19:20 2008
@@ -99,8 +99,8 @@
r.start.col = 0;
r.start.row = MAX (0, j - 1);
- r.end.col = SHEET_MAX_COLS;
- r.end.row = MIN (SHEET_MAX_ROWS, j + 1);
+ r.end.col = gnm_sheet_get_max_cols (sheet);
+ r.end.row = MIN (gnm_sheet_get_max_rows (sheet), j + 1);
sheet_style_optimize (sheet, r);
}
Modified: branches/gnumeric-1-8/src/tools/dao.c
==============================================================================
--- branches/gnumeric-1-8/src/tools/dao.c (original)
+++ branches/gnumeric-1-8/src/tools/dao.c Mon Apr 28 23:19:20 2008
@@ -70,8 +70,8 @@
dao->start_row = 0;
dao->offset_col = 0;
dao->offset_row = 0;
- dao->cols = SHEET_MAX_COLS;
- dao->rows = SHEET_MAX_ROWS;
+ dao->cols = gnm_sheet_get_max_cols (NULL);
+ dao->rows = gnm_sheet_get_max_rows (NULL);
dao->sheet = NULL;
dao->autofit_flag = TRUE;
dao->clear_outputrange = TRUE;
@@ -173,8 +173,8 @@
void
dao_adjust (data_analysis_output_t *dao, gint cols, gint rows)
{
- int max_rows = SHEET_MAX_ROWS - dao->start_row;
- int max_cols = SHEET_MAX_COLS - dao->start_col;
+ int max_rows = gnm_sheet_get_max_rows (dao->sheet) - dao->start_row;
+ int max_cols = gnm_sheet_get_max_cols (dao->sheet) - dao->start_col;
if (dao->cols == 1 && dao->rows == 1) {
if (cols != -1)
@@ -221,22 +221,22 @@
dao->sheet = sheet_new (wb, unique_name);
g_free (unique_name);
dao->start_col = dao->start_row = 0;
- dao->rows = SHEET_MAX_ROWS;
- dao->cols = SHEET_MAX_COLS;
+ dao->rows = gnm_sheet_get_max_rows (dao->sheet);
+ dao->cols = gnm_sheet_get_max_cols (dao->sheet);
workbook_sheet_attach (wb, dao->sheet);
} else if (dao->type == NewWorkbookOutput) {
Workbook *wb = workbook_new ();
dao->sheet = sheet_new (wb, name);
dao->start_col = dao->start_row = 0;
- dao->rows = SHEET_MAX_ROWS;
- dao->cols = SHEET_MAX_COLS;
+ dao->rows = gnm_sheet_get_max_rows (dao->sheet);
+ dao->cols = gnm_sheet_get_max_cols (dao->sheet);
workbook_sheet_attach (wb, dao->sheet);
dao->wbc = wb_control_wrapper_new (dao->wbc, NULL, wb, NULL);
}
if (dao->rows == 0 || (dao->rows == 1 && dao->cols == 1))
- dao->rows = SHEET_MAX_ROWS - dao->start_row;
+ dao->rows = gnm_sheet_get_max_rows (dao->sheet) - dao->start_row;
if (dao->cols == 0 || (dao->rows == 1 && dao->cols == 1))
- dao->cols = SHEET_MAX_COLS - dao->start_col;
+ dao->cols = gnm_sheet_get_max_cols (dao->sheet) - dao->start_col;
dao->offset_col = 0;
dao->offset_row = 0;
}
@@ -295,7 +295,7 @@
col += dao->start_col;
row += dao->start_row;
- return (!(col >= SHEET_MAX_COLS || row >= SHEET_MAX_ROWS));
+ return (!(col >= gnm_sheet_get_max_cols (dao->sheet) || row >= gnm_sheet_get_max_rows (dao->sheet)));
}
@@ -324,7 +324,7 @@
col += dao->start_col;
row += dao->start_row;
- if (col >= SHEET_MAX_COLS || row >= SHEET_MAX_ROWS) {
+ if (col >= gnm_sheet_get_max_cols (dao->sheet) || row >= gnm_sheet_get_max_rows (dao->sheet)) {
gnm_expr_free (expr);
return;
}
@@ -363,7 +363,7 @@
col += dao->start_col;
row += dao->start_row;
- if (col >= SHEET_MAX_COLS || row >= SHEET_MAX_ROWS) {
+ if (col >= gnm_sheet_get_max_cols (dao->sheet) || row >= gnm_sheet_get_max_rows (dao->sheet)) {
gnm_expr_free (expr);
return;
}
@@ -410,7 +410,7 @@
col += dao->start_col;
row += dao->start_row;
- if (col >= SHEET_MAX_COLS || row >= SHEET_MAX_ROWS) {
+ if (col >= gnm_sheet_get_max_cols (dao->sheet) || row >= gnm_sheet_get_max_rows (dao->sheet)) {
value_release (v);
return;
}
@@ -572,7 +572,7 @@
col += dao->start_col;
row += dao->start_row;
- if (col >= SHEET_MAX_COLS || row >= SHEET_MAX_ROWS)
+ if (col >= gnm_sheet_get_max_cols (dao->sheet) || row >= gnm_sheet_get_max_rows (dao->sheet))
return;
pos.col = col;
@@ -598,7 +598,7 @@
actual_col = dao->start_col + col;
ideal_size = sheet_col_size_fit_pixels (dao->sheet, actual_col,
- 0, SHEET_MAX_ROWS - 1,
+ 0, gnm_sheet_get_max_rows (dao->sheet) - 1,
FALSE);
if (ideal_size == 0)
return;
Modified: branches/gnumeric-1-8/src/tools/data-shuffling.c
==============================================================================
--- branches/gnumeric-1-8/src/tools/data-shuffling.c (original)
+++ branches/gnumeric-1-8/src/tools/data-shuffling.c Mon Apr 28 23:19:20 2008
@@ -231,12 +231,12 @@
if (st->type == SHUFFLE_COLS) {
/* Find empty space. */
- for (i = SHEET_MAX_COLS - 1; i >= 0; i--)
- for (j = SHEET_MAX_ROWS - 1; j >= 0; j--) {
+ for (i = gnm_sheet_get_max_cols (st->sheet) - 1; i >= 0; i--)
+ for (j = gnm_sheet_get_max_rows (st->sheet) - 1; j >= 0; j--) {
cell = sheet_cell_get (st->sheet, i, j);
if (cell != NULL)
break;
- else if (SHEET_MAX_ROWS - j >= st->rows)
+ else if (gnm_sheet_get_max_rows (st->sheet) - j >= st->rows)
goto cols_out;
}
cols_out:
@@ -247,12 +247,12 @@
do_swap_cols (st, (swap_t *) cur->data);
} else if (st->type == SHUFFLE_ROWS) {
/* Find empty space. */
- for (i = SHEET_MAX_ROWS - 1; i >= 0; i--)
- for (j = SHEET_MAX_COLS - 1; j >= 0; j--) {
+ for (i = gnm_sheet_get_max_rows (st->sheet) - 1; i >= 0; i--)
+ for (j = gnm_sheet_get_max_cols (st->sheet) - 1; j >= 0; j--) {
cell = sheet_cell_get (st->sheet, j, i);
if (cell != NULL)
break;
- else if (SHEET_MAX_COLS - j >= st->cols)
+ else if (gnm_sheet_get_max_cols (st->sheet) - j >= st->cols)
goto rows_out;
}
rows_out:
@@ -264,8 +264,8 @@
} else {
/* SHUFFLE_AREA */
/* Find empty space. */
- for (i = SHEET_MAX_COLS - 1; i >= 0; i--)
- for (j = SHEET_MAX_ROWS - 1; j >= 0; j--) {
+ for (i = gnm_sheet_get_max_cols (st->sheet) - 1; i >= 0; i--)
+ for (j = gnm_sheet_get_max_rows (st->sheet) - 1; j >= 0; j--) {
cell = sheet_cell_get (st->sheet, i, j);
if (cell == NULL)
goto area_out;
Modified: branches/gnumeric-1-8/src/tools/filter.c
==============================================================================
--- branches/gnumeric-1-8/src/tools/filter.c (original)
+++ branches/gnumeric-1-8/src/tools/filter.c Mon Apr 28 23:19:20 2008
@@ -175,7 +175,7 @@
/* FIXME: This is slow. We should probably have a linked list
* containing the filtered rows in the sheet structure. */
- colrow_foreach (&sheet->rows, 0, SHEET_MAX_ROWS,
+ colrow_foreach (&sheet->rows, 0, gnm_sheet_get_max_rows (sheet),
(ColRowHandler) cb_show_all, sheet);
sheet->has_filtered_rows = FALSE;
sheet_redraw_all (sheet, TRUE);
Modified: branches/gnumeric-1-8/src/tools/solver/reports-write.c
==============================================================================
--- branches/gnumeric-1-8/src/tools/solver/reports-write.c (original)
+++ branches/gnumeric-1-8/src/tools/solver/reports-write.c Mon Apr 28 23:19:20 2008
@@ -782,7 +782,7 @@
col = 0;
for (i = 0; i < vars; i++) {
if (res->obj_coeff[i] != 0) {
- if (1 + col*3 + 3 > SHEET_MAX_COLS)
+ if (1 + col*3 + 3 > gnm_sheet_get_max_cols (sheet))
goto unsuccessful;
/* Print the sign. */
Modified: branches/gnumeric-1-8/src/tools/solver/solver.c
==============================================================================
--- branches/gnumeric-1-8/src/tools/solver/solver.c (original)
+++ branches/gnumeric-1-8/src/tools/solver/solver.c Mon Apr 28 23:19:20 2008
@@ -164,8 +164,8 @@
; /* Nothing */
}
- if (col >= 0 && col < SHEET_MAX_COLS &&
- row >= 0 && row < SHEET_MAX_ROWS)
+ if (col >= 0 && col < gnm_sheet_get_max_cols (sheet) &&
+ row >= 0 && row < gnm_sheet_get_max_rows (sheet))
sp->target_cell = sheet_cell_fetch (sheet, col, row);
if (!doc)
Modified: branches/gnumeric-1-8/src/tools/tabulate.c
==============================================================================
--- branches/gnumeric-1-8/src/tools/tabulate.c (original)
+++ branches/gnumeric-1-8/src/tools/tabulate.c Mon Apr 28 23:19:20 2008
@@ -100,10 +100,10 @@
counts[i] = 1 + gnm_fake_floor ((data->maxima[i] - data->minima[i]) / data->steps[i]);
/* Silently truncate at the edges. */
- if (!data->with_coordinates && i == 0 && counts[i] > SHEET_MAX_COLS - 1) {
- counts[i] = SHEET_MAX_COLS - 1;
- } else if (!data->with_coordinates && i == 1 && counts[i] > SHEET_MAX_ROWS - 1) {
- counts[i] = SHEET_MAX_ROWS - 1;
+ if (!data->with_coordinates && i == 0 && counts[i] > gnm_sheet_get_max_cols (sheet) - 1) {
+ counts[i] = gnm_sheet_get_max_cols (sheet) - 1;
+ } else if (!data->with_coordinates && i == 1 && counts[i] > gnm_sheet_get_max_rows (sheet) - 1) {
+ counts[i] = gnm_sheet_get_max_rows (sheet) - 1;
}
}
}
@@ -231,7 +231,7 @@
if (data->with_coordinates) {
row++;
- if (row >= SHEET_MAX_ROWS)
+ if (row >= gnm_sheet_get_max_rows (sheet))
break;
}
Modified: branches/gnumeric-1-8/src/wbc-gtk-actions.c
==============================================================================
--- branches/gnumeric-1-8/src/wbc-gtk-actions.c (original)
+++ branches/gnumeric-1-8/src/wbc-gtk-actions.c Mon Apr 28 23:19:20 2008
@@ -123,9 +123,10 @@
{
GnmParsePos pp;
GnmRange r;
+ Sheet *sheet = wbcg_cur_sheet (wbcg);
range_init_full_sheet (&r);
- parse_pos_init_sheet (&pp, wbcg_cur_sheet (wbcg));
+ parse_pos_init_sheet (&pp, sheet);
cmd_define_name (WORKBOOK_CONTROL (wbcg), "Print_Area", &pp,
gnm_expr_top_new_constant
(value_new_cellrange_r (NULL, &r)),
Modified: branches/gnumeric-1-8/src/wbc-gtk.c
==============================================================================
--- branches/gnumeric-1-8/src/wbc-gtk.c (original)
+++ branches/gnumeric-1-8/src/wbc-gtk.c Mon Apr 28 23:19:20 2008
@@ -1957,7 +1957,7 @@
len = go_pango_measure_string (
gtk_widget_get_pango_context (GTK_WIDGET (wbcg_toplevel (wbcg))),
GTK_WIDGET (entry)->style->font_desc,
- cell_coord_name (SHEET_MAX_COLS - 1, SHEET_MAX_ROWS - 1));
+ cell_coord_name (gnm_sheet_get_max_cols (NULL) - 1, gnm_sheet_get_max_rows (NULL) - 1));
/*
* Add a little extra since font might be proportional and since
* we also put user defined names there.
Modified: branches/gnumeric-1-8/src/widgets/gnumeric-expr-entry.c
==============================================================================
--- branches/gnumeric-1-8/src/widgets/gnumeric-expr-entry.c (original)
+++ branches/gnumeric-1-8/src/widgets/gnumeric-expr-entry.c Mon Apr 28 23:19:20 2008
@@ -750,11 +750,11 @@
if (gee->flags & GNM_EE_FULL_ROW) {
dst->a.col = 0;
- dst->b.col = SHEET_MAX_COLS - 1;
+ dst->b.col = gnm_sheet_get_max_cols (gee->sheet) - 1;
}
if (gee->flags & GNM_EE_FULL_COL) {
dst->a.row = 0;
- dst->b.row = SHEET_MAX_ROWS - 1;
+ dst->b.row = gnm_sheet_get_max_rows (gee->sheet) - 1;
}
/* special case a single merge to be only corner */
Modified: branches/gnumeric-1-8/src/workbook-view.c
==============================================================================
--- branches/gnumeric-1-8/src/workbook-view.c (original)
+++ branches/gnumeric-1-8/src/workbook-view.c Mon Apr 28 23:19:20 2008
@@ -344,9 +344,9 @@
int rows = r->end.row - r->start.row + 1;
int cols = r->end.col - r->start.col + 1;
- if (rows == SHEET_MAX_ROWS)
+ if (rows == gnm_sheet_get_max_rows (sv->sheet))
snprintf (buffer, sizeof (buffer), _("%dC"), cols);
- else if (cols == SHEET_MAX_COLS)
+ else if (cols == gnm_sheet_get_max_cols (sv->sheet))
snprintf (buffer, sizeof (buffer), _("%dR"), rows);
else
snprintf (buffer, sizeof (buffer), _("%dR x %dC"),
Modified: branches/gnumeric-1-8/src/xml-sax-write.c
==============================================================================
--- branches/gnumeric-1-8/src/xml-sax-write.c (original)
+++ branches/gnumeric-1-8/src/xml-sax-write.c Mon Apr 28 23:19:20 2008
@@ -678,7 +678,7 @@
closure.prev = NULL;
closure.prev_pos = -1;
closure.rle_count = 0;
- colrow_foreach (&state->sheet->cols, 0, SHEET_MAX_COLS-1,
+ colrow_foreach (&state->sheet->cols, 0, gnm_sheet_get_max_cols (state->sheet)-1,
(ColRowHandler)&xml_write_colrow_info, &closure);
xml_write_colrow_info (NULL, &closure); /* flush */
gsf_xml_out_end_element (state->output); /* </gnm:Cols> */
@@ -691,7 +691,7 @@
closure.prev = NULL;
closure.prev_pos = -1;
closure.rle_count = 0;
- colrow_foreach (&state->sheet->rows, 0, SHEET_MAX_ROWS-1,
+ colrow_foreach (&state->sheet->rows, 0, gnm_sheet_get_max_rows (state->sheet)-1,
(ColRowHandler)&xml_write_colrow_info, &closure);
xml_write_colrow_info (NULL, &closure); /* flush */
gsf_xml_out_end_element (state->output); /* </gnm:Rows> */
@@ -803,7 +803,7 @@
{
gsf_xml_out_start_element (state->output, GNM "Cells");
sheet_foreach_cell_in_range ((Sheet *)state->sheet, CELL_ITER_IGNORE_NONEXISTENT,
- 0, 0, SHEET_MAX_COLS-1, SHEET_MAX_ROWS-1,
+ 0, 0, gnm_sheet_get_max_cols (state->sheet)-1, gnm_sheet_get_max_rows (state->sheet)-1,
(CellIterFunc) cb_write_cell, state);
gsf_xml_out_end_element (state->output); /* </gnm:Cells> */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]