ABWStylesCollector.h Source File documentation

ABWStylesCollector.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 libabw 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 __ABWSTYLESCOLLECTOR_H__
11 #define __ABWSTYLESCOLLECTOR_H__
12
13 #include <memory>
14 #include <stack>
15 #include <librevenge/librevenge.h>
16 #include "ABWCollector.h"
17
18 namespace libabw
19 {
20
21 struct ABWStylesTableState
22 {
23 ABWStylesTableState();
24 ABWStylesTableState(const ABWStylesTableState &ts);
25 ~ABWStylesTableState();
26
27 ABWPropertyMap m_currentCellProperties;
28
29 int m_currentTableWidth;
30 int m_currentTableRow;
31 int m_currentTableId;
32 };
33
34 struct ABWStylesParsingState
35 {
36 ABWStylesParsingState();
37 ABWStylesParsingState(const ABWStylesParsingState &ps);
38 ~ABWStylesParsingState();
39
40 std::stack<ABWStylesTableState> m_tableStates;
41 };
42
43 class ABWStylesCollector : public ABWCollector
44 {
45 public:
46 ABWStylesCollector(std::map<int, int> &tableSizes,
47 std::map<std::string, ABWData> &data,
48 std::map<int, std::shared_ptr<ABWListElement>> &listElements);
49 ~ABWStylesCollector() override;
50
51 // collector functions
52
53 void collectTextStyle(const char *, const char *, const char *, const char *) override {}
54 void collectDocumentProperties(const char *) override {}
55 void collectParagraphProperties(const char *level, const char *listid, const char *parentid,
56 const char *style, const char *props) override;
57 void collectSectionProperties(const char *, const char *, const char *, const char *,
58 const char *, const char *, const char *, const char *,
59 const char *) override {}
60 void collectCharacterProperties(const char *, const char *) override {}
61 void collectPageSize(const char *, const char *, const char *, const char *) override {}
62 void closeParagraphOrListElement() override {}
63 void closeSpan() override {}
64 void openLink(const char *) override {}
65 void closeLink() override {}
66 void openFoot(const char *) override {}
67 void closeFoot() override {}
68 void openEndnote(const char *) override {}
69 void closeEndnote() override {}
70 void openField(const char *, const char *) override {}
71 void closeField() override {}
72 void endSection() override {}
73 void startDocument() override {}
74 void endDocument() override {}
75 void insertLineBreak() override {}
76 void insertColumnBreak() override {}
77 void insertPageBreak() override {}
78 void insertText(const char *) override {}
79 void insertImage(const char *, const char *) override {}
80
81 void collectData(const char *name, const char *mimeType, const librevenge::RVNGBinaryData &data) override;
82 void collectHeaderFooter(const char *, const char *) override {}
83 void collectList(const char *id, const char *listDecimal, const char *listDelim,
84 const char *parentid, const char *startValue, const char *type) override;
85
86 void openTable(const char *props) override;
87 void closeTable() override;
88 void openCell(const char *props) override;
89 void closeCell() override;
90
91 void openFrame(const char *, const char *, const char *, const char *) override {}
92 void closeFrame(ABWOutputElements *(&elements), bool &) override
93 {
94 elements=nullptr;
95 }
96 void addFrameElements(ABWOutputElements &, bool) override {}
97
98 void addMetadataEntry(const char *, const char *) override {}
99
100 private:
101 ABWStylesCollector(const ABWStylesCollector &);
102 ABWStylesCollector &operator=(const ABWStylesCollector &);
103
104 std::string _findCellProperty(const char *name);
105 void _processList(int id, const char *listDelim, int parentid, int startValue, int type);
106
107 std::unique_ptr<ABWStylesParsingState> m_ps;
108 std::map<int, int> &m_tableSizes;
109 std::map<std::string, ABWData> &m_data;
110 int m_tableCounter;
111 std::map<int, std::shared_ptr<ABWListElement>> &m_listElements;
112 };
113
114 } // namespace libabw
115
116 #endif /* __ABWSTYLESCOLLECTOR_H__ */
117 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libabw::ABWStylesCollector::collectHeaderFooter
void collectHeaderFooter(const char *, const char *) override
Definition: ABWStylesCollector.h:82
libabw::ABWStylesTableState::m_currentTableWidth
int m_currentTableWidth
Definition: ABWStylesCollector.h:29
libabw::ABWStylesCollector::openTable
void openTable(const char *props) override
Definition: ABWStylesCollector.cpp:152
libabw::ABWStylesTableState::~ABWStylesTableState
~ABWStylesTableState()
Definition: ABWStylesCollector.cpp:129
libabw::ABWStylesTableState::m_currentTableRow
int m_currentTableRow
Definition: ABWStylesCollector.h:30
libabw::ABWStylesCollector::closeFoot
void closeFoot() override
Definition: ABWStylesCollector.h:67
libabw::ABWStylesCollector::~ABWStylesCollector
~ABWStylesCollector() override
Definition: ABWStylesCollector.cpp:148
libabw::ABWStylesCollector::operator=
ABWStylesCollector & operator=(const ABWStylesCollector &)
libabw::ABWStylesCollector::collectCharacterProperties
void collectCharacterProperties(const char *, const char *) override
Definition: ABWStylesCollector.h:60
libabw::ABWStylesCollector::openField
void openField(const char *, const char *) override
Definition: ABWStylesCollector.h:70
libabw::ABWStylesCollector::openFoot
void openFoot(const char *) override
Definition: ABWStylesCollector.h:66
libabw::ABWStylesParsingState::~ABWStylesParsingState
~ABWStylesParsingState()
Definition: ABWStylesCollector.cpp:137
libabw::ABWStylesTableState
Definition: ABWStylesCollector.h:21
libabw::ABWStylesCollector::collectPageSize
void collectPageSize(const char *, const char *, const char *, const char *) override
Definition: ABWStylesCollector.h:61
libabw::ABWStylesCollector::collectDocumentProperties
void collectDocumentProperties(const char *) override
Definition: ABWStylesCollector.h:54
libabw::ABWStylesCollector
Definition: ABWStylesCollector.h:43
libabw::ABWStylesCollector::m_listElements
std::map< int, std::shared_ptr< ABWListElement > > & m_listElements
Definition: ABWStylesCollector.h:111
libabw::ABWStylesCollector::openFrame
void openFrame(const char *, const char *, const char *, const char *) override
Definition: ABWStylesCollector.h:91
libabw::ABWStylesTableState::m_currentCellProperties
ABWPropertyMap m_currentCellProperties
Definition: ABWStylesCollector.h:27
libabw::ABWStylesParsingState::m_tableStates
std::stack< ABWStylesTableState > m_tableStates
Definition: ABWStylesCollector.h:40
libabw::ABWStylesCollector::m_tableSizes
std::map< int, int > & m_tableSizes
Definition: ABWStylesCollector.h:108
libabw::ABWStylesTableState::m_currentTableId
int m_currentTableId
Definition: ABWStylesCollector.h:31
libabw
Definition: AbiDocument.cpp:16
libabw::ABWStylesCollector::insertPageBreak
void insertPageBreak() override
Definition: ABWStylesCollector.h:77
libabw::ABWStylesCollector::collectData
void collectData(const char *name, const char *mimeType, const librevenge::RVNGBinaryData &data) override
Definition: ABWStylesCollector.cpp:217
libabw::ABWStylesCollector::closeCell
void closeCell() override
Definition: ABWStylesCollector.cpp:203
libabw::ABWStylesCollector::openEndnote
void openEndnote(const char *) override
Definition: ABWStylesCollector.h:68
libabw::ABWOutputElements
Definition: ABWOutputElements.h:24
libabw::ABWStylesCollector::closeTable
void closeTable() override
Definition: ABWStylesCollector.cpp:160
libabw::ABWStylesTableState::ABWStylesTableState
ABWStylesTableState()
Definition: ABWStylesCollector.cpp:117
libabw::ABWStylesCollector::closeParagraphOrListElement
void closeParagraphOrListElement() override
Definition: ABWStylesCollector.h:62
libabw::ABWStylesCollector::insertColumnBreak
void insertColumnBreak() override
Definition: ABWStylesCollector.h:76
libabw::ABWStylesCollector::collectParagraphProperties
void collectParagraphProperties(const char *level, const char *listid, const char *parentid, const char *style, const char *props) override
Definition: ABWStylesCollector.cpp:348
libabw::ABWStylesCollector::startDocument
void startDocument() override
Definition: ABWStylesCollector.h:73
libabw::ABWStylesCollector::endSection
void endSection() override
Definition: ABWStylesCollector.h:72
libabw::ABWStylesCollector::m_tableCounter
int m_tableCounter
Definition: ABWStylesCollector.h:110
libabw::ABWStylesCollector::insertText
void insertText(const char *) override
Definition: ABWStylesCollector.h:78
libabw::ABWStylesCollector::collectList
void collectList(const char *id, const char *listDecimal, const char *listDelim, const char *parentid, const char *startValue, const char *type) override
Definition: ABWStylesCollector.cpp:326
libabw::ABWStylesCollector::collectSectionProperties
void collectSectionProperties(const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *) override
Definition: ABWStylesCollector.h:57
libabw::ABWStylesParsingState
Definition: ABWStylesCollector.h:34
libabw::ABWStylesParsingState::ABWStylesParsingState
ABWStylesParsingState()
Definition: ABWStylesCollector.cpp:131
libabw::ABWStylesCollector::insertLineBreak
void insertLineBreak() override
Definition: ABWStylesCollector.h:75
libabw::ABWStylesCollector::closeSpan
void closeSpan() override
Definition: ABWStylesCollector.h:63
libabw::ABWStylesCollector::closeField
void closeField() override
Definition: ABWStylesCollector.h:71
libabw::ABWStylesCollector::_findCellProperty
std::string _findCellProperty(const char *name)
Definition: ABWStylesCollector.cpp:209
libabw::ABWStylesCollector::addFrameElements
void addFrameElements(ABWOutputElements &, bool) override
Definition: ABWStylesCollector.h:96
libabw::ABWCollector
Definition: ABWCollector.h:106
libabw::ABWStylesCollector::m_ps
std::unique_ptr< ABWStylesParsingState > m_ps
Definition: ABWStylesCollector.h:107
libabw::ABWStylesCollector::addMetadataEntry
void addMetadataEntry(const char *, const char *) override
Definition: ABWStylesCollector.h:98
libabw::ABWStylesCollector::closeLink
void closeLink() override
Definition: ABWStylesCollector.h:65
libabw::ABWStylesCollector::openLink
void openLink(const char *) override
Definition: ABWStylesCollector.h:64
libabw::ABWStylesCollector::ABWStylesCollector
ABWStylesCollector(std::map< int, int > &tableSizes, std::map< std::string, ABWData > &data, std::map< int, std::shared_ptr< ABWListElement >> &listElements)
Definition: ABWStylesCollector.cpp:139
libabw::ABWStylesCollector::closeFrame
void closeFrame(ABWOutputElements *(&elements), bool &) override
Definition: ABWStylesCollector.h:92
libabw::ABWStylesCollector::_processList
void _processList(int id, const char *listDelim, int parentid, int startValue, int type)
Definition: ABWStylesCollector.cpp:224
libabw::ABWStylesCollector::openCell
void openCell(const char *props) override
Definition: ABWStylesCollector.cpp:170
libabw::ABWPropertyMap
std::map< std::string, std::string > ABWPropertyMap
Definition: ABWCollector.h:39
libabw::ABWStylesCollector::collectTextStyle
void collectTextStyle(const char *, const char *, const char *, const char *) override
Definition: ABWStylesCollector.h:53
libabw::ABWStylesCollector::m_data
std::map< std::string, ABWData > & m_data
Definition: ABWStylesCollector.h:109
libabw::ABWStylesCollector::insertImage
void insertImage(const char *, const char *) override
Definition: ABWStylesCollector.h:79
ABWCollector.h
libabw::ABWStylesCollector::closeEndnote
void closeEndnote() override
Definition: ABWStylesCollector.h:69
libabw::ABWStylesCollector::endDocument
void endDocument() override
Definition: ABWStylesCollector.h:74