Orcus
Loading...
Searching...
No Matches
sheet.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_ODSTABLE_HPP
9#define INCLUDED_ORCUS_SPREADSHEET_ODSTABLE_HPP
10
11#include "../env.hpp"
12#include "types.hpp"
13
14#include <ostream>
15#include <memory>
16
17#include <ixion/address.hpp>
18#include <ixion/formula_tokens.hpp>
19#include <ixion/formula_result.hpp>
20
21namespace orcus {
22
23struct date_time_t;
24
25namespace spreadsheet {
26
27class document;
28
29struct auto_filter_t;
30
31namespace detail {
32
33struct sheet_impl;
34
35}
36
41class ORCUS_SPM_DLLPUBLIC sheet
42{
43 friend class document;
44 friend struct detail::sheet_impl;
45
46 static const row_t max_row_limit;
47 static const col_t max_col_limit;
48
49public:
50 sheet(document& doc, sheet_t sheet_index);
51 ~sheet() noexcept;
52
53 void set_auto(row_t row, col_t col, std::string_view s);
54 void set_string(row_t row, col_t col, string_id_t sindex);
55 void set_value(row_t row, col_t col, double value);
56 void set_bool(row_t row, col_t col, bool value);
57 void set_date_time(row_t row, col_t col, int year, int month, int day, int hour, int minute, double second);
58 void set_format(row_t row, col_t col, size_t index);
59 void set_format(row_t row_start, col_t col_start, row_t row_end, col_t col_end, size_t index);
60 void set_column_format(col_t col, col_t col_span, std::size_t index);
61 void set_row_format(row_t row, std::size_t index);
62
63 void set_formula(row_t row, col_t col, const ixion::formula_tokens_store_ptr_t& tokens);
64 void set_formula(row_t row, col_t col, const ixion::formula_tokens_store_ptr_t& tokens, ixion::formula_result result);
65 void set_grouped_formula(const range_t& range, ixion::formula_tokens_t tokens);
66 void set_grouped_formula(const range_t& range, ixion::formula_tokens_t tokens, ixion::formula_result result);
67
68 void set_col_width(col_t col, col_t col_span, col_width_t width);
69
83 col_width_t get_col_width(col_t col, col_t* col_start, col_t* col_end) const;
84
85 void set_col_hidden(col_t col, col_t col_span, bool hidden);
86 bool is_col_hidden(col_t col, col_t* col_start, col_t* col_end) const;
87
88 void set_row_height(row_t row, row_t row_span, row_height_t height);
89 row_height_t get_row_height(row_t row, row_t* row_start, row_t* row_end) const;
90
91 void set_row_hidden(row_t row, row_t row_span, bool hidden);
92 bool is_row_hidden(row_t row, row_t* row_start, row_t* row_end) const;
93
94 void set_merge_cell_range(const range_t& range);
95
96 void fill_down_cells(row_t src_row, col_t src_col, row_t range_size);
97
106 range_t get_merge_cell_range(row_t row, col_t col) const;
107
108 size_t get_string_identifier(row_t row, col_t col) const;
109
110 void set_auto_filter(std::unique_ptr<auto_filter_t> filter);
111 const auto_filter_t* get_auto_filter() const;
112
113 // Sheet dimension methods
114
122 ixion::abs_range_t get_data_range() const;
123
124 sheet_t get_index() const;
125
126 date_time_t get_date_time(row_t row, col_t col) const;
127
128 void dump_flat(std::ostream& os) const;
129 void dump_check(std::ostream& os, std::string_view sheet_name) const;
130 void dump_html(std::ostream& os) const;
131 void dump_json(std::ostream& os) const;
132 void dump_csv(std::ostream& os) const;
133
134 void dump_debug_state(const std::string& output_dir, std::string_view sheet_name) const;
135
139 size_t get_cell_format(row_t row, col_t col) const;
140
141private:
142 void finalize_import();
143
144 std::unique_ptr<detail::sheet_impl> mp_impl;
145};
146
147}}
148
149#endif
150/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition document.hpp:55
size_t get_cell_format(row_t row, col_t col) const
col_width_t get_col_width(col_t col, col_t *col_start, col_t *col_end) const
range_t get_merge_cell_range(row_t row, col_t col) const
ixion::abs_range_t get_data_range() const
Definition tokens.hpp:30
Definition types.hpp:528
Definition auto_filter.hpp:171
Definition types.hpp:637