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

Split merge cell support into a seperate file to decrease the size of sheet.c

Add merged cell support to autofill.

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

	* src/sheet-autofill.c (sheet_autofill_dir) : support merged cells.
	(fill_item_new) : Ditto.

	* src/sheet.c
	(sheet_merge_add) : rename
	(sheet_merge_remove) : rename
	(sheet_merge_get_overlap) : rename
	(sheet_merge_contains_pos) : rename
	(sheet_merge_is_corner) : rename
	(sheet_merged_relocate) : rename
	(sheet_merge_get_adjacent) : rename

	* src/rendered-value.c (rendered_value_new) : Use
	  sheet_merge_is_corner rather than sheet_region_get_merged_cell.
parent 331341ed
......@@ -97,7 +97,6 @@ STF - pasting a single line should not invoke the importer
- Other anchor types for sheet objects
- Merged Cells
- autofill
- copy/paste (cut works)
- fix undo ins/del row/col to restore lost merged regions
- printing
......
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-autofill.c (sheet_autofill_dir) : support merged cells.
(fill_item_new) : Ditto.
* src/sheet.c
(sheet_merge_add) : rename
(sheet_merge_remove) : rename
(sheet_merge_get_overlap) : rename
(sheet_merge_contains_pos) : rename
(sheet_merge_is_corner) : rename
(sheet_merged_relocate) : rename
(sheet_merge_get_adjacent) : rename
* src/rendered-value.c (rendered_value_new) : Use
sheet_merge_is_corner rather than sheet_region_get_merged_cell.
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_object_update_bbox) : Use the stored
......
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-autofill.c (sheet_autofill_dir) : support merged cells.
(fill_item_new) : Ditto.
* src/sheet.c
(sheet_merge_add) : rename
(sheet_merge_remove) : rename
(sheet_merge_get_overlap) : rename
(sheet_merge_contains_pos) : rename
(sheet_merge_is_corner) : rename
(sheet_merged_relocate) : rename
(sheet_merge_get_adjacent) : rename
* src/rendered-value.c (rendered_value_new) : Use
sheet_merge_is_corner rather than sheet_region_get_merged_cell.
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_object_update_bbox) : Use the stored
......
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-autofill.c (sheet_autofill_dir) : support merged cells.
(fill_item_new) : Ditto.
* src/sheet.c
(sheet_merge_add) : rename
(sheet_merge_remove) : rename
(sheet_merge_get_overlap) : rename
(sheet_merge_contains_pos) : rename
(sheet_merge_is_corner) : rename
(sheet_merged_relocate) : rename
(sheet_merge_get_adjacent) : rename
* src/rendered-value.c (rendered_value_new) : Use
sheet_merge_is_corner rather than sheet_region_get_merged_cell.
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_object_update_bbox) : Use the stored
......
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-autofill.c (sheet_autofill_dir) : support merged cells.
(fill_item_new) : Ditto.
* src/sheet.c
(sheet_merge_add) : rename
(sheet_merge_remove) : rename
(sheet_merge_get_overlap) : rename
(sheet_merge_contains_pos) : rename
(sheet_merge_is_corner) : rename
(sheet_merged_relocate) : rename
(sheet_merge_get_adjacent) : rename
* src/rendered-value.c (rendered_value_new) : Use
sheet_merge_is_corner rather than sheet_region_get_merged_cell.
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_object_update_bbox) : Use the stored
......
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-autofill.c (sheet_autofill_dir) : support merged cells.
(fill_item_new) : Ditto.
* src/sheet.c
(sheet_merge_add) : rename
(sheet_merge_remove) : rename
(sheet_merge_get_overlap) : rename
(sheet_merge_contains_pos) : rename
(sheet_merge_is_corner) : rename
(sheet_merged_relocate) : rename
(sheet_merge_get_adjacent) : rename
* src/rendered-value.c (rendered_value_new) : Use
sheet_merge_is_corner rather than sheet_region_get_merged_cell.
2000-12-29 Jody Goldberg <jgoldberg@home.com>
* src/sheet-control-gui.c (scg_object_update_bbox) : Use the stored
......
......@@ -23,6 +23,7 @@
#include "expr-name.h"
#include "style.h"
#include "cell.h"
#include "sheet-merge.h"
#include "format.h"
#include "eval.h"
#include "gutils.h"
......@@ -3505,7 +3506,7 @@ ms_excel_read_mergecells (BiffQuery *q, ExcelSheet *sheet)
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);
sheet_region_merge (NULL, sheet->gnum_sheet, &r);
sheet_merge_add (NULL, sheet->gnum_sheet, &r);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 1) {
range_dump (&r);
......
......@@ -176,6 +176,8 @@ GNUMERIC_BASE_SOURCES = \
selection.h \
sheet.c \
sheet.h \
sheet-merge.c \
sheet-merge.h \
sheet-private.h \
sheet-autofill.c \
sheet-autofill.h \
......
......@@ -4,6 +4,7 @@
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
* Jody Goldberg (jgoldberg@home.com)
*
* The information on cell spanning is attached in the row ColRowInfo
* structures. The actual representation of this information is
......@@ -17,6 +18,7 @@
#include <config.h>
#include "cellspan.h"
#include "cell.h"
#include "sheet-merge.h"
#include "style.h"
#include "colrow.h"
#include "value.h"
......@@ -209,7 +211,7 @@ cell_calc_span (Cell const * const cell, int * const col1, int * const col2)
* - The alignment mode are set to "justify"
*/
if (sheet != NULL) {
if (sheet_region_is_merge_cell (sheet, &cell->pos) ||
if (cell_is_merged (cell) ||
(!sheet->display_formulas && cell_is_number (cell))) {
*col1 = *col2 = cell->pos.col;
return;
......@@ -235,8 +237,7 @@ cell_calc_span (Cell const * const cell, int * const col1, int * const col2)
cell_width_pixel = cell_rendered_width (cell);
sheet_region_adjacent_merge (sheet, &cell->pos,
&merge_left, &merge_right);
sheet_merge_get_adjacent (sheet, &cell->pos, &merge_left, &merge_right);
min_col = (merge_left != NULL) ? merge_left->end.col : 0;
max_col = (merge_right != NULL) ? merge_right->start.col : SHEET_MAX_COLS;
......
......@@ -36,6 +36,7 @@
#include "eval.h"
#include "expr.h"
#include "cell.h"
#include "sheet-merge.h"
#include "parse-util.h"
#include "clipboard.h"
#include "selection.h"
......@@ -2408,7 +2409,7 @@ cmd_unmerge_cells_undo_internal (GnumericCommand *cmd, WorkbookControl *wbc,
for (i = 0 ; i < me->unmerged_regions->len ; ++i) {
Range const *tmp = &(g_array_index (me->unmerged_regions, Range, i));
sheet_region_merge (COMMAND_CONTEXT (wbc), me->sheet, tmp);
sheet_merge_add (COMMAND_CONTEXT (wbc), me->sheet, tmp);
if (re_span)
sheet_range_calc_spans (me->sheet, *tmp, SPANCALC_RE_RENDER);
}
......@@ -2429,13 +2430,13 @@ cmd_unmerge_cells_redo_internal (GnumericCommand *cmd, WorkbookControl *wbc,
me->unmerged_regions = g_array_new (FALSE, FALSE, sizeof (Range));
for (i = 0 ; i < me->ranges->len ; ++i) {
GSList *ptr, *merged = sheet_region_get_merged (me->sheet,
GSList *ptr, *merged = sheet_merge_get_overlap (me->sheet,
&(g_array_index (me->ranges, Range, i)));
for (ptr = merged ; ptr != NULL ; ptr = ptr->next) {
Range tmp = *(Range *)(ptr->data);
g_array_append_val (me->unmerged_regions, tmp);
sheet_region_unmerge (COMMAND_CONTEXT (wbc),
me->sheet, &tmp);
sheet_merge_remove (COMMAND_CONTEXT (wbc),
me->sheet, &tmp);
if (re_span)
sheet_range_calc_spans (me->sheet, tmp,
SPANCALC_RE_RENDER);
......@@ -2536,8 +2537,8 @@ cmd_merge_cells_undo (GnumericCommand *cmd, WorkbookControl *wbc)
for (i = 0 ; i < me->unmerge.ranges->len ; ++i) {
Range const * r = &(g_array_index (me->unmerge.ranges, Range, i));
sheet_region_unmerge (COMMAND_CONTEXT (wbc),
me->unmerge.sheet, r);
sheet_merge_remove (COMMAND_CONTEXT (wbc),
me->unmerge.sheet, r);
}
cmd_unmerge_cells_undo_internal (cmd, wbc, FALSE);
......@@ -2589,7 +2590,7 @@ cmd_merge_cells_redo (GnumericCommand *cmd, WorkbookControl *wbc)
CLEAR_VALUES | CLEAR_FORMATS |
CLEAR_COMMENTS | CLEAR_NOCHECKARRAY);
sheet_region_merge (COMMAND_CONTEXT (wbc),
sheet_merge_add (COMMAND_CONTEXT (wbc),
me->unmerge.sheet, r);
}
......
......@@ -25,6 +25,7 @@
#include "ranges.h"
#include "style.h"
#include "parse-util.h"
#include "sheet-merge.h"
#include "workbook.h"
#include "workbook-edit.h"
#include "gnumeric-util.h"
......@@ -347,7 +348,7 @@ recalc_spans (GnomeCanvasItem *item)
item_edit->text_offsets = g_slist_reverse (text_offsets);
col_span = item_edit->col_span;
merged = sheet_region_get_merged_cell (sheet, &item_edit->pos);
merged = sheet_merge_is_corner (sheet, &item_edit->pos);
if (merged != NULL) {
int tmp = merged->end.col - merged->start.col + 1;
if (col_span < tmp)
......
......@@ -16,6 +16,7 @@
#include "workbook-control-gui-priv.h"
#include "sheet-control-gui.h"
#include "sheet.h"
#include "sheet-merge.h"
#include "sheet-object-impl.h"
#include "gnumeric-type-util.h"
#include "cell.h"
......@@ -393,7 +394,7 @@ item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int
first_row = TRUE;
merged_active = merged_active_seen = merged_used = NULL;
merged_unused = sheet_region_get_merged (sheet,
merged_unused = sheet_merge_get_overlap (sheet,
range_init (&view, paint_col, paint_row, end_col-1, end_row-1));
row = paint_row;
......
......@@ -4,7 +4,7 @@
* rendered-value.c: Management & utility routines for formated
* colored text.
*
* Copyright (C) 2000 Jody Goldberg (jgoldberg@home.com)
* Copyright (C) 2000, 2001 Jody Goldberg (jgoldberg@home.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -27,6 +27,7 @@
#include "cell.h"
#include "style.h"
#include "sheet.h"
#include "sheet-merge.h"
#include "format.h"
#include "value.h"
#include "parse-util.h"
......@@ -83,10 +84,10 @@ rendered_value_new (Cell *cell, MStyle *mstyle, gboolean dynamic_width)
float cell_width;
if (cell_is_merged (cell)) {
Range const *merged =
sheet_region_get_merged_cell (cell->base.sheet, &cell->pos);
sheet_merge_is_corner (cell->base.sheet, &cell->pos);
cell_width = sheet_col_get_distance_pts (cell->base.sheet,
merged->start.col, merged->end.col + 1);
} else
cell_width = cell->col_info->size_pts;
cell_width -= cell->col_info->margin_a + cell->col_info->margin_b;
......
......@@ -19,6 +19,7 @@
#include "commands.h"
#include "value.h"
#include "cell.h"
#include "sheet-merge.h"
#include "sheet-control-gui.h"
#include "gnumeric-util.h"
......@@ -109,7 +110,7 @@ selection_is_simple (WorkbookControl *wbc, Sheet const *sheet,
r = sheet->selections->data;
if (!allow_merged) {
merged = sheet_region_get_merged (sheet, r);
merged = sheet_merge_get_overlap (sheet, r);
if (merged != NULL) {
gnumeric_error_invalid (COMMAND_CONTEXT (wbc), command_name,
_("can not operate on merged cells"));
......@@ -312,7 +313,7 @@ sheet_selection_set_internal (Sheet *sheet,
/* expand to include any merged regions */
looper :
changed = FALSE;
merged = sheet_region_get_merged (sheet, &new_sel);
merged = sheet_merge_get_overlap (sheet, &new_sel);
for (ptr = merged ; ptr != NULL ; ptr = ptr->next) {
Range const *r = ptr->data;
if (new_sel.start.col > r->start.col) {
......@@ -1165,7 +1166,7 @@ walk_boundaries (Sheet const *sheet, Range const * const bound,
{
int const step = forward ? 1 : -1;
CellPos pos = sheet->edit_pos_real;
Range const *merge = sheet_region_is_merge_cell (sheet, &sheet->edit_pos);
Range const *merge = sheet_merge_is_corner (sheet, &sheet->edit_pos);
*res = pos;
loop :
......@@ -1201,7 +1202,7 @@ loop :
pos.row += step;
}
if (smart_merge) {
merge = sheet_region_get_merged_cell (sheet, &pos);
merge = sheet_merge_contains_pos (sheet, &pos);
if (merge != NULL) {
if (forward) {
if (pos.col != merge->start.col ||
......@@ -1250,7 +1251,7 @@ sheet_selection_walk_step (Sheet *sheet,
is_singleton = TRUE;
else if (ss->start.col == sheet->edit_pos.col &&
ss->start.row == sheet->edit_pos.row) {
Range const *merge = sheet_region_is_merge_cell (sheet,
Range const *merge = sheet_merge_is_corner (sheet,
&sheet->edit_pos);
if (merge != NULL && range_equal (merge, ss))
is_singleton = TRUE;
......
......@@ -27,6 +27,8 @@
#include "formats.h"
#include "datetime.h"
#include "mstyle.h"
#include "ranges.h"
#include "sheet-merge.h"
#include "errno.h"
#include <math.h>
......@@ -92,10 +94,12 @@ typedef struct {
typedef struct _FillItem {
FillType type;
Cell *reference;
StyleFormat *fmt;
MStyle *style;
gboolean is_merged;
CellPos merged_size;
union {
ExprTree *formula;
Value *value;
......@@ -260,13 +264,22 @@ fill_item_new (Sheet *sheet, int col, int row)
ValueType value_type;
FillItem *fi;
Cell *cell;
CellPos pos;
Range const *merged;
pos.col = col;
pos.row = row;
fi = g_new (FillItem, 1);
fi->type = FILL_EMPTY;
fi->style = sheet_style_compute (sheet, col, row);
merged = sheet_merge_is_corner (sheet, &pos);
if ((fi->is_merged = (merged != NULL))) {
fi->merged_size.col = merged->end.col - col;
fi->merged_size.row = merged->end.row - row;
}
cell = sheet_cell_get (sheet, col, row);
fi->reference = cell;
if (!cell)
return fi;
......@@ -736,6 +749,14 @@ sheet_autofill_dir (Sheet *sheet,
loops * group_count + sub_index, fi);
}
if (fi->is_merged) {
Range tmp;
range_init (&tmp, col, row,
col + fi->merged_size.col,
row + fi->merged_size.row);
sheet_merge_add (NULL, sheet, &tmp);
}
col += col_inc;
row += row_inc;
}
......
/* vim: set sw=8: */
/*
* sheet-merge.c: merged cell support
*
* Copyright (C) 2000, 2001 Jody Goldberg (jgoldberg@home.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#include <config.h>
#include "sheet-merge.h"
#include "sheet.h"
#include "sheet-private.h"
#include "ranges.h"
#include "cell.h"
#include "expr.h"
#include "command-context.h"
#include <gnome.h> /*for translation */
static gint
range_row_cmp (Range const *a, Range const *b)
{
int tmp = b->start.row - a->start.row;
if (tmp == 0)
tmp = a->start.col - b->start.col; /* YES I DO MEAN a - b */
return tmp;
}
/**
* sheet_merge_add :
*
* @cc : command context
* @sheet : the sheet which will contain the region
* @src : The region to merge
*
* Add a range to the list of merge targets. Checks for array spliting returns
* TRUE if there was an error. Does not regen spans, redraw or render.
*/
gboolean
sheet_merge_add (CommandContext *cc, Sheet *sheet, Range const *range)
{
GSList *test;
Range *r_copy;
Cell *cell;
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (range != NULL, TRUE);
if (sheet_range_splits_array (sheet, range)) {
gnumeric_error_splits_array (cc, _("Merge"));
return TRUE;
}
test = sheet_merge_get_overlap (sheet, range);
if (test != NULL) {
gnumeric_error_invalid (cc,
_("There is already a merged region that intersects"),
range_name (range));
g_slist_free (test);
return TRUE;
}
r_copy = range_copy (range);
g_hash_table_insert (sheet->hash_merged, &r_copy->start, r_copy);
/* Store in order from bottom to top then LEFT TO RIGHT (by start coord) */
sheet->list_merged = g_slist_insert_sorted (sheet->list_merged, r_copy,
(GCompareFunc)range_row_cmp);
cell = sheet_cell_get (sheet, range->start.col, range->start.row);
if (cell != NULL)
cell->base.flags |= CELL_IS_MERGED;
sheet->priv->reposition_selection = TRUE;
return FALSE;
}
/**
* sheet_merge_remove :
*
* @cc : command context
* @sheet : the sheet which will contain the region
* @range : The region
*
* Remove a merged range.
* returns TRUE if there was an error.
*/
gboolean
sheet_merge_remove (CommandContext *cc, Sheet *sheet, Range const *range)
{
Range *r_copy;
Cell *cell;
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (range != NULL, TRUE);
r_copy = g_hash_table_lookup (sheet->hash_merged, &range->start);
g_return_val_if_fail (r_copy != NULL, TRUE);
g_return_val_if_fail (range_equal (range, r_copy), TRUE);
g_hash_table_remove (sheet->hash_merged, &r_copy->start);
sheet->list_merged = g_slist_remove (sheet->list_merged, r_copy);
g_free (r_copy);
cell = sheet_cell_get (sheet, range->start.col, range->start.row);
if (cell != NULL)
cell->base.flags &= ~CELL_IS_MERGED;
sheet->priv->reposition_selection = TRUE;
return FALSE;
}
/**
* sheet_merge_get_overlap :
*
* Returns a list of the merged regions that overlap the target region.
* The list is ordered from top to bottom and RIGHT TO LEFT (by start coord).
* Caller is responsible for freeing the list, but not the content.
*/
GSList *
sheet_merge_get_overlap (Sheet const *sheet, Range const *range)
{
GSList *ptr, *res = NULL;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (range != NULL, NULL);
for (ptr = sheet->list_merged ; ptr != NULL ; ptr = ptr->next) {
Range * const test = ptr->data;
if (range_overlap (range, test))
res = g_slist_prepend (res, test);
}
return res;
}
/**
* sheet_merge_contains_pos :
*
* If the CellPos is contained in the a merged region return the range.
* The Range should NOT be freed.
*/
Range const *
sheet_merge_contains_pos (Sheet const *sheet, CellPos const *pos)
{
GSList *ptr;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (pos != NULL, NULL);
for (ptr = sheet->list_merged ; ptr != NULL ; ptr = ptr->next) {
Range const * const range = ptr->data;
if (range_contains (range, pos->col, pos->row))
return range;
}
return NULL;
}
/**
* sheet_merge_get_adjacent
* @sheet : The sheet to look in.
* @pos : the cell to test for adjacent regions.
* @left : the return for a region on the left
* @right : the return for a region on the right
*
* Returns the nearest regions to either side of @pos.
*/
void
sheet_merge_get_adjacent (Sheet const *sheet, CellPos const *pos,
Range const **left, Range const **right)
{
GSList *ptr;
g_return_if_fail (IS_SHEET (sheet));
g_return_if_fail (pos != NULL);
*left = *right = NULL;
for (ptr = sheet->list_merged ; ptr != NULL ; ptr = ptr->next) {
Range const * const test = ptr->data;
if (test->start.row <= pos->row && pos->row <= test->end.row) {
int const diff = test->end.col - pos->col;
g_return_if_fail (diff != 0);
if (diff < 0) {
if (*left == NULL || (*left)->end.col < test->end.col)
*left = test;
} else {
if (*right == NULL || (*right)->start.col > test->start.col)
*right = test;
}
}
}
}
/**
* sheet_merge_is_corner :
*
* @sheet :
* @pos : cellpos if top left corner
*
* Returns a Range pointer if the @pos is the topleft of a merged region.
* The pointer should NOT be freed by the caller.
*/
Range const *
sheet_merge_is_corner (Sheet const *sheet, CellPos const *pos)
{
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (pos != NULL, NULL);
return g_hash_table_lookup (sheet->hash_merged, pos);
}
/**
* sheet_merge_relocate :
*
* @rinfo : Descriptor of what is moving.
*
* Shifts merged regions that need to move.
*/
void
sheet_merge_relocate (ExprRelocateInfo const *ri)
{
GSList *ptr, *copy, *to_move = NULL;
Range dest;
gboolean clear, change_sheets;
g_return_if_fail (ri != NULL);
g_return_if_fail (IS_SHEET (ri->origin_sheet));
g_return_if_fail (IS_SHEET (ri->target_sheet));
dest = ri->origin;
clear = range_translate (&dest, ri->col_offset, ri->row_offset);
change_sheets = (ri->origin_sheet != ri->target_sheet);
/* Clear the destination range on the target sheet */
if (change_sheets) {
copy = g_slist_copy (ri->target_sheet->list_merged);
for (ptr = copy; ptr != NULL ; ptr = ptr->next) {
Range const *r = ptr->data;
if (range_contains (&dest, r->start.col, r->start.row))
sheet_merge_remove (NULL, ri->target_sheet, r);
}
g_slist_free (copy);
}
copy = g_slist_copy (ri->origin_sheet->list_merged);
for (ptr = copy; ptr != NULL ; ptr = ptr->next ) {
Range const *r = ptr->data;
if (range_contains (&ri->origin, r->start.col, r->start.row)) {
Range tmp = *r;
/* Toss any objects that would be clipped. */
sheet_merge_remove (NULL, ri->origin_sheet, r);
if (!range_translate (&tmp, ri->col_offset, ri->row_offset))
to_move = g_slist_prepend (to_move, range_copy (&tmp));
} else if (!change_sheets &&
range_contains (&dest, r->start.col, r->start.row))
sheet_merge_remove (NULL, ri->origin_sheet, r);
}
g_slist_free (copy);
/* move the ranges after removing the previous content in case of overlap */
for (ptr = to_move ; ptr != NULL ; ptr = ptr->next) {
Range *dest = ptr->data;
sheet_merge_add (NULL, ri->target_sheet, dest);
g_free (dest);
}
g_slist_free (to_move);
}
#ifndef GNUMERIC_SHEET_MERGED_H
#define GNUMERIC_SHEET_MERGED_H
#include "gnumeric.h"
gboolean sheet_merge_add (