Orcus
Loading...
Searching...
No Matches
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 string_pool;
29struct date_time_t;
30
31namespace spreadsheet {
32
33class shared_strings;
34class styles;
35class tables;
36class pivot_collection;
37class sheet;
38class import_factory;
39
40struct document_config;
41struct table_t;
42
43namespace detail {
44
45struct document_impl;
46
47}
48
54class ORCUS_SPM_DLLPUBLIC document : public orcus::iface::document_dumper
55{
56 friend class sheet;
57 friend class import_factory;
58
59public:
60 document(const document&) = delete;
61 document& operator= (const document&) = delete;
62
63 document(const range_size_t& sheet_size);
64 ~document();
65
67 virtual void dump(dump_format_t format, const std::string& output) const override;
68
70 virtual void dump_check(std::ostream& os) const override;
71
72 shared_strings& get_shared_strings();
73 const shared_strings& get_shared_strings() const;
74
75 styles& get_styles();
76 const styles& get_styles() const;
77
78 pivot_collection& get_pivot_collection();
79 const pivot_collection& get_pivot_collection() const;
80
81 sheet* append_sheet(std::string_view sheet_name);
82 sheet* get_sheet(std::string_view sheet_name);
83 const sheet* get_sheet(std::string_view sheet_name) const;
84 sheet* get_sheet(sheet_t sheet_pos);
85 const sheet* get_sheet(sheet_t sheet_pos) const;
86
90 void clear();
91
97
98 sheet_t get_sheet_index(std::string_view name) const;
99 std::string_view get_sheet_name(sheet_t sheet_pos) const;
100
107 void set_sheet_name(sheet_t sheet_pos, std::string name);
108
109 range_size_t get_sheet_size() const;
110 void set_sheet_size(const range_size_t& sheet_size);
111 size_t get_sheet_count() const;
112
113 void set_origin_date(int year, int month, int day);
114 date_time_t get_origin_date() const;
115
116 void set_formula_grammar(formula_grammar_t grammar);
117 formula_grammar_t get_formula_grammar() const;
118
119 const ixion::formula_name_resolver* get_formula_name_resolver(formula_ref_context_t cxt) const;
120
121 ixion::model_context& get_model_context();
122 const ixion::model_context& get_model_context() const;
123
124 const document_config& get_config() const;
125 void set_config(const document_config& cfg);
126
127 string_pool& get_string_pool();
128 const string_pool& get_string_pool() const;
129
130 tables& get_tables();
131 const tables& get_tables() const;
132
133private:
134 void dump_flat(const std::string& outdir) const;
135 void dump_html(const ::std::string& outdir) const;
136 void dump_json(const ::std::string& outdir) const;
137 void dump_csv(const std::string& outdir) const;
138 void dump_debug_state(const std::string& outdir) const;
139
140 void finalize_import();
141 void insert_dirty_cell(const ixion::abs_address_t& pos);
142
143private:
144 std::unique_ptr<detail::document_impl> mp_impl;
145};
146
147}}
148
149#endif
150/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition interface.hpp:64
Definition document.hpp:55
virtual void dump_check(std::ostream &os) const override
void set_sheet_name(sheet_t sheet_pos, std::string name)
virtual void dump(dump_format_t format, const std::string &output) const override
Definition factory.hpp:53
Definition pivot.hpp:208
Definition shared_strings.hpp:31
Definition sheet.hpp:42
Definition styles.hpp:196
Definition tables.hpp:32
Definition string_pool.hpp:26
Definition types.hpp:528
Definition config.hpp:18
Definition types.hpp:627