1 #ifndef _GNM_STYLE_CONDITIONS_H_ 2 # define _GNM_STYLE_CONDITIONS_H_ 3 4 #include <gnumeric.h> 5 #include <dependent.h> 6 7 G_BEGIN_DECLS 8 9 // The values here are persisted directly in .gnumeric files as numbers. 10 // DO NOT REMOVE OR REORDER ANYTHING 11 typedef enum { 12 /* Cell Value */ 13 GNM_STYLE_COND_BETWEEN, 14 GNM_STYLE_COND_NOT_BETWEEN, 15 GNM_STYLE_COND_EQUAL, 16 GNM_STYLE_COND_NOT_EQUAL, 17 GNM_STYLE_COND_GT, 18 GNM_STYLE_COND_LT, 19 GNM_STYLE_COND_GTE, 20 GNM_STYLE_COND_LTE, 21 22 /* Arbitrary expr evaluated at EvalPos */ 23 GNM_STYLE_COND_CUSTOM, 24 25 /* New in Gnumeric 1.8 */ 26 GNM_STYLE_COND_CONTAINS_STR = 0x10, 27 GNM_STYLE_COND_NOT_CONTAINS_STR, 28 GNM_STYLE_COND_BEGINS_WITH_STR, 29 GNM_STYLE_COND_NOT_BEGINS_WITH_STR, 30 GNM_STYLE_COND_ENDS_WITH_STR, 31 GNM_STYLE_COND_NOT_ENDS_WITH_STR, 32 33 GNM_STYLE_COND_CONTAINS_ERR, 34 GNM_STYLE_COND_NOT_CONTAINS_ERR, 35 36 GNM_STYLE_COND_CONTAINS_BLANKS, 37 GNM_STYLE_COND_NOT_CONTAINS_BLANKS 38 } GnmStyleCondOp; 39 40 typedef struct { 41 GnmDependent base; 42 GnmCellPos pos; 43 GnmDependent *dep_cont; 44 } GnmStyleCondDep; 45 46 typedef struct { 47 GnmStyle *overlay; 48 GnmStyleCondDep deps[2]; 49 GnmStyleCondOp op; 50 } GnmStyleCond; 51 52 GType gnm_style_cond_get_type (void); 53 GnmStyleCond *gnm_style_cond_new (GnmStyleCondOp op, Sheet *sheet); 54 void gnm_style_cond_free (GnmStyleCond *cond); 55 gboolean gnm_style_cond_is_valid (GnmStyleCond const *cond); 56 57 void gnm_style_cond_set_overlay (GnmStyleCond *cond, 58 GnmStyle *overlay); 59 60 GnmExprTop const *gnm_style_cond_get_expr (GnmStyleCond const *cond, 61 unsigned idx); 62 void gnm_style_cond_set_expr (GnmStyleCond *cond, 63 GnmExprTop const *texpr, 64 unsigned idx); 65 66 GnmExprTop const *gnm_style_cond_get_alternate_expr (GnmStyleCond const *cond); 67 void gnm_style_cond_canonicalize (GnmStyleCond *cond); 68 69 Sheet *gnm_style_cond_get_sheet (GnmStyleCond const *cond); 70 char *gnm_style_cond_as_string (GnmStyleCond const *cond); 71 72 73 74 75 GType gnm_style_conditions_get_type (void); 76 GnmStyleConditions *gnm_style_conditions_new (Sheet *sheet); 77 GnmStyleConditions *gnm_style_conditions_dup (GnmStyleConditions const *sc); 78 GnmStyleConditions *gnm_style_conditions_dup_to (GnmStyleConditions const *sc, Sheet *sheet); 79 GPtrArray const *gnm_style_conditions_details (GnmStyleConditions const *sc); 80 void gnm_style_conditions_insert (GnmStyleConditions *sc, 81 GnmStyleCond const *cond, 82 int pos); 83 void gnm_style_conditions_delete (GnmStyleConditions *sc, 84 guint pos); 85 GPtrArray *gnm_style_conditions_overlay (GnmStyleConditions const *sc, 86 GnmStyle const *base); 87 int gnm_style_conditions_eval (GnmStyleConditions const *sc, 88 GnmEvalPos const *pos); 89 90 Sheet *gnm_style_conditions_get_sheet (GnmStyleConditions const *sc); 91 92 guint32 gnm_style_conditions_hash (GnmStyleConditions const *sc); 93 94 gboolean gnm_style_conditions_equal (GnmStyleConditions const *sca, 95 GnmStyleConditions const *scb, 96 gboolean relax_sheet); 97 98 GnmCellPos const *gnm_style_conditions_get_pos (GnmStyleConditions const *sc); 99 void gnm_style_conditions_set_pos (GnmStyleConditions *sc, 100 GnmCellPos const *pos); 101 102 G_END_DECLS 103 104 #endif /* _GNM_STYLE_CONDITIONS_H_ */ 105