1 module libxlsxd.format;
2 
3 import libxlsxd.xlsxwrap;
4 
5 Format newFormat() {
6 	return Format(lxw_format_new());
7 }
8 
9 void freeFormat(Format format) {
10 	lxw_format_free(format.handle);
11 }
12 
13 struct Format {
14 	import std.string : toStringz;
15 	lxw_format* handle;
16 
17 	this(lxw_format* handle) pure @nogc nothrow {
18 		this.handle = handle;
19 	}
20 
21 	int getXfIndex() @nogc nothrow {
22 		return lxw_format_get_xf_index(this.handle);
23 	}
24 
25 	lxw_font* getFontKey() @nogc nothrow {
26 		return lxw_format_get_font_key(this.handle);
27 	}
28 
29 	lxw_border* getBorderKey() @nogc nothrow {
30 		return lxw_format_get_border_key(this.handle);
31 	}
32 
33 	lxw_fill* getFillKey() @nogc nothrow {
34 		return lxw_format_get_fill_key(this.handle);
35 	}
36 
37 	static lxw_color_t checkColor(lxw_color_t color) @nogc nothrow {
38 		return lxw_format_check_color(color);
39 	}
40 
41 	void setFontName(string fontname) nothrow {
42 		format_set_font_name(this.handle, toStringz(fontname));
43 	}
44 
45 	void setFontSize(double size) @nogc nothrow {
46 		format_set_font_size(this.handle, size);
47 	}
48 
49 	void setFontColor(lxw_color_t color) @nogc nothrow {
50 		format_set_font_color(this.handle, color);
51 	}
52 
53 	void setBold() @nogc nothrow {
54 		format_set_bold(this.handle);
55 	}
56 
57 	void setItalic() @nogc nothrow {
58 		format_set_italic(this.handle);
59 	}
60 
61 	void setUnderline(ubyte style) @nogc nothrow {
62 		format_set_underline(this.handle, style);
63 	}
64 
65 	void setFontStrikeout() @nogc nothrow {
66 		format_set_font_strikeout(this.handle);
67 	}
68 
69 	void setFontScript(ubyte style) @nogc nothrow {
70 		format_set_font_script(this.handle, style);
71 	}
72 
73 	void setNumFormat(string numFormat) nothrow {
74 		format_set_num_format(this.handle, toStringz(numFormat));
75 	}
76 
77 	void setNumFormatIndex(ubyte index) @nogc nothrow {
78 		format_set_num_format_index(this.handle, index);
79 	}
80 
81 	void setUnlocked() @nogc nothrow {
82 		format_set_unlocked(this.handle);
83 	}
84 
85 	void setHidden() @nogc nothrow {
86 		format_set_hidden(this.handle);
87 	}
88 
89 	void setAlign(ubyte align_) @nogc nothrow {
90 		format_set_align(this.handle, align_);
91 	}
92 
93 	void setTextWrap() @nogc nothrow {
94 		format_set_text_wrap(this.handle);
95 	}
96 
97 	void setRotation(short angle) @nogc nothrow {
98 		format_set_rotation(this.handle, angle);
99 	}
100 
101 	void setIndent(ubyte level) @nogc nothrow {
102 		format_set_indent(this.handle, level);
103 	}
104 
105 	void setShrink() @nogc nothrow {
106 		format_set_shrink(this.handle);
107 	}
108 
109 	void setPattern(ubyte pattern) @nogc nothrow {
110 		format_set_pattern(this.handle, pattern);
111 	}
112 
113 	void setBgColor(lxw_color_t color) @nogc nothrow {
114 		format_set_bg_color(this.handle, color);
115 	}
116 
117 	void setFgColor(lxw_color_t color) @nogc nothrow {
118 		format_set_fg_color(this.handle, color);
119 	}
120 
121 	void setBorder(ubyte border) @nogc nothrow {
122 		format_set_border(this.handle, border);
123 	}
124 
125 	void setBottom(ubyte bottom) @nogc nothrow {
126 		format_set_bottom(this.handle, bottom);
127 	}
128 
129 	void setTop(ubyte top) @nogc nothrow {
130 		format_set_top(this.handle, top);
131 	}
132 
133 	void setLeft(ubyte left) @nogc nothrow {
134 		format_set_left(this.handle, left);
135 	}
136 
137 	void setRight(ubyte right) @nogc nothrow {
138 		format_set_right(this.handle, right);
139 	}
140 
141 	void setBorderColor(lxw_color_t color) @nogc nothrow {
142 		format_set_border_color(this.handle, color);
143 	}
144 
145 	void setBottomColor(lxw_color_t color) @nogc nothrow {
146 		format_set_bottom_color(this.handle, color);
147 	}
148 
149 	void setTopColor(lxw_color_t color) @nogc nothrow {
150 		format_set_top_color(this.handle, color);
151 	}
152 
153 	void setLeftColor(lxw_color_t color) @nogc nothrow {
154 		format_set_left_color(this.handle, color);
155 	}
156 
157 	void setRightColor(lxw_color_t color) @nogc nothrow {
158 		format_set_right_color(this.handle, color);
159 	}
160 
161 	void setDiagType(ubyte type) @nogc nothrow {
162 		format_set_diag_type(this.handle, type);
163 	}
164 
165 	void setDiagColor(lxw_color_t color) @nogc nothrow {
166 		format_set_diag_color(this.handle, color);
167 	}
168 
169 	void setDiagBorder(ubyte border) @nogc nothrow {
170 		format_set_diag_border(this.handle, border);
171 	}
172 
173 	void setFontOutline() @nogc nothrow {
174 		format_set_font_outline(this.handle);
175 	}
176 
177 	void setFontShadow() @nogc nothrow {
178 		format_set_font_shadow(this.handle);
179 	}
180 
181 	void setFontFamily(ubyte family) @nogc nothrow {
182 		format_set_font_family(this.handle, family);
183 	}
184 
185 	void setFontCharset(ubyte charset) @nogc nothrow {
186 		format_set_font_charset(this.handle, charset);
187 	}
188 
189 	void setFontScheme(string schema) nothrow {
190 		format_set_font_scheme(this.handle, toStringz(schema));
191 	}
192 
193 	void setFontCondense() @nogc nothrow {
194 		format_set_font_condense(this.handle);
195 	}
196 
197 	void setFontExtend() @nogc nothrow {
198 		format_set_font_extend(this.handle);
199 	}
200 
201 	void setReadingOrder(ubyte order) @nogc nothrow {
202 		format_set_reading_order(this.handle, order);
203 	}
204 
205 	void setTheme(ubyte theme) @nogc nothrow {
206 		format_set_theme(this.handle, theme);
207 	}
208 }