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