Move plugin init code
[gnumeric.git] / src / mstyle.h
blob72bc355289ceebbdd5100c2f20a7012bda268f62
1 #ifndef _GNM_MSTYLE_H_
2 # define _GNM_MSTYLE_H_
4 #include <gnumeric.h>
5 #include <style.h>
7 G_BEGIN_DECLS
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
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 */
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,
26 MSTYLE_PATTERN, /* marks a header */
27 /* Delimiter */
28 MSTYLE_ELEMENT_MAX_BLANK = MSTYLE_PATTERN,
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 */
40 MSTYLE_FORMAT, /* marks a header */
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 */
50 MSTYLE_CONTENTS_LOCKED,
51 MSTYLE_CONTENTS_HIDDEN,
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;
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);
73 GnmStyle *gnm_style_link_sheet (GnmStyle *style, Sheet *sheet);
74 void gnm_style_link (GnmStyle *style);
75 void gnm_style_link_multiple (GnmStyle *style, int count);
76 void gnm_style_unlink (GnmStyle *style);
77 void gnm_style_abandon_link (GnmStyle *style);
79 gboolean gnm_style_eq (GnmStyle const *a, GnmStyle const *b);
80 gboolean gnm_style_equal (GnmStyle const *a, GnmStyle const *b);
81 gboolean gnm_style_equal_XL (GnmStyle const *a, GnmStyle const *b);
82 gboolean gnm_style_equal_header (GnmStyle const *a, GnmStyle const *b,
83 gboolean top);
84 gboolean gnm_style_equal_elem (GnmStyle const *a, GnmStyle const *b, GnmStyleElement e);
86 guint gnm_style_hash (gconstpointer style);
87 guint gnm_style_hash_XL (gconstpointer style);
89 int gnm_style_cmp (GnmStyle const *a, GnmStyle const *b);
91 unsigned int gnm_style_find_conflicts (GnmStyle *accum, GnmStyle const *overlay,
92 unsigned int conflicts);
93 unsigned int gnm_style_find_differences (GnmStyle const *a, GnmStyle const *b,
94 gboolean relax_sheet);
96 gboolean gnm_style_is_complete (GnmStyle const *style);
97 gboolean gnm_style_is_element_set (GnmStyle const *style, GnmStyleElement elem);
98 void gnm_style_unset_element (GnmStyle *style, GnmStyleElement elem);
99 void gnm_style_set_font_color (GnmStyle *style, GnmColor *col);
100 void gnm_style_set_back_color (GnmStyle *style, GnmColor *col);
101 void gnm_style_set_pattern_color (GnmStyle *style, GnmColor *col);
102 GnmColor *gnm_style_get_font_color (GnmStyle const *style);
103 GnmColor *gnm_style_get_back_color (GnmStyle const *style);
104 GnmColor *gnm_style_get_pattern_color (GnmStyle const *style);
105 void gnm_style_set_border (GnmStyle *style, GnmStyleElement elem,
106 GnmBorder *border);
107 GnmBorder *gnm_style_get_border (GnmStyle const *style, GnmStyleElement elem);
108 void gnm_style_set_pattern (GnmStyle *style, int pattern);
109 int gnm_style_get_pattern (GnmStyle const *style);
110 void gnm_style_set_font_name (GnmStyle *style, char const *name);
111 char const *gnm_style_get_font_name (GnmStyle const *style);
112 void gnm_style_set_font_bold (GnmStyle *style, gboolean bold);
113 gboolean gnm_style_get_font_bold (GnmStyle const *style);
114 void gnm_style_set_font_italic (GnmStyle *style, gboolean italic);
115 gboolean gnm_style_get_font_italic (GnmStyle const *style);
116 void gnm_style_set_font_uline (GnmStyle *style, GnmUnderline ul);
117 GnmUnderline gnm_style_get_font_uline (GnmStyle const *style);
118 void gnm_style_set_font_strike (GnmStyle *style, gboolean strike);
119 gboolean gnm_style_get_font_strike (GnmStyle const *style);
120 void gnm_style_set_font_script (GnmStyle *style, GOFontScript script);
121 GOFontScript gnm_style_get_font_script (GnmStyle const *style);
122 void gnm_style_set_font_size (GnmStyle *style, double size);
123 double gnm_style_get_font_size (GnmStyle const *style);
125 GnmFont *gnm_style_get_font (GnmStyle const *style,
126 PangoContext *context);
127 void gnm_style_set_format (GnmStyle *style, GOFormat const *fmt);
128 void gnm_style_set_format_text (GnmStyle *style, char const *fmt);
129 GOFormat const*gnm_style_get_format (GnmStyle const *style);
130 void gnm_style_set_align_h (GnmStyle *style, GnmHAlign a);
131 GnmHAlign gnm_style_get_align_h (GnmStyle const *style);
132 void gnm_style_set_align_v (GnmStyle *style, GnmVAlign a);
133 GnmVAlign gnm_style_get_align_v (GnmStyle const *style);
134 void gnm_style_set_indent (GnmStyle *style, int i);
135 int gnm_style_get_indent (GnmStyle const *style);
137 /* -1 == vertical, 0..359 == rotation */
138 void gnm_style_set_rotation (GnmStyle *style, int r);
139 int gnm_style_get_rotation (GnmStyle const *style);
140 void gnm_style_set_text_dir (GnmStyle *style, GnmTextDir text_dir);
141 GnmTextDir gnm_style_get_text_dir (GnmStyle const *style);
143 void gnm_style_set_wrap_text (GnmStyle *style, gboolean f);
144 gboolean gnm_style_get_wrap_text (GnmStyle const *style);
145 gboolean gnm_style_get_effective_wrap_text (GnmStyle const *style);
146 void gnm_style_set_shrink_to_fit (GnmStyle *style, gboolean f);
147 gboolean gnm_style_get_shrink_to_fit (GnmStyle const *style);
149 void gnm_style_set_contents_locked (GnmStyle *style, gboolean f);
150 gboolean gnm_style_get_contents_locked (GnmStyle const *style);
151 void gnm_style_set_contents_hidden (GnmStyle *style, gboolean f);
152 gboolean gnm_style_get_contents_hidden (GnmStyle const *style);
154 void gnm_style_set_validation (GnmStyle *style, GnmValidation *v);
155 GnmValidation const *
156 gnm_style_get_validation (GnmStyle const *style);
158 void gnm_style_set_hlink (GnmStyle *style, GnmHLink *lnk);
159 GnmHLink *gnm_style_get_hlink (GnmStyle const *style);
161 void gnm_style_set_input_msg (GnmStyle *style, GnmInputMsg *msg);
162 GnmInputMsg *gnm_style_get_input_msg (GnmStyle const *style);
164 void gnm_style_set_conditions (GnmStyle *style, GnmStyleConditions *sc);
165 GnmStyleConditions *gnm_style_get_conditions (GnmStyle const *style);
166 GnmStyle const * gnm_style_get_cond_style (GnmStyle const *style, int ix);
168 void gnm_style_link_dependents (GnmStyle *style,
169 GnmRange const *r);
170 void gnm_style_unlink_dependents (GnmStyle *style,
171 GnmRange const *r);
173 gboolean gnm_style_visible_in_blank (GnmStyle const *style);
175 PangoAttrList *gnm_style_generate_attrs_full (GnmStyle const *style);
176 PangoAttrList *gnm_style_get_pango_attrs (GnmStyle const *style,
177 PangoContext *context,
178 double zoom);
179 int gnm_style_get_pango_height (GnmStyle const *style,
180 PangoContext *context,
181 double zoom);
182 void gnm_style_set_from_pango_attribute (GnmStyle *style,
183 PangoAttribute const *attr);
185 void gnm_style_init (void);
186 void gnm_style_shutdown (void);
188 /* debug util */
189 void gnm_style_dump (GnmStyle const *style);
191 G_END_DECLS
193 #endif /* _GNM_MSTYLE_H_ */