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 
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"),
67  m_textStyle() {}
68 
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 */) {}
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 
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
154 };
155 
156 
157 #endif // __WPGXPARSER_H__
158 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */

Generated for libwpg by doxygen 1.8.4