static void filter (data_analysis_output_t *dao, Sheet *sheet, GSList *rows, gint input_col_b, gint input_col_e, gint input_row_b, gint input_row_e) { GnmCell *cell; int i, r=0; if (dao->type == InPlaceOutput) { sheet->has_filtered_rows = TRUE; colrow_set_visibility (sheet, FALSE, FALSE, input_row_b+1, input_row_e); for (i=input_row_b; i<=input_row_e; i++) { ColRowInfo *ri = sheet_row_fetch (sheet, i); ri->in_advanced_filter = TRUE; } while (rows != NULL) { const gint *row = rows->data; colrow_set_visibility (sheet, FALSE, TRUE, *row, *row); rows = rows->next; } sheet_redraw_all (sheet, TRUE); /* FIXME: what happens if we just have hidden the selection? */ } else { for (i=input_col_b; i<=input_col_e; i++) { cell = sheet_cell_get (sheet, i, input_row_b); if (cell == NULL) dao_set_cell (dao, i - input_col_b, r, NULL); else { GnmValue *value = value_dup (cell->value); dao_set_cell_value (dao, i - input_col_b, r, value); } } ++r; while (rows != NULL) { const gint *row = rows->data; for (i=input_col_b; i<=input_col_e; i++) { cell = sheet_cell_get (sheet, i, *row); if (cell == NULL) dao_set_cell (dao, i - input_col_b, r, NULL); else { GnmValue *value = value_dup (cell->value); dao_set_cell_value (dao, i - input_col_b, r, value); } } ++r; rows = rows->next; } } }
static gboolean cb_show_all (GnmColRowIter const *iter, Sheet *sheet) { if (iter->cri->in_advanced_filter) { ColRowInfo *ri = sheet_row_fetch (sheet, iter->pos); if (!iter->cri->visible) colrow_set_visibility (sheet, FALSE, TRUE, iter->pos, iter->pos); ri->in_advanced_filter = FALSE; } return FALSE; }
/* * colrow_set_visibility_list : * * This is the high level command that is wrapped by undo and redo. * It should not be called by other commands. */ void colrow_set_visibility_list (Sheet *sheet, gboolean is_cols, gboolean visible, ColRowVisList *list) { ColRowVisList *ptr; ColRowIndex *info; for (ptr = list; ptr != NULL ; ptr = ptr->next) { info = ptr->data; colrow_set_visibility (sheet, is_cols, visible, info->first, info->last); } if (visible) sheet_colrow_optimize (sheet); if (is_cols) sheet_queue_respan (sheet, 0, gnm_sheet_get_last_row (sheet)); if (list != NULL) sheet_redraw_all (sheet, TRUE); }