00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __WPGXPARSER_H__
00029 #define __WPGXPARSER_H__
00030
00031 #include "WPGPaintInterface.h"
00032 #include <libwpd-stream/WPXStream.h>
00033 #include <libwpd/libwpd.h>
00034 #include "WPGColor.h"
00035
00036 #include <map>
00037
00038 class WPGXParser
00039 {
00040 public:
00041 WPGXParser(WPXInputStream *input, libwpg::WPGPaintInterface* painter);
00042 WPGXParser(const WPGXParser& parser);
00043 virtual ~WPGXParser() {};
00044 virtual bool parse() = 0;
00045
00046 unsigned char readU8();
00047 unsigned short readU16();
00048 unsigned int readU32();
00049 short readS16();
00050 int readS32();
00051 unsigned int readVariableLengthInteger();
00052 WPGXParser& operator=(const WPGXParser& parser);
00053
00054 protected:
00055 WPXInputStream* m_input;
00056 libwpg::WPGPaintInterface* m_painter;
00057 std::map<int,libwpg::WPGColor> m_colorPalette;
00058 };
00059
00060 class WPGTextDataHandler : public ::WPXDocumentInterface
00061 {
00062 public:
00063 WPGTextDataHandler(libwpg::WPGPaintInterface* painter) :
00064 m_painter(painter),
00065 m_x(0.0),
00066 m_y(0.0),
00067 m_width(0.0),
00068 m_height(0.0),
00069 m_fontName("Times New Roman"),
00070 m_fontSize(12.0),
00071 m_paragraphStyle(),
00072 m_textStyle() {}
00073
00074 ~WPGTextDataHandler() {}
00075 void setDocumentMetaData(const WPXPropertyList & ) {}
00076
00077 void startDocument() {}
00078 void endDocument() {}
00079
00080 void startSubDocument() {}
00081 void endSubDocument();
00082
00083 void definePageStyle(const WPXPropertyList & ) {}
00084 void openPageSpan(const WPXPropertyList & ) {}
00085 void closePageSpan() {}
00086 void openHeader(const WPXPropertyList & ) {}
00087 void closeHeader() {}
00088 void openFooter(const WPXPropertyList & ) {}
00089 void closeFooter() {}
00090
00091 void defineParagraphStyle(const WPXPropertyList & , const WPXPropertyListVector & ) {}
00092 void openParagraph(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
00093 void closeParagraph();
00094
00095 void defineCharacterStyle(const WPXPropertyList & ) {}
00096 void openSpan(const WPXPropertyList &propList);
00097 void closeSpan();
00098
00099 void defineSectionStyle(const WPXPropertyList & , const WPXPropertyListVector & ) {}
00100 void openSection(const WPXPropertyList & , const WPXPropertyListVector & ) {}
00101 void closeSection() {}
00102
00103 void insertTab();
00104 void insertSpace();
00105 void insertText(const WPXString &text);
00106 void insertLineBreak();
00107 void insertField(const WPXString & , const WPXPropertyList & ) {}
00108
00109 void defineOrderedListLevel(const WPXPropertyList & ) {}
00110 void defineUnorderedListLevel(const WPXPropertyList & ) {}
00111 void openOrderedListLevel(const WPXPropertyList & ) {}
00112 void openUnorderedListLevel(const WPXPropertyList & ) {}
00113 void closeOrderedListLevel() {}
00114 void closeUnorderedListLevel() {}
00115 void openListElement(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
00116 void closeListElement();
00117
00118 void openFootnote(const WPXPropertyList & ) {}
00119 void closeFootnote() {}
00120 void openEndnote(const WPXPropertyList & ) {}
00121 void closeEndnote() {}
00122 void openComment(const WPXPropertyList & ) {}
00123 void closeComment() {}
00124 void openTextBox(const WPXPropertyList & ) {}
00125 void closeTextBox() {}
00126
00127 void openTable(const WPXPropertyList & , const WPXPropertyListVector & ) {}
00128 void openTableRow(const WPXPropertyList & ) {}
00129 void closeTableRow() {}
00130 void openTableCell(const WPXPropertyList & ) {}
00131 void closeTableCell() {}
00132 void insertCoveredTableCell(const WPXPropertyList & ) {}
00133 void closeTable() {}
00134
00135 void openFrame(const WPXPropertyList & ) {}
00136 void closeFrame() {}
00137
00138 void insertBinaryObject(const WPXPropertyList & , const WPXBinaryData & ) {}
00139 void insertEquation(const WPXPropertyList & , const WPXString & ) {}
00140
00141 private:
00142 libwpg::WPGPaintInterface *m_painter;
00143 double m_x, m_y, m_width, m_height;
00144 ::WPXString m_fontName;
00145 double m_fontSize;
00146 ::WPXPropertyList m_paragraphStyle, m_textStyle;
00147 };
00148
00149
00150 #endif // __WPGXPARSER_H__