Update Spanish translation
[gnumeric.git] / src / validation.h
blob7e86b52feec993a99bb3a161781b62f58d9db4cb
1 #ifndef _GNM_VALIDATION_H_
2 # define _GNM_VALIDATION_H_
4 #include <gnumeric.h>
5 #include <dependent.h>
7 G_BEGIN_DECLS
9 typedef enum {
10 GNM_VALIDATION_STATUS_VALID, /* things validate */
11 GNM_VALIDATION_STATUS_INVALID_DISCARD, /* things do not validate and should be discarded */
12 GNM_VALIDATION_STATUS_INVALID_EDIT /* things do not validate and editing should continue */
13 } ValidationStatus;
14 typedef enum {
15 GNM_VALIDATION_STYLE_NONE,
16 GNM_VALIDATION_STYLE_STOP,
17 GNM_VALIDATION_STYLE_WARNING,
18 GNM_VALIDATION_STYLE_INFO,
19 GNM_VALIDATION_STYLE_PARSE_ERROR
20 } ValidationStyle;
21 typedef enum {
22 GNM_VALIDATION_TYPE_ANY,
23 GNM_VALIDATION_TYPE_AS_INT,
24 GNM_VALIDATION_TYPE_AS_NUMBER,
25 GNM_VALIDATION_TYPE_IN_LIST,
26 GNM_VALIDATION_TYPE_AS_DATE,
27 GNM_VALIDATION_TYPE_AS_TIME,
28 GNM_VALIDATION_TYPE_TEXT_LENGTH,
29 GNM_VALIDATION_TYPE_CUSTOM
30 } ValidationType;
31 typedef enum {
32 GNM_VALIDATION_OP_NONE = -1,
33 GNM_VALIDATION_OP_BETWEEN,
34 GNM_VALIDATION_OP_NOT_BETWEEN,
35 GNM_VALIDATION_OP_EQUAL,
36 GNM_VALIDATION_OP_NOT_EQUAL,
37 GNM_VALIDATION_OP_GT,
38 GNM_VALIDATION_OP_LT,
39 GNM_VALIDATION_OP_GTE,
40 GNM_VALIDATION_OP_LTE
41 } ValidationOp;
43 struct _GnmValidation {
44 int ref_count;
46 GOString *title;
47 GOString *msg;
48 GnmDependent deps[2];
49 ValidationStyle style;
50 ValidationType type;
51 ValidationOp op;
52 gboolean allow_blank;
53 gboolean use_dropdown;
56 GType gnm_validation_type_get_type (void);
57 #define GNM_VALIDATION_TYPE_TYPE (gnm_validation_type_get_type ())
59 GType gnm_validation_style_get_type (void);
60 #define GNM_VALIDATION_STYLE_TYPE (gnm_validation_style_get_type ())
62 GType gnm_validation_op_get_type (void);
63 #define GNM_VALIDATION_OP_TYPE (gnm_validation_op_get_type ())
66 GType gnm_validation_get_type (void);
67 GnmValidation *gnm_validation_new (ValidationStyle style,
68 ValidationType type,
69 ValidationOp op,
70 Sheet *sheet,
71 char const *title, char const *msg,
72 GnmExprTop const *texpr0,
73 GnmExprTop const *texpr1,
74 gboolean allow_blank,
75 gboolean use_dropdown);
76 GnmValidation *gnm_validation_dup (GnmValidation *v);
77 gboolean gnm_validation_equal (GnmValidation const *a,
78 GnmValidation const *b,
79 gboolean relax_sheet);
81 GnmValidation *gnm_validation_ref (GnmValidation const *v);
82 void gnm_validation_unref (GnmValidation const *v);
84 void gnm_validation_set_expr (GnmValidation *v,
85 GnmExprTop const *texpr, unsigned indx);
86 GError *gnm_validation_is_ok (GnmValidation const *v);
88 Sheet *gnm_validation_get_sheet (GnmValidation const *v);
89 void gnm_validation_set_sheet (GnmValidation *v, Sheet *sheet);
91 ValidationStatus gnm_validation_eval (WorkbookControl *wbc,
92 GnmStyle const *mstyle,
93 Sheet *sheet, GnmCellPos const *pos,
94 gboolean *showed_dialog);
95 ValidationStatus gnm_validation_eval_range (WorkbookControl *wbc,
96 Sheet *sheet,
97 GnmCellPos const *pos,
98 GnmRange const *r,
99 gboolean *showed_dialog);
101 G_END_DECLS
103 #endif /* _GNM_VALIDATION_H_ */