| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef MULTIPLAN_H |
| 23 |
#define MULTIPLAN_H |
| 24 |
|
| 25 |
#include <vector> |
| 26 |
|
| 27 |
#include <librevenge-stream/librevenge-stream.h> |
| 28 |
#include "libwps/libwps.h" |
| 29 |
|
| 30 |
#include "libwps_internal.h" |
| 31 |
#include "libwps_tools_win.h" |
| 32 |
|
| 33 |
#include "WKSContentListener.h" |
| 34 |
|
| 35 |
#include "WKSParser.h" |
| 36 |
|
| 37 |
namespace libwps |
| 38 |
{ |
| 39 |
|
| 40 |
namespace MultiplanParserInternal |
| 41 |
{ |
| 42 |
struct State; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
class MultiplanParser final : public WKSParser |
| 50 |
{ |
| 51 |
public: |
| 52 |
|
| 53 |
MultiplanParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, |
| 54 |
libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, |
| 55 |
char const *password=nullptr); |
| 56 |
|
| 57 |
~MultiplanParser() override; |
| 58 |
|
| 59 |
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final; |
| 60 |
|
| 61 |
bool checkHeader(WPSHeader *header, bool strict=false); |
| 62 |
|
| 63 |
protected: |
| 64 |
|
| 65 |
bool checkFilePosition(long pos); |
| 66 |
|
| 67 |
int version() const; |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
libwps_tools_win::Font::Type getDefaultFontType() const; |
| 72 |
|
| 73 |
|
| 74 |
static std::shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface); |
| 75 |
|
| 76 |
bool sendSpreadsheet(); |
| 77 |
|
| 78 |
bool sendCell(Vec2i const &cellPos, int pos); |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
bool readZones(); |
| 86 |
|
| 87 |
bool readColumnsWidth(); |
| 88 |
|
| 89 |
bool readZonesList(); |
| 90 |
|
| 91 |
bool readZonesListV2(); |
| 92 |
|
| 93 |
bool readCellDataPosition(WPSEntry const &entry); |
| 94 |
|
| 95 |
bool readLink(int pos, WKSContentListener::FormulaInstruction &instruction); |
| 96 |
|
| 97 |
bool readFilename(int pos, librevenge::RVNGString &filename); |
| 98 |
|
| 99 |
bool readSharedData(int pos, int cellType, Vec2i const &cellPos, WKSContentListener::CellContent &content); |
| 100 |
|
| 101 |
bool readName(int pos, WKSContentListener::FormulaInstruction &instruction); |
| 102 |
|
| 103 |
bool readFunctionNamesList(); |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
bool checkPassword(char const *password) const; |
| 109 |
|
| 110 |
RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input); |
| 111 |
|
| 112 |
bool retrievePasswordKeys(); |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
bool readZoneB(); |
| 118 |
|
| 119 |
|
| 120 |
protected: |
| 121 |
|
| 122 |
bool readDouble(double &value); |
| 123 |
|
| 124 |
bool readFormula(Vec2i const &cellPos, std::vector<WKSContentListener::FormulaInstruction> &formula, long endPos, std::string &extra); |
| 125 |
|
| 126 |
bool readFormulaV2(Vec2i const &cellPos, std::vector<WKSContentListener::FormulaInstruction> &formula, long endPos, std::string &extra); |
| 127 |
|
| 128 |
std::shared_ptr<WKSContentListener> m_listener; |
| 129 |
|
| 130 |
std::shared_ptr<MultiplanParserInternal::State> m_state; |
| 131 |
}; |
| 132 |
|
| 133 |
} |
| 134 |
|
| 135 |
#endif |
| 136 |
|