| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef POCKET_WORD_H |
| 23 |
#define POCKET_WORD_H |
| 24 |
|
| 25 |
#include <memory> |
| 26 |
#include <vector> |
| 27 |
|
| 28 |
#include <librevenge-stream/librevenge-stream.h> |
| 29 |
#include "libwps_internal.h" |
| 30 |
#include "libwps_tools_win.h" |
| 31 |
|
| 32 |
#include "WPSParser.h" |
| 33 |
|
| 34 |
namespace PocketWordParserInternal |
| 35 |
{ |
| 36 |
class SubDocument; |
| 37 |
|
| 38 |
struct State; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
class PocketWordParser : public WPSParser |
| 46 |
{ |
| 47 |
friend class PocketWordParserInternal::SubDocument; |
| 48 |
|
| 49 |
public: |
| 50 |
|
| 51 |
PocketWordParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, |
| 52 |
libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN); |
| 53 |
|
| 54 |
~PocketWordParser() override; |
| 55 |
|
| 56 |
void parse(librevenge::RVNGTextInterface *documentInterface) override; |
| 57 |
|
| 58 |
bool checkHeader(WPSHeader *header, bool strict=false); |
| 59 |
|
| 60 |
private: |
| 61 |
PocketWordParser(const PocketWordParser &) = delete; |
| 62 |
PocketWordParser &operator=(const PocketWordParser &) = delete; |
| 63 |
|
| 64 |
|
| 65 |
std::shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface); |
| 66 |
|
| 67 |
protected: |
| 68 |
|
| 69 |
bool createZones(); |
| 70 |
|
| 71 |
bool readFontNames(WPSEntry const &entry); |
| 72 |
|
| 73 |
bool readPageDims(WPSEntry const &entry); |
| 74 |
|
| 75 |
bool readParagraphList(WPSEntry const &entry, std::vector<int> ¶Id); |
| 76 |
|
| 77 |
bool readParagraphDims(WPSEntry const &entry); |
| 78 |
|
| 79 |
bool readParagraphUnkn(WPSEntry const &entry); |
| 80 |
|
| 81 |
bool readSound(WPSEntry const &entry, WPSEmbeddedObject &object); |
| 82 |
|
| 83 |
bool readSoundData(WPSEntry const &entry, long pictSize, WPSEmbeddedObject &object); |
| 84 |
|
| 85 |
bool readUnkn8(WPSEntry const &entry); |
| 86 |
|
| 87 |
bool readUnkn2021(WPSEntry const &entry, int type); |
| 88 |
|
| 89 |
bool checkFilePosition(long pos) const; |
| 90 |
|
| 91 |
void checkUnparsed(); |
| 92 |
|
| 93 |
|
| 94 |
void sendData(); |
| 95 |
|
| 96 |
bool sendParagraph(size_t paraId); |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
std::shared_ptr<WPSContentListener> m_listener; |
| 102 |
|
| 103 |
std::shared_ptr<PocketWordParserInternal::State> m_state; |
| 104 |
}; |
| 105 |
|
| 106 |
#endif |
| 107 |
|