1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_VALIDATION_H_
3 # define _GNM_VALIDATION_H_
11 GNM_VALIDATION_STATUS_VALID
, /* things validate */
12 GNM_VALIDATION_STATUS_INVALID_DISCARD
, /* things do not validate and should be discarded */
13 GNM_VALIDATION_STATUS_INVALID_EDIT
/* things do not validate and editing should continue */
16 GNM_VALIDATION_STYLE_NONE
,
17 GNM_VALIDATION_STYLE_STOP
,
18 GNM_VALIDATION_STYLE_WARNING
,
19 GNM_VALIDATION_STYLE_INFO
,
20 GNM_VALIDATION_STYLE_PARSE_ERROR
23 GNM_VALIDATION_TYPE_ANY
,
24 GNM_VALIDATION_TYPE_AS_INT
,
25 GNM_VALIDATION_TYPE_AS_NUMBER
,
26 GNM_VALIDATION_TYPE_IN_LIST
,
27 GNM_VALIDATION_TYPE_AS_DATE
,
28 GNM_VALIDATION_TYPE_AS_TIME
,
29 GNM_VALIDATION_TYPE_TEXT_LENGTH
,
30 GNM_VALIDATION_TYPE_CUSTOM
33 GNM_VALIDATION_OP_NONE
= -1,
34 GNM_VALIDATION_OP_BETWEEN
,
35 GNM_VALIDATION_OP_NOT_BETWEEN
,
36 GNM_VALIDATION_OP_EQUAL
,
37 GNM_VALIDATION_OP_NOT_EQUAL
,
40 GNM_VALIDATION_OP_GTE
,
44 struct _GnmValidation
{
50 ValidationStyle style
;
54 gboolean use_dropdown
;
57 GType
gnm_validation_type_get_type (void);
58 #define GNM_VALIDATION_TYPE_TYPE (gnm_validation_type_get_type ())
60 GType
gnm_validation_style_get_type (void);
61 #define GNM_VALIDATION_STYLE_TYPE (gnm_validation_style_get_type ())
63 GType
gnm_validation_op_get_type (void);
64 #define GNM_VALIDATION_OP_TYPE (gnm_validation_op_get_type ())
67 GType
gnm_validation_get_type (void);
68 GnmValidation
*gnm_validation_new (ValidationStyle style
,
72 char const *title
, char const *msg
,
73 GnmExprTop
const *texpr0
,
74 GnmExprTop
const *texpr1
,
76 gboolean use_dropdown
);
77 GnmValidation
*gnm_validation_dup (GnmValidation
*v
);
78 gboolean
gnm_validation_equal (GnmValidation
const *a
,
79 GnmValidation
const *b
,
80 gboolean relax_sheet
);
82 GnmValidation
*gnm_validation_ref (GnmValidation
const *v
);
83 void gnm_validation_unref (GnmValidation
const *v
);
85 void gnm_validation_set_expr (GnmValidation
*v
,
86 GnmExprTop
const *texpr
, unsigned indx
);
87 GError
*gnm_validation_is_ok (GnmValidation
const *v
);
89 Sheet
*gnm_validation_get_sheet (GnmValidation
const *v
);
90 void gnm_validation_set_sheet (GnmValidation
*v
, Sheet
*sheet
);
92 ValidationStatus
gnm_validation_eval (WorkbookControl
*wbc
,
93 GnmStyle
const *mstyle
,
94 Sheet
*sheet
, GnmCellPos
const *pos
,
95 gboolean
*showed_dialog
);
96 ValidationStatus
gnm_validation_eval_range (WorkbookControl
*wbc
,
98 GnmCellPos
const *pos
,
100 gboolean
*showed_dialog
);
104 #endif /* _GNM_VALIDATION_H_ */