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