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 pstring;
29 class string_pool;
30 
31 namespace spreadsheet {
32 
33 class import_global_settings;
34 class import_shared_strings;
35 class import_styles;
36 class sheet;
37 
38 struct table_t;
39 struct document_impl;
40 
45 class ORCUS_SPM_DLLPUBLIC document : public orcus::iface::document_dumper
46 {
47  friend class sheet;
48 
49 public:
50  document(const document&) = delete;
51  document& operator= (const document&) = delete;
52 
53  document();
54  ~document();
55 
56  import_shared_strings* get_shared_strings();
57  const import_shared_strings* get_shared_strings() const;
58 
59  import_styles* get_styles();
60  const import_styles* get_styles() const;
61 
62  sheet* append_sheet(const pstring& sheet_name, row_t row_size, col_t col_size);
63  sheet* get_sheet(const pstring& sheet_name);
64  sheet* get_sheet(sheet_t sheet_pos);
65  const sheet* get_sheet(sheet_t sheet_pos) const;
66 
67  void calc_formulas();
68 
72  void clear();
73 
77  virtual void dump_flat(const std::string& outdir) const;
78 
85  virtual void dump_html(const ::std::string& outdir) const;
86 
87  virtual void dump_json(const ::std::string& outdir) const;
88 
93  virtual void dump_check(std::ostream& os) const;
94 
95  sheet_t get_sheet_index(const pstring& name) const;
96  pstring get_sheet_name(sheet_t sheet_pos) const;
97 
98  size_t sheet_size() const;
99 
100  void set_origin_date(int year, int month, int day);
101  void set_formula_grammar(formula_grammar_t grammar);
102  formula_grammar_t get_formula_grammar() const;
103 
104  const ixion::formula_name_resolver* get_formula_name_resolver() const;
105 
106  ixion::model_context& get_model_context();
107  const ixion::model_context& get_model_context() const;
108 
109  string_pool& get_string_pool();
110 
119  void insert_table(table_t* p);
120 
121  const table_t* get_table(const pstring& name) const;
122 
123  void finalize();
124 
125 private:
126  void insert_dirty_cell(const ixion::abs_address_t& pos);
127 
128 private:
129  std::unique_ptr<document_impl> mp_impl;
130 };
131 
132 }}
133 
134 #endif
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: shared_strings.hpp:51
Definition: pstring.hpp:24
Definition: document.hpp:45
Definition: sheet.hpp:33
Definition: document.hpp:18
Definition: interface.hpp:42
Definition: styles.hpp:147
Definition: string_pool.hpp:22
Definition: base64.hpp:15
Definition: auto_filter.hpp:98