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

lock the encoding to be utf-8.

2002-01-25  Jody Goldberg <jody@gnome.org>

	* src/main.c (main) : lock the encoding to be utf-8.

	* src/eval.c : enable the micro hash by default.

	* src/expr.c (cellref_relocate) : simplify and remove the force
	  arguments.  Flag invalidations from inside vs to inside. From takes
	  precendence.
	(cellref_shift) : new.
	(cellrange_relocate) : simplfy and try a different tack on how to
	  handle corners with different sets of relocation needs.

	* src/commands.c (cmd_paste_cut_undo) : pass NULL for the
	  reloc_storage to disable invalidation.

	* src/sheet.c (sheet_move_range) : document.
	  Make the reloc_storage optional.  If it is not specified do NOT
	  invalidate references to the dst region that are being
	  invalidated.  Since this routine is only used for cut redo/undo
	  and undo really should not be invalidating we use that as a flag.
parent c4a1723b
......@@ -14,7 +14,6 @@ Pending Patches
---------------
Yukihiro's IM support
libole2 + vfs support.
Long term breakage
------------------
......
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/main.c (main) : lock the encoding to be utf-8.
* src/eval.c : enable the micro hash by default.
* src/expr.c (cellref_relocate) : simplify and remove the force
arguments. Flag invalidations from inside vs to inside. From takes
precendence.
(cellref_shift) : new.
(cellrange_relocate) : simplfy and try a different tack on how to
handle corners with different sets of relocation needs.
* src/commands.c (cmd_paste_cut_undo) : pass NULL for the
reloc_storage to disable invalidation.
* src/sheet.c (sheet_move_range) : document.
Make the reloc_storage optional. If it is not specified do NOT
invalidate references to the dst region that are being
invalidated. Since this routine is only used for cut redo/undo
and undo really should not be invalidating we use that as a flag.
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/Makefile.am : register the marshaller as BUILT sources.
......
Gnumeric 1.1.0
Jody:
* Initial port to gnome2.
* Enable microhash depend mechanism.
* Rework the range relocation logic.
--------------------------------------------------------------------------
Gnumeric 1.0.4
Jody:
......
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/main.c (main) : lock the encoding to be utf-8.
* src/eval.c : enable the micro hash by default.
* src/expr.c (cellref_relocate) : simplify and remove the force
arguments. Flag invalidations from inside vs to inside. From takes
precendence.
(cellref_shift) : new.
(cellrange_relocate) : simplfy and try a different tack on how to
handle corners with different sets of relocation needs.
* src/commands.c (cmd_paste_cut_undo) : pass NULL for the
reloc_storage to disable invalidation.
* src/sheet.c (sheet_move_range) : document.
Make the reloc_storage optional. If it is not specified do NOT
invalidate references to the dst region that are being
invalidated. Since this routine is only used for cut redo/undo
and undo really should not be invalidating we use that as a flag.
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/Makefile.am : register the marshaller as BUILT sources.
......
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/main.c (main) : lock the encoding to be utf-8.
* src/eval.c : enable the micro hash by default.
* src/expr.c (cellref_relocate) : simplify and remove the force
arguments. Flag invalidations from inside vs to inside. From takes
precendence.
(cellref_shift) : new.
(cellrange_relocate) : simplfy and try a different tack on how to
handle corners with different sets of relocation needs.
* src/commands.c (cmd_paste_cut_undo) : pass NULL for the
reloc_storage to disable invalidation.
* src/sheet.c (sheet_move_range) : document.
Make the reloc_storage optional. If it is not specified do NOT
invalidate references to the dst region that are being
invalidated. Since this routine is only used for cut redo/undo
and undo really should not be invalidating we use that as a flag.
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/Makefile.am : register the marshaller as BUILT sources.
......
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/main.c (main) : lock the encoding to be utf-8.
* src/eval.c : enable the micro hash by default.
* src/expr.c (cellref_relocate) : simplify and remove the force
arguments. Flag invalidations from inside vs to inside. From takes
precendence.
(cellref_shift) : new.
(cellrange_relocate) : simplfy and try a different tack on how to
handle corners with different sets of relocation needs.
* src/commands.c (cmd_paste_cut_undo) : pass NULL for the
reloc_storage to disable invalidation.
* src/sheet.c (sheet_move_range) : document.
Make the reloc_storage optional. If it is not specified do NOT
invalidate references to the dst region that are being
invalidated. Since this routine is only used for cut redo/undo
and undo really should not be invalidating we use that as a flag.
2002-01-25 Jody Goldberg <jody@gnome.org>
* src/Makefile.am : register the marshaller as BUILT sources.
......
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
-I$(top_srcdir) \
$(GNUMERIC_CFLAGS)
......
......@@ -2282,7 +2282,6 @@ cmd_paste_cut_undo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdPasteCut *me = CMD_PASTE_CUT (cmd);
ExprRelocateInfo reverse;
GSList *tmp = NULL;
g_return_val_if_fail (me != NULL, TRUE);
g_return_val_if_fail (me->paste_content != NULL, TRUE);
......@@ -2296,9 +2295,8 @@ cmd_paste_cut_undo (GnumericCommand *cmd, WorkbookControl *wbc)
reverse.col_offset = -me->info.col_offset;
reverse.row_offset = -me->info.row_offset;
/* Move things back, and throw away the undo info */
sheet_move_range (wbc, &reverse, &tmp);
workbook_expr_unrelocate_free (tmp);
/* Move things back being careful NOT to invalidate the src region */
sheet_move_range (wbc, &reverse, NULL);
/* Restore the original row heights */
colrow_set_states (me->info.target_sheet, FALSE,
......
......@@ -261,9 +261,8 @@ cb_dependent_queue_recalc (Dependent *dep, gpointer ignore)
}
}
/**************************************************************************/
#undef ENABLE_MICRO_HASH
#define ENABLE_MICRO_HASH
#ifdef ENABLE_MICRO_HASH
typedef struct {
gint num_buckets;
......@@ -480,7 +479,7 @@ typedef struct {
/*
* A DependencySingle stores a list of dependents that rely
* on the cell at @pos.
*
*
* A change in this cell will trigger a recomputation on the
* cells listed in deps.
*/
......@@ -597,7 +596,7 @@ add_range_dep (DependencyContainer *deps, Dependent *dep,
for ( ; i <= end; i++) {
/* Look it up */
DependencyRange *result;
if (deps->range_hash [i] == NULL) {
deps->range_hash [i] =
g_hash_table_new (deprange_hash_func,
......@@ -1019,7 +1018,7 @@ cb_search_rangedeps (gpointer key, gpointer value, gpointer closure)
/* No intersection is the common case */
if (range_contains (range, c->col, c->row)) {
DepFunc func = c->func;
dep_collection_foreach_dep (deprange->deps, dep,
dep_collection_foreach_dep (deprange->deps, dep,
(func) (dep, c->user););
}
}
......@@ -1174,7 +1173,7 @@ invalidate_refs (Dependent *dep, ExprRewriteInfo const *rwinfo)
ExprTree *newtree = expr_rewrite (dep->expression, rwinfo);
/* We are told this dependent depends on this region, hence if newtree
* is null then either
* is null then either
* 1) we did not depend on it ( ie. serious breakage )
* 2j we had a duplicate reference and we have already removed it.
* 3) We depended on things via a name which will be invalidated elsewhere
......@@ -1291,7 +1290,7 @@ do_deps_destroy (Sheet *sheet, ExprRewriteInfo const *rwinfo)
}
if (deps->names) {
g_hash_table_foreach (deps->names,
g_hash_table_foreach (deps->names,
cb_name_invalidate_sheet, (gpointer)rwinfo);
g_hash_table_destroy (deps->names);
deps->names = NULL;
......@@ -1369,7 +1368,7 @@ dependent_eval (Dependent *dep)
/**
* workbook_recalc :
* @wb :
* @wb :
*
* Computes all dependents in @wb that have been flags as requiring
* recomputation.
......
......@@ -261,9 +261,8 @@ cb_dependent_queue_recalc (Dependent *dep, gpointer ignore)
}
}
/**************************************************************************/
#undef ENABLE_MICRO_HASH
#define ENABLE_MICRO_HASH
#ifdef ENABLE_MICRO_HASH
typedef struct {
gint num_buckets;
......@@ -480,7 +479,7 @@ typedef struct {
/*
* A DependencySingle stores a list of dependents that rely
* on the cell at @pos.
*
*
* A change in this cell will trigger a recomputation on the
* cells listed in deps.
*/
......@@ -597,7 +596,7 @@ add_range_dep (DependencyContainer *deps, Dependent *dep,
for ( ; i <= end; i++) {
/* Look it up */
DependencyRange *result;
if (deps->range_hash [i] == NULL) {
deps->range_hash [i] =
g_hash_table_new (deprange_hash_func,
......@@ -1019,7 +1018,7 @@ cb_search_rangedeps (gpointer key, gpointer value, gpointer closure)
/* No intersection is the common case */
if (range_contains (range, c->col, c->row)) {
DepFunc func = c->func;
dep_collection_foreach_dep (deprange->deps, dep,
dep_collection_foreach_dep (deprange->deps, dep,
(func) (dep, c->user););
}
}
......@@ -1174,7 +1173,7 @@ invalidate_refs (Dependent *dep, ExprRewriteInfo const *rwinfo)
ExprTree *newtree = expr_rewrite (dep->expression, rwinfo);
/* We are told this dependent depends on this region, hence if newtree
* is null then either
* is null then either
* 1) we did not depend on it ( ie. serious breakage )
* 2j we had a duplicate reference and we have already removed it.
* 3) We depended on things via a name which will be invalidated elsewhere
......@@ -1291,7 +1290,7 @@ do_deps_destroy (Sheet *sheet, ExprRewriteInfo const *rwinfo)
}
if (deps->names) {
g_hash_table_foreach (deps->names,
g_hash_table_foreach (deps->names,
cb_name_invalidate_sheet, (gpointer)rwinfo);
g_hash_table_destroy (deps->names);
deps->names = NULL;
......@@ -1369,7 +1368,7 @@ dependent_eval (Dependent *dep)
/**
* workbook_recalc :
* @wb :
* @wb :
*
* Computes all dependents in @wb that have been flags as requiring
* recomputation.
......
......@@ -1168,12 +1168,9 @@ expr_tree_as_string (ExprTree const *expr, ParsePos const *pp)
typedef enum {
CELLREF_NO_RELOCATE,
CELLREF_RELOCATE_FROM_IN,
CELLREF_RELOCATE_FROM_OUT,
CELLREF_RELOCATE_ERR,
CELLREF_RELOCATE,
/* Both ends of the range must be treated as if they are inside the range */
CELLREF_RELOCATE_FORCE_TO_IN,
CELLREF_RELOCATE_FORCE_FROM_IN
} CellRefRelocate;
/*
......@@ -1184,8 +1181,7 @@ typedef enum {
* range changes when it should not.
*/
static CellRefRelocate
cellref_relocate (CellRef *ref, ExprRelocateInfo const *rinfo,
gboolean force_to_inside, gboolean force_from_inside)
cellref_relocate (CellRef *ref, ExprRelocateInfo const *rinfo)
{
/* For row or column refs
* Ref From To
......@@ -1209,18 +1205,10 @@ cellref_relocate (CellRef *ref, ExprRelocateInfo const *rinfo,
*/
int col = cellref_get_abs_col (ref, &rinfo->pos);
int row = cellref_get_abs_row (ref, &rinfo->pos);
Sheet * ref_sheet = (ref->sheet != NULL) ? ref->sheet : rinfo->pos.sheet;
/* Inside is based on the current location of the reference.
* Hence we need to use the ORIGIN_sheet rather than the target.
*/
gboolean const to_inside = force_to_inside ||
((rinfo->origin_sheet == ref_sheet) &&
range_contains (&rinfo->origin, col, row));
gboolean const from_inside = force_from_inside ||
((rinfo->origin_sheet == rinfo->pos.sheet) &&
range_contains (&rinfo->origin, rinfo->pos.eval.col, rinfo->pos.eval.row));
gboolean to_inside, from_inside;
Sheet *ref_sheet = ref->sheet;
if (ref_sheet == NULL)
ref_sheet = rinfo->pos.sheet;
/* fprintf (stderr, "%s\n", cellref_name (ref, &rinfo->pos, FALSE)); */
......@@ -1229,6 +1217,14 @@ cellref_relocate (CellRef *ref, ExprRelocateInfo const *rinfo,
row < 0 || row >= SHEET_MAX_ROWS)
return CELLREF_RELOCATE_ERR;
/* Inside is based on the current location of the reference.
* Hence we need to use the ORIGIN_sheet rather than the target.
*/
to_inside = (rinfo->origin_sheet == ref_sheet) &&
range_contains (&rinfo->origin, col, row);
from_inside = (rinfo->origin_sheet == rinfo->pos.sheet) &&
range_contains (&rinfo->origin, rinfo->pos.eval.col, rinfo->pos.eval.row);
/* Case (a) */
if (!from_inside && !to_inside)
return CELLREF_NO_RELOCATE;
......@@ -1268,45 +1264,36 @@ cellref_relocate (CellRef *ref, ExprRelocateInfo const *rinfo,
if (ref->row_relative)
row -= rinfo->pos.eval.row;
if (ref->sheet != ref_sheet) {
ref->sheet = ref_sheet;
ref->col = col;
ref->row = row;
return CELLREF_RELOCATE;
} else if (ref->col != col) {
ref->col = col;
if (ref->row != row) {
ref->row = row;
return CELLREF_RELOCATE;
}
/* 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.row == 0 && rinfo->origin.end.row >= SHEET_MAX_ROWS-1)
return from_inside ? CELLREF_RELOCATE_FORCE_FROM_IN
: CELLREF_RELOCATE_FORCE_TO_IN;
return CELLREF_RELOCATE;
} else if (ref->row != row) {
ref->row = row;
/* FIXME : As above */
if (rinfo->col_offset == 0 &&
rinfo->origin.start.col == 0 && rinfo->origin.end.col >= SHEET_MAX_COLS-1)
return from_inside ? CELLREF_RELOCATE_FORCE_FROM_IN
: CELLREF_RELOCATE_FORCE_TO_IN;
return CELLREF_RELOCATE;
}
if (ref->sheet == ref_sheet && ref->col == col && ref->row == row)
return CELLREF_NO_RELOCATE;
return CELLREF_NO_RELOCATE;
ref->sheet = ref_sheet;
ref->col = col;
ref->row = row;
return from_inside ? CELLREF_RELOCATE_FROM_IN : CELLREF_RELOCATE_FROM_OUT;
}
/**
* A utility routine that assumes @ref is from the origin sheet but is not
* contained by the origin range, and did not require relocation. However,
* @ref is part of a range whose opposing corned DID require relocation.
* So we check to see if the range should be extended using the heuristic
* that if movement is in only 1 dimension, and that for @ref that col/row is
* into the target range then we want to adjust the range.
*/
static gboolean
cellref_shift (CellRef const *ref, ExprRelocateInfo const *rinfo)
{
if (rinfo->col_offset == 0) {
int const col = cellref_get_abs_col (ref, &rinfo->pos);
return col < rinfo->origin.start.col ||
col > rinfo->origin.end.col;
} else if (rinfo->row_offset == 0) {
int const row = cellref_get_abs_row (ref, &rinfo->pos);
return row < rinfo->origin.start.row ||
row > rinfo->origin.end.row;
}
return TRUE;
}
static ExprTree *
......@@ -1314,34 +1301,33 @@ cellrange_relocate (Value const *v, ExprRelocateInfo const *rinfo)
{
/*
* If either end is an error then the whole range is an error.
* If both ends need relocation relocate
* If both ends need to relocate -> relocate
* If either end is relcated from inside the range -> relocate
* otherwise we can end up with invalid references
* If only 1 end needs relocation, relocate only if movement is
* in only 1 dimension, and the
* otherwise remain static
*/
CellRef ref_a = v->v_range.cell.a;
CellRef ref_b = v->v_range.cell.b;
int needs_reloc = 0;
switch (cellref_relocate (&ref_a, rinfo, FALSE, FALSE)) {
case CELLREF_NO_RELOCATE :
break;
case CELLREF_RELOCATE_ERR :
return expr_tree_new_constant (value_new_error (NULL, gnumeric_err_REF));
case CELLREF_RELOCATE : needs_reloc++; break;
case CELLREF_RELOCATE_FORCE_TO_IN : needs_reloc += 0x10; break;
case CELLREF_RELOCATE_FORCE_FROM_IN : needs_reloc += 0x100; break;
int needs = 0;
switch (cellref_relocate (&ref_a, rinfo)) {
case CELLREF_NO_RELOCATE : break;
case CELLREF_RELOCATE_FROM_IN : needs = 0x4; break;
case CELLREF_RELOCATE_FROM_OUT : needs = 0x1; break;
case CELLREF_RELOCATE_ERR : return expr_tree_new_constant (
value_new_error (NULL, gnumeric_err_REF));
}
switch (cellref_relocate (&ref_b, rinfo, FALSE, FALSE)) {
case CELLREF_NO_RELOCATE :
break;
case CELLREF_RELOCATE_ERR :
return expr_tree_new_constant (value_new_error (NULL, gnumeric_err_REF));
case CELLREF_RELOCATE : needs_reloc++; break;
case CELLREF_RELOCATE_FORCE_TO_IN : needs_reloc += 0x20; break;
case CELLREF_RELOCATE_FORCE_FROM_IN : needs_reloc += 0x200; break;
switch (cellref_relocate (&ref_b, rinfo)) {
case CELLREF_NO_RELOCATE : break;
case CELLREF_RELOCATE_FROM_IN : needs = 0x4; break;
case CELLREF_RELOCATE_FROM_OUT : needs |= 0x2; break;
case CELLREF_RELOCATE_ERR : return expr_tree_new_constant (
value_new_error (NULL, gnumeric_err_REF));
}
/* Only relocate if both ends of the range need relocation */
if (needs_reloc >= 2) {
if (needs != 0) {
Value *res;
Sheet const *sheet_a = ref_a.sheet;
Sheet const *sheet_b = ref_b.sheet;
......@@ -1351,27 +1337,17 @@ cellrange_relocate (Value const *v, ExprRelocateInfo const *rinfo)
if (sheet_b == NULL)
sheet_b = rinfo->pos.sheet;
#if 0
/* Force only happens when inserting row/col
* we want to deform the region
*/
switch (needs_reloc) {
case 2 : break;
case 0x10 : cellref_relocate (&ref_b, rinfo, TRUE, FALSE); break;
case 0x20 : cellref_relocate (&ref_a, rinfo, TRUE, FALSE); break;
case 0x100 : cellref_relocate (&ref_b, rinfo, FALSE, TRUE); break;
case 0x200 : cellref_relocate (&ref_a, rinfo, FALSE, TRUE); break;
default : g_warning ("Unexpected relocation type 0x%x", needs_reloc);
};
#endif
/* Dont allow creation of 3D references */
if (sheet_a == sheet_b)
if (sheet_a == sheet_b) {
if ((needs == 0x1 && cellref_shift (&ref_b, rinfo)) ||
(needs == 0x2 && cellref_shift (&ref_a, rinfo)))
return NULL;
res = value_new_cellrange (&ref_a, &ref_b,
rinfo->pos.eval.col,
rinfo->pos.eval.row);
else
} else
res = value_new_error (NULL, gnumeric_err_REF);
return expr_tree_new_constant (res);
}
......@@ -1532,15 +1508,14 @@ expr_rewrite (ExprTree const *expr, ExprRewriteInfo const *rwinfo)
case EXPR_REWRITE_RELOCATE : {
CellRef res = expr->var.ref; /* Copy */
switch (cellref_relocate (&res, &rwinfo->u.relocate, FALSE, FALSE)) {
switch (cellref_relocate (&res, &rwinfo->u.relocate)) {
case CELLREF_NO_RELOCATE :
return NULL;
case CELLREF_RELOCATE_FROM_IN :
case CELLREF_RELOCATE_FROM_OUT :
return expr_tree_new_var (&res);
case CELLREF_RELOCATE_ERR :
return expr_tree_new_constant (value_new_error (NULL, gnumeric_err_REF));
case CELLREF_RELOCATE :
case CELLREF_RELOCATE_FORCE_TO_IN :
case CELLREF_RELOCATE_FORCE_FROM_IN :
return expr_tree_new_var (&res);
}
}
}
......
......@@ -178,8 +178,9 @@ main (int argc, char *argv [])
/* Make stdout line buffered - we only use it for debug info */
setvbuf (stdout, NULL, _IOLBF, 0);
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
/* Force all of the locale segments to update from the environment.
* Unless we do this they will default to C
......
......@@ -178,8 +178,9 @@ main (int argc, char *argv [])
/* Make stdout line buffered - we only use it for debug info */
setvbuf (stdout, NULL, _IOLBF, 0);
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
/* Force all of the locale segments to update from the environment.
* Unless we do this they will default to C
......
......@@ -3653,6 +3653,17 @@ sheet_delete_rows (WorkbookControl *wbc, Sheet *sheet,
return FALSE;
}
/**
* sheet_move_range :
* @wbc :
* @rinfo :
* @reloc_storage : optionally NULL.
*
* Move a range as specified in @rinfo report warnings to @wbc.
* if @reloc_storage is non NULL, invalidate references to the
* target region that are being cleared, and store the undo information
* in @reloc_storage. If it is NULL do NOT INVALIDATE.
**/
void
sheet_move_range (WorkbookControl *wbc,
ExprRelocateInfo const *rinfo,
......@@ -3679,50 +3690,52 @@ sheet_move_range (WorkbookControl *wbc,
* to from the src range are adjusted because they will point into
* the destinatin.
*/
*reloc_storage = NULL;
if (!out_of_range) {
GSList *invalid;
ExprRelocateInfo reloc_info;
/*
* We need to be careful about invalidating references to the old
* content of the destination region. We only invalidate references
* to regions that are actually lost. However, this care is
* only necessary if the source and target sheets are the same.
*
* Handle dst cells being pasted over
*/
if (rinfo->origin_sheet == rinfo->target_sheet &&
range_overlap (&rinfo->origin, &dst))
invalid = range_split_ranges (&rinfo->origin, &dst);
else
invalid = g_slist_append (NULL, range_dup (&dst));
reloc_info.origin_sheet = reloc_info.target_sheet = rinfo->target_sheet;;
reloc_info.col_offset = SHEET_MAX_COLS; /* send to infinity */
reloc_info.row_offset = SHEET_MAX_ROWS; /* to force invalidation */
while (invalid) {
Range *r = invalid->data;
invalid = g_slist_remove (invalid, r);
if (!range_overlap (r, &rinfo->origin)) {
reloc_info.origin = *r;
*reloc_storage = g_slist_concat (*reloc_storage,
workbook_expr_relocate (rinfo->target_sheet->workbook, &reloc_info));
if (reloc_storage != NULL) {
*reloc_storage = NULL;
if (!out_of_range) {
GSList *invalid;
ExprRelocateInfo reloc_info;
/*
* We need to be careful about invalidating references to the old
* content of the destination region. We only invalidate references
* to regions that are actually lost. However, this care is
* only necessary if the source and target sheets are the same.
*
* Handle dst cells being pasted over
*/
if (rinfo->origin_sheet == rinfo->target_sheet &&
range_overlap (&rinfo->origin, &dst))
invalid = range_split_ranges (&rinfo->origin, &dst);
else
invalid = g_slist_append (NULL, range_dup (&dst));
reloc_info.origin_sheet = reloc_info.target_sheet = rinfo->target_sheet;;
reloc_info.col_offset = SHEET_MAX_COLS; /* send to infinity */
reloc_info.row_offset = SHEET_MAX_ROWS; /* to force invalidation */
while (invalid) {
Range *r = invalid->data;
invalid = g_slist_remove (invalid, r);
if (!range_overlap (r, &rinfo->origin)) {
reloc_info.origin = *r;
*reloc_storage = g_slist_concat (*reloc_storage,
workbook_expr_relocate (rinfo->target_sheet->workbook, &reloc_info));
}
g_free (r);
}
g_free (r);
/*
* DO NOT handle src cells moving out the bounds.
* that is handled elsewhere.
*/
}
/*
* DO NOT handle src cells moving out the bounds.
* that is handled elsewhere.
*/
/* 2. Fix references to and from the cells which are moving */
*reloc_storage = g_slist_concat (*reloc_storage,
workbook_expr_relocate (rinfo->origin_sheet->workbook, rinfo));
}
/* 2. Fix references to and from the cells which are moving */
*reloc_storage = g_slist_concat (*reloc_storage,
workbook_expr_relocate (rinfo->origin_sheet->workbook, rinfo));
/* 3. Collect the cells */
sheet_foreach_cell_in_range (rinfo->origin_sheet, TRUE,
rinfo->origin.start.col,
......
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