Orcus
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 <ixion/address.hpp>
16 #include <ixion/formula_tokens.hpp>
17 #include <ixion/formula_result.hpp>
18 
19 namespace orcus {
20 
21 struct date_time_t;
22 
23 namespace spreadsheet {
24 
25 class document;
26 struct sheet_impl;
27 struct auto_filter_t;
28 
33 class ORCUS_SPM_DLLPUBLIC sheet
34 {
35  friend struct sheet_impl;
36 
37  static const row_t max_row_limit;
38  static const col_t max_col_limit;
39 
40 public:
41  sheet(document& doc, sheet_t sheet_index);
42  virtual ~sheet();
43 
44  void set_auto(row_t row, col_t col, std::string_view s);
45  void set_string(row_t row, col_t col, string_id_t sindex);
46  void set_value(row_t row, col_t col, double value);
47  void set_bool(row_t row, col_t col, bool value);
48  void set_date_time(row_t row, col_t col, int year, int month, int day, int hour, int minute, double second);
49  void set_format(row_t row, col_t col, size_t index);
50  void set_format(row_t row_start, col_t col_start, row_t row_end, col_t col_end, size_t index);
51 
52  void set_formula(row_t row, col_t col, const ixion::formula_tokens_store_ptr_t& tokens);
53  void set_formula(row_t row, col_t col, const ixion::formula_tokens_store_ptr_t& tokens, ixion::formula_result result);
54  void set_grouped_formula(const range_t& range, ixion::formula_tokens_t tokens);
55  void set_grouped_formula(const range_t& range, ixion::formula_tokens_t tokens, ixion::formula_result result);
56 
57  void set_col_width(col_t col, col_width_t width);
58  col_width_t get_col_width(col_t col, col_t* col_start, col_t* col_end) const;
59 
60  void set_col_hidden(col_t col, bool hidden);
61  bool is_col_hidden(col_t col, col_t* col_start, col_t* col_end) const;
62 
63  void set_row_height(row_t row, row_height_t height);
64  row_height_t get_row_height(row_t row, row_t* row_start, row_t* row_end) const;
65 
66  void set_row_hidden(row_t row, bool hidden);
67  bool is_row_hidden(row_t row, row_t* row_start, row_t* row_end) const;
68 
69  void set_merge_cell_range(const range_t& range);
70 
71  void fill_down_cells(row_t src_row, col_t src_col, row_t range_size);
72 
81  range_t get_merge_cell_range(row_t row, col_t col) const;
82 
83  size_t get_string_identifier(row_t row, col_t col) const;
84 
85  auto_filter_t* get_auto_filter_data();
86  const auto_filter_t* get_auto_filter_data() const;
87  void set_auto_filter_data(auto_filter_t* p);
88 
89  // Sheet dimension methods
90 
98  ixion::abs_range_t get_data_range() const;
99 
100  sheet_t get_index() const;
101 
102  date_time_t get_date_time(row_t row, col_t col) const;
103 
104  void finalize();
105 
106  void dump_flat(std::ostream& os) const;
107  void dump_check(std::ostream& os, std::string_view sheet_name) const;
108  void dump_html(std::ostream& os) const;
109  void dump_json(std::ostream& os) const;
110  void dump_csv(std::ostream& os) const;
111 
115  size_t get_cell_format(row_t row, col_t col) const;
116 
117 private:
118  sheet_impl* mp_impl;
119 };
120 
121 }}
122 
123 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: document.hpp:47
Definition: sheet.hpp:34
size_t get_cell_format(row_t row, col_t col) 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:19
Definition: types.hpp:460
Definition: auto_filter.hpp:38
Definition: types.hpp:407