WPGXParser.h Source File documentation

WPGXParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwpg
3 * Version: MPL 2.0 / LGPLv2.1+
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 * Major Contributor(s):
10 * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
11 * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl)
12 * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
13 *
14 * For minor contributions see the git repository.
15 *
16 * Alternatively, the contents of this file may be used under the terms
17 * of the GNU Lesser General Public License Version 2.1 or later
18 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19 * applicable instead of those above.
20 *
21 * For further information visit http://libwpg.sourceforge.net
22 */
23
24 /* "This product is not manufactured, approved, or supported by
25 * Corel Corporation or Corel Corporation Limited."
26 */
27
28 #ifndef __WPGXPARSER_H__
29 #define __WPGXPARSER_H__
30
31 #include <libwpg/libwpg.h>
32 #include <librevenge-stream/librevenge-stream.h>
33 #include <librevenge/librevenge.h>
34 #include "WPGColor.h"
35
36 #include <map>
37
38 class WPGXParser
39 {
40 public:
41 WPGXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
42 WPGXParser(const WPGXParser &parser);
43 virtual ~WPGXParser() {}
44 virtual bool parse() = 0;
45
46 unsigned char readU8();
47 unsigned short readU16();
48 unsigned int readU32();
49 short readS16();
50 int readS32();
51 unsigned int readVariableLengthInteger();
52 WPGXParser &operator=(const WPGXParser &parser);
53
54 protected:
55 librevenge::RVNGInputStream *m_input;
56 librevenge::RVNGDrawingInterface *m_painter;
57 std::map<int,libwpg::WPGColor> m_colorPalette;
58 };
59
60 class WPGTextDataHandler : public librevenge::RVNGTextInterface
61 {
62 public:
63 WPGTextDataHandler(librevenge::RVNGDrawingInterface *painter) :
64 m_painter(painter),
65 m_fontName("Times New Roman"),
66 m_paragraphStyle(),
67 m_textStyle() {}
68
69 ~WPGTextDataHandler() override {}
70 void setDocumentMetaData(const librevenge::RVNGPropertyList & /* propList */) override {}
71
72 void startDocument(const librevenge::RVNGPropertyList & /* propList */) override {}
73 void endDocument() override {}
74
75 void defineEmbeddedFont(const librevenge::RVNGPropertyList & /* propList */) override {}
76
77 void definePageStyle(const librevenge::RVNGPropertyList & /* propList */) override {}
78 void openPageSpan(const librevenge::RVNGPropertyList & /* propList */) override {}
79 void closePageSpan() override {}
80 void openHeader(const librevenge::RVNGPropertyList & /* propList */) override {}
81 void closeHeader() override {}
82 void openFooter(const librevenge::RVNGPropertyList & /* propList */) override {}
83 void closeFooter() override {}
84
85 void defineParagraphStyle(const librevenge::RVNGPropertyList & /* propList */) override {}
86 void openParagraph(const librevenge::RVNGPropertyList &propList) override;
87 void closeParagraph() override;
88
89 void defineCharacterStyle(const librevenge::RVNGPropertyList & /* propList */) override {}
90 void openSpan(const librevenge::RVNGPropertyList &propList) override;
91 void closeSpan() override;
92
93 void openLink(const librevenge::RVNGPropertyList & /* propList */) override {}
94 void closeLink() override {}
95
96 void defineSectionStyle(const librevenge::RVNGPropertyList & /* propList */) override {}
97 void openSection(const librevenge::RVNGPropertyList & /* propList */) override {}
98 void closeSection() override {}
99
100 void insertTab() override;
101 void insertSpace() override;
102 void insertText(const librevenge::RVNGString &text) override;
103 void insertLineBreak() override;
104 void insertField(const librevenge::RVNGPropertyList & /* propList */) override {}
105
106 void openOrderedListLevel(const librevenge::RVNGPropertyList & /* propList */) override {}
107 void openUnorderedListLevel(const librevenge::RVNGPropertyList & /* propList */) override {}
108 void closeOrderedListLevel() override {}
109 void closeUnorderedListLevel() override {}
110 void openListElement(const librevenge::RVNGPropertyList &propList) override;
111 void closeListElement() override;
112
113 void openFootnote(const librevenge::RVNGPropertyList & /* propList */) override {}
114 void closeFootnote() override {}
115 void openEndnote(const librevenge::RVNGPropertyList & /* propList */) override {}
116 void closeEndnote() override {}
117 void openComment(const librevenge::RVNGPropertyList & /* propList */) override {}
118 void closeComment() override {}
119 void openTextBox(const librevenge::RVNGPropertyList & /* propList */) override {}
120 void closeTextBox() override {}
121
122 void openTable(const librevenge::RVNGPropertyList & /* propList */) override {}
123 void openTableRow(const librevenge::RVNGPropertyList & /* propList */) override {}
124 void closeTableRow() override {}
125 void openTableCell(const librevenge::RVNGPropertyList & /* propList */) override {}
126 void closeTableCell() override {}
127 void insertCoveredTableCell(const librevenge::RVNGPropertyList & /* propList */) override {}
128 void closeTable() override {}
129
130 void openFrame(const librevenge::RVNGPropertyList & /* propList */) override {}
131 void closeFrame() override {}
132
133 void openGroup(const librevenge::RVNGPropertyList & /* propList */) override {}
134 void closeGroup() override {}
135
136 void defineGraphicStyle(const librevenge::RVNGPropertyList & /* propList */) override {}
137 void drawRectangle(const librevenge::RVNGPropertyList & /* propList */) override {}
138 void drawEllipse(const librevenge::RVNGPropertyList & /* propList */) override {}
139 void drawPolygon(const librevenge::RVNGPropertyList & /* propList */) override {}
140 void drawPolyline(const librevenge::RVNGPropertyList & /* propList */) override {}
141 void drawPath(const librevenge::RVNGPropertyList & /* propList */) override {}
142 void drawConnector(const librevenge::RVNGPropertyList & /* propList */) override {}
143
144 void insertBinaryObject(const librevenge::RVNGPropertyList & /* propList */) override {}
145 void insertEquation(const librevenge::RVNGPropertyList & /* propList */) override {}
146
147 private:
148 librevenge::RVNGDrawingInterface *m_painter;
149 librevenge::RVNGString m_fontName;
150 librevenge::RVNGPropertyList m_paragraphStyle, m_textStyle;
151 // Unimplemented to prevent compiler from creating crasher ones
152 WPGTextDataHandler(const WPGTextDataHandler &);
153 WPGTextDataHandler &operator=(const WPGTextDataHandler &);
154 };
155
156
157 #endif // __WPGXPARSER_H__
158 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPGTextDataHandler::openFootnote
void openFootnote(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:113
WPGTextDataHandler::closeFooter
void closeFooter() override
Definition: WPGXParser.h:83
WPGTextDataHandler::insertBinaryObject
void insertBinaryObject(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:144
WPGTextDataHandler::openHeader
void openHeader(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:80
WPGTextDataHandler::openGroup
void openGroup(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:133
WPGTextDataHandler::closeTableCell
void closeTableCell() override
Definition: WPGXParser.h:126
WPGTextDataHandler::insertField
void insertField(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:104
WPGTextDataHandler::openTable
void openTable(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:122
WPGColor.h
WPGXParser::m_input
librevenge::RVNGInputStream * m_input
Definition: WPGXParser.h:55
WPGXParser::operator=
WPGXParser & operator=(const WPGXParser &parser)
Definition: WPGXParser.cpp:195
WPGTextDataHandler::startDocument
void startDocument(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:72
WPGTextDataHandler::openTextBox
void openTextBox(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:119
WPGTextDataHandler::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition: WPGXParser.h:148
WPGTextDataHandler::openEndnote
void openEndnote(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:115
WPGXParser::readS16
short readS16()
Definition: WPGXParser.cpp:156
WPGTextDataHandler::drawPath
void drawPath(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:141
WPGTextDataHandler::~WPGTextDataHandler
~WPGTextDataHandler() override
Definition: WPGXParser.h:69
WPGTextDataHandler::closeSection
void closeSection() override
Definition: WPGXParser.h:98
WPGTextDataHandler::drawPolyline
void drawPolyline(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:140
WPGTextDataHandler::drawConnector
void drawConnector(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:142
WPGXParser::readS32
int readS32()
Definition: WPGXParser.cpp:161
WPGTextDataHandler::m_fontName
librevenge::RVNGString m_fontName
Definition: WPGXParser.h:149
WPGTextDataHandler::defineGraphicStyle
void defineGraphicStyle(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:136
WPGTextDataHandler::setDocumentMetaData
void setDocumentMetaData(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:70
WPGTextDataHandler::openComment
void openComment(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:117
WPGXParser::readU8
unsigned char readU8()
Definition: WPGXParser.cpp:128
WPGTextDataHandler::defineParagraphStyle
void defineParagraphStyle(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:85
WPGXParser::~WPGXParser
virtual ~WPGXParser()
Definition: WPGXParser.h:43
WPGTextDataHandler::closeFrame
void closeFrame() override
Definition: WPGXParser.h:131
WPGTextDataHandler::insertEquation
void insertEquation(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:145
WPGTextDataHandler::defineCharacterStyle
void defineCharacterStyle(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:89
WPGTextDataHandler::closePageSpan
void closePageSpan() override
Definition: WPGXParser.h:79
WPGTextDataHandler::closeFootnote
void closeFootnote() override
Definition: WPGXParser.h:114
WPGXParser::m_colorPalette
std::map< int, libwpg::WPGColor > m_colorPalette
Definition: WPGXParser.h:57
WPGTextDataHandler::openTableRow
void openTableRow(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:123
WPGXParser::readU32
unsigned int readU32()
Definition: WPGXParser.cpp:147
WPGTextDataHandler::drawEllipse
void drawEllipse(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:138
WPGTextDataHandler::closeComment
void closeComment() override
Definition: WPGXParser.h:118
WPGTextDataHandler::closeHeader
void closeHeader() override
Definition: WPGXParser.h:81
WPGTextDataHandler::openPageSpan
void openPageSpan(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:78
WPGTextDataHandler::openUnorderedListLevel
void openUnorderedListLevel(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:107
WPGTextDataHandler::defineEmbeddedFont
void defineEmbeddedFont(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:75
WPGTextDataHandler::openTableCell
void openTableCell(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:125
WPGTextDataHandler::closeEndnote
void closeEndnote() override
Definition: WPGXParser.h:116
WPGTextDataHandler::closeLink
void closeLink() override
Definition: WPGXParser.h:94
WPGTextDataHandler::openSection
void openSection(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:97
WPGTextDataHandler::closeUnorderedListLevel
void closeUnorderedListLevel() override
Definition: WPGXParser.h:109
WPGTextDataHandler::openLink
void openLink(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:93
WPGTextDataHandler::openFooter
void openFooter(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:82
WPGTextDataHandler::definePageStyle
void definePageStyle(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:77
WPGTextDataHandler::closeOrderedListLevel
void closeOrderedListLevel() override
Definition: WPGXParser.h:108
WPGTextDataHandler::closeGroup
void closeGroup() override
Definition: WPGXParser.h:134
WPGTextDataHandler::closeTable
void closeTable() override
Definition: WPGXParser.h:128
WPGXParser::WPGXParser
WPGXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
Definition: WPGXParser.cpp:117
WPGTextDataHandler::drawPolygon
void drawPolygon(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:139
WPGXParser
Definition: WPGXParser.h:38
WPGTextDataHandler::openOrderedListLevel
void openOrderedListLevel(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:106
WPGXParser::readVariableLengthInteger
unsigned int readVariableLengthInteger()
Definition: WPGXParser.cpp:166
WPGTextDataHandler::openFrame
void openFrame(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:130
WPGXParser::parse
virtual bool parse()=0
WPGXParser::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition: WPGXParser.h:56
WPGXParser::readU16
unsigned short readU16()
Definition: WPGXParser.cpp:140
WPGTextDataHandler::drawRectangle
void drawRectangle(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:137
WPGTextDataHandler::defineSectionStyle
void defineSectionStyle(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:96
WPGTextDataHandler::closeTextBox
void closeTextBox() override
Definition: WPGXParser.h:120
WPGTextDataHandler::endDocument
void endDocument() override
Definition: WPGXParser.h:73
WPGTextDataHandler::closeTableRow
void closeTableRow() override
Definition: WPGXParser.h:124
WPGTextDataHandler::insertCoveredTableCell
void insertCoveredTableCell(const librevenge::RVNGPropertyList &) override
Definition: WPGXParser.h:127
WPGTextDataHandler::WPGTextDataHandler
WPGTextDataHandler(librevenge::RVNGDrawingInterface *painter)
Definition: WPGXParser.h:63
WPGTextDataHandler::m_textStyle
librevenge::RVNGPropertyList m_textStyle
Definition: WPGXParser.h:150
WPGTextDataHandler
Definition: WPGXParser.h:60