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

Massive re-org. Export, and improve warning message for TXO.

1999-09-15  Jody Goldberg  <jgoldberg@home.com>

	* ms-escher.c : Massive re-org.
	* ms-obj.c (ms_obj_read_text_impl) : Export, and improve warning
	  message for TXO.
	(ms_obj_read_text_impl) : The drawing will read the TXO.

1999-09-13  Jody Goldberg <jgoldberg@home.com>

	* src/ranges.c (range_dump) : Improve format.

	* src/workbook.c (deps_output) : The selection can be a region.

	* src/dialogs/dialog-cell-sort.c (dialog_cell_sor) :
	  sheet_selection_first_range returns a range.

	* src/print.c (sheet_print_selection) : Ditto.

	* src/selection.c (sheet_selection_first_range) : Simplify and move
	  closer to to sheet_verify_selection_simple.

	* src/workbook.c (insert_cols_cmd, insert_cols_cmd) : Handle
	  sheet_verify_selection_simple rename to selection_is_simple.

	* src/sheet.c (sheet_update_controls) : Use selection_apply
	  rather than sheet_selection_to_list which is expensive.
	(sheet_col_selection_type, sheet_row_selection_type) :
	  Constification.
parent dc9458c7
......@@ -41,6 +41,28 @@
other version numbers are to be increased, too. Fix typos; small
prettifications.
1999-09-13 Jody Goldberg <jgoldberg@home.com>
* src/ranges.c (range_dump) : Improve format.
* src/workbook.c (deps_output) : The selection can be a region.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sor) :
sheet_selection_first_range returns a range.
* src/print.c (sheet_print_selection) : Ditto.
* src/selection.c (sheet_selection_first_range) : Simplify and move
closer to to sheet_verify_selection_simple.
* src/workbook.c (insert_cols_cmd, insert_cols_cmd) : Handle
sheet_verify_selection_simple rename to selection_is_simple.
* src/sheet.c (sheet_update_controls) : Use selection_apply
rather than sheet_selection_to_list which is expensive.
(sheet_col_selection_type, sheet_row_selection_type) :
Constification.
1999-09-13 Michael Meeks <michael@nuclecu.unam.mx>
* src/parser.y (forget_array): Created. exp: added array_row, array_exp,
......
Gnumeric 0.36
Jody:
* Improve selection to correctly handle overlapping ranges.
......
......@@ -41,6 +41,28 @@
other version numbers are to be increased, too. Fix typos; small
prettifications.
1999-09-13 Jody Goldberg <jgoldberg@home.com>
* src/ranges.c (range_dump) : Improve format.
* src/workbook.c (deps_output) : The selection can be a region.
* src/dialogs/dialog-cell-sort.c (dialog_cell_sor) :
sheet_selection_first_range returns a range.
* src/print.c (sheet_print_selection) : Ditto.
* src/selection.c (sheet_selection_first_range) : Simplify and move
closer to to sheet_verify_selection_simple.
* src/workbook.c (insert_cols_cmd, insert_cols_cmd) : Handle
sheet_verify_selection_simple rename to selection_is_simple.
* src/sheet.c (sheet_update_controls) : Use selection_apply
rather than sheet_selection_to_list which is expensive.
(sheet_col_selection_type, sheet_row_selection_type) :
Constification.
1999-09-13 Michael Meeks <michael@nuclecu.unam.mx>
* src/parser.y (forget_array): Created. exp: added array_row, array_exp,
......
1999-09-15 Jody Goldberg <jgoldberg@home.com>
* ms-escher.c : Massive re-org.
* ms-obj.c (ms_obj_read_text_impl) : Export, and improve warning
message for TXO.
(ms_obj_read_text_impl) : The drawing will read the TXO.
1999-09-12 Michael Meeks <michael@nuclecu.unam.mx>
* ms-excel-write.c (write_sheet_bools): write grid-lines & margins &
......@@ -5,7 +12,6 @@
* ms-excel-read.c (ms_excel_read_sheet): Add preconditions & load
print info for grid-lines, & scads of other stuff. (margin_read): Create.
1999-09-11 Michael Meeks <michael@nuclecu.unam.mx>
......
......@@ -28,7 +28,6 @@
#define SpContainer 0xf004
#define Spgr 0xf009
#define Sp 0xf00a
#define OPT 0xf00b
#define Textbox 0xf00c
#define ClientTextbox 0xf00d
#define Anchor 0xf00e
......
This diff is collapsed.
......@@ -69,7 +69,7 @@ object_type_names[] =
"MS Drawing" /* 0x1E */
};
static void
void
ms_obj_read_text_impl (BiffQuery *q, ExcelWorkbook * wb)
{
static char const * const orientations[] = {
......@@ -101,7 +101,14 @@ ms_obj_read_text_impl (BiffQuery *q, ExcelWorkbook * wb)
g_return_if_fail (orient <= 3);
g_return_if_fail (1 <= halign && halign <= 4);
g_return_if_fail (1 <= valign && valign <= 4);
g_return_if_fail (num_formats >= 2);
/* TODO : figure this out. There seem to be strings with 0 formats too.
* do they indicate empty strings ? */
if (num_formats < 2) {
g_warning ("EXCEL : docs state that there should be >= 2 formats. "
"This record has %d", num_formats);
return;
}
/* MS-Documentation error. The offset for the reserved 4 x 0 is 18 */
if (unicode_flag)
......@@ -139,28 +146,9 @@ ms_obj_read_text_impl (BiffQuery *q, ExcelWorkbook * wb)
void
ms_obj_read_text (BiffQuery *q, ExcelWorkbook * wb, int const id)
{
/* next record must be a DRAWING */
/* next record must be a DRAWING, it will load the TXO records */
g_return_if_fail (ms_biff_query_next (q));
g_return_if_fail (q->opcode == BIFF_MS_O_DRAWING);
ms_escher_hack_get_drawing (q, wb);
if (ms_excel_read_debug > 1)
dump (q->data, q->length);
/* then a TXO, CONTINUE, CONTINUE */
g_return_if_fail (ms_biff_query_next (q));
g_return_if_fail (q->opcode == BIFF_TXO);
ms_obj_read_text_impl (q, wb);
#if 0
/* FIXME : Most but not all have a trailing Drawing */
/* finally another DRAWING */
g_return_if_fail (ms_biff_query_next (q));
if (q->opcode != BIFF_MS_O_DRAWING)
printf ("Expected MS_O_DRAWING found 0x%x\n", q->opcode);
else
ms_escher_hack_get_drawing (q);
#endif
}
static void
......@@ -380,6 +368,7 @@ ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
ms_excel_read_chart (q, wb, obj_id);
break;
case 0x02 : /* Text Box */
case 0x06 : /* Text Box */
case 0x07 : /* Button */
ms_obj_read_text (q, wb, obj_id);
......
......@@ -12,5 +12,6 @@
void ms_obj_read_obj (BiffQuery *q, ExcelWorkbook * wb);
void ms_obj_read_text (BiffQuery *q, ExcelWorkbook * wb, int const id);
void ms_obj_read_text_impl (BiffQuery *q, ExcelWorkbook * wb);
#endif /* GNUMERIC_MS_OBJ_H */
......@@ -298,23 +298,29 @@ static void del_clause(GtkWidget * widget, SORT_FLOW * sf)
/*
* Main entry point for the Cell Sort dialog box
*/
void dialog_cell_sort(Workbook * inwb, Sheet * sheet)
void
dialog_cell_sort(Workbook * inwb, Sheet * sheet)
{
int lp;
int start_col, start_row, end_col, end_row;
Range const * sel;
SORT_FLOW sort_flow;
g_return_if_fail(inwb);
g_return_if_fail(sheet);
g_return_if_fail(IS_SHEET(sheet));
if (!sheet_selection_first_range (sheet,
&start_col, &start_row,
&end_col, &end_row)){
if ((sel = selection_first_range (sheet)) == NULL) {
gnumeric_notice(inwb, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a single range"));
return;
}
start_row = sel->start.row;
start_col = sel->start.col;
end_row = sel->end.row;
end_col = sel->end.col;
if (end_row >= SHEET_MAX_ROWS - 2 ||
end_col >= SHEET_MAX_COLS - 2){
gnumeric_notice(inwb, GNOME_MESSAGE_BOX_ERROR,
......
......@@ -23,7 +23,7 @@ dialog_delete_cells (Workbook *wb, Sheet *sheet)
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
if (!sheet_verify_selection_simple (sheet, _("delete cells")))
if (!selection_is_simple (sheet, _("delete cells")))
return;
ss = sheet->selections->data;
......
......@@ -24,7 +24,7 @@ dialog_insert_cells (Workbook *wb, Sheet *sheet)
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
if (!sheet_verify_selection_simple (sheet, _("insert cells")))
if (!selection_is_simple (sheet, _("insert cells")))
return;
ss = sheet->selections->data;
......
......@@ -17,6 +17,7 @@
#include "cursors.h"
#include "selection.h"
#include "utils.h"
#include "ranges.h"
#undef DEBUG_POSITIONS
......@@ -412,10 +413,10 @@ selection_insert_selection_string (GnumericSheet *gsheet)
int pos;
/* Get the new selection string */
strcpy (buffer, cell_name (sel->start_col, sel->start_row));
if (!(sel->start_col == sel->end_col && sel->start_row == sel->end_row)){
strcpy (buffer, cell_name (sel->pos.start.col, sel->pos.start.row));
if (!range_is_singleton (&sel->pos)) {
strcat (buffer, ":");
strcat (buffer, cell_name (sel->end_col, sel->end_row));
strcat (buffer, cell_name (sel->pos.end.col, sel->pos.end.row));
}
gsheet->sel_text_len = strlen (buffer);
......@@ -539,23 +540,23 @@ selection_expand_horizontal (GnumericSheet *gsheet, int n, gboolean jump_to_boun
}
ic = gsheet->selection;
start_col = ic->start_col;
end_col = ic->end_col;
start_col = ic->pos.start.col;
end_col = ic->pos.end.col;
if (ic->base_col < end_col)
end_col =
sheet_find_boundary_horizontal (gsheet->sheet_view->sheet,
end_col, ic->end_row,
end_col, ic->pos.end.row,
n, jump_to_boundaries);
else if (ic->base_col > start_col || n < 0)
start_col =
sheet_find_boundary_horizontal (gsheet->sheet_view->sheet,
start_col, ic->start_row,
start_col, ic->pos.start.row,
n, jump_to_boundaries);
else
end_col =
sheet_find_boundary_horizontal (gsheet->sheet_view->sheet,
end_col, ic->end_row,
end_col, ic->pos.end.row,
n, jump_to_boundaries);
if (end_col < start_col) {
......@@ -567,9 +568,9 @@ selection_expand_horizontal (GnumericSheet *gsheet, int n, gboolean jump_to_boun
selection_remove_selection_string (gsheet);
item_cursor_set_bounds (ic,
start_col,
ic->start_row,
ic->pos.start.row,
end_col,
ic->end_row);
ic->pos.end.row);
selection_insert_selection_string (gsheet);
}
......@@ -587,23 +588,23 @@ selection_expand_vertical (GnumericSheet *gsheet, int n, gboolean jump_to_bounda
}
ic = gsheet->selection;
start_row = ic->start_row;
end_row = ic->end_row;
start_row = ic->pos.start.row;
end_row = ic->pos.end.row;
if (ic->base_row < end_row)
end_row =
sheet_find_boundary_vertical (gsheet->sheet_view->sheet,
ic->end_col, end_row,
ic->pos.end.col, end_row,
n, jump_to_boundaries);
else if (ic->base_row > start_row || n < 0)
start_row =
sheet_find_boundary_vertical (gsheet->sheet_view->sheet,
ic->start_col, start_row,
ic->pos.start.col, start_row,
n, jump_to_boundaries);
else
end_row =
sheet_find_boundary_vertical (gsheet->sheet_view->sheet,
ic->end_col, end_row,
ic->pos.end.col, end_row,
n, jump_to_boundaries);
if (end_row < start_row) {
......@@ -614,9 +615,9 @@ selection_expand_vertical (GnumericSheet *gsheet, int n, gboolean jump_to_bounda
selection_remove_selection_string (gsheet);
item_cursor_set_bounds (ic,
ic->start_col,
ic->pos.start.col,
start_row,
ic->end_col,
ic->pos.end.col,
end_row);
selection_insert_selection_string (gsheet);
}
......
......@@ -17,6 +17,7 @@
#include "cursors.h"
#include "selection.h"
#include "utils.h"
#include "ranges.h"
#undef DEBUG_POSITIONS
......@@ -412,10 +413,10 @@ selection_insert_selection_string (GnumericSheet *gsheet)
int pos;
/* Get the new selection string */
strcpy (buffer, cell_name (sel->start_col, sel->start_row));
if (!(sel->start_col == sel->end_col && sel->start_row == sel->end_row)){
strcpy (buffer, cell_name (sel->pos.start.col, sel->pos.start.row));
if (!range_is_singleton (&sel->pos)) {
strcat (buffer, ":");
strcat (buffer, cell_name (sel->end_col, sel->end_row));
strcat (buffer, cell_name (sel->pos.end.col, sel->pos.end.row));
}
gsheet->sel_text_len = strlen (buffer);
......@@ -539,23 +540,23 @@ selection_expand_horizontal (GnumericSheet *gsheet, int n, gboolean jump_to_boun
}
ic = gsheet->selection;
start_col = ic->start_col;
end_col = ic->end_col;
start_col = ic->pos.start.col;
end_col = ic->pos.end.col;
if (ic->base_col < end_col)
end_col =
sheet_find_boundary_horizontal (gsheet->sheet_view->sheet,
end_col, ic->end_row,
end_col, ic->pos.end.row,
n, jump_to_boundaries);
else if (ic->base_col > start_col || n < 0)
start_col =
sheet_find_boundary_horizontal (gsheet->sheet_view->sheet,
start_col, ic->start_row,
start_col, ic->pos.start.row,
n, jump_to_boundaries);
else
end_col =
sheet_find_boundary_horizontal (gsheet->sheet_view->sheet,
end_col, ic->end_row,
end_col, ic->pos.end.row,
n, jump_to_boundaries);
if (end_col < start_col) {
......@@ -567,9 +568,9 @@ selection_expand_horizontal (GnumericSheet *gsheet, int n, gboolean jump_to_boun
selection_remove_selection_string (gsheet);
item_cursor_set_bounds (ic,
start_col,
ic->start_row,
ic->pos.start.row,
end_col,
ic->end_row);
ic->pos.end.row);
selection_insert_selection_string (gsheet);
}
......@@ -587,23 +588,23 @@ selection_expand_vertical (GnumericSheet *gsheet, int n, gboolean jump_to_bounda
}
ic = gsheet->selection;
start_row = ic->start_row;
end_row = ic->end_row;
start_row = ic->pos.start.row;
end_row = ic->pos.end.row;
if (ic->base_row < end_row)
end_row =
sheet_find_boundary_vertical (gsheet->sheet_view->sheet,
ic->end_col, end_row,
ic->pos.end.col, end_row,
n, jump_to_boundaries);
else if (ic->base_row > start_row || n < 0)
start_row =
sheet_find_boundary_vertical (gsheet->sheet_view->sheet,
ic->start_col, start_row,
ic->pos.start.col, start_row,
n, jump_to_boundaries);
else
end_row =
sheet_find_boundary_vertical (gsheet->sheet_view->sheet,
ic->end_col, end_row,
ic->pos.end.col, end_row,
n, jump_to_boundaries);
if (end_row < start_row) {
......@@ -614,9 +615,9 @@ selection_expand_vertical (GnumericSheet *gsheet, int n, gboolean jump_to_bounda
selection_remove_selection_string (gsheet);
item_cursor_set_bounds (ic,
ic->start_col,
ic->pos.start.col,
start_row,
ic->end_col,
ic->pos.end.col,
end_row);
selection_insert_selection_string (gsheet);
}
......
......@@ -134,11 +134,11 @@ item_cursor_get_pixel_coords (ItemCursor *item_cursor, int *x, int *y, int *w, i
ItemGrid *item_grid = item_cursor->item_grid;
Sheet *sheet = item_cursor->sheet;
*x = sheet_col_get_distance (sheet, item_grid->left_col, item_cursor->start_col);
*y = sheet_row_get_distance (sheet, item_grid->top_row, item_cursor->start_row);
*x = sheet_col_get_distance (sheet, item_grid->left_col, item_cursor->pos.start.col);
*y = sheet_row_get_distance (sheet, item_grid->top_row, item_cursor->pos.start.row);
*w = sheet_col_get_distance (sheet, item_cursor->start_col, item_cursor->end_col+1);
*h = sheet_row_get_distance (sheet, item_cursor->start_row, item_cursor->end_row+1);
*w = sheet_col_get_distance (sheet, item_cursor->pos.start.col, item_cursor->pos.end.col+1);
*h = sheet_row_get_distance (sheet, item_cursor->pos.start.row, item_cursor->pos.end.row+1);
}
static void
......@@ -338,10 +338,10 @@ item_cursor_set_bounds (ItemCursor *item_cursor, int start_col, int start_row, i
item = GNOME_CANVAS_ITEM (item_cursor);
item_cursor_request_redraw (item_cursor);
item_cursor->start_col = start_col;
item_cursor->end_col = end_col;
item_cursor->start_row = start_row;
item_cursor->end_row = end_row;
item_cursor->pos.start.col = start_col;
item_cursor->pos.end.col = end_col;
item_cursor->pos.start.row = start_row;
item_cursor->pos.end.row = end_row;
item_cursor_request_redraw (item_cursor);
......@@ -384,15 +384,15 @@ item_cursor_translate (GnomeCanvasItem *item, double dx, double dy)
static void
item_cursor_setup_auto_fill (ItemCursor *item_cursor, ItemCursor *parent, int x, int y)
item_cursor_setup_auto_fill (ItemCursor *item_cursor, ItemCursor const *parent, int x, int y)
{
item_cursor->base_x = x;
item_cursor->base_y = y;
item_cursor->base_cols = parent->end_col - parent->start_col;
item_cursor->base_rows = parent->end_row - parent->start_row;
item_cursor->base_col = parent->start_col;
item_cursor->base_row = parent->start_row;
item_cursor->base_cols = parent->pos.end.col - parent->pos.start.col;
item_cursor->base_rows = parent->pos.end.row - parent->pos.start.row;
item_cursor->base_col = parent->pos.start.col;
item_cursor->base_row = parent->pos.start.row;
}
static void
......@@ -463,8 +463,8 @@ item_cursor_selection_event (GnomeCanvasItem *item, GdkEvent *event)
item_cursor_set_bounds (
ITEM_CURSOR (new_item),
item_cursor->start_col, item_cursor->start_row,
item_cursor->end_col, item_cursor->end_row);
item_cursor->pos.start.col, item_cursor->pos.start.row,
item_cursor->pos.end.col, item_cursor->pos.end.row);
gnome_canvas_update_now (canvas);
gnome_canvas_item_grab (
......@@ -491,8 +491,8 @@ item_cursor_target_region_ok (ItemCursor *item_cursor)
v = sheet_is_region_empty_or_selected (
item_cursor->sheet,
item_cursor->start_col, item_cursor->start_row,
item_cursor->end_col, item_cursor->end_row);
item_cursor->pos.start.col, item_cursor->pos.start.row,
item_cursor->pos.end.col, item_cursor->pos.end.row);
if (v)
return TRUE;
......@@ -530,8 +530,8 @@ static void
item_cursor_do_action (ItemCursor *item_cursor, ActionType action, guint32 time)
{
Sheet *sheet = item_cursor->sheet;
int col = item_cursor->start_col;
int row = item_cursor->start_row;
int col = item_cursor->pos.start.col;
int row = item_cursor->pos.start.row;
switch (action){
case ACTION_NONE:
......@@ -621,12 +621,12 @@ item_cursor_set_bounds_visibly (ItemCursor *item_cursor,
item_cursor_set_bounds (item_cursor, start_col, start_row, end_col, end_row);
/* Now, make the range visible as well as we can guess */
if (start_col < item_cursor->start_col)
if (start_col < item_cursor->pos.start.col)
watch_col = start_col;
else
watch_col = end_col;
if (start_row < item_cursor->start_row)
if (start_row < item_cursor->pos.start.row)
watch_row = start_row;
else
watch_row = end_row;
......@@ -678,8 +678,8 @@ item_cursor_drag_event (GnomeCanvasItem *item, GdkEvent *event)
col = item_grid_find_col (item_cursor->item_grid, x, NULL);
row = item_grid_find_row (item_cursor->item_grid, y, NULL);
w = (item_cursor->end_col - item_cursor->start_col);
h = (item_cursor->end_row - item_cursor->start_row);
w = (item_cursor->pos.end.col - item_cursor->pos.start.col);
h = (item_cursor->pos.end.row - item_cursor->pos.start.row);
if (col + w > SHEET_MAX_COLS-1)
return TRUE;
......@@ -708,28 +708,28 @@ item_cursor_autofill_event (GnomeCanvasItem *item, GdkEvent *event)
gnome_canvas_item_ungrab (item, event->button.time);
#if DEBUG_AUTOFILL
g_warning ("Temporary flush after ungrap here\n");
g_warning ("Temporary flush after ungrab here\n");
gnome_canvas_update_now (canvas);
gdk_flush ();
#endif
if (!((item_cursor->end_col == item_cursor->base_col + item_cursor->base_cols) &&
(item_cursor->end_row == item_cursor->base_row + item_cursor->base_rows))){
if (!((item_cursor->pos.end.col == item_cursor->base_col + item_cursor->base_cols) &&
(item_cursor->pos.end.row == item_cursor->base_row + item_cursor->base_rows))){
sheet_accept_pending_input (sheet);
sheet_autofill (sheet,
item_cursor->base_col, item_cursor->base_row,
item_cursor->base_cols+1, item_cursor->base_rows+1,
item_cursor->end_col, item_cursor->end_row);
item_cursor->pos.end.col, item_cursor->pos.end.row);
}
sheet_cursor_set (sheet,
item_cursor->base_col, item_cursor->base_row,
item_cursor->base_col, item_cursor->base_row,
item_cursor->end_col, item_cursor->end_row);
item_cursor->pos.end.col, item_cursor->pos.end.row);
sheet_selection_reset_only (sheet);
sheet_selection_append (sheet, item_cursor->base_col, item_cursor->base_row);
sheet_selection_extend_to (sheet, item_cursor->end_col, item_cursor->end_row);
sheet_selection_extend_to (sheet, item_cursor->pos.end.col, item_cursor->pos.end.row);
gtk_object_destroy (GTK_OBJECT (item));
......@@ -806,10 +806,10 @@ item_cursor_init (ItemCursor *item_cursor)
item->x2 = 1;
item->y2 = 1;
item_cursor->start_col = 0;
item_cursor->end_col = 0;
item_cursor->start_row = 0;
item_cursor->end_row = 0;
item_cursor->pos.start.col = 0;
item_cursor->pos.end.col = 0;
item_cursor->pos.start.row = 0;
item_cursor->pos.end.row = 0;
item_cursor->style = ITEM_CURSOR_SELECTION;
item_cursor->tag = -1;
item_cursor->visible = 1;
......
......@@ -21,8 +21,7 @@ typedef struct {
Sheet *sheet;
ItemGrid *item_grid; /* A copy of our "parent" grid */
int start_col, end_col;
int start_row, end_row;
Range pos;
ItemCursorStyle style;
GdkGC *gc;
......
#ifndef GNUMERIC_PIXMAPS_H
#define GNUMERIC_PIXMAPS_H
#define GNUMERIC_TEST_ACTIVE_OBJECT
#include "pixmaps/rect.xpm"
#include "pixmaps/line.xpm"
#include "pixmaps/arrow.xpm"
#include "pixmaps/oval.xpm"
#ifdef GNUMERIC_TEST_ACTIVE_OBJECT
#include "pixmaps/button.xpm"
#include "pixmaps/checkbox.xpm"
#endif
#ifdef ENABLE_BONOBO
#include "pixmaps/graphic.xpm"
#endif
......
/* XPM */
static char * checkbox_xpm[] = {
"24 24 2 1",
" c None",
". c #000000",
" ",
" ",
" ",
" ",
" ................ ",
" . . ",
" . .. . ",
" . .. . ",
" . .. . ",
" . .. . ",
" . .. . ",
" . .. . ",
" . .. . ",
" . .. . ",
" . .. .. . ",
" . .. .. . ",
" . .... . ",
" . .. . ",
" . . ",
" ................ ",
" ",
" ",
" ",
" "};
......@@ -475,9 +475,8 @@ print_sheet (gpointer key, gpointer value, gpointer user_data)
static void
sheet_print_selection (Sheet *sheet, PrintJobInfo *pj)
{
int tlx, tly, brx, bry;
if (!sheet_selection_first_range (sheet, &tlx, &tly, &brx, &bry)) {
Range const * sel;
if ((sel = selection_first_range (sheet)) == NULL) {
gnumeric_notice (
sheet->workbook, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a single range"));
......@@ -485,8 +484,9 @@ sheet_print_selection (Sheet *sheet, PrintJobInfo *pj)
}
print_job_info_init_sheet (sheet, pj);
print_sheet_range (sheet, tlx, tly,
brx + 1, bry + 1, pj);
print_sheet_range (sheet,
sel->start.col, sel->start.row,
sel->end.col + 1, sel->end.row + 1, pj);
}
static void
......
......@@ -241,12 +241,15 @@ range_dump (Range const * src)
{
/* keep these as 2 print statements, because
* col_name uses a static buffer */
fprintf (stderr, "%s%d",
printf ("%s%d",
col_name(src->start.col),
src->start.row + 1);
fprintf (stderr, ":%s%d\n",
col_name(src->end.col),
src->end.row + 1);
if (src->start.col != src->end.col ||
src->start.row == src->end.row)
fprintf (":%s%d\n",
col_name(src->end.col),
src->end.row + 1);
}
Range*
......@@ -256,3 +259,23 @@ range_duplicate (Range const * src)
*res = *src;
return res;
}
gboolean
range_equal (Range const *a, Range const *b)
{
if (a->start.col != b->start.col)
return FALSE;
if (a->start.row != b->start.row)
return FALSE;
if (a->end.col != b->end.col)
return FALSE;
if (a->end.row != b->end.row)
return FALSE;
return TRUE;
}
gboolean
range_is_singleton (Range const *r)
{
return r->start.col == r->end.col && r->start.row == r->end.row;
}
......@@ -20,8 +20,10 @@ void range_list_foreach (GSList *ranges,
void *data);
void range_set_style (GSList *ranges, Style *style);
gboolean range_contains (Range const *range, int col, int row);
void range_dump (Range const * src);
Range* range_duplicate (Range const * src);
gboolean range_is_singleton (Range const *r);
gboolean range_equal (Range const *a, Range const *b);
gboolean range_contains (Range const *range, int col, int row);
void range_dump (Range const *src);
Range* range_duplicate (Range const *src);
#endif /* GNUMERIC_RANGES_H */
......@@ -35,35 +35,18 @@ segments_intersect (int const s_a, int const e_a,
return