IWORKTable.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libetonyek project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef IWORKTABLE_H_INCLUDED
11 #define IWORKTABLE_H_INCLUDED
12 
13 #include <deque>
14 #include <memory>
15 
16 #include <boost/optional.hpp>
17 
18 #include "IWORKStyle_fwd.h"
19 #include "IWORKTypes.h"
20 #include "IWORKOutputElements.h"
21 
22 namespace libetonyek
23 {
24 
25 class IWORKLanguageManager;
26 class IWORKText;
27 class IWORKTableRecorder;
28 
30 {
31  struct Cell
32  {
34  unsigned m_columnSpan;
35  unsigned m_rowSpan;
36  bool m_covered;
37  boost::optional<IWORKFormula> m_formula;
40  boost::optional<std::string> m_value;
41 
42  Cell();
43  };
44 
45  typedef std::deque<Cell> Row_t;
46  typedef std::deque<Row_t> Table_t;
47 
48 public:
49  enum CellType
50  {
56  };
57 
58 public:
59  explicit IWORKTable(const IWORKTableNameMapPtr_t &tableNameMap, const IWORKLanguageManager &langManager);
60 
61  void setRecorder(const std::shared_ptr<IWORKTableRecorder> &recorder);
62  const std::shared_ptr<IWORKTableRecorder> &getRecorder() const;
63 
64  void setSize(unsigned columns, unsigned rows);
65  void setHeaders(unsigned headerColumns, unsigned headerRows, unsigned footerRows);
66  void setBandedRows(bool banded = true);
67  void setRepeated(bool columns, bool rows);
68 
69  void setStyle(const IWORKStylePtr_t &style);
70  void setSizes(const IWORKColumnSizes_t &columnSizes, const IWORKRowSizes_t &rowSizes);
71  void setBorders(const IWORKGridLineMap_t &verticalLines, const IWORKGridLineMap_t &horizontalLines);
72  void insertCell(unsigned column, unsigned row,
73  const boost::optional<std::string> &value = boost::none,
74  const std::shared_ptr<IWORKText> &text = std::shared_ptr<IWORKText>(),
75  unsigned columnSpan = 1, unsigned rowSpan = 1,
76  const boost::optional<IWORKFormula> &formula = boost::none,
79  void insertCoveredCell(unsigned column, unsigned row);
80 
81  void draw(const librevenge::RVNGPropertyList &tableProps, IWORKOutputElements &elements, bool drawAsSimpleTable);
82 
86 
87  IWORKStylePtr_t getDefaultCellStyle(unsigned column, unsigned row) const;
88  IWORKStylePtr_t getDefaultLayoutStyle(unsigned column, unsigned row) const;
89  IWORKStylePtr_t getDefaultParagraphStyle(unsigned column, unsigned row) const;
90 
91 private:
92  IWORKStylePtr_t getDefaultStyle(unsigned column, unsigned row, const IWORKStylePtr_t *group) const;
93 
94 private:
97 
98  Table_t m_table;
104 
105  unsigned m_rows;
106  unsigned m_columns;
107  unsigned m_headerRows;
108  unsigned m_footerRows;
109  unsigned m_headerColumns;
113 
117 
118  std::shared_ptr<IWORKTableRecorder> m_recorder;
119 };
120 
121 }
122 
123 #endif // IWORKTABLE_H_INCLUDED
124 
125 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
CellType
Definition: IWORKTable.h:49
void setHeaders(unsigned headerColumns, unsigned headerRows, unsigned footerRows)
Definition: IWORKTable.cpp:320
Definition: IWORKBezierElement.cpp:18
Definition: IWORKOutputElements.h:29
boost::optional< IWORKFormula > m_formula
Definition: IWORKTable.h:37
IWORKRowSizes_t m_rowSizes
Definition: IWORKTable.h:101
bool m_headerRowsRepeated
Definition: IWORKTable.h:111
bool m_headerColumnsRepeated
Definition: IWORKTable.h:112
void setSizes(const IWORKColumnSizes_t &columnSizes, const IWORKRowSizes_t &rowSizes)
Definition: IWORKTable.cpp:367
const IWORKLanguageManager & m_langManager
Definition: IWORKTable.h:96
IWORKStylePtr_t getDefaultParagraphStyle(unsigned column, unsigned row) const
Definition: IWORKTable.cpp:589
Definition: IWORKTable.h:31
void setDefaultParagraphStyle(CellType type, const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:567
void setSize(unsigned columns, unsigned rows)
Definition: IWORKTable.cpp:308
std::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
const std::shared_ptr< IWORKTableRecorder > & getRecorder() const
Definition: IWORKTable.cpp:303
std::deque< Cell > Row_t
Definition: IWORKTable.h:45
std::deque< Row_t > Table_t
Definition: IWORKTable.h:46
IWORKOutputElements m_content
Definition: IWORKTable.h:33
void setRepeated(bool columns, bool rows)
Definition: IWORKTable.cpp:344
Definition: IWORKToken.h:284
unsigned m_headerColumns
Definition: IWORKTable.h:109
Definition: IWORKToken.h:399
IWORKStylePtr_t getDefaultStyle(unsigned column, unsigned row, const IWORKStylePtr_t *group) const
Definition: IWORKTable.cpp:594
Definition: IWORKToken.h:156
void insertCell(unsigned column, unsigned row, const boost::optional< std::string > &value=boost::none, const std::shared_ptr< IWORKText > &text=std::shared_ptr< IWORKText >(), unsigned columnSpan=1, unsigned rowSpan=1, const boost::optional< IWORKFormula > &formula=boost::none, const IWORKStylePtr_t &style=IWORKStylePtr_t(), IWORKCellType type=IWORK_CELL_TYPE_TEXT)
Definition: IWORKTable.cpp:394
Definition: IWORKToken.h:268
void setBorders(const IWORKGridLineMap_t &verticalLines, const IWORKGridLineMap_t &horizontalLines)
Definition: IWORKTable.cpp:382
IWORKColumnSizes_t m_columnSizes
Definition: IWORKTable.h:100
Definition: IWORKToken.h:245
void setDefaultLayoutStyle(CellType type, const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:555
Definition: IWORKEnum.h:73
IWORKGridLineMap_t m_verticalLines
Definition: IWORKTable.h:102
void draw(const librevenge::RVNGPropertyList &tableProps, IWORKOutputElements &elements, bool drawAsSimpleTable)
Definition: IWORKTable.cpp:447
Table_t m_table
Definition: IWORKTable.h:98
unsigned m_rowSpan
Definition: IWORKTable.h:35
unsigned m_columns
Definition: IWORKTable.h:106
unsigned m_columnSpan
Definition: IWORKTable.h:34
std::deque< double > IWORKColumnSizes_t
Definition: IWORKTypes_fwd.h:22
std::deque< double > IWORKRowSizes_t
Definition: IWORKTypes_fwd.h:24
Definition: IWORKToken.h:87
IWORKStylePtr_t getDefaultCellStyle(unsigned column, unsigned row) const
Definition: IWORKTable.cpp:579
IWORKTable(const IWORKTableNameMapPtr_t &tableNameMap, const IWORKLanguageManager &langManager)
Definition: IWORKTable.cpp:278
std::shared_ptr< IWORKTableNameMap_t > IWORKTableNameMapPtr_t
Definition: IWORKTypes_fwd.h:32
std::map< unsigned, IWORKGridLine_t > IWORKGridLineMap_t
Definition: IWORKTypes.h:102
IWORKGridLineMap_t m_horizontalLines
Definition: IWORKTable.h:103
void setDefaultCellStyle(CellType type, const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:543
std::shared_ptr< IWORKTableRecorder > m_recorder
Definition: IWORKTable.h:118
Definition: IWORKLanguageManager.h:23
unsigned m_rows
Definition: IWORKTable.h:105
void setRecorder(const std::shared_ptr< IWORKTableRecorder > &recorder)
Definition: IWORKTable.cpp:298
const IWORKTableNameMapPtr_t m_tableNameMap
Definition: IWORKTable.h:95
IWORKStylePtr_t m_style
Definition: IWORKTable.h:99
IWORKStylePtr_t m_defaultCellStyles[5]
Definition: IWORKTable.h:114
Definition: IWORKToken.h:85
Definition: IWORKTable.h:29
IWORKStylePtr_t m_defaultLayoutStyles[5]
Definition: IWORKTable.h:115
Definition: IWORKTable.h:51
IWORKStylePtr_t m_style
Definition: IWORKTable.h:38
IWORKStylePtr_t m_defaultParaStyles[5]
Definition: IWORKTable.h:116
Definition: IWORKToken.h:295
void setBandedRows(bool banded=true)
Definition: IWORKTable.cpp:333
IWORKCellType m_type
Definition: IWORKTable.h:39
void insertCoveredCell(unsigned column, unsigned row)
Definition: IWORKTable.cpp:431
IWORKCellType
Definition: IWORKEnum.h:70
bool m_bandedRows
Definition: IWORKTable.h:110
unsigned m_footerRows
Definition: IWORKTable.h:108
boost::optional< std::string > m_value
Definition: IWORKTable.h:40
IWORKStylePtr_t getDefaultLayoutStyle(unsigned column, unsigned row) const
Definition: IWORKTable.cpp:584
void setStyle(const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:356
unsigned m_headerRows
Definition: IWORKTable.h:107
Cell()
Definition: IWORKTable.cpp:266
bool m_covered
Definition: IWORKTable.h:36

Generated for libetonyek by doxygen 1.8.13