FB2TableContext.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 libe-book 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 FB2TABLECONTEXT_H_INCLUDED
11 #define FB2TABLECONTEXT_H_INCLUDED
12
13 #include "FB2ParserContext.h"
14
15 namespace libebook
16 {
17
18 class FB2TableModel;
19
20 class FB2TableContext : public FB2BlockFormatContextBase
21 {
22 // disable copying
23 FB2TableContext(const FB2TableContext &other);
24 FB2TableContext &operator=(const FB2TableContext &other);
25
26 public:
27 FB2TableContext(FB2ParserContext *parentContext, const FB2BlockFormat &format);
28 virtual ~FB2TableContext();
29
30 private:
31 virtual FB2XMLParserContext *element(const FB2TokenData &name, const FB2TokenData &ns);
32 virtual void startOfElement();
33 virtual void endOfElement();
34 virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
35
36 private:
37 FB2TableModel *m_model;
38 };
39
40 class FB2CellContext : public FB2StyleContextBase
41 {
42 // disable copying
43 FB2CellContext(const FB2CellContext &other);
44 FB2CellContext &operator=(const FB2CellContext &other);
45
46 public:
47 FB2CellContext(FB2ParserContext *parentContext, FB2TableModel *model, const FB2BlockFormat &format, bool header);
48
49 private:
50 virtual void startOfElement();
51 virtual void endOfElement();
52 virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
53 virtual void endOfAttributes();
54
55 void openCell();
56
57 private:
58 FB2TableModel *const m_model;
59 const bool m_header;
60 bool m_opened;
61 int m_columnSpan;
62 int m_rowSpan;
63 size_t m_coveredColumns;
64 };
65
66 class FB2TrContext : public FB2BlockFormatContextBase
67 {
68 // no copying
69 FB2TrContext(const FB2TrContext &);
70 FB2TrContext &operator=(const FB2TrContext &);
71
72 public:
73 FB2TrContext(FB2ParserContext *parentContext, FB2TableModel *model, const FB2BlockFormat &format);
74
75 private:
76 virtual FB2XMLParserContext *element(const FB2TokenData &name, const FB2TokenData &ns);
77 virtual void endOfElement();
78 virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value);
79
80 void openRow(bool header);
81
82 private:
83 FB2TableModel *m_model;
84 bool m_opened;
85 };
86
87 }
88
89 #endif // FB2TABLECONTEXT_H_INCLUDED
90
91 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::FB2TrContext::m_opened
bool m_opened
Definition: FB2TableContext.h:84
libebook::FB2CellContext::m_rowSpan
int m_rowSpan
Definition: FB2TableContext.h:62
FB2ParserContext.h
libebook::FB2TableContext::~FB2TableContext
virtual ~FB2TableContext()
Definition: FB2TableContext.cpp:132
libebook::FB2XMLParserContext
Definition: FB2XMLParserContext.h:18
libebook::FB2TokenData
Definition: FB2Token.h:135
libebook::FB2NodeContextBase::endOfAttributes
virtual void endOfAttributes()
Signalize the end of attributes.
Definition: FB2ParserContext.cpp:50
libebook::FB2TableContext::m_model
FB2TableModel * m_model
Definition: FB2TableContext.h:37
libebook::FB2TrContext
Definition: FB2TableContext.h:66
libebook::EBOOKHTMLToken::value
Definition: EBOOKHTMLToken.h:263
libebook::FB2TableModel
Definition: FB2TableContext.cpp:21
libebook::FB2CellContext::m_opened
bool m_opened
Definition: FB2TableContext.h:60
libebook::FB2TableContext::element
virtual FB2XMLParserContext * element(const FB2TokenData &name, const FB2TokenData &ns)
Create a context for parsing a child element.
Definition: FB2TableContext.cpp:137
libebook::FB2TableContext::startOfElement
virtual void startOfElement()
Signalize the start of an element.
Definition: FB2TableContext.cpp:153
libebook::FB2CellContext::m_coveredColumns
size_t m_coveredColumns
Definition: FB2TableContext.h:63
libebook::FB2TableContext::FB2TableContext
FB2TableContext(const FB2TableContext &other)
libebook::FB2TableContext::operator=
FB2TableContext & operator=(const FB2TableContext &other)
libebook::FB2BlockFormatContextBase
Definition: FB2ParserContext.h:151
libebook::FB2CellContext
Definition: FB2TableContext.h:40
libebook::FB2TrContext::m_model
FB2TableModel * m_model
Definition: FB2TableContext.h:83
name
string name
Definition: CHMStream.cpp:80
libebook::FB2TableContext::attribute
virtual void attribute(const FB2TokenData &name, const FB2TokenData *ns, const char *value)
Process an attribute.
Definition: FB2TableContext.cpp:163
libebook::FB2TableContext
Definition: FB2TableContext.h:20
libebook::EBOOKOPFToken::format
Definition: EBOOKOPFToken.h:56
libebook::FB2CellContext::m_columnSpan
int m_columnSpan
Definition: FB2TableContext.h:61
libebook::FB2CellContext::m_model
FB2TableModel *const m_model
Definition: FB2TableContext.h:58
libebook::FB2TableContext::endOfElement
virtual void endOfElement()
Signalize the end of an element.
Definition: FB2TableContext.cpp:158
libebook
Definition: CHMParser.cpp:20
libebook::FB2StyleContextBase
Definition: FB2ParserContext.h:132
libebook::EBOOKHTMLToken::header
Definition: EBOOKHTMLToken.h:84
libebook::FB2BlockFormat
Definition: FB2Style.h:35
libebook::FB2CellContext::m_header
const bool m_header
Definition: FB2TableContext.h:59
libebook::FB2ParserContext
Base class for all contexts.
Definition: FB2ParserContext.h:23