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
18namespace orcus {
19
20class pstring;
21struct date_time_t;
22
23namespace spreadsheet {
24
25class document;
26class sheet_range;
27struct sheet_impl;
28struct auto_filter_t;
29
34class 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
41public:
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
73 void fill_down_cells(row_t src_row, col_t src_col, row_t range_size);
74
83 range_t get_merge_cell_range(row_t row, col_t col) const;
84
85 size_t get_string_identifier(row_t row, col_t col) const;
86
87 auto_filter_t* get_auto_filter_data();
88 const auto_filter_t* get_auto_filter_data() const;
89 void set_auto_filter_data(auto_filter_t* p);
90
91 // Sheet dimension methods
92
100 ixion::abs_range_t get_data_range() const;
101
114 row_t row_start, col_t col_start, row_t row_end, col_t col_end) const;
115
116 row_t row_size() const;
117 col_t col_size() const;
118 sheet_t get_index() const;
119
120 date_time_t get_date_time(row_t row, col_t col) const;
121
122 void finalize();
123
124 void dump_flat(std::ostream& os) const;
125 void dump_check(std::ostream& os, const pstring& sheet_name) const;
126 void dump_html(std::ostream& os) const;
127 void dump_json(std::ostream& os) const;
128 void dump_csv(std::ostream& os) const;
129
133 size_t get_cell_format(row_t row, col_t col) const;
134
135private:
136 sheet_impl* mp_impl;
137};
138
139}}
140
141#endif
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: pstring.hpp:28
Definition: document.hpp:48
Definition: sheet_range.hpp:28
Definition: sheet.hpp:35
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
sheet_range get_sheet_range(row_t row_start, col_t col_start, row_t row_end, col_t col_end) const
ixion::abs_range_t get_data_range() const
Definition: tokens.hpp:22
Definition: types.hpp:420
Definition: auto_filter.hpp:39
Definition: types.hpp:368