1 module libxlsxd.chartsheet;
2 
3 import libxlsxd.xlsxwrap;
4 
5 struct Chartsheet {
6 	import libxlsxd.chart;
7 	import std.exception : enforce;
8 	import std.string : toStringz;
9 
10 	lxw_chartsheet* handle;
11 
12 	this(lxw_chartsheet* handle) @nogc nothrow pure @safe {
13 		this.handle = handle;
14 	}
15 
16 	void setChart(Chart c) {
17 		enforce(chartsheet_set_chart(this.handle, c.handle)
18 				== LXW_NO_ERROR
19 			);
20 	}
21 
22 	void setChartOpt(Chart chart, lxw_image_options* opt) {
23 		enforce(chartsheet_set_chart_opt(this.handle, chart.handle, opt)
24 				== LXW_NO_ERROR
25 			);
26 	}
27 
28 	void activate() nothrow @nogc {
29 		chartsheet_activate(this.handle);
30 	}
31 
32 	void select() nothrow @nogc {
33 		chartsheet_select(this.handle);
34 	}
35 
36 	void hide() nothrow @nogc {
37 		chartsheet_hide(this.handle);
38 	}
39 
40 	void setFirstSheet() nothrow @nogc {
41 		chartsheet_set_first_sheet(this.handle);
42 	}
43 
44 	void setTabColor(lxw_color_t color) nothrow @nogc {
45 		chartsheet_set_tab_color(this.handle, color);
46 	}
47 
48 	void protect(string password, lxw_protection* option) {
49 		chartsheet_protect(this.handle, toStringz(password), option);
50 	}
51 
52 	void setZoom(ushort zoom) nothrow @nogc {
53 		chartsheet_set_zoom(this.handle, zoom);
54 	}
55 
56 	void setLandscape() nothrow @nogc {
57 		chartsheet_set_landscape(this.handle);
58 	}
59 
60 	void setPortrait() nothrow @nogc {
61 		chartsheet_set_portrait(this.handle);
62 	}
63 
64 	void setPaper(ubyte paper) nothrow @nogc {
65 		chartsheet_set_paper(this.handle, paper);
66 	}
67 
68 	void setMargins(double left, double right, double top, double bottom)
69 			nothrow @nogc 
70 	{
71 		chartsheet_set_margins(this.handle, left, right, top, bottom);
72 	}
73 
74 	void setHeader(string header) {
75 		enforce(chartsheet_set_header(this.handle, toStringz(header))
76 				== LXW_NO_ERROR
77 			);
78 	}
79 
80 	void setFooter(string footer) {
81 		enforce(chartsheet_set_footer(this.handle, toStringz(footer))
82 				== LXW_NO_ERROR
83 			);
84 	}
85 
86 	void setHeaderOpt(string header, lxw_header_footer_options* opt) {
87 		enforce(chartsheet_set_header_opt(this.handle, toStringz(header), opt)
88 				== LXW_NO_ERROR
89 			);
90 	}
91 
92 	void setFooterOpt(string footer, lxw_header_footer_options* opt) {
93 		enforce(chartsheet_set_footer_opt(this.handle, toStringz(footer), opt)
94 				== LXW_NO_ERROR
95 			);
96 	}
97 
98 	void free() nothrow @nogc {
99 		lxw_chartsheet_free(this.handle);
100 	}
101 
102 	void assembleXmlFile() nothrow @nogc {
103 		lxw_chartsheet_assemble_xml_file(this.handle);
104 	}
105 }