| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef XY_WRITE_H |
| 23 |
#define XY_WRITE_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 XYWriteParserInternal |
| 35 |
{ |
| 36 |
class SubDocument; |
| 37 |
|
| 38 |
struct Cell; |
| 39 |
struct Format; |
| 40 |
struct State; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
class XYWriteParser : public WPSParser |
| 48 |
{ |
| 49 |
friend struct XYWriteParserInternal::Cell; |
| 50 |
friend class XYWriteParserInternal::SubDocument; |
| 51 |
|
| 52 |
public: |
| 53 |
|
| 54 |
XYWriteParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, |
| 55 |
libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN); |
| 56 |
|
| 57 |
~XYWriteParser() override; |
| 58 |
|
| 59 |
void parse(librevenge::RVNGTextInterface *documentInterface) override; |
| 60 |
|
| 61 |
bool checkHeader(WPSHeader *header, bool strict=false); |
| 62 |
|
| 63 |
private: |
| 64 |
XYWriteParser(const XYWriteParser &) = delete; |
| 65 |
XYWriteParser &operator=(const XYWriteParser &) = delete; |
| 66 |
|
| 67 |
|
| 68 |
std::shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface); |
| 69 |
|
| 70 |
protected: |
| 71 |
|
| 72 |
bool checkFilePosition(long pos) const; |
| 73 |
|
| 74 |
bool findAllZones(); |
| 75 |
|
| 76 |
bool parseTextZone(WPSEntry const &entry, std::string const &styleName=""); |
| 77 |
|
| 78 |
bool parseFrameZone(XYWriteParserInternal::Format const &frameFormat); |
| 79 |
|
| 80 |
bool parsePictureZone(XYWriteParserInternal::Format const &pictureFormat); |
| 81 |
|
| 82 |
bool parseMetaData(WPSEntry const &entry); |
| 83 |
|
| 84 |
bool parseFormat(XYWriteParserInternal::Format &format); |
| 85 |
|
| 86 |
bool createFormatChildren(XYWriteParserInternal::Format &format, size_t fPos=2); |
| 87 |
|
| 88 |
bool update(XYWriteParserInternal::Format const &format, libwps_tools_win::Font::Type &fontType) const; |
| 89 |
|
| 90 |
bool createTable(XYWriteParserInternal::Format const &format, long endPos); |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
std::shared_ptr<WPSContentListener> m_listener; |
| 96 |
|
| 97 |
std::shared_ptr<XYWriteParserInternal::State> m_state; |
| 98 |
}; |
| 99 |
|
| 100 |
#endif |
| 101 |
|