Commit 89274950 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

take a cellpos *


2002-06-21  Jody Goldberg <jody@gnome.org>

	* src/parse-util.c (parse_cell_name) : take a cellpos *

	* src/func-builtin.c (gnumeric_selection) : dummy out for now until a
	  different approach is available.

	* src/commands.c : convert to sheetview.
	  s/parent/cmd/ to make things more readable
	(cmd_selection_clear) : rename from cmd_clear_selection so that we can
	  start to group the operations that currently operate on selections.
	(cmd_selection_format) : rename from cmd_format.
	(cmd_selection_colrow_hide) : rename from cmd_colrow_hide_selection.
	(cmd_selection_outline_change) : rename from cmd_colrow_outline_change.
	(cmd_selection_group) : rename from cmd_group.
	(cmd_selection_autoformat) : rename from cmd_autoformat.
	(cmd_colrow_hide_correct_selection) : take a control.

	* src/colrow.c (cb_colrow_visibility) : selections are now part of
	  sheetview.
	(colrow_get_visiblity_toggle) : ditto.

	* src/cmd-edit.c (cmd_select_cur_row) : convert to sheetview.
	(cmd_select_cur_col) : ditto.
	(cmd_select_cur_array) : ditto.
	(cmd_select_cur_depends) : ditto.
	(cmd_select_cur_inputs) : ditto.
	(cmd_paste_to_selection) : ditto.

	* src/bonobo-io.c (deserialize_wb_from_xml_stream) : pass the wbv into
	  the context directly.
	(gnumeric_bonobo_write_workbook) : ditto.
	(gnumeric_bonobo_read_workbook) : ditto.

	* src/consolidate.c (redraw_respan_and_select) : set selection only
	  for the calling view.
	(row_consolidate) : pass in the view.
	(col_consolidate) : ditto.
	(colrow_consolidate) : ditto.
	(consolidate_apply) : Take a control so that we can extract the view.

	* src/commands.c (cmd_consolidate_redo) : Pass the control.

2002-06-20  Jody Goldberg <jody@gnome.org>

	* src/sheet-view.c (sheet_view_init) : init the selection.

	* src/workbook-view.c (workbook_view_new) : init current_sheet_view.
	(wb_view_format_feedback) : operate on the sheetview.
	(wb_view_selection_desc) : ditto.
	(wb_view_edit_line_set) : ditto.

2002-06-20  Jody Goldberg <jody@gnome.org>

	* src/workbook-view.c (wb_view_sheet_add) : Use sheet_get_view.
	(wb_view_sheet_focus) : ditto.
	* src/xml-io.c (xml_write_selection_info) : ditto.
	(xml_read_selection_info): ditto.
	(xml_workbook_write) : now that the view is in the context don't
	  bother passing it.
	(xml_write_wbv_attributes) : ditto.
	(xml_read_wbv_attributes) : ditto.
