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 <boost/optional.hpp>
14 
15 #include <deque>
16 
17 #include "IWORKStyle_fwd.h"
18 #include "IWORKTypes.h"
19 #include "IWORKOutputElements.h"
20 
21 namespace libetonyek
22 {
23 
25 {
26  struct Cell
27  {
29  unsigned m_columnSpan;
30  unsigned m_rowSpan;
31  bool m_covered;
32  boost::optional<IWORKFormula> m_formula;
35  boost::optional<std::string> m_value;
36 
37  Cell();
38  };
39 
40  typedef std::deque<Cell> Row_t;
41  typedef std::deque<Row_t> Table_t;
42 
43 public:
44  enum CellType
45  {
51  };
52 
53 public:
54  explicit IWORKTable(const IWORKTableNameMapPtr_t &tableNameMap);
55 
56  void setSize(unsigned columns, unsigned rows);
57  void setHeaders(unsigned headerColumns, unsigned headerRows, unsigned footerRows);
58  void setBandedRows(bool banded = true);
59  void setRepeated(bool columns, bool rows);
60 
61  void setStyle(const IWORKStylePtr_t &style);
62  void setSizes(const IWORKColumnSizes_t &columnSizes, const IWORKRowSizes_t &rowSizes);
63  void setBorders(const IWORKGridLineList_t &verticalLines, const IWORKGridLineList_t &horizontalLines);
64  void insertCell(unsigned column, unsigned row, const boost::optional<std::string> &value = boost::none, const IWORKOutputElements &content = IWORKOutputElements(), 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);
65  void insertCoveredCell(unsigned column, unsigned row);
66 
67  void draw(const librevenge::RVNGPropertyList &tableProps, IWORKOutputElements &elements);
68 
72 
73  IWORKStylePtr_t getDefaultCellStyle(unsigned column, unsigned row) const;
74  IWORKStylePtr_t getDefaultLayoutStyle(unsigned column, unsigned row) const;
75  IWORKStylePtr_t getDefaultParagraphStyle(unsigned column, unsigned row) const;
76 
77 private:
78  IWORKStylePtr_t getDefaultStyle(unsigned column, unsigned row, const IWORKStylePtr_t *group) const;
79 
80 private:
82 
83  Table_t m_table;
89 
90  unsigned m_rows;
91  unsigned m_columns;
92  unsigned m_headerRows;
93  unsigned m_footerRows;
94  unsigned m_headerColumns;
98 
102 };
103 
104 }
105 
106 #endif // IWORKTABLE_H_INCLUDED
107 
108 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
CellType
Definition: IWORKTable.h:44
void setHeaders(unsigned headerColumns, unsigned headerRows, unsigned footerRows)
Definition: IWORKTable.cpp:229
Definition: IWORKBezierElement.cpp:18
Definition: IWORKOutputElements.h:30
boost::optional< IWORKFormula > m_formula
Definition: IWORKTable.h:32
IWORKRowSizes_t m_rowSizes
Definition: IWORKTable.h:86
bool m_headerRowsRepeated
Definition: IWORKTable.h:96
bool m_headerColumnsRepeated
Definition: IWORKTable.h:97
IWORKStylePtr_t getDefaultLayoutStyle(unsigned column, unsigned row) const
Definition: IWORKTable.cpp:393
boost::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
void setSizes(const IWORKColumnSizes_t &columnSizes, const IWORKRowSizes_t &rowSizes)
Definition: IWORKTable.cpp:252
Definition: IWORKToken.h:85
Definition: IWORKTable.h:26
void setDefaultParagraphStyle(CellType type, const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:382
void setSize(unsigned columns, unsigned rows)
Definition: IWORKTable.cpp:223
std::deque< Cell > Row_t
Definition: IWORKTable.h:40
std::deque< Row_t > Table_t
Definition: IWORKTable.h:41
IWORKOutputElements m_content
Definition: IWORKTable.h:28
void setRepeated(bool columns, bool rows)
Definition: IWORKTable.cpp:241
unsigned m_headerColumns
Definition: IWORKTable.h:94
Definition: IWORKToken.h:144
Definition: IWORKToken.h:241
std::vector< IWORKGridLine_t > IWORKGridLineList_t
Definition: IWORKTypes.h:101
IWORKStylePtr_t getDefaultCellStyle(unsigned column, unsigned row) const
Definition: IWORKTable.cpp:388
IWORKColumnSizes_t m_columnSizes
Definition: IWORKTable.h:85
Definition: IWORKToken.h:218
void setDefaultLayoutStyle(CellType type, const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:376
Definition: IWORKEnum.h:73
IWORKTable(const IWORKTableNameMapPtr_t &tableNameMap)
Definition: IWORKTable.cpp:205
IWORKGridLineList_t m_horizontalLines
Definition: IWORKTable.h:88
IWORKGridLineList_t m_verticalLines
Definition: IWORKTable.h:87
Table_t m_table
Definition: IWORKTable.h:83
void draw(const librevenge::RVNGPropertyList &tableProps, IWORKOutputElements &elements)
Definition: IWORKTable.cpp:293
unsigned m_rowSpan
Definition: IWORKTable.h:30
unsigned m_columns
Definition: IWORKTable.h:91
unsigned m_columnSpan
Definition: IWORKTable.h:29
std::deque< double > IWORKColumnSizes_t
Definition: IWORKTypes_fwd.h:23
std::deque< double > IWORKRowSizes_t
Definition: IWORKTypes_fwd.h:25
Definition: IWORKToken.h:79
boost::shared_ptr< IWORKTableNameMap_t > IWORKTableNameMapPtr_t
Definition: IWORKTypes_fwd.h:33
void setDefaultCellStyle(CellType type, const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:370
unsigned m_rows
Definition: IWORKTable.h:90
IWORKStylePtr_t getDefaultStyle(unsigned column, unsigned row, const IWORKStylePtr_t *group) const
Definition: IWORKTable.cpp:403
const IWORKTableNameMapPtr_t m_tableNameMap
Definition: IWORKTable.h:81
IWORKStylePtr_t m_style
Definition: IWORKTable.h:84
IWORKStylePtr_t m_defaultCellStyles[5]
Definition: IWORKTable.h:99
Definition: IWORKToken.h:77
void insertCell(unsigned column, unsigned row, const boost::optional< std::string > &value=boost::none, const IWORKOutputElements &content=IWORKOutputElements(), 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:267
Definition: IWORKTable.h:24
IWORKStylePtr_t m_defaultLayoutStyles[5]
Definition: IWORKTable.h:100
Definition: IWORKTable.h:46
IWORKStylePtr_t m_style
Definition: IWORKTable.h:33
IWORKStylePtr_t m_defaultParaStyles[5]
Definition: IWORKTable.h:101
Definition: IWORKToken.h:266
IWORKStylePtr_t getDefaultParagraphStyle(unsigned column, unsigned row) const
Definition: IWORKTable.cpp:398
void setBandedRows(bool banded=true)
Definition: IWORKTable.cpp:236
void setBorders(const IWORKGridLineList_t &verticalLines, const IWORKGridLineList_t &horizontalLines)
Definition: IWORKTable.cpp:261
IWORKCellType m_type
Definition: IWORKTable.h:34
void insertCoveredCell(unsigned column, unsigned row)
Definition: IWORKTable.cpp:283
IWORKCellType
Definition: IWORKEnum.h:70
bool m_bandedRows
Definition: IWORKTable.h:95
unsigned m_footerRows
Definition: IWORKTable.h:93
boost::optional< std::string > m_value
Definition: IWORKTable.h:35
void setStyle(const IWORKStylePtr_t &style)
Definition: IWORKTable.cpp:247
unsigned m_headerRows
Definition: IWORKTable.h:92
Cell()
Definition: IWORKTable.cpp:193
bool m_covered
Definition: IWORKTable.h:31

Generated for libetonyek by doxygen 1.8.10