Ejemplo n.º 1
0
/**
 * gnm_app_recalc:
 *
 * Recalculate everything dirty in all workbooks that have automatic
 * recalc turned on.
 **/
void
gnm_app_recalc (void)
{
	GList *l;

	g_return_if_fail (app != NULL);

	gnm_app_recalc_start ();

	for (l = app->workbook_list; l; l = l->next) {
		Workbook *wb = l->data;

		if (workbook_get_recalcmode (wb))
			workbook_recalc (wb);
	}

	gnm_app_recalc_finish ();
}
Ejemplo n.º 2
0
/*
 * colrow_autofit:
 * @sheet: the sheet to change
 * @range: the range to consider
 * @is_cols: TRUE for columns, FALSE for rows.
 * @ignore_strings: Don't consider cells with string values.
 * @min_current: Don't shrink below current size.
 * @min_default: Don't shrink below default size.
 * @indices: indices appropriate for colrow_restore_state_group.
 * @sizes: old sizes appropriate for colrow_restore_state_group.
 *
 * This function autofits columns or rows in @range as specified by
 * @is_cols.  Only cells in @range are considered for the sizing
 * and the size can be bounded below by current size and/or default
 * size.
 */
void
colrow_autofit (Sheet *sheet, const GnmRange *range, gboolean is_cols,
		gboolean ignore_strings,
		gboolean min_current, gboolean min_default,
		ColRowIndexList **indices,
		ColRowStateGroup **sizes)
{
	struct cb_autofit data;
	int a, b;
	ColRowCollection *crs;
	ColRowHandler handler;

	data.sheet = sheet;
	data.range = range;
	data.ignore_strings = ignore_strings;
	data.min_current = min_current;
	data.min_default = min_default;

	if (is_cols) {
		a = range->start.col;
		b = range->end.col;
		crs = &sheet->cols;
		handler = cb_autofit_col;
	} else {
		a = range->start.row;
		b = range->end.row;
		crs = &sheet->rows;
		handler = cb_autofit_row;
	}

	if (indices)
		*indices = colrow_get_index_list (a, b, NULL);
	if (sizes)
		*sizes = g_slist_prepend (NULL, colrow_get_states (sheet, is_cols, a, b));

	/* We potentially do a lot of recalcs as part of this, so make sure
	   stuff that caches sub-computations see the whole thing instead
	   of clearing between cells.  */
	gnm_app_recalc_start ();
	colrow_foreach (crs, a, b, handler, &data);
	gnm_app_recalc_finish ();
}