Update Spanish translation
[gnumeric.git] / src / sheet-filter.h
blobe0aea5b1fd4e817d51ab811e5d7b0fbc2c09e167
1 #ifndef _GNM_SHEET_FILTER_H_
2 # define _GNM_SHEET_FILTER_H_
4 #include <gnumeric.h>
5 #include <goffice/goffice.h>
7 G_BEGIN_DECLS
9 typedef enum {
10 GNM_FILTER_UNUSED = -1,
12 GNM_FILTER_OP_EQUAL = 0, /* exact match, no regecxp */
13 GNM_FILTER_OP_GT,
14 GNM_FILTER_OP_LT,
15 GNM_FILTER_OP_GTE,
16 GNM_FILTER_OP_LTE,
17 GNM_FILTER_OP_NOT_EQUAL, /* exact match, no regecxp */
19 GNM_FILTER_OP_BLANKS = 0x20,
20 GNM_FILTER_OP_NON_BLANKS = 0x21,
22 GNM_FILTER_OP_TOP_N = 0x30,
23 GNM_FILTER_OP_BOTTOM_N = 0x31,
24 GNM_FILTER_OP_TOP_N_PERCENT = 0x32,
25 GNM_FILTER_OP_BOTTOM_N_PERCENT = 0x33,
26 /* Next two added in 1.11.6 */
27 GNM_FILTER_OP_TOP_N_PERCENT_N = 0x34,
28 GNM_FILTER_OP_BOTTOM_N_PERCENT_N = 0x35,
29 GNM_FILTER_OP_BOTTOM_MASK = 0x01,
30 GNM_FILTER_OP_REL_N_MASK = 0x04,
31 GNM_FILTER_OP_PERCENT_MASK = 0x06,
33 /* Added in 1.7.7 */
34 GNM_FILTER_OP_GT_AVERAGE = 0x40,
35 GNM_FILTER_OP_LT_AVERAGE = 0x41,
36 GNM_FILTER_OP_WITHIN_STDDEV = 0x50,
37 GNM_FILTER_OP_OUTSIDE_STDDEV = 0x51,
39 GNM_FILTER_OP_MATCH = 0x60, /* regexp */
40 GNM_FILTER_OP_NO_MATCH = 0x61, /* regexp */
42 GNM_FILTER_OP_TYPE_OP = 0x00,
43 GNM_FILTER_OP_TYPE_BLANKS = 0x20,
44 GNM_FILTER_OP_TYPE_BUCKETS = 0x30,
45 GNM_FILTER_OP_TYPE_AVERAGE = 0x40,
46 GNM_FILTER_OP_TYPE_STDDEV = 0x50,
47 GNM_FILTER_OP_TYPE_MATCH = 0x60,
48 GNM_FILTER_OP_TYPE_MASK = 0x70
49 } GnmFilterOp;
51 struct _GnmFilterCondition {
52 GnmFilterOp op[2];
53 GnmValue *value[2];
54 gboolean is_and;
55 double count;
58 struct _GnmFilter {
59 int ref_count;
60 Sheet *sheet;
61 GnmRange r;
63 GPtrArray *fields;
64 gboolean is_active;
67 GType gnm_filter_condition_get_type (void);
68 GnmFilterCondition *gnm_filter_condition_dup (GnmFilterCondition const *src);
69 void gnm_filter_condition_free (GnmFilterCondition *cond);
70 GnmFilterCondition *gnm_filter_condition_new_single (GnmFilterOp op, GnmValue *v);
71 GnmFilterCondition *gnm_filter_condition_new_double (GnmFilterOp op0, GnmValue *v0,
72 gboolean join_with_and,
73 GnmFilterOp op1, GnmValue *v1);
74 GnmFilterCondition *gnm_filter_condition_new_bucket (gboolean top,
75 gboolean absolute,
76 gboolean rel_range,
77 double n);
79 GType gnm_filter_get_type (void);
80 GnmFilter *gnm_filter_new (Sheet *sheet, GnmRange const *r);
81 GnmFilter *gnm_filter_dup (GnmFilter const *src,
82 Sheet *sheet);
83 GnmFilter * gnm_filter_ref (GnmFilter *filter);
84 void gnm_filter_unref (GnmFilter *filter);
85 void gnm_filter_remove (GnmFilter *filter);
86 void gnm_filter_attach (GnmFilter *filter, Sheet *sheet);
87 GnmFilterCondition const *gnm_filter_get_condition (GnmFilter const *filter, unsigned i);
88 void gnm_filter_set_condition (GnmFilter *filter, unsigned i,
89 GnmFilterCondition *cond,
90 gboolean apply);
91 void gnm_filter_reapply (GnmFilter *filter);
93 GnmFilter *gnm_sheet_filter_at_pos (Sheet const *sheet, GnmCellPos const *pos);
94 GnmFilter *gnm_sheet_filter_intersect_rows (Sheet const *sheet,
95 int from, int to);
96 GnmRange *gnm_sheet_filter_can_be_extended (Sheet const *sheet,
97 GnmFilter const *f,
98 GnmRange const *r);
99 void gnm_sheet_filter_insdel_colrow (Sheet *sheet,
100 gboolean is_cols, gboolean is_insert,
101 int start, int count,
102 GOUndo **pundo);
104 G_END_DECLS
106 #endif /* _GNM_SHEET_FILTER_H_ */