Orcus
types.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
7 
8 #ifndef ORCUS_SPREADSHEET_TYPES_HPP
9 #define ORCUS_SPREADSHEET_TYPES_HPP
10 
11 #include "orcus/env.hpp"
12 #include <cstdlib>
13 #include <cstdint>
14 #include <iosfwd>
15 
16 // NB: This header should only use primitive data types and enums.
17 
18 namespace orcus { namespace spreadsheet {
19 
20 typedef int32_t row_t;
21 typedef int32_t col_t;
22 typedef int32_t sheet_t;
23 typedef uint8_t color_elem_t;
24 typedef uint16_t col_width_t;
25 typedef uint16_t row_height_t;
26 
27 typedef uint32_t pivot_cache_id_t;
28 
29 ORCUS_DLLPUBLIC col_width_t get_default_column_width();
30 ORCUS_DLLPUBLIC row_height_t get_default_row_height();
31 
32 enum class error_value_t
33 {
34  unknown = 0,
35  null, // #NULL!
36  div0, // #DIV/0!
37  value, // #VALUE!
38  ref, // #REF!
39  name, // #NAME?
40  num, // #NUM!
41  na // #N/A!
42 };
43 
44 enum class border_direction_t
45 {
46  unknown = 0,
47  top,
48  bottom,
49  left,
50  right,
51  diagonal,
52  diagonal_bl_tr,
53  diagonal_tl_br
54 };
55 
56 enum class border_style_t
57 {
58  unknown = 0,
59  none,
60  solid,
61  dash_dot,
62  dash_dot_dot,
63  dashed,
64  dotted,
65  double_border,
66  hair,
67  medium,
68  medium_dash_dot,
69  medium_dash_dot_dot,
70  medium_dashed,
71  slant_dash_dot,
72  thick,
73  thin,
74  double_thin,
75  fine_dashed
76 };
77 
78 enum class fill_pattern_t
79 {
80  none = 0,
81  solid,
82  dark_down,
83  dark_gray,
84  dark_grid,
85  dark_horizontal,
86  dark_trellis,
87  dark_up,
88  dark_vertical,
89  gray_0625,
90  gray_125,
91  light_down,
92  light_gray,
93  light_grid,
94  light_horizontal,
95  light_trellis,
96  light_up,
97  light_vertical,
98  medium_gray
99 };
100 
101 enum class strikethrough_style_t
102 {
103  none = 0,
104  solid,
105  dash,
106  dot_dash,
107  dot_dot_dash,
108  dotted,
109  long_dash,
110  wave
111 };
112 
113 enum class strikethrough_type_t
114 {
115  unknown = 0,
116  none,
117  single,
118  double_type
119 };
120 
121 enum class strikethrough_width_t
122 {
123  unknown = 0,
124  width_auto,
125  thin,
126  medium,
127  thick,
128  bold
129 };
130 
131 enum class strikethrough_text_t
132 {
133  unknown = 0,
134  slash,
135  cross
136 };
137 
138 enum class formula_grammar_t
139 {
140  unknown = 0,
141  xls_xml,
142  xlsx_2007,
143  xlsx_2010,
144  ods,
145  gnumeric
146 };
147 
148 enum class formula_t
149 {
150  unknown = 0,
151  array,
152  data_table,
153  normal,
154  shared
155 };
156 
157 enum class underline_t
158 {
159  none = 0,
160  single_line,
161  single_accounting, // unique to xlsx
162  double_line,
163  double_accounting, // unique to xlsx
164  dotted,
165  dash,
166  long_dash,
167  dot_dash,
168  dot_dot_dot_dash,
169  wave
170 };
171 
172 enum class underline_width_t
173 {
174  none = 0,
175  normal,
176  bold,
177  thin,
178  medium,
179  thick,
180  positive_integer,
181  percent,
182  positive_length
183 };
184 
185 enum class underline_mode_t
186 {
187  continuos = 0,
188  skip_white_space
189 };
190 
191 enum class underline_type_t
192 {
193  none = 0,
194  single,
195  double_type //necessary to not call it "double", since it is a reserved word
196 };
197 
199 {
200  underline_t underline_style;
201  underline_width_t underline_width;
202  underline_mode_t underline_mode;
203  underline_type_t underline_type;
204 };
205 
206 enum class hor_alignment_t
207 {
208  unknown = 0,
209  left,
210  center,
211  right,
212  justified,
213  distributed,
214  filled
215 };
216 
217 enum class ver_alignment_t
218 {
219  unknown = 0,
220  top,
221  middle,
222  bottom,
223  justified,
224  distributed
225 };
226 
232 enum class data_table_type_t
233 {
234  column,
235  row,
236  both
237 };
238 
242 enum class totals_row_function_t
243 {
244  none = 0,
245  sum,
246  minimum,
247  maximum,
248  average,
249  count,
250  count_numbers,
251  standard_deviation,
252  variance,
253  custom
254 };
255 
256 enum class conditional_format_t
257 {
258  unknown = 0,
259  condition,
260  date,
261  formula,
262  colorscale,
263  databar,
264  iconset
265 };
266 
267 enum class condition_operator_t
268 {
269  unknown = 0,
270  equal,
271  less,
272  greater,
273  greater_equal,
274  less_equal,
275  not_equal,
276  between,
277  not_between,
278  duplicate,
279  unique,
280  top_n,
281  bottom_n,
282  above_average,
283  below_average,
284  above_equal_average,
285  below_equal_average,
286  contains_error,
287  contains_no_error,
288  begins_with,
289  ends_with,
290  contains,
291  contains_blanks,
292  not_contains,
293  expression
294 };
295 
296 enum class condition_type_t
297 {
298  unknown = 0,
299  value,
300  automatic,
301  max,
302  min,
303  formula,
304  percent,
305  percentile
306 };
307 
308 enum class condition_date_t
309 {
310  unknown = 0,
311  today,
312  yesterday,
313  tomorrow,
314  last_7_days,
315  this_week,
316  next_week,
317  last_week,
318  this_month,
319  next_month,
320  last_month,
321  this_year,
322  next_year,
323  last_year,
324 };
325 
326 enum class databar_axis_t
327 {
328  none = 0,
329  middle,
330  automatic
331 };
332 
333 enum class pivot_cache_group_by_t
334 {
335  unknown = 0,
336  days, // grouping on "days" for date values.
337  hours, // grouping on "hours" for date values.
338  minutes, // grouping on "minutes" for date values.
339  months, // grouping on "months" for date values.
340  quarters, // grouping on "quarters" for date values.
341  range, // grouping by numeric ranges for numeric values.
342  seconds, // grouping on "seconds" for date values.
343  years // grouping on "years" for date values.
344 };
345 
346 struct address_t
347 {
348  row_t row;
349  col_t column;
350 };
351 
353 {
354  row_t rows;
355  col_t columns;
356 };
357 
358 struct range_t
359 {
360  address_t first;
361  address_t last;
362 };
363 
364 ORCUS_DLLPUBLIC bool operator== (const address_t& left, const address_t& right);
365 ORCUS_DLLPUBLIC bool operator!= (const address_t& left, const address_t& right);
366 
367 ORCUS_DLLPUBLIC bool operator== (const range_t& left, const range_t& right);
368 ORCUS_DLLPUBLIC bool operator!= (const range_t& left, const range_t& right);
369 ORCUS_DLLPUBLIC bool operator< (const range_t& left, const range_t& right);
370 ORCUS_DLLPUBLIC bool operator> (const range_t& left, const range_t& right);
371 
372 ORCUS_DLLPUBLIC range_t& operator+= (range_t& left, const address_t& right);
373 ORCUS_DLLPUBLIC range_t& operator-= (range_t& left, const address_t& right);
374 
375 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, const address_t& v);
376 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, const range_t& v);
377 
378 struct ORCUS_DLLPUBLIC color_rgb_t
379 {
380  color_elem_t red;
381  color_elem_t green;
382  color_elem_t blue;
383 
384  color_rgb_t();
385  color_rgb_t(const color_rgb_t& other);
386  color_rgb_t(color_rgb_t&& other);
387 
388  color_rgb_t& operator= (const color_rgb_t& other);
389 };
390 
400 ORCUS_DLLPUBLIC totals_row_function_t to_totals_row_function_enum(const char* p, size_t n);
401 
411 ORCUS_DLLPUBLIC pivot_cache_group_by_t to_pivot_cache_group_by_enum(const char* p, size_t n);
412 
422 ORCUS_DLLPUBLIC error_value_t to_error_value_enum(const char* p, size_t n);
423 
435 ORCUS_DLLPUBLIC color_rgb_t to_color_rgb(const char* p, size_t n);
436 
437 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, error_value_t ev);
438 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, const color_rgb_t& color);
439 
440 }}
441 
442 #endif
443 
444 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: types.hpp:378
Definition: types.hpp:358
Definition: types.hpp:198
Definition: types.hpp:352
Definition: types.hpp:346
Definition: base64.hpp:15