Orcus
Toggle main menu visibility
Loading...
Searching...
No Matches
include
orcus
spreadsheet
styles.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 INCLUDED_ORCUS_SPREADSHEET_STYLES_HPP
9
#define INCLUDED_ORCUS_SPREADSHEET_STYLES_HPP
10
11
#include "../env.hpp"
12
#include "../measurement.hpp"
13
#include "document_types.hpp"
14
15
#include <memory>
16
#include <string_view>
17
#include <optional>
18
19
namespace
orcus {
namespace
spreadsheet {
20
21
class
document
;
22
26
struct
ORCUS_SPM_DLLPUBLIC font_t
27
{
28
std::optional<std::string_view> name;
29
std::optional<std::string_view> name_asian;
30
std::optional<std::string_view> name_complex;
31
std::optional<double> size;
32
std::optional<double> size_asian;
33
std::optional<double> size_complex;
34
std::optional<bool> bold;
35
std::optional<bool> bold_asian;
36
std::optional<bool> bold_complex;
37
std::optional<bool> italic;
38
std::optional<bool> italic_asian;
39
std::optional<bool> italic_complex;
40
std::optional<color_t> color;
41
42
underline_t
underline;
43
strikethrough_t
strikethrough;
44
45
font_t();
46
font_t(
const
font_t& other);
47
~font_t();
48
49
font_t& operator=(
const
font_t& other);
50
51
bool
operator==(
const
font_t& other)
const
;
52
bool
operator!=(
const
font_t& other)
const
;
53
54
void
reset();
55
56
struct
ORCUS_SPM_DLLPUBLIC
hash
57
{
58
std::size_t operator()(
const
font_t& v)
const
;
59
};
60
};
61
65
struct
ORCUS_SPM_DLLPUBLIC fill_t
66
{
67
std::optional<fill_pattern_t> pattern_type;
68
std::optional<color_t> fg_color;
69
std::optional<color_t> bg_color;
70
71
fill_t();
72
void
reset();
73
};
74
78
struct
ORCUS_SPM_DLLPUBLIC border_attrs_t
79
{
80
std::optional<border_style_t> style;
81
std::optional<color_t> border_color;
82
std::optional<length_t> border_width;
83
84
border_attrs_t();
85
void
reset();
86
};
87
91
struct
ORCUS_SPM_DLLPUBLIC border_t
92
{
93
border_attrs_t
top;
94
border_attrs_t
bottom;
95
border_attrs_t
left;
96
border_attrs_t
right;
97
border_attrs_t
diagonal;
98
border_attrs_t
diagonal_bl_tr;
99
border_attrs_t
diagonal_tl_br;
100
101
border_t();
102
void
reset();
103
};
104
108
struct
ORCUS_SPM_DLLPUBLIC protection_t
109
{
110
std::optional<bool> locked;
111
std::optional<bool> hidden;
112
std::optional<bool> print_content;
113
std::optional<bool> formula_hidden;
114
115
protection_t();
116
void
reset();
117
};
118
122
struct
ORCUS_SPM_DLLPUBLIC number_format_t
123
{
124
std::optional<std::size_t> identifier;
125
std::optional<std::string_view> format_string;
126
127
number_format_t();
128
void
reset();
129
130
bool
operator== (
const
number_format_t& other)
const
noexcept
;
131
bool
operator!= (
const
number_format_t& other)
const
noexcept
;
132
};
133
138
struct
ORCUS_SPM_DLLPUBLIC cell_format_t
139
{
141
std::size_t
font
;
143
std::size_t
fill
;
145
std::size_t
border
;
147
std::size_t
protection
;
149
std::size_t
number_format
;
151
std::size_t
style_xf
;
153
hor_alignment_t
hor_align
;
155
ver_alignment_t
ver_align
;
157
std::optional<bool>
wrap_text
;
159
std::optional<bool>
shrink_to_fit
;
160
bool
apply_num_format:1;
161
bool
apply_font:1;
162
bool
apply_fill:1;
163
bool
apply_border:1;
164
bool
apply_alignment:1;
165
bool
apply_protection:1;
166
167
cell_format_t();
168
void
reset();
169
};
170
177
struct
ORCUS_SPM_DLLPUBLIC cell_style_t
178
{
179
std::string_view name;
180
std::string_view display_name;
181
std::size_t xf;
182
std::size_t builtin;
183
std::string_view parent_name;
184
185
cell_style_t();
186
void
reset();
187
};
188
189
ORCUS_SPM_DLLPUBLIC std::ostream& operator<< (std::ostream& os,
const
color_t
& c);
190
195
class
ORCUS_SPM_DLLPUBLIC styles
196
{
197
friend
class
document;
198
199
struct
impl;
200
std::unique_ptr<impl> mp_impl;
201
202
public
:
203
styles();
204
~styles();
205
206
void
reserve_font_store(
size_t
n);
207
std::size_t append_font(
const
font_t
& font);
208
209
void
reserve_fill_store(
size_t
n);
210
std::size_t append_fill(
const
fill_t
& fill);
211
212
void
reserve_border_store(
size_t
n);
213
std::size_t append_border(
const
border_t
& border);
214
215
std::size_t append_protection(
const
protection_t
& protection);
216
217
void
reserve_number_format_store(
size_t
n);
218
std::size_t append_number_format(
const
number_format_t
& nf);
219
220
void
reserve_cell_style_format_store(
size_t
n);
221
size_t
append_cell_style_format(
const
cell_format_t
& cf);
222
223
void
reserve_cell_format_store(
size_t
n);
224
size_t
append_cell_format(
const
cell_format_t
& cf);
225
226
void
reserve_diff_cell_format_store(
size_t
n);
227
size_t
append_diff_cell_format(
const
cell_format_t
& cf);
228
229
void
reserve_cell_style_store(
size_t
n);
230
void
append_cell_style(
const
cell_style_t
& cs);
231
232
const
font_t
* get_font(
size_t
index)
const
;
233
const
fill_t
* get_fill(
size_t
index)
const
;
234
const
border_t
* get_border(
size_t
index)
const
;
235
const
protection_t
* get_protection(
size_t
index)
const
;
236
const
number_format_t
* get_number_format(
size_t
index)
const
;
237
const
cell_format_t
* get_cell_format(
size_t
index)
const
;
238
const
cell_format_t
* get_cell_style_format(
size_t
index)
const
;
239
const
cell_format_t
* get_dxf_format(
size_t
index)
const
;
240
const
cell_style_t
* get_cell_style(
size_t
index)
const
;
241
const
cell_style_t
* get_cell_style_by_xf(
size_t
xfid)
const
;
242
243
size_t
get_font_count()
const
;
244
size_t
get_fill_count()
const
;
245
size_t
get_border_count()
const
;
246
size_t
get_protection_count()
const
;
247
size_t
get_number_format_count()
const
;
248
size_t
get_cell_formats_count()
const
;
249
size_t
get_cell_style_formats_count()
const
;
250
size_t
get_dxf_count()
const
;
251
size_t
get_cell_styles_count()
const
;
252
253
void
clear();
254
255
private
:
256
void
finalize_import();
257
};
258
259
}}
260
261
#endif
262
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::spreadsheet::document
Definition
document.hpp:55
orcus::spreadsheet::border_attrs_t
Definition
styles.hpp:79
orcus::spreadsheet::border_t
Definition
styles.hpp:92
orcus::spreadsheet::cell_format_t
Definition
styles.hpp:139
orcus::spreadsheet::cell_format_t::fill
std::size_t fill
Definition
styles.hpp:143
orcus::spreadsheet::cell_format_t::ver_align
ver_alignment_t ver_align
Definition
styles.hpp:155
orcus::spreadsheet::cell_format_t::style_xf
std::size_t style_xf
Definition
styles.hpp:151
orcus::spreadsheet::cell_format_t::font
std::size_t font
Definition
styles.hpp:141
orcus::spreadsheet::cell_format_t::border
std::size_t border
Definition
styles.hpp:145
orcus::spreadsheet::cell_format_t::hor_align
hor_alignment_t hor_align
Definition
styles.hpp:153
orcus::spreadsheet::cell_format_t::shrink_to_fit
std::optional< bool > shrink_to_fit
Definition
styles.hpp:159
orcus::spreadsheet::cell_format_t::number_format
std::size_t number_format
Definition
styles.hpp:149
orcus::spreadsheet::cell_format_t::wrap_text
std::optional< bool > wrap_text
Definition
styles.hpp:157
orcus::spreadsheet::cell_format_t::protection
std::size_t protection
Definition
styles.hpp:147
orcus::spreadsheet::cell_style_t
Definition
styles.hpp:178
orcus::spreadsheet::color_t
Definition
document_types.hpp:21
orcus::spreadsheet::fill_t
Definition
styles.hpp:66
orcus::spreadsheet::font_t::hash
Definition
styles.hpp:57
orcus::spreadsheet::font_t
Definition
styles.hpp:27
orcus::spreadsheet::number_format_t
Definition
styles.hpp:123
orcus::spreadsheet::protection_t
Definition
styles.hpp:109
orcus::spreadsheet::strikethrough_t
Definition
document_types.hpp:38
orcus::spreadsheet::underline_t
Definition
document_types.hpp:59
Generated on
for Orcus by
1.17.0