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 <map>
15#include <memory>
16#include <utility>
17
18#include <boost/optional.hpp>
19
20#include "IWORKStyle_fwd.h"
21#include "IWORKTypes.h"
22#include "IWORKOutputElements.h"
23
24namespace libetonyek
25{
26
28class IWORKText;
29
31{
32 struct Cell
33 {
35 unsigned m_columnSpan;
36 unsigned m_rowSpan;
39 boost::optional<unsigned> m_formulaHC;
42 boost::optional<std::string> m_value;
43 boost::optional<IWORKDateTimeData> m_dateTime;
44
45 Cell();
46 };
47
48 typedef std::map<unsigned, Cell> Row_t;
49 typedef std::deque<Row_t> Table_t;
50
51public:
60
61public:
62 explicit IWORKTable(const IWORKTableNameMapPtr_t &tableNameMap, IWORKFormatNameMap &formatNameMap, const IWORKLanguageManager &langManager);
63
64 void setName(std::string const &name);
65 void setSize(unsigned columns, unsigned rows);
66 void setHeaders(unsigned headerColumns, unsigned headerRows, unsigned footerRows);
67 void setBandedRows(bool banded = true);
68 void setRepeated(bool columns, bool rows);
69
70 void setOrder(int order);
71 void setStyle(const IWORKStylePtr_t &style);
72 void setSizes(const IWORKColumnSizes_t &columnSizes, const IWORKRowSizes_t &rowSizes);
73 void setBorders(const IWORKGridLineMap_t &verticalLines, const IWORKGridLineMap_t &horizontalLines);
74 void setBorders(const IWORKGridLineMap_t &verticalLeftLines, const IWORKGridLineMap_t &verticalRightLines,
75 const IWORKGridLineMap_t &horizontalTopLines, const IWORKGridLineMap_t &horizontalBottomLines);
76 void setComment(unsigned column, unsigned row, IWORKOutputElements const &text);
77 void insertCell(unsigned column, unsigned row,
78 const boost::optional<std::string> &value = boost::none,
79 const std::shared_ptr<IWORKText> &text = std::shared_ptr<IWORKText>(),
80 const boost::optional<IWORKDateTimeData> &dateTime = boost::none,
81 unsigned columnSpan = 1, unsigned rowSpan = 1,
83 const boost::optional<unsigned> &formulaHC = boost::none,
86 void insertCoveredCell(unsigned column, unsigned row);
87
88 void draw(const librevenge::RVNGPropertyList &tableProps, IWORKOutputElements &elements, bool drawAsSimpleTable);
89
93
94 boost::optional<int> getOrder() const;
96 IWORKStylePtr_t getDefaultCellStyle(unsigned column, unsigned row) const;
97 IWORKStylePtr_t getDefaultLayoutStyle(unsigned column, unsigned row) const;
98 IWORKStylePtr_t getDefaultParagraphStyle(unsigned column, unsigned row) const;
99
100private:
101 IWORKStylePtr_t getDefaultStyle(unsigned column, unsigned row, const IWORKStylePtr_t *group) const;
102
103 boost::optional<std::string> writeFormat(IWORKOutputElements &elements, const IWORKStylePtr_t &style, const IWORKCellType type, boost::optional<std::string> &rvngValueType);
104
105private:
109 std::map<std::pair<unsigned, unsigned>, IWORKOutputElements> m_commentMap;
110
113 boost::optional<std::string> m_name;
114 boost::optional<int> m_order;
118 IWORKGridLineMap_t m_verticalRightLines; // if empty, m_verticalLines stores right/left line
120 IWORKGridLineMap_t m_horizontalBottomLines; // if empty, m_horizontalLines stores right/left line
121
122 unsigned m_rows;
123 unsigned m_columns;
124 unsigned m_headerRows;
125 unsigned m_footerRows;
130
134};
135
136}
137
138#endif // IWORKTABLE_H_INCLUDED
139
140/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition IWORKLanguageManager.h:24
Definition IWORKOutputElements.h:33
const IWORKLanguageManager & m_langManager
Definition IWORKTable.h:107
IWORKStylePtr_t m_defaultLayoutStyles[5]
Definition IWORKTable.h:132
std::map< unsigned, Cell > Row_t
Definition IWORKTable.h:48
boost::optional< std::string > writeFormat(IWORKOutputElements &elements, const IWORKStylePtr_t &style, const IWORKCellType type, boost::optional< std::string > &rvngValueType)
Definition IWORKTable.cpp:600
IWORKGridLineMap_t m_verticalRightLines
Definition IWORKTable.h:118
void setDefaultCellStyle(CellType type, const IWORKStylePtr_t &style)
Definition IWORKTable.cpp:930
IWORKFormatNameMap & m_formatNameMap
Definition IWORKTable.h:108
boost::optional< int > getOrder() const
Definition IWORKTable.cpp:948
void draw(const librevenge::RVNGPropertyList &tableProps, IWORKOutputElements &elements, bool drawAsSimpleTable)
Definition IWORKTable.cpp:676
IWORKColumnSizes_t m_columnSizes
Definition IWORKTable.h:115
bool m_bandedRows
Definition IWORKTable.h:127
void setBandedRows(bool banded=true)
Definition IWORKTable.cpp:507
void setDefaultLayoutStyle(CellType type, const IWORKStylePtr_t &style)
Definition IWORKTable.cpp:936
IWORKStylePtr_t getStyle() const
Definition IWORKTable.cpp:953
void setName(std::string const &name)
Definition IWORKTable.cpp:489
unsigned m_footerRows
Definition IWORKTable.h:125
unsigned m_headerColumns
Definition IWORKTable.h:126
void insertCell(unsigned column, unsigned row, const boost::optional< std::string > &value=boost::none, const std::shared_ptr< IWORKText > &text=std::shared_ptr< IWORKText >(), const boost::optional< IWORKDateTimeData > &dateTime=boost::none, unsigned columnSpan=1, unsigned rowSpan=1, const IWORKFormulaPtr_t &formula=IWORKFormulaPtr_t(), const boost::optional< unsigned > &formulaHC=boost::none, const IWORKStylePtr_t &style=IWORKStylePtr_t(), IWORKCellType type=IWORK_CELL_TYPE_TEXT)
Definition IWORKTable.cpp:557
IWORKRowSizes_t m_rowSizes
Definition IWORKTable.h:116
void setStyle(const IWORKStylePtr_t &style)
Definition IWORKTable.cpp:523
Table_t m_table
Definition IWORKTable.h:111
IWORKGridLineMap_t m_horizontalLines
Definition IWORKTable.h:119
bool m_headerColumnsRepeated
Definition IWORKTable.h:129
IWORKStylePtr_t getDefaultCellStyle(unsigned column, unsigned row) const
Definition IWORKTable.cpp:958
boost::optional< int > m_order
Definition IWORKTable.h:114
IWORKGridLineMap_t m_horizontalBottomLines
Definition IWORKTable.h:120
IWORKTable(const IWORKTableNameMapPtr_t &tableNameMap, IWORKFormatNameMap &formatNameMap, const IWORKLanguageManager &langManager)
Definition IWORKTable.cpp:463
boost::optional< std::string > m_name
Definition IWORKTable.h:113
IWORKStylePtr_t getDefaultParagraphStyle(unsigned column, unsigned row) const
Definition IWORKTable.cpp:968
unsigned m_headerRows
Definition IWORKTable.h:124
bool m_headerRowsRepeated
Definition IWORKTable.h:128
IWORKStylePtr_t getDefaultLayoutStyle(unsigned column, unsigned row) const
Definition IWORKTable.cpp:963
IWORKStylePtr_t m_defaultParaStyles[5]
Definition IWORKTable.h:133
unsigned m_rows
Definition IWORKTable.h:122
void setBorders(const IWORKGridLineMap_t &verticalLines, const IWORKGridLineMap_t &horizontalLines)
Definition IWORKTable.cpp:537
void setSizes(const IWORKColumnSizes_t &columnSizes, const IWORKRowSizes_t &rowSizes)
Definition IWORKTable.cpp:528
void setRepeated(bool columns, bool rows)
Definition IWORKTable.cpp:512
unsigned m_columns
Definition IWORKTable.h:123
IWORKGridLineMap_t m_verticalLines
Definition IWORKTable.h:117
IWORKStylePtr_t getDefaultStyle(unsigned column, unsigned row, const IWORKStylePtr_t *group) const
Definition IWORKTable.cpp:973
IWORKStylePtr_t m_style
Definition IWORKTable.h:112
void setDefaultParagraphStyle(CellType type, const IWORKStylePtr_t &style)
Definition IWORKTable.cpp:942
const IWORKTableNameMapPtr_t m_tableNameMap
Definition IWORKTable.h:106
void setSize(unsigned columns, unsigned rows)
Definition IWORKTable.cpp:494
void setOrder(int order)
Definition IWORKTable.cpp:518
IWORKStylePtr_t m_defaultCellStyles[5]
Definition IWORKTable.h:131
void setHeaders(unsigned headerColumns, unsigned headerRows, unsigned footerRows)
Definition IWORKTable.cpp:500
void setComment(unsigned column, unsigned row, IWORKOutputElements const &text)
Definition IWORKTable.cpp:543
std::deque< Row_t > Table_t
Definition IWORKTable.h:49
CellType
Definition IWORKTable.h:53
@ CELL_TYPE_ROW_HEADER
Definition IWORKTable.h:57
@ CELL_TYPE_ROW_FOOTER
Definition IWORKTable.h:58
@ CELL_TYPE_BODY
Definition IWORKTable.h:54
@ CELL_TYPE_ALTERNATE_BODY
Definition IWORKTable.h:55
@ CELL_TYPE_COLUMN_HEADER
Definition IWORKTable.h:56
std::map< std::pair< unsigned, unsigned >, IWORKOutputElements > m_commentMap
Definition IWORKTable.h:109
void insertCoveredCell(unsigned column, unsigned row)
Definition IWORKTable.cpp:590
Definition IWORKText.h:33
@ column
Definition IWORKToken.h:156
@ value
Definition IWORKToken.h:631
@ row
Definition IWORKToken.h:390
@ text
Definition IWORKToken.h:472
@ rows
Definition IWORKToken.h:392
@ type
Definition IWORKToken.h:493
@ group
Definition IWORKToken.h:248
@ style
Definition IWORKToken.h:421
@ formula
Definition IWORKToken.h:228
@ columns
Definition IWORKToken.h:158
@ name
Definition IWORKToken.h:585
@ order
Definition PAG1Token.h:43
Definition IWORKBezierElement.cpp:21
IWORKCellType
Definition IWORKEnum.h:80
@ IWORK_CELL_TYPE_TEXT
Definition IWORKEnum.h:82
std::unordered_map< std::string, std::string > IWORKFormatNameMap
Definition IWORKTypes_fwd.h:32
std::map< unsigned, IWORKGridLine_t > IWORKGridLineMap_t
Definition IWORKTypes.h:122
std::deque< IWORKColumnRowSize > IWORKColumnSizes_t
Definition IWORKTypes_fwd.h:24
std::shared_ptr< IWORKFormula > IWORKFormulaPtr_t
Definition IWORKTypes.h:125
std::deque< IWORKColumnRowSize > IWORKRowSizes_t
Definition IWORKTypes_fwd.h:26
std::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition IWORKStyle_fwd.h:23
std::shared_ptr< IWORKTableNameMap_t > IWORKTableNameMapPtr_t
Definition IWORKTypes_fwd.h:36
IWORKCellType m_type
Definition IWORKTable.h:41
unsigned m_columnSpan
Definition IWORKTable.h:35
IWORKStylePtr_t m_style
Definition IWORKTable.h:40
unsigned m_rowSpan
Definition IWORKTable.h:36
IWORKFormulaPtr_t m_formula
Definition IWORKTable.h:38
IWORKOutputElements m_content
Definition IWORKTable.h:34
boost::optional< IWORKDateTimeData > m_dateTime
Definition IWORKTable.h:43
boost::optional< unsigned > m_formulaHC
Definition IWORKTable.h:39
Cell()
Definition IWORKTable.cpp:449
bool m_covered
Definition IWORKTable.h:37
boost::optional< std::string > m_value
Definition IWORKTable.h:42

Generated for libetonyek by doxygen 1.18.0