WPGXParser.h
Go to the documentation of this file.
1 /* libwpg
2  * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
3  * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl)
4  * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02111-1301 USA
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_x(0.0),
66  m_y(0.0),
67  m_width(0.0),
68  m_height(0.0),
69  m_fontName("Times New Roman"),
70  m_fontSize(12.0),
72  m_textStyle() {}
73 
75  void setDocumentMetaData(const WPXPropertyList & /* propList */) {}
76 
77  void startDocument() {}
78  void endDocument() {}
79 
80  void startSubDocument() {}
81  void endSubDocument();
82 
83  void definePageStyle(const WPXPropertyList & /* propList */) {}
84  void openPageSpan(const WPXPropertyList & /* propList */) {}
85  void closePageSpan() {}
86  void openHeader(const WPXPropertyList & /* propList */) {}
87  void closeHeader() {}
88  void openFooter(const WPXPropertyList & /* propList */) {}
89  void closeFooter() {}
90 
91  void defineParagraphStyle(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* tabStops */) {}
92  void openParagraph(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
93  void closeParagraph();
94 
95  void defineCharacterStyle(const WPXPropertyList & /* propList */) {}
96  void openSpan(const WPXPropertyList &propList);
97  void closeSpan();
98 
99  void defineSectionStyle(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* columns */) {}
100  void openSection(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* columns */) {}
101  void closeSection() {}
102 
103  void insertTab();
104  void insertSpace();
105  void insertText(const WPXString &text);
106  void insertLineBreak();
107  void insertField(const WPXString & /* type */, const WPXPropertyList & /* propList */) {}
108 
109  void defineOrderedListLevel(const WPXPropertyList & /* propList */) {}
110  void defineUnorderedListLevel(const WPXPropertyList & /* propList */) {}
111  void openOrderedListLevel(const WPXPropertyList & /* propList */) {}
112  void openUnorderedListLevel(const WPXPropertyList & /* propList */) {}
115  void openListElement(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
116  void closeListElement();
117 
118  void openFootnote(const WPXPropertyList & /* propList */) {}
119  void closeFootnote() {}
120  void openEndnote(const WPXPropertyList & /* propList */) {}
121  void closeEndnote() {}
122  void openComment(const WPXPropertyList & /* propList */) {}
123  void closeComment() {}
124  void openTextBox(const WPXPropertyList & /* propList */) {}
125  void closeTextBox() {}
126 
127  void openTable(const WPXPropertyList & /* propList */, const WPXPropertyListVector & /* columns */) {}
128  void openTableRow(const WPXPropertyList & /* propList */) {}
129  void closeTableRow() {}
130  void openTableCell(const WPXPropertyList & /* propList */) {}
131  void closeTableCell() {}
132  void insertCoveredTableCell(const WPXPropertyList & /* propList */) {}
133  void closeTable() {}
134 
135  void openFrame(const WPXPropertyList & /* propList */) {}
136  void closeFrame() {}
137 
138  void insertBinaryObject(const WPXPropertyList & /* propList */, const WPXBinaryData & /* data */) {}
139  void insertEquation(const WPXPropertyList & /* propList */, const WPXString & /* data */) {}
140 
141 private:
143  double m_x, m_y, m_width, m_height;
144  ::WPXString m_fontName;
145  double m_fontSize;
146  ::WPXPropertyList m_paragraphStyle, m_textStyle;
147 };
148 
149 
150 #endif // __WPGXPARSER_H__

Generated for libwpg by doxygen 1.8.4