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 "orcus/env.hpp"
12 #include "orcus/spreadsheet/types.hpp"
13 
14 #include <ostream>
15 #include <ixion/address.hpp>
16 #include <ixion/formula_tokens.hpp>
17 
18 namespace orcus {
19 
20 class pstring;
21 struct date_time_t;
22 
23 namespace spreadsheet {
24 
25 class document;
26 class sheet_range;
27 struct sheet_impl;
28 struct auto_filter_t;
29 
34 class ORCUS_SPM_DLLPUBLIC sheet
35 {
36  friend struct sheet_impl;
37 
38  static const row_t max_row_limit;
39  static const col_t max_col_limit;
40 
41 public:
42  sheet(document& doc, sheet_t sheet_index, row_t row_size, col_t col_size);
43  virtual ~sheet();
44 
45  void set_auto(row_t row, col_t col, const char* p, size_t n);
46  void set_string(row_t row, col_t col, size_t sindex);
47  void set_value(row_t row, col_t col, double value);
48  void set_bool(row_t row, col_t col, bool value);
49  void set_date_time(row_t row, col_t col, int year, int month, int day, int hour, int minute, double second);
50  void set_format(row_t row, col_t col, size_t index);
51  void set_format(row_t row_start, col_t col_start, row_t row_end, col_t col_end, size_t index);
52 
53  void set_formula(row_t row, col_t col, const ixion::formula_tokens_store_ptr_t& tokens);
54  void set_grouped_formula(const range_t range, ixion::formula_tokens_t tokens);
55 
56  void set_formula_result(row_t row, col_t col, double value);
57  void set_formula_result(row_t row, col_t col, const char* p, size_t n);
58 
59  void set_col_width(col_t col, col_width_t width);
60  col_width_t get_col_width(col_t col, col_t* col_start, col_t* col_end) const;
61 
62  void set_col_hidden(col_t col, bool hidden);
63  bool is_col_hidden(col_t col, col_t* col_start, col_t* col_end) const;
64 
65  void set_row_height(row_t row, row_height_t height);
66  row_height_t get_row_height(row_t row, row_t* row_start, row_t* row_end) const;
67 
68  void set_row_hidden(row_t row, bool hidden);
69  bool is_row_hidden(row_t row, row_t* row_start, row_t* row_end) const;
70 
71  void set_merge_cell_range(const range_t& range);
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 
111  sheet_range get_sheet_range(
112  row_t row_start, col_t col_start, row_t row_end, col_t col_end) const;
113 
114  row_t row_size() const;
115  col_t col_size() const;
116  sheet_t get_index() const;
117 
118  date_time_t get_date_time(row_t row, col_t col) const;
119 
120  void finalize();
121 
122  void dump_flat(std::ostream& os) const;
123  void dump_check(std::ostream& os, const pstring& sheet_name) const;
124  void dump_html(std::ostream& os) const;
125  void dump_json(std::ostream& os) const;
126  void dump_csv(std::ostream& os) const;
127 
131  size_t get_cell_format(row_t row, col_t col) const;
132 
133 private:
134  sheet_impl* mp_impl;
135 };
136 
137 }}
138 
139 #endif
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: pstring.hpp:24
Definition: types.hpp:403
Definition: document.hpp:47
Definition: sheet.hpp:34
Definition: types.hpp:358
Definition: tokens.hpp:21
Definition: sheet_range.hpp:27
Definition: auto_filter.hpp:38
Definition: base64.hpp:15