- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

ABWCollector.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 __ABWCOLLECTOR_H__
11 #define __ABWCOLLECTOR_H__
12
13 #include <string>
14 #include <map>
15 #include <librevenge/librevenge.h>
16
17 namespace libabw
18 {
19
20 enum ABWUnit
21 {
22 ABW_NONE,
23 ABW_CM,
24 ABW_IN,
25 ABW_MM,
26 ABW_PI,
27 ABW_PT,
28 ABW_PX,
29 ABW_PERCENT
30 };
31
32 enum ABWListType
33 {
34 ABW_ORDERED,
35 ABW_UNORDERED
36 };
37
38 typedef std::map<std::string, std::string> ABWPropertyMap;
39
40 bool findInt(const std::string &str, int &res);
41 bool findDouble(const std::string &str, double &res, ABWUnit &unit);
42 void parsePropString(const std::string &str, ABWPropertyMap &props);
43
44 struct ABWData
45 {
46 ABWData()
47 : m_mimeType(), m_binaryData() {}
48 ABWData(const ABWData &data)
49 : m_mimeType(data.m_mimeType), m_binaryData(data.m_binaryData) {}
50 ABWData(const librevenge::RVNGString &mimeType, const librevenge::RVNGBinaryData binaryData)
51 : m_mimeType(mimeType), m_binaryData(binaryData) {}
52 ~ABWData() {}
53
54 librevenge::RVNGString m_mimeType;
55 librevenge::RVNGBinaryData m_binaryData;
56 };
57
58 struct ABWListElement
59 {
60 ABWListElement()
61 : m_listLevel(-1), m_minLabelWidth(0.0), m_spaceBefore(0.0), m_parentId() {}
62 virtual ~ABWListElement() {}
63 virtual void writeOut(librevenge::RVNGPropertyList &propList) const;
64 virtual ABWListType getType() const = 0;
65
66 int m_listLevel;
67 double m_minLabelWidth;
68 double m_spaceBefore;
69 int m_parentId;
70 };
71
72 struct ABWOrderedListElement : public ABWListElement
73 {
74 ABWOrderedListElement()
75 : ABWListElement(), m_numFormat(), m_numPrefix(), m_numSuffix(), m_startValue(-1) {}
76 ~ABWOrderedListElement() {}
77 void writeOut(librevenge::RVNGPropertyList &propList) const;
78 ABWListType getType() const
79 {
80 return ABW_ORDERED;
81 }
82
83 librevenge::RVNGString m_numFormat;
84 librevenge::RVNGString m_numPrefix;
85 librevenge::RVNGString m_numSuffix;
86 int m_startValue;
87 };
88
89 struct ABWUnorderedListElement : public ABWListElement
90 {
91 ABWUnorderedListElement()
92 : ABWListElement(), m_bulletChar() {}
93 ~ABWUnorderedListElement() {}
94 void writeOut(librevenge::RVNGPropertyList &propList) const;
95 ABWListType getType() const
96 {
97 return ABW_UNORDERED;
98 }
99
100 librevenge::RVNGString m_bulletChar;
101 };
102
103 class ABWCollector
104 {
105 public:
106 ABWCollector() {}
107 virtual ~ABWCollector() {}
108
109 // collector functions
110
111 virtual void collectTextStyle(const char *name, const char *basedon, const char *followedby, const char *props) = 0;
112 virtual void collectDocumentProperties(const char *props) = 0;
113 virtual void collectParagraphProperties(const char *level, const char *listid, const char *parentid,
114 const char *style, const char *props) = 0;
115 virtual void collectSectionProperties(const char *footer, const char *footerLeft, const char *footerFirst,
116 const char *footerLast, const char *header, const char *headerLeft,
117 const char *headerFirst, const char *headerLast, const char *props) = 0;
118 virtual void collectCharacterProperties(const char *style, const char *props) = 0;
119 virtual void collectPageSize(const char *width, const char *height, const char *units, const char *pageScale) = 0;
120 virtual void closeParagraphOrListElement() = 0;
121 virtual void closeSpan() = 0;
122 virtual void openLink(const char *href) = 0;
123 virtual void closeLink() = 0;
124 virtual void openFoot(const char *id) = 0;
125 virtual void closeFoot() = 0;
126 virtual void openEndnote(const char *id) = 0;
127 virtual void closeEndnote() = 0;
128 virtual void endSection() = 0;
129 virtual void startDocument() = 0;
130 virtual void endDocument() = 0;
131 virtual void insertLineBreak() = 0;
132 virtual void insertColumnBreak() = 0;
133 virtual void insertPageBreak() = 0;
134 virtual void insertText(const char *text) = 0;
135 virtual void insertImage(const char *dataid, const char *props) = 0;
136 virtual void collectList(const char *id, const char *listDecimal, const char *listDelim,
137 const char *parentid, const char *startValue, const char *type) = 0;
138
139 virtual void collectData(const char *name, const char *mimeType, const librevenge::RVNGBinaryData &data) = 0;
140 virtual void collectHeaderFooter(const char *id, const char *type) = 0;
141
142 virtual void openTable(const char *props) = 0;
143 virtual void closeTable() = 0;
144 virtual void openCell(const char *props) = 0;
145 virtual void closeCell() = 0;
146
147 virtual void addMetadataEntry(const char *name, const char *value) = 0;
148 };
149
150 } // namespace libabw
151
152 #endif /* __ABWCOLLECTOR_H__ */
153 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libabw::ABWListElement::m_spaceBefore
double m_spaceBefore
Definition: ABWCollector.h:68
libabw::ABWCollector::ABWCollector
ABWCollector()
Definition: ABWCollector.h:106
libabw::ABW_PX
Definition: ABWCollector.h:28
libabw::ABWData::m_binaryData
librevenge::RVNGBinaryData m_binaryData
Definition: ABWCollector.h:55
libabw::ABWUnorderedListElement
Definition: ABWCollector.h:89
libabw::ABWCollector::closeTable
virtual void closeTable()=0
libabw::ABWUnorderedListElement::ABWUnorderedListElement
ABWUnorderedListElement()
Definition: ABWCollector.h:91
libabw::ABWCollector::~ABWCollector
virtual ~ABWCollector()
Definition: ABWCollector.h:107
libabw::ABWCollector::endDocument
virtual void endDocument()=0
libabw::ABW_CM
Definition: ABWCollector.h:23
libabw::ABWCollector::insertText
virtual void insertText(const char *text)=0
libabw::ABWOrderedListElement::writeOut
void writeOut(librevenge::RVNGPropertyList &propList) const
Definition: ABWCollector.cpp:123
libabw::ABWCollector::collectData
virtual void collectData(const char *name, const char *mimeType, const librevenge::RVNGBinaryData &data)=0
libabw::ABWListElement::m_parentId
int m_parentId
Definition: ABWCollector.h:69
libabw::ABWListElement::getType
virtual ABWListType getType() const =0
libabw::ABWCollector::collectTextStyle
virtual void collectTextStyle(const char *name, const char *basedon, const char *followedby, const char *props)=0
libabw::ABWCollector::closeParagraphOrListElement
virtual void closeParagraphOrListElement()=0
libabw::ABWOrderedListElement::~ABWOrderedListElement
~ABWOrderedListElement()
Definition: ABWCollector.h:76
libabw::parsePropString
void parsePropString(const std::string &str, ABWPropertyMap &props)
Definition: ABWCollector.cpp:30
libabw
Definition: ABWCollector.h:17
libabw::ABWListElement::~ABWListElement
virtual ~ABWListElement()
Definition: ABWCollector.h:62
libabw::ABWCollector::closeSpan
virtual void closeSpan()=0
libabw::ABWCollector::collectCharacterProperties
virtual void collectCharacterProperties(const char *style, const char *props)=0
libabw::ABWData::ABWData
ABWData(const librevenge::RVNGString &mimeType, const librevenge::RVNGBinaryData binaryData)
Definition: ABWCollector.h:50
libabw::ABWOrderedListElement::ABWOrderedListElement
ABWOrderedListElement()
Definition: ABWCollector.h:74
libabw::ABWListElement::writeOut
virtual void writeOut(librevenge::RVNGPropertyList &propList) const
Definition: ABWCollector.cpp:115
libabw::ABWListElement
Definition: ABWCollector.h:58
libabw::ABWCollector::insertLineBreak
virtual void insertLineBreak()=0
libabw::ABWOrderedListElement::m_numSuffix
librevenge::RVNGString m_numSuffix
Definition: ABWCollector.h:85
libabw::ABWUnorderedListElement::~ABWUnorderedListElement
~ABWUnorderedListElement()
Definition: ABWCollector.h:93
libabw::ABW_ORDERED
Definition: ABWCollector.h:34
libabw::ABWListElement::m_listLevel
int m_listLevel
Definition: ABWCollector.h:66
libabw::ABWCollector::insertColumnBreak
virtual void insertColumnBreak()=0
libabw::ABWUnorderedListElement::writeOut
void writeOut(librevenge::RVNGPropertyList &propList) const
Definition: ABWCollector.cpp:135
libabw::ABWOrderedListElement::m_startValue
int m_startValue
Definition: ABWCollector.h:86
libabw::ABWUnorderedListElement::getType
ABWListType getType() const
Definition: ABWCollector.h:95
libabw::ABWOrderedListElement::getType
ABWListType getType() const
Definition: ABWCollector.h:78
libabw::ABWCollector::collectList
virtual void collectList(const char *id, const char *listDecimal, const char *listDelim, const char *parentid, const char *startValue, const char *type)=0
libabw::ABWCollector::openTable
virtual void openTable(const char *props)=0
libabw::ABWUnorderedListElement::m_bulletChar
librevenge::RVNGString m_bulletChar
Definition: ABWCollector.h:100
libabw::ABW_PI
Definition: ABWCollector.h:26
libabw::ABWListElement::ABWListElement
ABWListElement()
Definition: ABWCollector.h:60
libabw::ABWCollector::collectDocumentProperties
virtual void collectDocumentProperties(const char *props)=0
libabw::ABWListType
ABWListType
Definition: ABWCollector.h:32
libabw::ABWOrderedListElement::m_numPrefix
librevenge::RVNGString m_numPrefix
Definition: ABWCollector.h:84
libabw::ABWData::ABWData
ABWData()
Definition: ABWCollector.h:46
libabw::ABWCollector::closeLink
virtual void closeLink()=0
libabw::ABWCollector
Definition: ABWCollector.h:103
libabw::ABWListElement::m_minLabelWidth
double m_minLabelWidth
Definition: ABWCollector.h:67
libabw::ABWCollector::startDocument
virtual void startDocument()=0
libabw::ABWOrderedListElement
Definition: ABWCollector.h:72
libabw::findInt
bool findInt(const std::string &str, int &res)
Definition: ABWCollector.cpp:14
libabw::ABWCollector::openEndnote
virtual void openEndnote(const char *id)=0
libabw::ABWData::ABWData
ABWData(const ABWData &data)
Definition: ABWCollector.h:48
libabw::ABW_MM
Definition: ABWCollector.h:25
libabw::ABWCollector::closeEndnote
virtual void closeEndnote()=0
libabw::ABWData::m_mimeType
librevenge::RVNGString m_mimeType
Definition: ABWCollector.h:54
libabw::ABW_PT
Definition: ABWCollector.h:27
libabw::ABWCollector::addMetadataEntry
virtual void addMetadataEntry(const char *name, const char *value)=0
libabw::ABWCollector::openLink
virtual void openLink(const char *href)=0
libabw::ABWData::~ABWData
~ABWData()
Definition: ABWCollector.h:52
libabw::ABWData
Definition: ABWCollector.h:44
libabw::ABWCollector::closeCell
virtual void closeCell()=0
libabw::ABWCollector::collectPageSize
virtual void collectPageSize(const char *width, const char *height, const char *units, const char *pageScale)=0
libabw::ABWCollector::closeFoot
virtual void closeFoot()=0
libabw::ABWCollector::openFoot
virtual void openFoot(const char *id)=0
libabw::ABWOrderedListElement::m_numFormat
librevenge::RVNGString m_numFormat
Definition: ABWCollector.h:83
libabw::ABWPropertyMap
std::map< std::string, std::string > ABWPropertyMap
Definition: ABWCollector.h:38
libabw::ABWCollector::collectHeaderFooter
virtual void collectHeaderFooter(const char *id, const char *type)=0
libabw::ABWCollector::insertPageBreak
virtual void insertPageBreak()=0
libabw::ABW_PERCENT
Definition: ABWCollector.h:29
libabw::ABW_IN
Definition: ABWCollector.h:24
libabw::ABWCollector::endSection
virtual void endSection()=0
libabw::ABWCollector::openCell
virtual void openCell(const char *props)=0
libabw::ABW_UNORDERED
Definition: ABWCollector.h:35
libabw::ABWCollector::collectSectionProperties
virtual void collectSectionProperties(const char *footer, const char *footerLeft, const char *footerFirst, const char *footerLast, const char *header, const char *headerLeft, const char *headerFirst, const char *headerLast, const char *props)=0
libabw::findDouble
bool findDouble(const std::string &str, double &res, ABWUnit &unit)
Definition: ABWCollector.cpp:48
libabw::ABWCollector::collectParagraphProperties
virtual void collectParagraphProperties(const char *level, const char *listid, const char *parentid, const char *style, const char *props)=0
libabw::ABW_NONE
Definition: ABWCollector.h:22
libabw::ABWUnit
ABWUnit
Definition: ABWCollector.h:20
libabw::ABWCollector::insertImage
virtual void insertImage(const char *dataid, const char *props)=0