Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WPS8_H
00023 #define WPS8_H
00024
00025 #include <vector>
00026 #include <list>
00027 #include <map>
00028 #include <libwpd/WPXString.h>
00029
00030 #include "libwps_internal.h"
00031 #include "WPS.h"
00032 #include "WPSContentListener.h"
00033 #include <libwpd-stream/WPXStream.h>
00034 #include "WPSParser.h"
00035
00041 class HeaderIndexEntries
00042 {
00043 public:
00044 uint32_t offset;
00045 uint32_t length;
00046 };
00047
00048 typedef std::multimap <std::string, HeaderIndexEntries> HeaderIndexMultiMap;
00049
00050 class WPS8ContentListener : public WPSContentListener
00051 {
00052 public:
00053 WPS8ContentListener(std::list<WPSPageSpan> &pageList, WPXDocumentInterface *documentInterface);
00054 ~WPS8ContentListener();
00055
00056 void attributeChange(const bool isOn, const uint8_t attribute);
00057
00058 private:
00059 WPS8ContentListener(const WPS8ContentListener&);
00060 WPS8ContentListener& operator=(const WPS8ContentListener&);
00061 };
00062
00063 struct WPSRange
00064 {
00065 uint32_t start;
00066 uint32_t limit;
00067 WPSRange() : start(0), limit(0) {}
00068 ~WPSRange() {}
00069 };
00070
00071 struct WPSStream
00072 {
00073 uint32_t type;
00074 WPSRange span;
00075 WPSStream() : type(0), span() {}
00076 ~WPSStream() {}
00077 };
00078
00079 struct WPSNote
00080 {
00081 uint32_t offset;
00082 WPSRange contents;
00083 WPSNote() : offset(0), contents() {}
00084 };
00085
00086 #define WPS_STREAM_DUMMY 0
00087 #define WPS_STREAM_BODY 1
00088 #define WPS_STREAM_FOOTNOTES 2
00089 #define WPS_STREAM_ENDNOTES 3
00090
00091 #define WPS_NUM_SEP_PAR 0x0
00092 #define WPS_NUM_SEP_DOT 0x2
00093
00094 class WPS8Parser : public WPSParser
00095 {
00096 public:
00097 WPS8Parser(WPXInputStream *input, WPSHeader * header);
00098 ~WPS8Parser();
00099
00100 void parse(WPXDocumentInterface *documentInterface);
00101 private:
00102 void readFontsTable(WPXInputStream * input);
00103 void readStreams(WPXInputStream * input);
00104 void readNotes(std::vector<WPSNote> &dest, WPXInputStream * input, const char *key);
00105 void appendUTF16LE(WPXInputStream *input, WPS8ContentListener *listener);
00106 void readText(WPXInputStream * input, WPS8ContentListener *listener);
00107 void readTextRange(WPXInputStream * input, WPS8ContentListener *listener, uint32_t startpos, uint32_t endpos, uint16_t stream);
00108 void readNote(WPXInputStream * input, WPS8ContentListener *listener, bool is_endnote);
00109 bool readFODPage(WPXInputStream * input, std::vector<FOD> * FODs, uint16_t page_size);
00110 void parseHeaderIndexEntry(WPXInputStream * input);
00111 void parseHeaderIndex(WPXInputStream * input);
00112 void parsePages(std::list<WPSPageSpan> &pageList, WPXInputStream *input);
00113 void parse(WPXInputStream *stream, WPS8ContentListener *listener);
00114 void propertyChangeTextAttribute(const uint32_t newTextAttributeBits, const uint8_t attribute, const uint32_t bit, WPS8ContentListener *listener);
00115 void propertyChangeDelta(uint32_t newTextAttributeBits, WPS8ContentListener *listener);
00116 void propertyChange(std::string rgchProp, WPS8ContentListener *listener);
00117 void propertyChangePara(std::string rgchProp, WPS8ContentListener *listener);
00118 uint32_t offset_eot;
00119 uint32_t oldTextAttributeBits;
00120 HeaderIndexMultiMap headerIndexTable;
00121 std::vector<FOD> CHFODs;
00122 std::vector<FOD> PAFODs;
00123 std::vector<std::string> fonts;
00124 std::vector<WPSStream> streams;
00125 std::vector<WPSNote> footnotes;
00126 std::vector<WPSNote> endnotes;
00127
00128 std::vector<WPSNote>::iterator fn_iter;
00129 std::vector<WPSNote>::iterator en_iter;
00130 };
00131
00132
00133 #endif