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 
18 namespace ixion {
19 
20 class formula_name_resolver;
21 class model_context;
22 struct abs_address_t;
23 
24 }
25 
26 namespace orcus {
27 
28 class string_pool;
29 struct date_time_t;
30 
31 namespace spreadsheet {
32 
33 class import_shared_strings;
34 class styles;
35 class pivot_collection;
36 class sheet;
37 
38 struct document_config;
39 struct table_t;
40 struct document_impl;
41 
46 class ORCUS_SPM_DLLPUBLIC document : public orcus::iface::document_dumper
47 {
48  friend class sheet;
49 
50 public:
51  document(const document&) = delete;
52  document& operator= (const document&) = delete;
53 
54  document(const range_size_t& sheet_size);
55  ~document();
56 
57  import_shared_strings* get_shared_strings();
58  const import_shared_strings* get_shared_strings() const;
59 
60  styles& get_styles();
61  const styles& get_styles() const;
62 
63  pivot_collection& get_pivot_collection();
64  const pivot_collection& get_pivot_collection() const;
65 
66  sheet* append_sheet(std::string_view sheet_name);
67  sheet* get_sheet(std::string_view sheet_name);
68  const sheet* get_sheet(std::string_view sheet_name) const;
69  sheet* get_sheet(sheet_t sheet_pos);
70  const sheet* get_sheet(sheet_t sheet_pos) const;
71 
75  void clear();
76 
82 
83  virtual void dump(dump_format_t format, const std::string& output) const override;
84 
90  void dump_flat(const std::string& outdir) const;
91 
97  void dump_html(const ::std::string& outdir) const;
98 
104  void dump_json(const ::std::string& outdir) const;
105 
111  void dump_csv(const std::string& outdir) const;
112 
117  virtual void dump_check(std::ostream& os) const override;
118 
119  sheet_t get_sheet_index(std::string_view name) const;
120  std::string_view get_sheet_name(sheet_t sheet_pos) const;
121 
122  range_size_t get_sheet_size() const;
123  void set_sheet_size(const range_size_t& sheet_size);
124  size_t get_sheet_count() const;
125 
126  void set_origin_date(int year, int month, int day);
127  date_time_t get_origin_date() const;
128 
129  void set_formula_grammar(formula_grammar_t grammar);
130  formula_grammar_t get_formula_grammar() const;
131 
132  const ixion::formula_name_resolver* get_formula_name_resolver(formula_ref_context_t cxt) const;
133 
134  ixion::model_context& get_model_context();
135  const ixion::model_context& get_model_context() const;
136 
137  const document_config& get_config() const;
138  void set_config(const document_config& cfg);
139 
140  string_pool& get_string_pool();
141 
151 
152  const table_t* get_table(std::string_view name) const;
153 
154  void finalize();
155 
156 private:
157  void insert_dirty_cell(const ixion::abs_address_t& pos);
158 
159 private:
160  std::unique_ptr<document_impl> mp_impl;
161 };
162 
163 }}
164 
165 #endif
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: interface.hpp:45
Definition: document.hpp:47
void dump_flat(const std::string &outdir) const
virtual void dump_check(std::ostream &os) const override
void dump_json(const ::std::string &outdir) const
void dump_html(const ::std::string &outdir) const
void insert_table(table_t *p)
void dump_csv(const std::string &outdir) const
Definition: shared_strings.hpp:51
Definition: pivot.hpp:208
Definition: sheet.hpp:34
Definition: styles.hpp:280
Definition: string_pool.hpp:23
Definition: types.hpp:460
Definition: config.hpp:18
Definition: types.hpp:401
Definition: auto_filter.hpp:98