Commit e36eb87f authored by Michael Meeks's avatar Michael Meeks Committed by Arturo Espinosa

Removed fatal bug, and accelerated code by testing for DV in MULBLANK

1998-11-11  Michael Meeks    <michael@imaginator.com>

	* plugins/excel/ms-biff.h, plugins/excel/ms-excel.c: Removed fatal
	bug, and accelerated code by testing for DV in MULBLANK case.

	* plugins/excel/ms-excel.c(ms_excel_set_cell_xf): Out by one indexes
	causing serious attribute offset grief in fonts.

	* Rememberance_Day:
	They went with songs to the battle, they were young,
	Straight of limb, true of eye, steady and aglow.
	They were staunch to the end against odds uncounted,
	They fell with their faces to the foe.

	They shall grow not old, as we that are left grow old,
parent bab4901f
......@@ -9,3 +9,6 @@ Plugin system:
Number formatting code:
Chris Lahey
Excel file loading code:
Michael Meeks (michael@imaginator.com)
......@@ -185,12 +185,28 @@ cell_comment_destroy (Cell *cell)
/* Free resources */
string_unref (comment->comment);
if (comment->timer_tag != -1)
gtk_timeout_remove (comment->timer_tag);
if (comment->window)
gtk_object_destroy (GTK_OBJECT (comment->window));
for (l = comment->realized_list; l; l = l->next)
gtk_object_destroy (l->data);
g_free (comment);
}
static void
cell_comment_cancel_timer (Cell *cell)
{
if (cell->comment->timer_tag != -1){
gtk_timeout_remove (cell->comment->timer_tag);
cell->comment->timer_tag = -1;
}
}
static void
cell_display_comment (Cell *cell)
{
......@@ -199,6 +215,8 @@ cell_display_comment (Cell *cell)
g_return_if_fail (cell != NULL);
cell_comment_cancel_timer (cell);
window = gtk_window_new (GTK_WINDOW_POPUP);
label = gtk_label_new (cell->comment->comment->str);
gtk_container_add (GTK_CONTAINER (window), label);
......@@ -247,10 +265,7 @@ cell_comment_clicked (GnomeCanvasItem *item, GdkEvent *event, Cell *cell)
break;
case GDK_LEAVE_NOTIFY:
if (cell->comment->timer_tag != -1){
gtk_timeout_remove (cell->comment->timer_tag);
cell->comment->timer_tag = -1;
}
cell_comment_cancel_timer (cell);
if (cell->comment->window){
gtk_object_destroy (GTK_OBJECT (cell->comment->window));
cell->comment->window = NULL;
......@@ -1454,6 +1469,8 @@ cell_draw (Cell *cell, void *sv, GdkGC *gc, GdkDrawable *drawable, int x1, int y
char *
cell_get_text (Cell *cell)
{
char *str;
g_return_val_if_fail (cell != NULL, NULL);
if (cell->parsed_node){
......@@ -1466,6 +1483,7 @@ cell_get_text (Cell *cell)
return ret;
}
return value_string (cell->value);
str = format_value (cell->style->format, cell->value, NULL);
return str;
}
......@@ -101,6 +101,8 @@ void cell_set_text (Cell *cell, char *text);
void cell_set_text_simple (Cell *cell, char *text);
void cell_content_changed (Cell *cell);
void cell_set_formula (Cell *cell, char *text);
void cell_set_formula_tree (Cell *cell, ExprTree *formula);
void cell_set_formula_tree_simple (Cell *cell, ExprTree *formula);
void cell_set_format (Cell *cell, char *format);
void cell_set_format_simple (Cell *cell, char *format);
void cell_set_font (Cell *cell, char *font_name);
......@@ -109,13 +111,17 @@ void cell_set_comment (Cell *cell, char *str);
void cell_comment_destroy (Cell *cell);
void cell_comment_reposition (Cell *cell);
void cell_set_font_from_style (Cell *cell, StyleFont *style_font);
void cell_set_foreground (Cell *cell, gushort red, gushort green, gushort blue);
void cell_set_background (Cell *cell, gushort red, gushort green, gushort blue);
void cell_set_foreground (Cell *cell, gushort red,
gushort green, gushort blue);
void cell_set_background (Cell *cell, gushort red,
gushort green, gushort blue);
void cell_set_pattern (Cell *cell, int pattern);
void cell_set_alignment (Cell *cell, int halign, int valign, int orientation, int auto_return);
void cell_set_alignment (Cell *cell, int halign, int valign,
int orientation, int auto_return);
void cell_set_halign (Cell *cell, StyleHAlignFlags halign);
void cell_set_rendered_text (Cell *cell, char *rendered_text);
void cell_relocate (Cell *cell, int target_col, int target_row);
void cell_relocate (Cell *cell,
int target_col, int target_row);
void cell_get_span (Cell *cell, int *col1, int *col2);
char *cell_get_text (Cell *cell);
void cell_make_value (Cell *cell);
......
......@@ -410,8 +410,8 @@ sheet_row_info_set_height (Sheet *sheet, ColRowInfo *ri, int height, gboolean he
sheet_redraw_all (sheet);
}
/*
* sheet_row_set_height
/**
* sheet_row_set_height:
* @sheet: The sheet
* @row: The row
* @height: The desired height
......@@ -443,8 +443,8 @@ sheet_row_set_height (Sheet *sheet, int row, int height, gboolean height_set_by_
sheet_row_add (sheet, ri);
}
/*
* sheet_row_set_internal_height
/**
* sheet_row_set_internal_height:
* @sheet: The sheet
* @row: The row
* @height: The desired height
......@@ -474,8 +474,8 @@ sheet_row_set_internal_height (Sheet *sheet, ColRowInfo *ri, int height)
sheet_redraw_all (sheet);
}
/*
* sheet_recompute_spans_for_col
/**
* sheet_recompute_spans_for_col:
* @sheet: the sheet
* @col: The column that changed
*
......@@ -1689,7 +1689,7 @@ gen_col_blanks (Sheet *sheet, int start_col, int end_col,
return TRUE;
}
/*
/**
* sheet_cell_get
* @sheet: The sheet where we want to locate the cell
* @col: the cell column
......@@ -2164,7 +2164,14 @@ clear_cell_content (Sheet *sheet, int col, int row, Cell *cell, void *user_data)
return TRUE;
}
/*
/**
* sheet_clear_region_content:
* @sheet: The sheet on which we operate
* @start_col: starting column
* @start_row: starting row
* @end_col: end column
* @end_row: end row
*
* Clears the contents in a region of cells
*/
void
......@@ -2185,6 +2192,12 @@ sheet_clear_region_content (Sheet *sheet, int start_col, int start_row, int end_
clear_cell_content, NULL);
}
/**
* sheet_selection_clear_content:
* @sheet: The sheet where we operate
*
* Removes the contents of all the cells in the current selection.
**/
void
sheet_selection_clear_content (Sheet *sheet)
{
......@@ -2202,6 +2215,64 @@ sheet_selection_clear_content (Sheet *sheet)
}
}
static int
clear_cell_comments (Sheet *sheet, int col, int row, Cell *cell, void *user_data)
{
cell_comment_destroy (cell);
return TRUE;
}
/**
* sheet_clear_region_comments:
* @sheet: The sheet on which we operate
* @start_col: starting column
* @start_row: starting row
* @end_col: end column
* @end_row: end row
*
* Removes all of the comments in the cells in the specified range.
**/
void
sheet_clear_region_comments (Sheet *sheet, int start_col, int start_row, int end_col, int end_row)
{
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
g_return_if_fail (start_col <= end_col);
g_return_if_fail (start_row <= end_row);
/* Queue a redraw for the region being redrawn */
sheet_redraw_cell_region (sheet, start_col, start_row, end_col, end_row);
sheet_cell_foreach_range (
sheet, TRUE,
start_col, start_row,
end_col, end_row,
clear_cell_comments, NULL);
}
/**
* sheet_selection_clear_comments:
* @sheet: The sheet where we operate
*
* Removes all of the comments on the range of selected cells.
**/
void
sheet_selection_clear_comments (Sheet *sheet)
{
GList *l;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
for (l = sheet->selections; l; l = l->next){
SheetSelection *ss = l->data;
sheet_clear_region_comments (sheet,
ss->start_col, ss->start_row,
ss->end_col, ss->end_row);
}
}
static int
clear_cell_format (Sheet *sheet, int col, int row, Cell *cell, void *user_data)
{
......
......@@ -179,9 +179,10 @@ void sheet_selection_append_range (Sheet *sheet,
CellList *sheet_selection_to_list (Sheet *sheet);
/* Operations on the selection */
void sheet_selection_clear (Sheet *sheet);
void sheet_selection_clear_content (Sheet *sheet);
void sheet_selection_clear_comments (Sheet *sheet);
void sheet_selection_clear_formats (Sheet *sheet);
void sheet_selection_clear (Sheet *sheet);
/* Cut/Copy/Paste on the workbook selection */
gboolean sheet_selection_copy (Sheet *sheet);
......@@ -253,6 +254,9 @@ void sheet_clear_region_formats (Sheet *sheet,
void sheet_clear_region_content (Sheet *sheet,
int start_col, int start_row,
int end_col, int end_row);
void sheet_clear_region_comments (Sheet *sheet,
int start_col, int start_row,
int end_col, int end_row);
/* Sets the width/height of a column row in terms of pixels */
void sheet_col_set_width (Sheet *sheet,
......
......@@ -500,6 +500,15 @@ clear_formats_cmd (GtkWidget *widget, Workbook *wb)
sheet_selection_clear_formats (sheet);
}
static void
clear_comments_cmd (GtkWidget *widget, Workbook *wb)
{
Sheet *sheet;
sheet = workbook_get_current_sheet (wb);
sheet_selection_clear_comments (sheet);
}
static void
clear_content_cmd (GtkWidget *widget, Workbook *wb)
{
......@@ -628,6 +637,7 @@ static GnomeUIInfo workbook_menu_file [] = {
static GnomeUIInfo workbook_menu_edit_clear [] = {
{ GNOME_APP_UI_ITEM, N_("_All"), NULL, clear_all_cmd },
{ GNOME_APP_UI_ITEM, N_("_Formats"), NULL, clear_formats_cmd },
{ GNOME_APP_UI_ITEM, N_("_Comments"), NULL, clear_comments_cmd },
{ GNOME_APP_UI_ITEM, N_("_Content"), NULL, clear_content_cmd },
GNOMEUIINFO_END
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment