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{
40public:
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
54protected:
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{
62public:
63 WPGTextDataHandler(librevenge::RVNGDrawingInterface *painter) :
64 m_painter(painter),
65 m_fontName("Times New Roman"),
66 m_paragraphStyle(),
67 m_textStyle() {}
68
69 ~WPGTextDataHandler() {}
70 void setDocumentMetaData(const librevenge::RVNGPropertyList & /* propList */) {}
71
72 void startDocument(const librevenge::RVNGPropertyList & /* propList */) {}
73 void endDocument() {}
74
75 void defineEmbeddedFont(const librevenge::RVNGPropertyList & /* propList */) {}
76
77 void definePageStyle(const librevenge::RVNGPropertyList & /* propList */) {}
78 void openPageSpan(const librevenge::RVNGPropertyList & /* propList */) {}
79 void closePageSpan() {}
80 void openHeader(const librevenge::RVNGPropertyList & /* propList */) {}
81 void closeHeader() {}
82 void openFooter(const librevenge::RVNGPropertyList & /* propList */) {}
83 void closeFooter() {}
84
85 void defineParagraphStyle(const librevenge::RVNGPropertyList & /* propList */) {}
86 void openParagraph(const librevenge::RVNGPropertyList &propList);
87 void closeParagraph();
88
89 void defineCharacterStyle(const librevenge::RVNGPropertyList & /* propList */) {}
90 void openSpan(const librevenge::RVNGPropertyList &propList);
91 void closeSpan();
92
93 void openLink(const librevenge::RVNGPropertyList & /* propList */) {}
94 void closeLink() {}
95
96 void defineSectionStyle(const librevenge::RVNGPropertyList & /* propList */) {}
97 void openSection(const librevenge::RVNGPropertyList & /* propList */) {}
98 void closeSection() {}
99
100 void insertTab();
101 void insertSpace();
102 void insertText(const librevenge::RVNGString &text);
103 void insertLineBreak();
104 void insertField(const librevenge::RVNGPropertyList & /* propList */) {}
105
106 void openOrderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
107 void openUnorderedListLevel(const librevenge::RVNGPropertyList & /* propList */) {}
108 void closeOrderedListLevel() {}
109 void closeUnorderedListLevel() {}
110 void openListElement(const librevenge::RVNGPropertyList &propList);
111 void closeListElement();
112
113 void openFootnote(const librevenge::RVNGPropertyList & /* propList */) {}
114 void closeFootnote() {}
115 void openEndnote(const librevenge::RVNGPropertyList & /* propList */) {}
116 void closeEndnote() {}
117 void openComment(const librevenge::RVNGPropertyList & /* propList */) {}
118 void closeComment() {}
119 void openTextBox(const librevenge::RVNGPropertyList & /* propList */) {}
120 void closeTextBox() {}
121
122 void openTable(const librevenge::RVNGPropertyList & /* propList */) {}
123 void openTableRow(const librevenge::RVNGPropertyList & /* propList */) {}
124 void closeTableRow() {}
125 void openTableCell(const librevenge::RVNGPropertyList & /* propList */) {}
126 void closeTableCell() {}
127 void insertCoveredTableCell(const librevenge::RVNGPropertyList & /* propList */) {}
128 void closeTable() {}
129
130 void openFrame(const librevenge::RVNGPropertyList & /* propList */) {}
131 void closeFrame() {}
132
133 void openGroup(const librevenge::RVNGPropertyList & /* propList */) {}
134 void closeGroup() {}
135
136 void defineGraphicStyle(const librevenge::RVNGPropertyList & /* propList */) {}
137 void drawRectangle(const librevenge::RVNGPropertyList & /* propList */) {}
138 void drawEllipse(const librevenge::RVNGPropertyList & /* propList */) {}
139 void drawPolygon(const librevenge::RVNGPropertyList & /* propList */) {}
140 void drawPolyline(const librevenge::RVNGPropertyList & /* propList */) {}
141 void drawPath(const librevenge::RVNGPropertyList & /* propList */) {}
142 void drawConnector(const librevenge::RVNGPropertyList & /* propList */) {}
143
144 void insertBinaryObject(const librevenge::RVNGPropertyList & /* propList */) {}
145 void insertEquation(const librevenge::RVNGPropertyList & /* propList */) {}
146
147private:
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: */
WPGColor.h
WPGTextDataHandler::closeGroup
void closeGroup()
Definition WPGXParser.h:134
WPGTextDataHandler::closeHeader
void closeHeader()
Definition WPGXParser.h:81
WPGTextDataHandler::openUnorderedListLevel
void openUnorderedListLevel(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:107
WPGTextDataHandler::closeTextBox
void closeTextBox()
Definition WPGXParser.h:120
WPGTextDataHandler::definePageStyle
void definePageStyle(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:77
WPGTextDataHandler::defineGraphicStyle
void defineGraphicStyle(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:136
WPGTextDataHandler::closeComment
void closeComment()
Definition WPGXParser.h:118
WPGTextDataHandler::insertBinaryObject
void insertBinaryObject(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:144
WPGTextDataHandler::defineSectionStyle
void defineSectionStyle(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:96
WPGTextDataHandler::openComment
void openComment(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:117
WPGTextDataHandler::openEndnote
void openEndnote(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:115
WPGTextDataHandler::closeTableCell
void closeTableCell()
Definition WPGXParser.h:126
WPGTextDataHandler::openFrame
void openFrame(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:130
WPGTextDataHandler::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition WPGXParser.h:148
WPGTextDataHandler::openTable
void openTable(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:122
WPGTextDataHandler::closeListElement
void closeListElement()
Definition WPGXParser.cpp:251
WPGTextDataHandler::startDocument
void startDocument(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:72
WPGTextDataHandler::openOrderedListLevel
void openOrderedListLevel(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:106
WPGTextDataHandler::drawPolyline
void drawPolyline(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:140
WPGTextDataHandler::drawConnector
void drawConnector(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:142
WPGTextDataHandler::closeFootnote
void closeFootnote()
Definition WPGXParser.h:114
WPGTextDataHandler::openTableCell
void openTableCell(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:125
WPGTextDataHandler::insertEquation
void insertEquation(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:145
WPGTextDataHandler::openTableRow
void openTableRow(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:123
WPGTextDataHandler::insertText
void insertText(const librevenge::RVNGString &text)
Definition WPGXParser.cpp:236
WPGTextDataHandler::insertLineBreak
void insertLineBreak()
Definition WPGXParser.cpp:241
WPGTextDataHandler::drawRectangle
void drawRectangle(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:137
WPGTextDataHandler::closeEndnote
void closeEndnote()
Definition WPGXParser.h:116
WPGTextDataHandler::openParagraph
void openParagraph(const librevenge::RVNGPropertyList &propList)
Definition WPGXParser.cpp:206
WPGTextDataHandler::openFooter
void openFooter(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:82
WPGTextDataHandler::operator=
WPGTextDataHandler & operator=(const WPGTextDataHandler &)
WPGTextDataHandler::setDocumentMetaData
void setDocumentMetaData(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:70
WPGTextDataHandler::openSection
void openSection(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:97
WPGTextDataHandler::drawPath
void drawPath(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:141
WPGTextDataHandler::closeLink
void closeLink()
Definition WPGXParser.h:94
WPGTextDataHandler::defineEmbeddedFont
void defineEmbeddedFont(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:75
WPGTextDataHandler::insertField
void insertField(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:104
WPGTextDataHandler::closeOrderedListLevel
void closeOrderedListLevel()
Definition WPGXParser.h:108
WPGTextDataHandler::openSpan
void openSpan(const librevenge::RVNGPropertyList &propList)
Definition WPGXParser.cpp:216
WPGTextDataHandler::insertSpace
void insertSpace()
Definition WPGXParser.cpp:231
WPGTextDataHandler::openLink
void openLink(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:93
WPGTextDataHandler::closeUnorderedListLevel
void closeUnorderedListLevel()
Definition WPGXParser.h:109
WPGTextDataHandler::m_fontName
::librevenge::RVNGString m_fontName
Definition WPGXParser.h:149
WPGTextDataHandler::closeFooter
void closeFooter()
Definition WPGXParser.h:83
WPGTextDataHandler::WPGTextDataHandler
WPGTextDataHandler(const WPGTextDataHandler &)
WPGTextDataHandler::m_paragraphStyle
::librevenge::RVNGPropertyList m_paragraphStyle
Definition WPGXParser.h:150
WPGTextDataHandler::WPGTextDataHandler
WPGTextDataHandler(librevenge::RVNGDrawingInterface *painter)
Definition WPGXParser.h:63
WPGTextDataHandler::openPageSpan
void openPageSpan(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:78
WPGTextDataHandler::m_textStyle
::librevenge::RVNGPropertyList m_textStyle
Definition WPGXParser.h:150
WPGTextDataHandler::closeTable
void closeTable()
Definition WPGXParser.h:128
WPGTextDataHandler::closeSpan
void closeSpan()
Definition WPGXParser.cpp:221
WPGTextDataHandler::drawEllipse
void drawEllipse(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:138
WPGTextDataHandler::closePageSpan
void closePageSpan()
Definition WPGXParser.h:79
WPGTextDataHandler::closeSection
void closeSection()
Definition WPGXParser.h:98
WPGTextDataHandler::openHeader
void openHeader(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:80
WPGTextDataHandler::defineCharacterStyle
void defineCharacterStyle(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:89
WPGTextDataHandler::openListElement
void openListElement(const librevenge::RVNGPropertyList &propList)
Definition WPGXParser.cpp:246
WPGTextDataHandler::drawPolygon
void drawPolygon(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:139
WPGTextDataHandler::closeParagraph
void closeParagraph()
Definition WPGXParser.cpp:211
WPGTextDataHandler::~WPGTextDataHandler
~WPGTextDataHandler()
Definition WPGXParser.h:69
WPGTextDataHandler::openFootnote
void openFootnote(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:113
WPGTextDataHandler::openTextBox
void openTextBox(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:119
WPGTextDataHandler::insertCoveredTableCell
void insertCoveredTableCell(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:127
WPGTextDataHandler::openGroup
void openGroup(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:133
WPGTextDataHandler::defineParagraphStyle
void defineParagraphStyle(const librevenge::RVNGPropertyList &)
Definition WPGXParser.h:85
WPGTextDataHandler::closeTableRow
void closeTableRow()
Definition WPGXParser.h:124
WPGTextDataHandler::insertTab
void insertTab()
Definition WPGXParser.cpp:226
WPGTextDataHandler::closeFrame
void closeFrame()
Definition WPGXParser.h:131
WPGTextDataHandler::endDocument
void endDocument()
Definition WPGXParser.h:73
WPGXParser::readVariableLengthInteger
unsigned int readVariableLengthInteger()
Definition WPGXParser.cpp:166
WPGXParser::readU16
unsigned short readU16()
Definition WPGXParser.cpp:140
WPGXParser::WPGXParser
WPGXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
Definition WPGXParser.cpp:117
WPGXParser::readS32
int readS32()
Definition WPGXParser.cpp:161
WPGXParser::readU32
unsigned int readU32()
Definition WPGXParser.cpp:147
WPGXParser::readU8
unsigned char readU8()
Definition WPGXParser.cpp:128
WPGXParser::operator=
WPGXParser & operator=(const WPGXParser &parser)
Definition WPGXParser.cpp:195
WPGXParser::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition WPGXParser.h:56
WPGXParser::readS16
short readS16()
Definition WPGXParser.cpp:156
WPGXParser::m_input
librevenge::RVNGInputStream * m_input
Definition WPGXParser.h:55
WPGXParser::m_colorPalette
std::map< int, libwpg::WPGColor > m_colorPalette
Definition WPGXParser.h:57
WPGXParser::~WPGXParser
virtual ~WPGXParser()
Definition WPGXParser.h:43
WPGXParser::parse
virtual bool parse()=0