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 __ORCUS_SPREADSHEET_ODSTABLE_HPP__
9 #define __ORCUS_SPREADSHEET_ODSTABLE_HPP__
10 
11 #include "orcus/spreadsheet/import_interface.hpp"
12 #include "orcus/spreadsheet/export_interface.hpp"
13 #include "orcus/env.hpp"
14 
15 #include <ostream>
16 
17 namespace orcus {
18 
19 class pstring;
20 
21 namespace spreadsheet {
22 
23 class document;
24 struct sheet_impl;
25 struct auto_filter_t;
26 
31 class ORCUS_SPM_DLLPUBLIC sheet : public iface::import_sheet, public iface::export_sheet
32 {
33  friend struct sheet_impl;
34 
35  static const row_t max_row_limit;
36  static const col_t max_col_limit;
37 
38 public:
39  sheet(document& doc, sheet_t sheet_index, row_t row_size, col_t col_size);
40  virtual ~sheet();
41 
42  // Import methods
43 
44  virtual iface::import_sheet_properties* get_sheet_properties();
45  virtual iface::import_data_table* get_data_table();
46  virtual iface::import_table* get_table();
47  virtual iface::import_auto_filter* get_auto_filter();
48 
49  virtual void set_auto(row_t row, col_t col, const char* p, size_t n);
50  virtual void set_string(row_t row, col_t col, size_t sindex);
51  virtual void set_value(row_t row, col_t col, double value);
52  virtual void set_bool(row_t row, col_t col, bool value);
53  virtual void set_date_time(row_t row, col_t col, int year, int month, int day, int hour, int minute, double second);
54  virtual void set_format(row_t row, col_t col, size_t index);
55  virtual void set_format(row_t row_start, col_t col_start, row_t row_end, col_t col_end, size_t index);
56  virtual void set_formula(row_t row, col_t col, formula_grammar_t grammar, const char* p, size_t n);
57  virtual void set_shared_formula(
58  row_t row, col_t col, formula_grammar_t grammar, size_t sindex,
59  const char* p_formula, size_t n_formula, const char* p_range, size_t n_range);
60  virtual void set_shared_formula(
61  row_t row, col_t col, formula_grammar_t grammar, size_t sindex,
62  const char* p_formula, size_t n_formula);
63  virtual void set_shared_formula(row_t row, col_t col, size_t sindex);
64  virtual void set_formula_result(row_t row, col_t col, double value);
65  virtual void set_formula_result(row_t row, col_t col, const char* p, size_t n);
66  virtual void set_array_formula(row_t, col_t, formula_grammar_t,
67  const char*, size_t, row_t, col_t);
68  virtual void set_array_formula(row_t, col_t, formula_grammar_t,
69  const char*, size_t, const char*, size_t);
70 
71  // Export methods
72 
73  virtual void write_string(std::ostream& os, row_t row, col_t col) const;
74 
75  void set_col_width(col_t col, col_width_t width);
76  col_width_t get_col_width(col_t col, col_t* col_start, col_t* col_end) const;
77 
78  void set_col_hidden(col_t col, bool hidden);
79 
80  void set_row_height(row_t row, row_height_t height);
81  row_height_t get_row_height(row_t row, row_t* row_start, row_t* row_end) const;
82 
83  void set_row_hidden(row_t row, bool hidden);
84 
85  void set_merge_cell_range(const char* p_ref, size_t p_ref_len);
86 
87  size_t get_string_identifier(row_t row, col_t col) const;
88 
89  auto_filter_t* get_auto_filter_data();
90  const auto_filter_t* get_auto_filter_data() const;
91  void set_auto_filter_data(auto_filter_t* p);
92 
93  row_t row_size() const;
94  col_t col_size() const;
95  sheet_t get_index() const;
96 
97  void finalize();
98 
99  void dump_flat(std::ostream& os) const;
100  void dump_check(std::ostream& os, const pstring& sheet_name) const;
101  void dump_html(const ::std::string& filepath) const;
102 
106  size_t get_cell_format(row_t row, col_t col) const;
107 
108 private:
109  sheet_impl* mp_impl;
110 };
111 
112 }}
113 
114 #endif
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: import_interface.hpp:415
Definition: pstring.hpp:24
Definition: document.hpp:44
Definition: import_interface.hpp:198
Definition: sheet.hpp:31
Definition: import_interface.hpp:156
Definition: export_interface.hpp:18
Definition: import_interface.hpp:182
Definition: import_interface.hpp:378
Definition: auto_filter.hpp:38
Definition: base64.hpp:15