Commit bbf396c6 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

Add CENTER_ACROSS_SELECTION. (cell_set_text_simple) : Begin transition to


2000-03-23  Jody Goldberg <jgoldberg@home.com>

	* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
	(cell_set_text_simple) : Begin transition to checking
	  format of current cell for match.  No real change yet.

	* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
	* src/cell-draw.c (cell_draw) : Ditto.
	* src/print-cell.c (print_cell) : Ditto.
	* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
	(Sheet_cell_get_alignment) : Ditto.
	* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
	* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.

	* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.

	* src/number-match.c (format_create_regexp) : Extend to support
	  currency names.

	* src/item-grid.c (item_grid_draw_border) : minor optimization for
	  non-border case.
parent ac663415
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
(cell_set_text_simple) : Begin transition to checking
format of current cell for match. No real change yet.
* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
* src/cell-draw.c (cell_draw) : Ditto.
* src/print-cell.c (print_cell) : Ditto.
* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
(Sheet_cell_get_alignment) : Ditto.
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.
* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.
* src/number-match.c (format_create_regexp) : Extend to support
currency names.
* src/item-grid.c (item_grid_draw_border) : minor optimization for
non-border case.
2000-03-23 Miguel de Icaza <miguel@helixcode.com>
* src/gnumeric-sheet.c (start_cell_selection_at): Disable feedback
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
(cell_set_text_simple) : Begin transition to checking
format of current cell for match. No real change yet.
* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
* src/cell-draw.c (cell_draw) : Ditto.
* src/print-cell.c (print_cell) : Ditto.
* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
(Sheet_cell_get_alignment) : Ditto.
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.
* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.
* src/number-match.c (format_create_regexp) : Extend to support
currency names.
* src/item-grid.c (item_grid_draw_border) : minor optimization for
non-border case.
2000-03-23 Miguel de Icaza <miguel@helixcode.com>
* src/gnumeric-sheet.c (start_cell_selection_at): Disable feedback
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
(cell_set_text_simple) : Begin transition to checking
format of current cell for match. No real change yet.
* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
* src/cell-draw.c (cell_draw) : Ditto.
* src/print-cell.c (print_cell) : Ditto.
* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
(Sheet_cell_get_alignment) : Ditto.
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.
* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.
* src/number-match.c (format_create_regexp) : Extend to support
currency names.
* src/item-grid.c (item_grid_draw_border) : minor optimization for
non-border case.
2000-03-23 Miguel de Icaza <miguel@helixcode.com>
* src/gnumeric-sheet.c (start_cell_selection_at): Disable feedback
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
(cell_set_text_simple) : Begin transition to checking
format of current cell for match. No real change yet.
* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
* src/cell-draw.c (cell_draw) : Ditto.
* src/print-cell.c (print_cell) : Ditto.
* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
(Sheet_cell_get_alignment) : Ditto.
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.
* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.
* src/number-match.c (format_create_regexp) : Extend to support
currency names.
* src/item-grid.c (item_grid_draw_border) : minor optimization for
non-border case.
2000-03-23 Miguel de Icaza <miguel@helixcode.com>
* src/gnumeric-sheet.c (start_cell_selection_at): Disable feedback
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
(cell_set_text_simple) : Begin transition to checking
format of current cell for match. No real change yet.
* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
* src/cell-draw.c (cell_draw) : Ditto.
* src/print-cell.c (print_cell) : Ditto.
* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
(Sheet_cell_get_alignment) : Ditto.
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.
* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.
* src/number-match.c (format_create_regexp) : Extend to support
currency names.
* src/item-grid.c (item_grid_draw_border) : minor optimization for
non-border case.
2000-03-23 Miguel de Icaza <miguel@helixcode.com>
* src/gnumeric-sheet.c (start_cell_selection_at): Disable feedback
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
(cell_set_text_simple) : Begin transition to checking
format of current cell for match. No real change yet.
* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
* src/cell-draw.c (cell_draw) : Ditto.
* src/print-cell.c (print_cell) : Ditto.
* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
(Sheet_cell_get_alignment) : Ditto.
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.
* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.
* src/number-match.c (format_create_regexp) : Extend to support
currency names.
* src/item-grid.c (item_grid_draw_border) : minor optimization for
non-border case.
2000-03-23 Miguel de Icaza <miguel@helixcode.com>
* src/gnumeric-sheet.c (start_cell_selection_at): Disable feedback
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_calculate_span) : Add CENTER_ACROSS_SELECTION.
(cell_set_text_simple) : Begin transition to checking
format of current cell for match. No real change yet.
* idl/Gnumeric.idl : Add CENTER_ACROSS_SELECTION.
* src/cell-draw.c (cell_draw) : Ditto.
* src/print-cell.c (print_cell) : Ditto.
* src/corba-sheet.c (Sheet_cell_set_alignment) : Ditto.
(Sheet_cell_get_alignment) : Ditto.
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_align_page) : Ditto.
* src/dialogs/cell-format.glade : Ditto, reorganize alignment page.
* src/format.c : Move definition of _StyleFormatEntry from mstyle.h.
* src/number-match.c (format_create_regexp) : Extend to support
currency names.
* src/item-grid.c (item_grid_draw_border) : minor optimization for
non-border case.
2000-03-23 Miguel de Icaza <miguel@helixcode.com>
* src/gnumeric-sheet.c (start_cell_selection_at): Disable feedback
......
......@@ -145,6 +145,7 @@ module GNOME {
const short HALIGN_CENTER = 8;
const short HALIGN_FILL = 16;
const short HALIGN_JUSTIFY = 32;
const short HALIGN_CENTER_ACROSS_SELECTION = 64;
const short VALIGN_TOP = 1;
const short VALIGN_BOTTOM = 2;
......
......@@ -145,6 +145,7 @@ module GNOME {
const short HALIGN_CENTER = 8;
const short HALIGN_FILL = 16;
const short HALIGN_JUSTIFY = 32;
const short HALIGN_CENTER_ACROSS_SELECTION = 64;
const short VALIGN_TOP = 1;
const short VALIGN_BOTTOM = 2;
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (biff_xf_data_new) : Support horizontal alignment
center_across_selection.
* ms-excel-write.c (halign_to_excel) : Ditto.
* ms-obj.c (object_anchor_to_position) : remove some debug code.
2000-03-23 Jon K Hellan <hellan@acm.org>
......
......@@ -1468,22 +1468,13 @@ biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
xf->halign = HALIGN_JUSTIFY;
break;
case 6:
/* FIXME :
* ACK! this seems to create a somewhat dynamic span.
/*
* All adjacent blank cells with this type of alignment
* are merged into a single span. cursor still behaves
* normally and the span is adjusted if contents are changed.
* Use center for now.
* xf->halign = HALIGN_CENTRE_ACROSS_SELECTION;
*/
xf->halign = HALIGN_CENTER;
{
static gboolean need_warning = TRUE;
if (need_warning) {
g_warning ("EXCEL : 'Center across selection' is unsupported. Using Center");
need_warning = FALSE;
}
}
xf->halign = HALIGN_CENTER_ACROSS_SELECTION;
break;
default:
......
......@@ -1572,6 +1572,9 @@ halign_to_excel (StyleHAlignFlags halign)
case HALIGN_JUSTIFY:
ialign = eBiffHAJustify;
break;
case HALIGN_CENTER_ACROSS_SELECTION:
ialign = eBuffHACenterAcrossSelection;
break;
default:
ialign = eBiffHAGeneral;
}
......
2000-03-23 Jody Goldberg <jgoldberg@home.com>
* epsf.c (epsf_write_cell) : Add HALIGN_CENTER_ACROSS_SELECTION.
* html.c (html_write_cell{32,40}) : Ditto.
* latex.c (html_write_wb_latex) : Ditto.
* roff.c (write_wb_roff) : Ditto.
2000-03-23 Jon K Hellan <hellan@acm.org>
* boot.c (html_init): Tag html savers as AUTO, the others as
......
......@@ -107,7 +107,9 @@ epsf_write_cell (FILE *fp, Cell *cell, float x, float y)
if (mstyle_get_align_h (mstyle) & HALIGN_RIGHT)
ps_text_right (fp, cell->text->str,
x + cell_width - 2, y+2 + (font_size/3));
else if (mstyle_get_align_h (mstyle) & HALIGN_CENTER)
else if (mstyle_get_align_h (mstyle) == HALIGN_CENTER ||
/* FIXME : center across selection is wrong */
mstyle_get_align_h (mstyle) == HALIGN_CENTER_ACROSS_SELECTION)
ps_text_center (fp, cell->text->str,
x + 2, x + cell_width - 2, y + 2 + (font_size / 3));
else
......
......@@ -114,6 +114,7 @@ html_write_cell32 (FILE *fp, Cell *cell, MStyle *style)
break;
case HALIGN_CENTER :
case HALIGN_CENTER_ACROSS_SELECTION :
fprintf (fp, " align=center");
break;
default :
......@@ -159,6 +160,7 @@ html_write_cell40 (FILE *fp, Cell *cell, MStyle *style)
break;
case HALIGN_CENTER :
case HALIGN_CENTER_ACROSS_SELECTION :
fprintf (fp, " halign=center");
break;
default :
......
......@@ -114,6 +114,7 @@ html_write_cell32 (FILE *fp, Cell *cell, MStyle *style)
break;
case HALIGN_CENTER :
case HALIGN_CENTER_ACROSS_SELECTION :
fprintf (fp, " align=center");
break;
default :
......@@ -159,6 +160,7 @@ html_write_cell40 (FILE *fp, Cell *cell, MStyle *style)
break;
case HALIGN_CENTER :
case HALIGN_CENTER_ACROSS_SELECTION :
fprintf (fp, " halign=center");
break;
default :
......
......@@ -120,9 +120,11 @@ html_write_wb_latex (CommandContext *context, Workbook *wb,
fprintf (fp, "\t&");
else
fprintf (fp, "\t ");
if (mstyle_get_align_h (mstyle) & HALIGN_RIGHT)
if (mstyle_get_align_h (mstyle) == HALIGN_RIGHT)
fprintf (fp, "\\hfill ");
if (mstyle_get_align_h (mstyle) & HALIGN_CENTER)
else if (mstyle_get_align_h (mstyle) == HALIGN_CENTER ||
/* FIXME : center across selection is wrong */
mstyle_get_align_h (mstyle) == HALIGN_CENTER_ACROSS_SELECTION)
fprintf (fp, "{\\centering "); /* doesn't work */
if (mstyle_get_align_v (mstyle) & VALIGN_TOP)
;
......
......@@ -103,7 +103,9 @@ write_wb_roff (CommandContext *context, Workbook *wb, FILE *fp)
break;
if (mstyle_get_align_h (mstyle) & HALIGN_RIGHT)
fprintf (fp, "r");
else if (mstyle_get_align_h (mstyle) & HALIGN_CENTER)
else if (mstyle_get_align_h (mstyle) == HALIGN_CENTER ||
/* FIXME : center across selection is different */
mstyle_get_align_h (mstyle) == HALIGN_CENTER_ACROSS_SELECTION)
fprintf (fp, "c");
else
fprintf (fp, "l");
......
......@@ -306,6 +306,10 @@ cell_draw (Cell *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo,
x1 += 1 + cell->col->margin_a + (width - cell->width_pixel) / 2;
break;
case HALIGN_CENTER_ACROSS_SELECTION:
x1 = rect.x + (rect.width - cell->width_pixel) / 2;
break;
default:
g_warning ("Single-line justification style not supported\n");
x1 += 1 + cell->col->margin_a;
......@@ -379,6 +383,7 @@ cell_draw (Cell *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo,
break;
case HALIGN_CENTER:
case HALIGN_CENTER_ACROSS_SELECTION:
len = gdk_string_width (font, str);
x_offset = (cell->col->size_pixels - len) / 2;
}
......
......@@ -494,31 +494,38 @@ cell_set_text_simple (Cell *cell, const char *text)
cell_set_formula (cell, text);
else {
char *end;
long l;
int set=0;
l = strtol (text, &end, 10);
long l = strtol (text, &end, 10);
if (l != LONG_MAX && l != LONG_MIN &&
text != end && (l == (int)l)) {
/* Allow and ignore spaces at the end of integers. */
/* Allow and ignore spaces at the end of integers. */
/* JEG : 2000/3/23 Why for ints and not doubles ? */
while (*end == ' ')
end++;
if (*end == 0) {
if (*end == FALSE)
cell->value = value_new_int (l);
set = 1;
}
}
if (!set) {
if (cell->value == NULL) {
double d;
d = strtod (text, &end);
if (text != end && *end == 0) {
/* It is a floating point number. */
/* It is a floating point number. */
if (text != end && *end == 0)
cell->value = value_new_float ((float_t)d);
} else {
/* It is text. Ignore leading single quotes */
cell->value = value_new_string (text[0] == '\'' ? text+1 : text);
}
if (cell->value == NULL) {
/* Check to see if it matches via current format */
#if 0
if (format_match (text, float_t *v, char **format))
{
}
#endif
}
if (cell->value == NULL) {
/* It is text. Ignore leading single quotes */
cell->value = value_new_string (text[0] == '\'' ? text+1 : text);
}
cell_render_value (cell);
......@@ -1053,8 +1060,7 @@ cell_calculate_span (Cell const * const cell,
* column is used.
*/
if (cell_is_number (cell) ||
cell_contents_fit_inside_column (cell)) {
if (cell_is_number (cell)) {
*col1 = *col2 = cell->col->pos;
return;
}
......@@ -1066,7 +1072,9 @@ cell_calculate_span (Cell const * const cell,
mstyle_get_align_h (mstyle));
row = cell->row->pos;
if (align == HALIGN_JUSTIFY ||
if ((cell_contents_fit_inside_column (cell) &&
align != HALIGN_CENTER_ACROSS_SELECTION) ||
align == HALIGN_JUSTIFY ||
align == HALIGN_FILL ||
mstyle_get_fit_in_cell (mstyle) ||
mstyle_get_align_v (mstyle) == VALIGN_JUSTIFY) {
......@@ -1183,12 +1191,53 @@ cell_calculate_span (Cell const * const cell,
} /* for */
break;
} /* case HALIGN_CENTER */
case HALIGN_CENTER_ACROSS_SELECTION:
{
int tmp;
int const row = cell->row->pos;
int left = cell->col->pos, right = left;
left_loop :
tmp = left - 1;
if (tmp >= 0 &&
cell_is_blank (sheet_cell_get (sheet, tmp, row))) {
MStyle * const mstyle =
sheet_style_compute (cell->sheet, tmp, row);
gboolean const res =
(mstyle_get_align_h (mstyle) == HALIGN_CENTER_ACROSS_SELECTION);
mstyle_unref (mstyle);
if (res) {
left = tmp;
goto left_loop;
}
}
right_loop :
tmp = right + 1;
if (tmp < SHEET_MAX_COLS &&
cell_is_blank (sheet_cell_get (sheet, tmp, row))) {
MStyle * const mstyle =
sheet_style_compute (cell->sheet, tmp, row);
gboolean const res =
(mstyle_get_align_h (mstyle) == HALIGN_CENTER_ACROSS_SELECTION);
mstyle_unref (mstyle);
if (res) {
right = tmp;
goto right_loop;
}
}
*col1 = left;
*col2 = right;
break;
}
default:
g_warning ("Unknown horizontal alignment type %d\n", align);
*col1 = *col2 = cell->col->pos;
} /* case HALIGN_CENTER */
} /* switch */
}
......
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