1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_SELECTION_H_
3 # define _GNM_SELECTION_H_
6 #include <goffice/goffice.h>
12 COL_ROW_PARTIAL_SELECTION
,
13 COL_ROW_FULL_SELECTION
14 } ColRowSelectionType
;
17 GNM_SELECTION_MODE_ADD
= 0,
18 GNM_SELECTION_MODE_REMOVE
,
19 GNM_SELECTION_MODE_TOGGLE
22 /* Selection information */
23 GnmCellPos
const *sv_is_singleton_selected (SheetView
const *sv
);
24 gboolean
sv_is_pos_selected (SheetView
const *sv
, int col
, int row
);
25 gboolean
sv_is_range_selected (SheetView
const *sv
, GnmRange
const *r
);
26 gboolean
sv_is_full_range_selected (SheetView
const *sv
, GnmRange
const *r
);
27 gboolean
sv_is_colrow_selected (SheetView
const *sv
,
28 int colrow
, gboolean is_col
);
29 gboolean
sv_is_full_colrow_selected (SheetView
const *sv
,
30 gboolean is_cols
, int index
);
31 ColRowSelectionType
sv_selection_col_type (SheetView
const *sv
, int col
);
32 ColRowSelectionType
sv_selection_row_type (SheetView
const *sv
, int row
);
34 char *selection_to_string (SheetView
*sv
,
35 gboolean include_sheet_name_prefix
);
36 GnmRange
const *selection_first_range (SheetView
const *sv
,
37 GOCmdContext
*cc
, char const *cmd_name
);
38 GSList
*selection_get_ranges (SheetView
const *sv
,
39 gboolean allow_intersection
);
41 void sv_selection_to_plot (SheetView
*sv
, GogPlot
*plot
);
43 /* Selection management */
44 void sv_selection_reset (SheetView
*sv
);
45 void sv_selection_add_pos (SheetView
*sv
, int col
, int row
, GnmSelectionMode mode
);
46 void sv_selection_add_range (SheetView
*sv
, GnmRange
const *range
);
47 void sv_selection_add_full (SheetView
*sv
,
48 int edit_col
, int edit_row
,
49 int base_col
, int base_row
,
50 int move_col
, int move_row
,
51 GnmSelectionMode mode
);
52 void sv_selection_set (SheetView
*sv
, GnmCellPos
const *edit
,
53 int base_col
, int base_row
,
54 int move_col
, int move_row
);
55 void sv_selection_extend_to (SheetView
*sv
, int col
, int row
);
56 void sv_selection_free (SheetView
*sv
);
57 void sv_selection_simplified_free (SheetView
*sv
);
58 void sv_selection_simplify (SheetView
*sv
);
60 void sv_selection_walk_step (SheetView
*sv
,
64 /* Utilities for operating on a selection */
65 typedef void (*SelectionApplyFunc
) (SheetView
*sv
, GnmRange
const *r
,
67 typedef gboolean (*GnmSelectionFunc
) (SheetView
*sv
, GnmRange
const *r
,
70 void sv_selection_apply (SheetView
*sv
, SelectionApplyFunc
const func
,
71 gboolean allow_intersection
,
73 gboolean
sv_selection_foreach (SheetView
*sv
,
74 GnmSelectionFunc handler
,
79 #endif /* _GNM_SELECTION_H_ */