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 "WPGPaintInterface.h"
32 #include <libwpd-stream/WPXStream.h>
33 #include <libwpd/libwpd.h>
34 #include "WPGColor.h"
35 
36 #include <map>
37 
39 {
40 public:
41  WPGXParser(WPXInputStream *input, libwpg::WPGPaintInterface *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  WPXInputStream *m_input;
57  std::map<int,libwpg::WPGColor> m_colorPalette;
58 };
59 
60 class WPGTextDataHandler : public ::WPXDocumentInterface
61 {
62 public:
64  m_painter(painter),
65  m_fontName("Times New Roman"),
67  m_textStyle() {}
68 
70  void setDocumentMetaData(const WPXPropertyList & /* propList */) {}
71 
72  void startDocument() {}
73  void endDocument() {}
74 
75  void startSubDocument() {}
76  void endSubDocument();
77 
78  void definePageStyle(const WPXPropertyList & /* propList */) {}
79  void openPageSpan(const WPXPropertyList & /* propList */) {}
80  void closePageSpan() {}
81  void openHeader(const WPXPropertyList & /* propList */) {}
82  void closeHeader() {}
83  void openFooter(const WPXPropertyList & /* propList */) {}
84  void closeFooter() {}
85 
86  void defineParagraphStyle(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* tabStops */) {}
87  void openParagraph(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
88  void closeParagraph();
89 
90  void defineCharacterStyle(const WPXPropertyList & /* propList */) {}
91  void openSpan(const WPXPropertyList &propList);
92  void closeSpan();
93 
94  void defineSectionStyle(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* columns */) {}
95  void openSection(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* columns */) {}
96  void closeSection() {}
97 
98  void insertTab();
99  void insertSpace();
100  void insertText(const WPXString &text);
101  void insertLineBreak();
102  void insertField(const WPXString & /* type */, const WPXPropertyList & /* propList */) {}
103 
104  void defineOrderedListLevel(const WPXPropertyList & /* propList */) {}
105  void defineUnorderedListLevel(const WPXPropertyList & /* propList */) {}
106  void openOrderedListLevel(const WPXPropertyList & /* propList */) {}
107  void openUnorderedListLevel(const WPXPropertyList & /* propList */) {}
110  void openListElement(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
111  void closeListElement();
112 
113  void openFootnote(const WPXPropertyList & /* propList */) {}
114  void closeFootnote() {}
115  void openEndnote(const WPXPropertyList & /* propList */) {}
116  void closeEndnote() {}
117  void openComment(const WPXPropertyList & /* propList */) {}
118  void closeComment() {}
119  void openTextBox(const WPXPropertyList & /* propList */) {}
120  void closeTextBox() {}
121 
122  void openTable(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* columns */) {}
123  void openTableRow(const WPXPropertyList & /* propList */) {}
124  void closeTableRow() {}
125  void openTableCell(const WPXPropertyList & /* propList */) {}
126  void closeTableCell() {}
127  void insertCoveredTableCell(const WPXPropertyList & /* propList */) {}
128  void closeTable() {}
129 
130  void openFrame(const WPXPropertyList & /* propList */) {}
131  void closeFrame() {}
132 
133  void insertBinaryObject(const WPXPropertyList & /* propList */, const WPXBinaryData & /* data */) {}
134  void insertEquation(const WPXPropertyList & /* propList */, const WPXString & /* data */) {}
135 
136 private:
138  ::WPXString m_fontName;
139  ::WPXPropertyList m_paragraphStyle, m_textStyle;
140  // Unimplemented to prevent compiler from creating crasher ones
143 };
144 
145 
146 #endif // __WPGXPARSER_H__
147 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */

Generated for libwpg by doxygen 1.8.3.1