Commit 3916b17f authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Change image viewers. The eog/bonobo viewer is no longer built or

2000-12-02  Jody Goldberg <jgoldberg@home.com>

	* ms-escher.c (ms_escher_read_Blip) : Change image viewers.  The
	  eog/bonobo viewer is no longer built or installed.

	* ms-excel-read.c (ms_excel_read_sheet) : XL docs do not mention that
	  the PROTECT record can sometimes be of size 0.
	(ms_excel_read_workbook) : Ditto.
	(ms_excel_read_PROTECT) : new function.
	(ms_excel_read_mergecells) : Correct.
	(biff_xf_data_new) : remove the warnings about merged cells.

2000-12-02  Jody Goldberg <jgoldberg@home.com>

	* src/expr.c (cellrange_relocate) : fix the logic that was broken when
	  supporting the partial ranges.
	(cellref_relocate) : move some of the code here, to decrease
	  replication.
parent cfb877e8
......@@ -12,6 +12,8 @@ Release Critical
- new wb_controls do not display
: selection string
- calculated cells do not respan.
Long term breakage
------------------
......
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (cellrange_relocate) : fix the logic that was broken when
supporting the partial ranges.
(cellref_relocate) : move some of the code here, to decrease
replication.
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c : Add some debug macros to catch the magic helix
......
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (cellrange_relocate) : fix the logic that was broken when
supporting the partial ranges.
(cellref_relocate) : move some of the code here, to decrease
replication.
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c : Add some debug macros to catch the magic helix
......
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (cellrange_relocate) : fix the logic that was broken when
supporting the partial ranges.
(cellref_relocate) : move some of the code here, to decrease
replication.
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c : Add some debug macros to catch the magic helix
......
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (cellrange_relocate) : fix the logic that was broken when
supporting the partial ranges.
(cellref_relocate) : move some of the code here, to decrease
replication.
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c : Add some debug macros to catch the magic helix
......
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (cellrange_relocate) : fix the logic that was broken when
supporting the partial ranges.
(cellref_relocate) : move some of the code here, to decrease
replication.
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* src/item-bar.c : Add some debug macros to catch the magic helix
......
2000-12-01 Jody Goldberg <jgoldberg@home.com>
* Makefile.am (SGML_FILES) : Add missing copying-moving.sgml
2000-11-18 Jody Goldberg <jgoldberg@home.com>
* Release 0.59
......
......@@ -16,6 +16,7 @@ SGML_FILES = \
autofill.sgml \
autosave.sgml \
cell_refer.sgml \
copying-moving.sgml \
dndselection.sgml \
editing.sgml \
files.sgml \
......
2000-12-01 Jody Goldberg <jgoldberg@home.com>
* Makefile.am (SGML_FILES) : Add missing copying-moving.sgml
2000-11-18 Jody Goldberg <jgoldberg@home.com>
* Release 0.59
......
2000-12-02 Jody Goldberg <jgoldberg@home.com>
* ms-escher.c (ms_escher_read_Blip) : Change image viewers. The
eog/bonobo viewer is no longer built or installed.
* ms-excel-read.c (ms_excel_read_sheet) : XL docs do not mention that
the PROTECT record can sometimes be of size 0.
(ms_excel_read_workbook) : Ditto.
(ms_excel_read_PROTECT) : new function.
(ms_excel_read_mergecells) : Correct.
(biff_xf_data_new) : remove the warnings about merged cells.
2000-12-01 Jody Goldberg <jgoldberg@home.com>
* ms-obj.c (ms_read_OBJ) : simplify.
......
......@@ -397,7 +397,7 @@ ms_escher_read_Blip (MSEscherState * state, MSEscherHeader * h)
ms_escher_get_data (state, h->offset, h->len,
header, &needs_free);
repoid = "OAFIID:eog_image-generic:0d77ee99-ce0d-4463-94ec-99969f567f33";
repoid = "OAFIID:eog_embeddedable_image:759a2e09-31e1-4741-9ce7-8354d49a16bb";
ms_escher_blip_new (data, h->len - header, repoid, state->container);
#ifndef NO_DEBUG_EXCEL
......
......@@ -1725,18 +1725,16 @@ biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, MsBiffVersion ver)
/* FIXME : This code seems irrelevant for merging.
* The undocumented record MERGECELLS appears to be the correct source.
* Nothing seems to set the merge flags.
* I've not seen examples of indent or shrink.
*/
static gboolean indent_warn = TRUE;
static gboolean shrink_warn = TRUE;
static gboolean merge_warn = TRUE;
/* FIXME : What are the lower 8 bits Always 0 ?? */
/* We need this to be able to support travel.xls */
const guint16 data = MS_OLE_GET_GUINT16 (q->data + 8);
int const indent = data & 0x0f;
gboolean const shrink = (data & 0x10) ? TRUE : FALSE;
gboolean const merge = (data & 0x20) ? TRUE : FALSE;
/* gboolean const merge = (data & 0x20) ? TRUE : FALSE; */
if (indent != 0 && indent_warn) {
indent_warn = FALSE;
......@@ -1747,10 +1745,6 @@ biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, MsBiffVersion ver)
shrink_warn = FALSE;
g_warning ("EXCEL : Shrink to fit is not supported yet.");
}
if (merge && merge_warn) {
merge_warn = FALSE;
g_warning ("EXCEL : Merge cells is not supported yet.");
}
subdata = (data & 0x00C0) >> 10;
switch (subdata) {
......@@ -3454,8 +3448,6 @@ ms_excel_read_guts (BiffQuery *q, ExcelSheet *sheet)
static void
ms_excel_read_mergecells (BiffQuery *q, ExcelSheet *sheet)
{
static gboolean need_warning = TRUE;
const guint16 num_merged = MS_OLE_GET_GUINT16(q->data);
const guint8 *ptr = q->data + 2;
int i;
......@@ -3465,20 +3457,23 @@ ms_excel_read_mergecells (BiffQuery *q, ExcelSheet *sheet)
*/
g_return_if_fail (q->length == 2+8*num_merged);
if (need_warning) {
need_warning = FALSE;
g_warning ("EXCEL : Merged Cells are not supported yet.");
}
for (i = 0 ; i < num_merged ; ++i, ptr += 8) {
Range r;
r.start.row = MS_OLE_GET_GUINT16(ptr);
r.start.col = MS_OLE_GET_GUINT16(ptr+2);
r.end.row = MS_OLE_GET_GUINT16(ptr+4);
r.end.row = MS_OLE_GET_GUINT16(ptr+2);
r.start.col = MS_OLE_GET_GUINT16(ptr+4);
r.end.col = MS_OLE_GET_GUINT16(ptr+6);
#if 0
/* FIXME : enable when the core support is better
* - draws borders
* - handles attempts to span from neighbouring cells.
*/
sheet_region_merge (NULL, sheet->gnum_sheet, &r);
#endif
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
if (ms_excel_read_debug > 1) {
range_dump (&r);
fprintf(stderr, "\n");
}
}
#endif
......@@ -3523,6 +3518,25 @@ sheet_container (ExcelSheet *sheet)
return &sheet->container;
}
static gboolean
ms_excel_read_PROTECT (BiffQuery *q, char const *obj_type)
{
/* TODO : Use this information when gnumeric supports protection */
gboolean is_protected = TRUE;
/* MS Docs fail to mention that in some stream this
* record can have size zero. I assume the in that
* case its existence is the flag.
*/
#ifndef NO_DEBUG_EXCEL
if (q->length > 0)
is_protected = (1 == MS_OLE_GET_GUINT16(q->data));
if (ms_excel_read_debug > 1 && is_protected)
printf ("%s is protected\n", obj_type);
#endif
return is_protected;
}
static gboolean
ms_excel_read_sheet (BiffQuery *q, ExcelWorkbook *wb, WorkbookView *wb_view,
ExcelSheet *sheet)
......@@ -3668,16 +3682,8 @@ ms_excel_read_sheet (BiffQuery *q, ExcelWorkbook *wb, WorkbookView *wb_view,
case BIFF_OBJPROTECT:
case BIFF_PROTECT:
{
/* TODO : Use this information when gnumeric supports protection */
gboolean const is_protected = MS_OLE_GET_GUINT16(q->data) == 1;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 1 && is_protected) {
printf ("Sheet is protected\n");
}
#endif
ms_excel_read_PROTECT (q, "Sheet");
break;
}
case BIFF_HCENTER:
pi->center_horizontally = MS_OLE_GET_GUINT16 (q->data) == 0x1;
......@@ -4233,16 +4239,8 @@ ms_excel_read_workbook (IOContext *context, WorkbookView *wb_view,
case BIFF_OBJPROTECT :
case BIFF_PROTECT :
{
/* TODO : Use this information when gnumeric supports protection */
gboolean const is_protected = MS_OLE_GET_GUINT16(q->data) == 1;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 1 && is_protected) {
printf ("Sheet is protected\n");
}
#endif
ms_excel_read_PROTECT (q, "Workbook");
break;
}
case BIFF_PASSWORD :
break;
......
......@@ -198,10 +198,11 @@ cell_calc_span (Cell const * const cell, int * const col1, int * const col2)
/*
* Report only one column is used if
* - cell is a number
* - Cell is going to re recalculated
* - Cell is a number
* - Cell is the top left of a merged cell
* - the text fits inside column (for non center across selection)
* - the alignment mode are set to "justify"
* - The text fits inside column (for non center across selection)
* - The alignment mode are set to "justify"
*/
if (sheet != NULL) {
if (sheet_region_is_merge_cell (sheet, &cell->pos) ||
......@@ -215,7 +216,8 @@ cell_calc_span (Cell const * const cell, int * const col1, int * const col2)
align = cell_default_halign (cell, mstyle);
row = cell->pos.row;
if ((cell_contents_fit_inside_column (cell) &&
if (cell_needs_recalc (cell) ||
(cell_contents_fit_inside_column (cell) &&
align != HALIGN_CENTER_ACROSS_SELECTION) ||
align == HALIGN_JUSTIFY ||
align == HALIGN_FILL ||
......
......@@ -1322,9 +1322,8 @@ expr_tree_as_string (ExprTree const *tree, ParsePos const *pp)
enum CellRefRelocate {
CELLREF_NO_RELOCATE,
CELLREF_RELOCATE_ERR,
CELLREF_RELOCATE_COL,
CELLREF_RELOCATE_ROW,
CELLREF_RELOCATE_BOTH,
CELLREF_RELOCATE,
CELLREF_RELOCATE_FORCE, /* relocate both ends even if only one changed */
};
static enum CellRefRelocate
......@@ -1414,17 +1413,36 @@ cellref_relocate (CellRef *ref,
ref->sheet = ref_sheet;
ref->col = col;
ref->row = row;
return CELLREF_RELOCATE_BOTH;
return CELLREF_RELOCATE;
} else if (ref->col != col) {
ref->col = col;
if (ref->row != row) {
ref->row = row;
return CELLREF_RELOCATE_BOTH;
return CELLREF_RELOCATE;
}
return CELLREF_RELOCATE_COL;
/* FIXME : We should only do this if the start ? end ?
* col is included in the translation region (figure this out
* in relation to abs/rel references)
* Using offset == 0 would relocates too much. If you cut B2
* and paste it into B3 the source region A1:B2 will resize to
* A1:B3 even though it should not. This is correct for
* insert/delete row/col but not when dealing with cut & paste.
* To work around the problem I added a kludge to only do it if
* the target range is an entire row/col. This gives the
* desired behavior most of the time. However, it is probably
* not absolutely correct.
*/
if (rinfo->row_offset == 0 &&
rinfo->origin.start.col == 0 && rinfo->origin.end.col >= SHEET_MAX_COLS-1)
return CELLREF_RELOCATE_FORCE;
return CELLREF_RELOCATE;
} else if (ref->row != row) {
ref->row = row;
return CELLREF_RELOCATE_ROW;
/* FIXME : AS ABOVE */
if (rinfo->col_offset == 0 &&
rinfo->origin.start.row == 0 && rinfo->origin.end.row >= SHEET_MAX_ROWS-1)
return CELLREF_RELOCATE_FORCE;
return CELLREF_RELOCATE;
}
return CELLREF_NO_RELOCATE;
......@@ -1448,48 +1466,22 @@ cellrange_relocate (const Value *v,
break;
case CELLREF_RELOCATE_ERR :
return expr_tree_new_constant (value_new_error (NULL, gnumeric_err_REF));
case CELLREF_RELOCATE_COL :
/* FIXME : We should only do this if the start ? end ?
* col is included in the translation region (figure this out
* in relation to abs/rel references)
* The current code relocates too much. If you cut B2 and
* paste it into B3 the source region A1:B2 will resize to
* A1:B3 even though it should not.
* This is correct for insert/delete row/col but not when dealing
* with cut & paste.
*/
if (rinfo->row_offset == 0 &&
rinfo->origin.start.col == 0 && rinfo->origin.end.col >= SHEET_MAX_COLS-1)
needs_reloc = 2;
break;
case CELLREF_RELOCATE_ROW :
/* FIXME : */
if (rinfo->col_offset == 0 &&
rinfo->origin.start.row == 0 && rinfo->origin.end.row >= SHEET_MAX_ROWS-1)
needs_reloc = 2;
break;
case CELLREF_RELOCATE_BOTH :
case CELLREF_RELOCATE :
needs_reloc++;
break;
case CELLREF_RELOCATE_FORCE :
needs_reloc = 2;
}
switch (cellref_relocate (&ref_b, rinfo)) {
case CELLREF_NO_RELOCATE :
break;
case CELLREF_RELOCATE_ERR :
return expr_tree_new_constant (value_new_error (NULL, gnumeric_err_REF));
case CELLREF_RELOCATE_COL :
/* FIXME : */
if (rinfo->row_offset == 0 &&
rinfo->origin.start.col == 0 && rinfo->origin.end.col >= SHEET_MAX_COLS-1)
needs_reloc = 2;
break;
case CELLREF_RELOCATE_ROW :
/* FIXME : */
if (rinfo->col_offset == 0 &&
rinfo->origin.start.row == 0 && rinfo->origin.end.row >= SHEET_MAX_ROWS-1)
needs_reloc = 2;
break;
case CELLREF_RELOCATE_BOTH :
case CELLREF_RELOCATE :
needs_reloc++;
break;
case CELLREF_RELOCATE_FORCE :
needs_reloc = 2;
}
/* Only relocate if both ends of the range need relocation */
......@@ -1636,9 +1628,8 @@ expr_rewrite (ExprTree const *expr,
return NULL;
case CELLREF_RELOCATE_ERR :
return expr_tree_new_constant (value_new_error (NULL, gnumeric_err_REF));
case CELLREF_RELOCATE_COL :
case CELLREF_RELOCATE_ROW :
case CELLREF_RELOCATE_BOTH :
case CELLREF_RELOCATE :
case CELLREF_RELOCATE_FORCE :
return expr_tree_new_var (&res);
}
}
......
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