Orcus
document.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_DOCUMENT_HPP
9#define INCLUDED_ORCUS_SPREADSHEET_DOCUMENT_HPP
10
11#include "orcus/env.hpp"
12#include "orcus/interface.hpp"
13#include "orcus/spreadsheet/types.hpp"
14
15#include <ostream>
16#include <memory>
17
18namespace ixion {
19
20class formula_name_resolver;
21class model_context;
22struct abs_address_t;
23
24}
25
26namespace orcus {
27
28class pstring;
29class string_pool;
30struct date_time_t;
31
32namespace spreadsheet {
33
34class import_shared_strings;
35class styles;
36class pivot_collection;
37class sheet;
38
39struct document_config;
40struct table_t;
41struct document_impl;
42
47class ORCUS_SPM_DLLPUBLIC document : public orcus::iface::document_dumper
48{
49 friend class sheet;
50
51public:
52 document(const document&) = delete;
53 document& operator= (const document&) = delete;
54
55 document();
56 ~document();
57
58 import_shared_strings* get_shared_strings();
59 const import_shared_strings* get_shared_strings() const;
60
61 styles& get_styles();
62 const styles& get_styles() const;
63
64 pivot_collection& get_pivot_collection();
65 const pivot_collection& get_pivot_collection() const;
66
67 sheet* append_sheet(const pstring& sheet_name, row_t row_size, col_t col_size);
68 sheet* get_sheet(const pstring& sheet_name);
69 const sheet* get_sheet(const pstring& sheet_name) const;
70 sheet* get_sheet(sheet_t sheet_pos);
71 const sheet* get_sheet(sheet_t sheet_pos) const;
72
73 void calc_formulas();
74
78 void clear();
79
80 virtual void dump(dump_format_t format, const std::string& output) const override;
84 void dump_flat(const std::string& outdir) const;
85
92 void dump_html(const ::std::string& outdir) const;
93
94 void dump_json(const ::std::string& outdir) const;
95
96 void dump_csv(const std::string& outdir) const;
97
102 virtual void dump_check(std::ostream& os) const override;
103
104 sheet_t get_sheet_index(const pstring& name) const;
105 pstring get_sheet_name(sheet_t sheet_pos) const;
106
107 size_t sheet_size() const;
108
109 void set_origin_date(int year, int month, int day);
110 date_time_t get_origin_date() const;
111
112 void set_formula_grammar(formula_grammar_t grammar);
113 formula_grammar_t get_formula_grammar() const;
114
115 const ixion::formula_name_resolver* get_formula_name_resolver() const;
116
117 ixion::model_context& get_model_context();
118 const ixion::model_context& get_model_context() const;
119
120 const document_config& get_config() const;
121 void set_config(const document_config& cfg);
122
123 string_pool& get_string_pool();
124
134
135 const table_t* get_table(const pstring& name) const;
136
137 void finalize();
138
139private:
140 void insert_dirty_cell(const ixion::abs_address_t& pos);
141
142private:
143 std::unique_ptr<document_impl> mp_impl;
144};
145
146}}
147
148#endif
149/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: interface.hpp:45
Definition: pstring.hpp:28
Definition: document.hpp:48
void dump_flat(const std::string &outdir) const
virtual void dump_check(std::ostream &os) const override
void dump_html(const ::std::string &outdir) const
void insert_table(table_t *p)
Definition: shared_strings.hpp:52
Definition: pivot.hpp:267
Definition: sheet.hpp:35
Definition: styles.hpp:150
Definition: string_pool.hpp:23
Definition: types.hpp:420
Definition: config.hpp:18
Definition: auto_filter.hpp:99