1 #ifndef _GNM_MSTYLE_H_ 2 # define _GNM_MSTYLE_H_ 3 4 #include <gnumeric.h> 5 #include <style.h> 6 7 G_BEGIN_DECLS 8 9 /* 10 * Keep element_size up to date. 11 * Keep header_style_equal when adding new types that would create an implicit header 12 * when sorting 13 */ 14 typedef enum { 15 /* Types that are visible in blank cells */ 16 MSTYLE_COLOR_BACK, /* marks a header */ 17 MSTYLE_COLOR_PATTERN, /* marks a header */ 18 19 MSTYLE_BORDER_TOP, 20 MSTYLE_BORDER_BOTTOM, /* marks a vertical header */ 21 MSTYLE_BORDER_LEFT, 22 MSTYLE_BORDER_RIGHT, /* marks a horizontal header */ 23 MSTYLE_BORDER_REV_DIAGONAL, 24 MSTYLE_BORDER_DIAGONAL, 25 26 MSTYLE_PATTERN, /* marks a header */ 27 /* Delimiter */ 28 MSTYLE_ELEMENT_MAX_BLANK = MSTYLE_PATTERN, 29 30 /* Normal types */ 31 MSTYLE_FONT_COLOR, /* marks a header */ 32 MSTYLE_FONT_NAME, /* marks a header */ 33 MSTYLE_FONT_BOLD, /* marks a header */ 34 MSTYLE_FONT_ITALIC, /* marks a header */ 35 MSTYLE_FONT_UNDERLINE, /* marks a header */ 36 MSTYLE_FONT_STRIKETHROUGH, /* marks a header */ 37 MSTYLE_FONT_SCRIPT, /* marks a header */ 38 MSTYLE_FONT_SIZE, /* marks a header */ 39 40 MSTYLE_FORMAT, /* marks a header */ 41 42 MSTYLE_ALIGN_V, /* marks a header */ 43 MSTYLE_ALIGN_H, /* marks a header */ 44 MSTYLE_INDENT, /* marks a header */ 45 MSTYLE_ROTATION, /* marks a header */ 46 MSTYLE_TEXT_DIR, /* marks a header */ 47 MSTYLE_WRAP_TEXT, /* marks a header */ 48 MSTYLE_SHRINK_TO_FIT, /* marks a header */ 49 50 MSTYLE_CONTENTS_LOCKED, 51 MSTYLE_CONTENTS_HIDDEN, 52 53 /* Things not in MS Excel's Style */ 54 MSTYLE_VALIDATION, 55 MSTYLE_HLINK, /* patch equal_XL if this is changed */ 56 MSTYLE_INPUT_MSG, /* patch equal_XL if this is changed */ 57 MSTYLE_CONDITIONS, /* patch equal_XL if this is changed */ 58 /* Delimiter */ 59 MSTYLE_ELEMENT_MAX 60 } GnmStyleElement; 61 62 GType gnm_style_get_type (void); 63 GnmStyle *gnm_style_new (void); 64 GnmStyle *gnm_style_new_default (void); 65 GnmStyle *gnm_style_new_merged (GnmStyle const *base, GnmStyle const *overlay); 66 GnmStyle *gnm_style_dup (GnmStyle const *src); 67 void gnm_style_merge (GnmStyle *base, GnmStyle const *overlay); 68 void gnm_style_merge_element (GnmStyle *dst, GnmStyle const *src, 69 GnmStyleElement elem); 70 GnmStyle *gnm_style_ref (GnmStyle const *style); 71 void gnm_style_unref (GnmStyle const *style); 72 73 GnmStyle *gnm_style_link_sheet (GnmStyle *style, Sheet *sheet); 74 void gnm_style_link (GnmStyle *style); 75 void gnm_style_unlink (GnmStyle *style); 76 void gnm_style_abandon_link (GnmStyle *style); 77 78 gboolean gnm_style_eq (GnmStyle const *a, GnmStyle const *b); 79 gboolean gnm_style_equal (GnmStyle const *a, GnmStyle const *b); 80 gboolean gnm_style_equal_XL (GnmStyle const *a, GnmStyle const *b); 81 gboolean gnm_style_equal_header (GnmStyle const *a, GnmStyle const *b, 82 gboolean top); 83 gboolean gnm_style_equal_elem (GnmStyle const *a, GnmStyle const *b, GnmStyleElement e); 84 85 guint gnm_style_hash (gconstpointer style); 86 guint gnm_style_hash_XL (gconstpointer style); 87 88 int gnm_style_cmp (GnmStyle const *a, GnmStyle const *b); 89 90 unsigned int gnm_style_find_conflicts (GnmStyle *accum, GnmStyle const *overlay, 91 unsigned int conflicts); 92 unsigned int gnm_style_find_differences (GnmStyle const *a, GnmStyle const *b, 93 gboolean relax_sheet); 94 95 gboolean gnm_style_is_complete (GnmStyle const *style); 96 gboolean gnm_style_is_element_set (GnmStyle const *style, GnmStyleElement elem); 97 void gnm_style_unset_element (GnmStyle *style, GnmStyleElement elem); 98 void gnm_style_set_font_color (GnmStyle *style, GnmColor *col); 99 void gnm_style_set_back_color (GnmStyle *style, GnmColor *col); 100 void gnm_style_set_pattern_color (GnmStyle *style, GnmColor *col); 101 GnmColor *gnm_style_get_font_color (GnmStyle const *style); 102 GnmColor *gnm_style_get_back_color (GnmStyle const *style); 103 GnmColor *gnm_style_get_pattern_color (GnmStyle const *style); 104 void gnm_style_set_border (GnmStyle *style, GnmStyleElement elem, 105 GnmBorder *border); 106 GnmBorder *gnm_style_get_border (GnmStyle const *style, GnmStyleElement elem); 107 void gnm_style_set_pattern (GnmStyle *style, int pattern); 108 int gnm_style_get_pattern (GnmStyle const *style); 109 void gnm_style_set_font_name (GnmStyle *style, char const *name); 110 char const *gnm_style_get_font_name (GnmStyle const *style); 111 void gnm_style_set_font_bold (GnmStyle *style, gboolean bold); 112 gboolean gnm_style_get_font_bold (GnmStyle const *style); 113 void gnm_style_set_font_italic (GnmStyle *style, gboolean italic); 114 gboolean gnm_style_get_font_italic (GnmStyle const *style); 115 void gnm_style_set_font_uline (GnmStyle *style, GnmUnderline ul); 116 GnmUnderline gnm_style_get_font_uline (GnmStyle const *style); 117 void gnm_style_set_font_strike (GnmStyle *style, gboolean strike); 118 gboolean gnm_style_get_font_strike (GnmStyle const *style); 119 void gnm_style_set_font_script (GnmStyle *style, GOFontScript script); 120 GOFontScript gnm_style_get_font_script (GnmStyle const *style); 121 void gnm_style_set_font_size (GnmStyle *style, double size); 122 double gnm_style_get_font_size (GnmStyle const *style); 123 124 GnmFont *gnm_style_get_font (GnmStyle const *style, 125 PangoContext *context); 126 void gnm_style_set_format (GnmStyle *style, GOFormat const *fmt); 127 void gnm_style_set_format_text (GnmStyle *style, char const *fmt); 128 GOFormat const*gnm_style_get_format (GnmStyle const *style); 129 void gnm_style_set_align_h (GnmStyle *style, GnmHAlign a); 130 GnmHAlign gnm_style_get_align_h (GnmStyle const *style); 131 void gnm_style_set_align_v (GnmStyle *style, GnmVAlign a); 132 GnmVAlign gnm_style_get_align_v (GnmStyle const *style); 133 void gnm_style_set_indent (GnmStyle *style, int i); 134 int gnm_style_get_indent (GnmStyle const *style); 135 136 /* -1 == vertical, 0..359 == rotation */ 137 void gnm_style_set_rotation (GnmStyle *style, int r); 138 int gnm_style_get_rotation (GnmStyle const *style); 139 void gnm_style_set_text_dir (GnmStyle *style, GnmTextDir text_dir); 140 GnmTextDir gnm_style_get_text_dir (GnmStyle const *style); 141 142 void gnm_style_set_wrap_text (GnmStyle *style, gboolean f); 143 gboolean gnm_style_get_wrap_text (GnmStyle const *style); 144 gboolean gnm_style_get_effective_wrap_text (GnmStyle const *style); 145 void gnm_style_set_shrink_to_fit (GnmStyle *style, gboolean f); 146 gboolean gnm_style_get_shrink_to_fit (GnmStyle const *style); 147 148 void gnm_style_set_contents_locked (GnmStyle *style, gboolean f); 149 gboolean gnm_style_get_contents_locked (GnmStyle const *style); 150 void gnm_style_set_contents_hidden (GnmStyle *style, gboolean f); 151 gboolean gnm_style_get_contents_hidden (GnmStyle const *style); 152 153 void gnm_style_set_validation (GnmStyle *style, GnmValidation *v); 154 GnmValidation const * 155 gnm_style_get_validation (GnmStyle const *style); 156 157 void gnm_style_set_hlink (GnmStyle *style, GnmHLink *lnk); 158 GnmHLink *gnm_style_get_hlink (GnmStyle const *style); 159 160 void gnm_style_set_input_msg (GnmStyle *style, GnmInputMsg *msg); 161 GnmInputMsg *gnm_style_get_input_msg (GnmStyle const *style); 162 163 void gnm_style_set_conditions (GnmStyle *style, GnmStyleConditions *sc); 164 GnmStyleConditions *gnm_style_get_conditions (GnmStyle const *style); 165 GnmStyle const * gnm_style_get_cond_style (GnmStyle const *style, int ix); 166 167 void gnm_style_link_dependents (GnmStyle *style, 168 GnmRange const *r); 169 void gnm_style_unlink_dependents (GnmStyle *style, 170 GnmRange const *r); 171 172 gboolean gnm_style_visible_in_blank (GnmStyle const *style); 173 174 PangoAttrList *gnm_style_generate_attrs_full (GnmStyle const *style); 175 PangoAttrList *gnm_style_get_pango_attrs (GnmStyle const *style, 176 PangoContext *context, 177 double zoom); 178 int gnm_style_get_pango_height (GnmStyle const *style, 179 PangoContext *context, 180 double zoom); 181 void gnm_style_set_from_pango_attribute (GnmStyle *style, 182 PangoAttribute const *attr); 183 184 void gnm_style_init (void); 185 void gnm_style_shutdown (void); 186 187 /* debug util */ 188 void gnm_style_dump (GnmStyle const *style); 189 190 G_END_DECLS 191 192 #endif /* _GNM_MSTYLE_H_ */ 193