parent eb4178dc
2002-06-21 Jody Goldberg <jody@gnome.org>
* src/parse-util.c (parse_cell_name) : take a cellpos *
* src/func-builtin.c (gnumeric_selection) : dummy out for now until a
different approach is available.
* src/commands.c : convert to sheetview.
s/parent/cmd/ to make things more readable
(cmd_selection_clear) : rename from cmd_clear_selection so that we can
start to group the operations that currently operate on selections.
(cmd_selection_format) : rename from cmd_format.
(cmd_selection_colrow_hide) : rename from cmd_colrow_hide_selection.
(cmd_selection_outline_change) : rename from cmd_colrow_outline_change.
(cmd_selection_group) : rename from cmd_group.
(cmd_selection_autoformat) : rename from cmd_autoformat.
(cmd_colrow_hide_correct_selection) : take a control.
* src/colrow.c (cb_colrow_visibility) : selections are now part of
sheetview.
(colrow_get_visiblity_toggle) : ditto.
* src/cmd-edit.c (cmd_select_cur_row) : convert to sheetview.
(cmd_select_cur_col) : ditto.
(cmd_select_cur_array) : ditto.
(cmd_select_cur_depends) : ditto.
(cmd_select_cur_inputs) : ditto.
(cmd_paste_to_selection) : ditto.
* src/bonobo-io.c (deserialize_wb_from_xml_stream) : pass the wbv into
the context directly.
(gnumeric_bonobo_write_workbook) : ditto.
(gnumeric_bonobo_read_workbook) : ditto.
* src/consolidate.c (redraw_respan_and_select) : set selection only
for the calling view.
(row_consolidate) : pass in the view.
(col_consolidate) : ditto.
(colrow_consolidate) : ditto.
(consolidate_apply) : Take a control so that we can extract the view.
* src/commands.c (cmd_consolidate_redo) : Pass the control.
2002-06-20 Jody Goldberg <jody@gnome.org>
* src/sheet-view.c (sheet_view_init) : init the selection.
* src/workbook-view.c (workbook_view_new) : init current_sheet_view.
(wb_view_format_feedback) : operate on the sheetview.
(wb_view_selection_desc) : ditto.
(wb_view_edit_line_set) : ditto.
2002-06-20 Jody Goldberg <jody@gnome.org>
* src/workbook-view.c (wb_view_sheet_add) : Use sheet_get_view.
(wb_view_sheet_focus) : ditto.
* src/xml-io.c (xml_write_selection_info) : ditto.
(xml_read_selection_info): ditto.
(xml_workbook_write) : now that the view is in the context don't
bother passing it.
(xml_write_wbv_attributes) : ditto.
(xml_read_wbv_attributes) : ditto.
2002-06-21 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/application.h (gnumeric_application_get_app) : new
......
2002-06-21 Jody Goldberg <jody@gnome.org>
* src/parse-util.c (parse_cell_name) : take a cellpos *
* src/func-builtin.c (gnumeric_selection) : dummy out for now until a
different approach is available.
* src/commands.c : convert to sheetview.
s/parent/cmd/ to make things more readable
(cmd_selection_clear) : rename from cmd_clear_selection so that we can
start to group the operations that currently operate on selections.
(cmd_selection_format) : rename from cmd_format.
(cmd_selection_colrow_hide) : rename from cmd_colrow_hide_selection.
(cmd_selection_outline_change) : rename from cmd_colrow_outline_change.
(cmd_selection_group) : rename from cmd_group.
(cmd_selection_autoformat) : rename from cmd_autoformat.
(cmd_colrow_hide_correct_selection) : take a control.
* src/colrow.c (cb_colrow_visibility) : selections are now part of
sheetview.
(colrow_get_visiblity_toggle) : ditto.
* src/cmd-edit.c (cmd_select_cur_row) : convert to sheetview.
(cmd_select_cur_col) : ditto.
(cmd_select_cur_array) : ditto.
(cmd_select_cur_depends) : ditto.
(cmd_select_cur_inputs) : ditto.
(cmd_paste_to_selection) : ditto.
* src/bonobo-io.c (deserialize_wb_from_xml_stream) : pass the wbv into
the context directly.
(gnumeric_bonobo_write_workbook) : ditto.
(gnumeric_bonobo_read_workbook) : ditto.
* src/consolidate.c (redraw_respan_and_select) : set selection only
for the calling view.
(row_consolidate) : pass in the view.
(col_consolidate) : ditto.
(colrow_consolidate) : ditto.
(consolidate_apply) : Take a control so that we can extract the view.
* src/commands.c (cmd_consolidate_redo) : Pass the control.
2002-06-20 Jody Goldberg <jody@gnome.org>
* src/sheet-view.c (sheet_view_init) : init the selection.
* src/workbook-view.c (workbook_view_new) : init current_sheet_view.
(wb_view_format_feedback) : operate on the sheetview.
(wb_view_selection_desc) : ditto.
(wb_view_edit_line_set) : ditto.
2002-06-20 Jody Goldberg <jody@gnome.org>
* src/workbook-view.c (wb_view_sheet_add) : Use sheet_get_view.
(wb_view_sheet_focus) : ditto.
* src/xml-io.c (xml_write_selection_info) : ditto.
(xml_read_selection_info): ditto.
(xml_workbook_write) : now that the view is in the context don't
bother passing it.
(xml_write_wbv_attributes) : ditto.
(xml_read_wbv_attributes) : ditto.
2002-06-21 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/application.h (gnumeric_application_get_app) : new
......
2002-06-21 Jody Goldberg <jody@gnome.org>
* src/parse-util.c (parse_cell_name) : take a cellpos *
* src/func-builtin.c (gnumeric_selection) : dummy out for now until a
different approach is available.
* src/commands.c : convert to sheetview.
s/parent/cmd/ to make things more readable
(cmd_selection_clear) : rename from cmd_clear_selection so that we can
start to group the operations that currently operate on selections.
(cmd_selection_format) : rename from cmd_format.
(cmd_selection_colrow_hide) : rename from cmd_colrow_hide_selection.
(cmd_selection_outline_change) : rename from cmd_colrow_outline_change.
(cmd_selection_group) : rename from cmd_group.
(cmd_selection_autoformat) : rename from cmd_autoformat.
(cmd_colrow_hide_correct_selection) : take a control.
* src/colrow.c (cb_colrow_visibility) : selections are now part of
sheetview.
(colrow_get_visiblity_toggle) : ditto.
* src/cmd-edit.c (cmd_select_cur_row) : convert to sheetview.
(cmd_select_cur_col) : ditto.
(cmd_select_cur_array) : ditto.
(cmd_select_cur_depends) : ditto.
(cmd_select_cur_inputs) : ditto.
(cmd_paste_to_selection) : ditto.
* src/bonobo-io.c (deserialize_wb_from_xml_stream) : pass the wbv into
the context directly.
(gnumeric_bonobo_write_workbook) : ditto.
(gnumeric_bonobo_read_workbook) : ditto.
* src/consolidate.c (redraw_respan_and_select) : set selection only
for the calling view.
(row_consolidate) : pass in the view.
(col_consolidate) : ditto.
(colrow_consolidate) : ditto.
(consolidate_apply) : Take a control so that we can extract the view.
* src/commands.c (cmd_consolidate_redo) : Pass the control.
2002-06-20 Jody Goldberg <jody@gnome.org>
* src/sheet-view.c (sheet_view_init) : init the selection.
* src/workbook-view.c (workbook_view_new) : init current_sheet_view.
(wb_view_format_feedback) : operate on the sheetview.
(wb_view_selection_desc) : ditto.
(wb_view_edit_line_set) : ditto.
2002-06-20 Jody Goldberg <jody@gnome.org>
* src/workbook-view.c (wb_view_sheet_add) : Use sheet_get_view.
(wb_view_sheet_focus) : ditto.
* src/xml-io.c (xml_write_selection_info) : ditto.
(xml_read_selection_info): ditto.
(xml_workbook_write) : now that the view is in the context don't
bother passing it.
(xml_write_wbv_attributes) : ditto.
(xml_read_wbv_attributes) : ditto.
2002-06-21 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/application.h (gnumeric_application_get_app) : new
......
2002-06-21 Jody Goldberg <jody@gnome.org>
* applix-read.c (applix_parse_cellref) : take a CellPos.
(applix_read_cells) : tidy a smidge.
(applix_read_impl) :
2002-06-20 Jody Goldberg <jody@gnome.org>
* applix-read.c (applix_read_view) : selection is in the view now.
Tweak the logic to truely ignore the 'Current' view.
2002-06-20 Morten Welinder <terra@diku.dk>
* applix-read.c (applix_read_impl): Initialize vars.
......
......@@ -757,7 +757,7 @@ applix_get_sheet (ApplixReadState *state, unsigned char **buffer,
static char *
applix_parse_cellref (ApplixReadState *state, unsigned char *buffer,
Sheet **sheet, int *col, int *row,
Sheet **sheet, CellPos *pos,
char const separator)
{
int len;
......@@ -765,11 +765,11 @@ applix_parse_cellref (ApplixReadState *state, unsigned char *buffer,
*sheet = applix_get_sheet (state, &buffer, separator);
/* Get cell addr */
if (*sheet && parse_cell_name (buffer, col, row, FALSE, &len))
if (*sheet && parse_cell_name (buffer, pos, FALSE, &len))
return buffer + len;
*sheet = NULL;
*col = *row = -1;
pos->col = pos->row = -1;
return NULL;
}
......@@ -800,6 +800,7 @@ applix_read_view (ApplixReadState *state, unsigned char *buffer)
{
Sheet *sheet = NULL;
unsigned char *name = buffer + 19;
gboolean ignore;
int len = strlen (name);
g_return_val_if_fail (len > 1 && name [len-1] == '~', -1);
......@@ -813,27 +814,24 @@ applix_read_view (ApplixReadState *state, unsigned char *buffer)
else
name [len-1] = '\0';
ignore = !strcmp (name, "Current"); /* ignore current */
while (NULL != (buffer = applix_get_line (state))) {
if (!a_strncmp (buffer, "View Top Left: ")) {
int col, row;
if (applix_parse_cellref (state, buffer+15, &sheet, &col, &row, ':'))
sheet_set_initial_top_left (sheet, col, row);
if (!strcmp (name, "Current")) /* ignore current */
sheet = NULL;
continue;
} else if (!a_strncmp (buffer, "View Open Cell: ")) {
int col, row;
if (applix_parse_cellref (state, buffer+16, &sheet, &col, &row, ':'))
sheet_selection_set (sheet, col, row, col, row, col, row);
if (!strcmp (name, "Current")) /* ignore current */
sheet = NULL;
if (!a_strncmp (buffer, "View End, Name: ~"))
break;
if (ignore)
continue;
}
if (sheet == NULL)
continue;
if (!a_strncmp (buffer, "View Default Column Width ")) {
if (!a_strncmp (buffer, "View Top Left: ")) {
CellPos pos;
if (applix_parse_cellref (state, buffer+15, &sheet, &pos, ':'))
sheet_set_initial_top_left (sheet, pos.col, pos.row);
} else if (!a_strncmp (buffer, "View Open Cell: ")) {
CellPos pos;
if (applix_parse_cellref (state, buffer+16, &sheet, &pos, ':'))
sv_selection_set (sheet_get_view (sheet, state->wb_view),
&pos, pos.col, pos.row, pos.col, pos.row);
} else if (!a_strncmp (buffer, "View Default Column Width ")) {
char *ptr, *tmp = buffer + 26;
int width = strtol (tmp, &ptr, 10);
if (tmp == ptr || width <= 0)
......@@ -895,8 +893,7 @@ applix_read_view (ApplixReadState *state, unsigned char *buffer)
applix_width_to_pixels (width),
TRUE);
} while (ptr[0] == ' ' && isalpha ((unsigned char) ptr[1]));
} else if (!a_strncmp (buffer, "View End, Name: ~"))
break;
}
}
return 0;
......@@ -906,9 +903,9 @@ static int
applix_read_cells (ApplixReadState *state)
{
Sheet *sheet;
int col, row;
MStyle *style;
Cell *cell;
CellPos pos;
ParseError perr;
unsigned char content_type, *tmp, *ptr;
......@@ -928,15 +925,15 @@ applix_read_cells (ApplixReadState *state)
}
/* Get cell */
ptr = applix_parse_cellref (state, ptr, &sheet, &col, &row, '!');
ptr = applix_parse_cellref (state, ptr, &sheet, &pos, '!');
if (ptr == NULL) {
mstyle_unref (style);
return applix_parse_error (state, "Expression did not specify target cell");
}
cell = sheet_cell_fetch (sheet, col, row);
cell = sheet_cell_fetch (sheet, pos.col, pos.row);
/* Apply the formating */
sheet_style_set_pos (sheet, col, row, style);
sheet_style_set_pos (sheet, pos.col, pos.row, style);
content_type = *ptr;
switch (content_type) {
case ';' : /* First of a shared formula */
......@@ -971,14 +968,14 @@ applix_read_cells (ApplixReadState *state)
if (*expr_string == '~') {
Sheet *start_sheet, *end_sheet;
tmp = applix_parse_cellref (state, expr_string+1, &start_sheet,
&r.start.col, &r.start.row, ':');
&r.start, ':');
if (start_sheet == NULL || tmp == NULL || tmp[0] != '.' || tmp[1] != '.') {
(void) applix_parse_error (state, "Invalid array expression");
continue;
}
tmp = applix_parse_cellref (state, tmp+2, &end_sheet,
&r.end.col, &r.end.row, ':');
&r.end, ':');
if (end_sheet == NULL || tmp == NULL || tmp[0] != '~') {
(void) applix_parse_error (state, "Invalid array expression");
continue;
......@@ -1141,7 +1138,7 @@ static int
applix_read_impl (ApplixReadState *state)
{
Sheet *sheet;
int col, row;
CellPos pos;
int ext_links = -1;
unsigned char *real_name = NULL;
char top_cell_addr[30] = "";
......@@ -1253,7 +1250,7 @@ applix_read_impl (ApplixReadState *state)
return -1;
/* We only need the sheet, the visible cell, and edit pos are already set */
if (applix_parse_cellref (state, cur_cell_addr, &sheet, &col, &row, ':'))
if (applix_parse_cellref (state, cur_cell_addr, &sheet, &pos, ':'))
wb_view_sheet_focus (state->wb_view, sheet);
return 0;
......
2002-06-20 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (ms_excel_workbook_new) : store the workbookview.
(ms_excel_read_selection) : selection is now in the view.
2002-06-06 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (ms_excel_read_workbook) : convert to gsf.
......
......@@ -2365,7 +2365,7 @@ ms_wb_get_fmt (MSContainer const *container, guint16 indx)
}
static ExcelWorkbook *
ms_excel_workbook_new (MsBiffVersion ver, IOContext *context)
ms_excel_workbook_new (MsBiffVersion ver, IOContext *context, WorkbookView *wbv)
{
static MSContainerClass const vtbl = {
NULL, NULL,
......@@ -2382,6 +2382,7 @@ ms_excel_workbook_new (MsBiffVersion ver, IOContext *context)
ans->container.ver = ver;
ans->context = context;
ans->wbv = wbv;
ans->extern_sheet_v8 = NULL;
ans->extern_sheet_v7 = NULL;
......@@ -3016,6 +3017,7 @@ ms_excel_read_selection (BiffQuery *q, ExcelSheet *esheet)
int const act_col = GSF_LE_GET_GUINT16 (q->data + 3);
int num_refs = GSF_LE_GET_GUINT16 (q->data + 7);
guint8 *refs;
SheetView *sv = sheet_get_view (esheet->gnum_sheet, esheet->wb->wbv);
d (1, printf ("Start selection\n"););
d (6, printf ("Cursor: %d %d\n", act_col, act_row););
......@@ -3023,7 +3025,7 @@ ms_excel_read_selection (BiffQuery *q, ExcelSheet *esheet)
/* FIXME : pane_number will be relevant for split panes.
* because frozen panes are bound together this does not matter.
*/
sheet_selection_reset (esheet->gnum_sheet);
sv_selection_reset (sv);
for (refs = q->data + 9; num_refs > 0; refs += 6, num_refs--) {
int const start_row = GSF_LE_GET_GUINT16 (refs + 0);
int const start_col = GSF_LE_GET_GUINT8 (refs + 4);
......@@ -3032,11 +3034,10 @@ ms_excel_read_selection (BiffQuery *q, ExcelSheet *esheet)
d (6, printf ("Ref %d = %d %d %d %d\n", num_refs,
start_col, start_row, end_col, end_row););
/* FIXME: This should not trigger a recalc */
sheet_selection_add_range (esheet->gnum_sheet,
start_col, start_row,
start_col, start_row,
end_col, end_row);
sv_selection_add_range (sv,
start_col, start_row,
start_col, start_row,
end_col, end_row);
}
#if 0
/* FIXME: Disable for now. We need to reset the index of the
......@@ -4479,7 +4480,7 @@ ms_excel_read_bof (BiffQuery *q,
ver->version = vv;
if (ver->type == MS_BIFF_TYPE_Workbook) {
ewb = ms_excel_workbook_new (ver->version, context);
ewb = ms_excel_workbook_new (ver->version, context, wb_view);
ewb->gnum_wb = wb_view_workbook (wb_view);
if (ver->version >= MS_BIFF_V8) {
guint32 ver = GSF_LE_GET_GUINT32 (q->data + 4);
......
......@@ -84,8 +84,9 @@ typedef struct _BiffFormatData {
typedef struct _ExcelWorkbook
{
MSContainer container;
IOContext *context;
MSContainer container;
IOContext *context;
WorkbookView *wbv;
GPtrArray *excel_sheets;
GHashTable *boundsheet_data_by_stream;
......
......@@ -3302,6 +3302,7 @@ write_sheet_tail (IOContext *context, BiffPut *bp, ExcelSheet *esheet)
}
/* See: S59DE2.HTM */
#warning YUCK! store the real selection
data = ms_biff_put_len_next (bp, BIFF_SELECTION, 15);
MS_OLE_SET_GUINT32 (data + 0, 0x00000103);
MS_OLE_SET_GUINT32 (data + 4, 0x01000000);
......
......@@ -143,13 +143,13 @@ excel_gb_range_select (GBRunEvalContext *ec,
{
ExcelGBRange *range = EXCEL_GB_RANGE (object);
sheet_selection_add_range (range->sheet,
range->range.start.col,
range->range.start.row,
range->range.start.col,
range->range.start.row,
range->range.end.col,
range->range.end.row);
sv_selection_add_range (range->sheet,
range->range.start.col,
range->range.start.row,
range->range.start.col,
range->range.start.row,
range->range.end.col,
range->range.end.row);
sheet_selection_redraw (range->sheet);
......@@ -258,13 +258,13 @@ excel_gb_range_new_ref (GBRunEvalContext *ec,
Range tmp;
int len;
if (!parse_cell_name (text, &tmp.start.col, &tmp.start.row, FALSE, &len)) {
if (!parse_cell_name (text, &tmp.start, FALSE, &len)) {
gbrun_exception_firev (ec, "Invalid range '%s'", text);
return NULL;
}
if (text [len] == ':') {
if (!parse_cell_name (text + len + 1, &tmp.end.col, &tmp.end.row, TRUE, NULL)) {
if (!parse_cell_name (text + len + 1, &tmp.end, &tmp.end, TRUE, NULL)) {
gbrun_exception_firev (ec, "Invalid range '%s'", text);
return NULL;
}
......
2002-06-21 Jody Goldberg <jody@gnome.org>
* sc.c (sc_parse_cell_name_list) : change to parse_cell_name.
2002-06-07 Jody Goldberg <jody@gnome.org>
* sc.c (sc_file_probe) : new.
......
......@@ -203,7 +203,8 @@ sc_parse_cell_name_list (Sheet *sheet, const char *cell_name_str,
char *buf;
GSList *cells = NULL;
Cell *cell;
int i, n, col, row;
CellPos pos;
int i, n;
g_return_val_if_fail (sheet != NULL, NULL);
g_return_val_if_fail (IS_SHEET (sheet), NULL);
......@@ -217,14 +218,14 @@ sc_parse_cell_name_list (Sheet *sheet, const char *cell_name_str,
(!cell_name_str [i])){
buf [n] = '\0';
if (!parse_cell_name (buf, &col, &row)){
if (!parse_cell_name (buf, &pos)){
*error_flag = 1;
g_free (buf);
g_slist_free (cells);
return NULL;
}
cell = sheet_cell_fetch (sheet, col, row);
cell = sheet_cell_fetch (sheet, pos.col, pos.row);
cells = g_slist_append (cells, (gpointer) cell);
n = 0;
} else
......
2002-06-20 Jody Goldberg <jody@gnome.org>
* xml-sax-read.c (xml_sax_selection_range) : use sheet_get_view.
(xml_sax_selection) : ditto.
2002-06-06 Jody Goldberg <jody@gnome.org>
* xml-sax-read.c (xml_sax_unknown_attr) : doh!
......
......@@ -136,8 +136,6 @@ xml_sax_attr_int (xmlChar const * const *attrs, char const *name, int *res)
static gboolean
xml_sax_attr_cellpos (xmlChar const * const *attrs, char const *name, CellPos *val)
{
CellPos tmp;
g_return_val_if_fail (attrs != NULL, FALSE);
g_return_val_if_fail (attrs[0] != NULL, FALSE);
g_return_val_if_fail (attrs[1] != NULL, FALSE);
......@@ -145,12 +143,11 @@ xml_sax_attr_cellpos (xmlChar const * const *attrs, char const *name, CellPos *v
if (strcmp (attrs[0], name))
return FALSE;
if (!parse_cell_name ((gchar *)attrs[1], &tmp.col, &tmp.row, TRUE, NULL)) {
if (!parse_cell_name ((gchar *)attrs[1], val, TRUE, NULL)) {
g_warning ("Invalid attribute '%s', expected cellpos, received '%s'",
name, attrs[1]);
return FALSE;
}
*val = tmp;
return TRUE;
}
......@@ -819,10 +816,11 @@ xml_sax_selection_range (XMLSaxParseState *state, xmlChar const **attrs)
{
Range r;
if (xml_sax_attr_range (attrs, &r))
sheet_selection_add_range (state->sheet,
r.start.col, r.start.row,
r.start.col, r.start.row,
r.end.col, r.end.row);
sv_selection_add_range (
sheet_get_view (state->sheet, state->wb_view),
r.start.col, r.start.row,
r.start.col, r.start.row,
r.end.col, r.end.row);
}
static void
......@@ -830,7 +828,7 @@ xml_sax_selection (XMLSaxParseState *state, xmlChar const **attrs)
{
int col = -1, row = -1;
sheet_selection_reset (state->sheet);
sv_selection_reset (sheet_get_view (state->sheet, state->wb_view));
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (xml_sax_attr_int (attrs, "CursorCol", &col)) ;
......@@ -850,13 +848,8 @@ static void
xml_sax_selection_end (XMLSaxParseState *state)
{
CellPos const pos = state->cell;
state->cell.col = state->cell.row = -1;
g_return_if_fail (pos.col >= 0);
g_return_if_fail (pos.row >= 0);
sheet_set_edit_pos (state->sheet, pos.col, pos.row);
sv_set_edit_pos (sheet_get_view (state->sheet, state->wb_view), &pos);
}
static void
......
......@@ -229,8 +229,8 @@ deserialize_wb_from_xml_stream (StreamIOCtxt *sc, IOContext *ioc,
ioc, _("Does not contain a Workbook file"));
return -1;
}
xc = xml_parse_ctx_new_full (doc, gmr, version, NULL, NULL, NULL);
xml_workbook_read (ioc, wb_view, xc, doc->xmlRootNode);
xc = xml_parse_ctx_new_full (doc, gmr, wb_view, version, NULL, NULL, NULL);
xml_workbook_read (ioc, xc, doc->xmlRootNode);
xml_parse_ctx_destroy (xc);
xmlFreeDoc (doc);
......@@ -577,10 +577,10 @@ gnumeric_bonobo_write_workbook (GnumFileSaver const *fs,
return;
}
ctxt = xml_parse_ctx_new_full (
xml, NULL, GNUM_XML_LATEST, NULL,
xml, NULL, wb_view, GNUM_XML_LATEST, NULL,
gnumeric_bonobo_obj_write, storage);
xml->xmlRootNode = xml_workbook_write (ctxt, wb_view);
xml->xmlRootNode = xml_workbook_write (ctxt);
xml_parse_ctx_destroy (ctxt);
/*
......@@ -697,11 +697,11 @@ gnumeric_bonobo_read_workbook (GnumFileOpener const *fo,
}
ctxt = xml_parse_ctx_new_full (
doc, gmr, version,
doc, gmr, wb_view, version,
gnumeric_bonobo_obj_read,
NULL, storage);
xml_workbook_read (context, wb_view, ctxt, doc->xmlRootNode);
xml_workbook_read (context, ctxt, doc->xmlRootNode);
workbook_set_saveinfo (wb_view_workbook (wb_view),
(char *) filename, FILE_FL_AUTO,
gnumeric_bonobo_saver);
......
......@@ -43,77 +43,75 @@
/**
* cmd_select_cur_row:
* @sheet: The sheet
* @sv: The sheet
*
* Selects an entire row
*/
void
cmd_select_cur_row (Sheet *sheet)
cmd_select_cur_row (SheetView *sv)
{
Range const *sel = selection_first_range (sheet, NULL, NULL);
Range const *sel = selection_first_range (sv, NULL, NULL);
if (sel != NULL) {
Range r = *sel;
sheet_selection_reset (sheet);
sheet_selection_add_range (sheet,
sheet->edit_pos.col, sheet->edit_pos.row,
sv_selection_reset (sv);
sv_selection_add_range (sv,
sv->edit_pos.col, sv->edit_pos.row,
0, r.start.row, SHEET_MAX_COLS-1, r.end.row);
sheet_update (sheet);
sheet_update (sv->sheet);
}
}
/**
* cmd_select_cur_col:
* @sheet: The sheet
* @sv: The sheet
*
* Selects an entire column
*/
void
cmd_select_cur_col (Sheet *sheet)
cmd_select_cur_col (SheetView *sv)
{
Range const *sel = selection_first_range (sheet, NULL, NULL);
Range const *sel = selection_first_range (sv, NULL, NULL);
if (sel != NULL) {
Range r = *sel;
sheet_selection_reset (sheet);
sheet_selection_add_range (sheet,
sheet->edit_pos.col, sheet->edit_pos.row,
sv_selection_reset (sv);
sv_selection_add_range (sv,
sv->edit_pos.col, sv->edit_pos.row,
r.