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_TEXT_H
00023 #define WPS8_TEXT_H
00024
00025 #include <vector>
00026
00027 #include "libwps_internal.h"
00028
00029 #include "WPSDebug.h"
00030
00031 #include "WPSTextParser.h"
00032
00033 namespace WPS8Struct
00034 {
00035 struct FileData;
00036 }
00037
00038 namespace WPS8TextInternal
00039 {
00040 struct State;
00041 class SubDocument;
00042 }
00043
00044 class WPS8Parser;
00045 class WPS8TextStyle;
00046
00047 class WPS8Text : public WPSTextParser
00048 {
00049 friend class WPS8TextInternal::SubDocument;
00050 friend class WPS8Parser;
00051 friend class WPS8TextStyle;
00052 public:
00053 WPS8Text(WPS8Parser &parser);
00054 ~WPS8Text();
00055
00057 void setListener(WPSContentListenerPtr &listen);
00058
00060 int numPages() const;
00061
00063 void flushExtra();
00064
00066 bool readStructures();
00067
00069 int getNumTextZones() const;
00070
00076 int getTextZoneType(int typeId) const;
00077
00079 WPSEntry getHeaderEntry() const;
00080
00082 WPSEntry getFooterEntry() const;
00083
00085 WPSEntry getTextEntry() const;
00086
00088 WPSEntry getEntry(int strsId) const;
00089
00091 void readText(WPSEntry const &entry);
00092
00094 void readTextInCell(int strsId, int cellId);
00095
00096 protected:
00098 WPS8Parser &mainParser()
00099 {
00100 return reinterpret_cast<WPS8Parser &>(m_mainParser);
00101 }
00103 WPS8Parser const &mainParser() const
00104 {
00105 return reinterpret_cast<WPS8Parser const &>(m_mainParser);
00106 }
00107
00108
00109
00110
00112 bool readFont(long endPos, int &id, std::string &mess);
00113
00115 bool readParagraph(long endPos, int &id, std::string &mess);
00116
00117
00118
00119
00121 bool readString(RVNGInputStreamPtr input, long page_size,
00122 librevenge::RVNGString &res);
00124 long readUTF16LE(RVNGInputStreamPtr input, long endPos, uint16_t firstC);
00125
00129 bool readNotes(WPSEntry const &entry);
00130
00134 void createNotesCorrespondance();
00135
00136
00137
00138
00139
00146 typedef bool (WPS8Text::* DataParser)
00147 (long bot, long eot, int id, WPS8Struct::FileData const &data,
00148 std::string &mess);
00153 typedef bool (WPS8Text::* EndDataParser)
00154 (long endPos, std::vector<long> const &textPtrs);
00162 bool readPLC(WPSEntry const &entry,
00163 std::vector<long> &textPtrs, std::vector<long> &listValues,
00164 DataParser parser = &WPS8Text::defDataParser,
00165 EndDataParser endParser = 0L);
00167 bool defDataParser
00168 (long , long , int , WPS8Struct::FileData const &data, std::string &mess);
00170 bool textZonesDataParser(long bot, long eot, int nId,
00171 WPS8Struct::FileData const &data,
00172 std::string &mess);
00173
00175 bool objectDataParser(long bot, long eot, int id,
00176 WPS8Struct::FileData const &data, std::string &mess);
00177
00179 bool tokenEndDataParser(long endPage, std::vector<long> const &textPtrs);
00182 bool bmktEndDataParser(long endPage, std::vector<long> const &textPtrs);
00183
00184 protected:
00186 WPSContentListenerPtr m_listener;
00188 shared_ptr<WPS8TextStyle> m_styleParser;
00190 mutable shared_ptr<WPS8TextInternal::State> m_state;
00191 protected:
00192 };
00193
00194
00195 #endif
00196