Beispiel #1
0
static GnmValue *
cb_clipboard_prepend_cell (GnmCellIter const *iter, GnmCellRegion *cr)
{
	GnmRange     a;
	GnmCellCopy *copy = gnm_cell_copy_new (cr,
		iter->pp.eval.col - cr->base.col,
		iter->pp.eval.row - cr->base.row);
	copy->val = value_dup (iter->cell->value);

	if (gnm_cell_has_expr (iter->cell)) {
		gnm_expr_top_ref (copy->texpr = iter->cell->base.texpr);

		/* Check for array division */
		if (!cr->not_as_contents &&
		    gnm_cell_array_bound (iter->cell, &a) &&
		    (a.start.col < cr->base.col ||
		     a.start.row < cr->base.row ||
		     a.end.col >= (cr->base.col + cr->cols) ||
		     a.end.row >= (cr->base.row + cr->rows)))
			cr->not_as_contents = TRUE;
	} else
		copy->texpr = NULL;

	return NULL;
}
Beispiel #2
0
/**
 * sv_select_cur_array :
 * @sv: The sheet
 *
 * If the editpos is part of an array clear the selection and select the array.
 **/
void
sv_select_cur_array (SheetView *sv)
{
	GnmRange a;
	int const c = sv->edit_pos.col;
	int const r = sv->edit_pos.row;

	if (!gnm_cell_array_bound (sheet_cell_get (sv->sheet, c, r), &a))
		return;

	/* leave the edit pos where it is, select the entire array. */
	sv_selection_reset (sv);
	sv_selection_add_full (sv, c, r,
		a.start.col, a.start.row, a.end.col, a.end.row);
	sheet_update (sv->sheet);
}