| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef QUATTRO_H |
| 23 |
#define QUATTRO_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 "WKSParser.h" |
| 34 |
|
| 35 |
namespace QuattroParserInternal |
| 36 |
{ |
| 37 |
class SubDocument; |
| 38 |
struct State; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
class QuattroGraph; |
| 43 |
class QuattroSpreadsheet; |
| 44 |
|
| 45 |
namespace QuattroFormulaInternal |
| 46 |
{ |
| 47 |
class CellReference; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
class QuattroParser final : public WKSParser |
| 54 |
{ |
| 55 |
friend class QuattroParserInternal::SubDocument; |
| 56 |
|
| 57 |
friend class QuattroGraph; |
| 58 |
friend class QuattroSpreadsheet; |
| 59 |
public: |
| 60 |
|
| 61 |
QuattroParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, |
| 62 |
libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, |
| 63 |
char const *password=nullptr); |
| 64 |
|
| 65 |
~QuattroParser() final; |
| 66 |
|
| 67 |
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final; |
| 68 |
|
| 69 |
bool checkHeader(WPSHeader *header, bool strict=false); |
| 70 |
|
| 71 |
protected: |
| 72 |
|
| 73 |
int version() const; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
libwps_tools_win::Font::Type getDefaultFontType() const; |
| 78 |
|
| 79 |
bool getExternalFileName(int fId, librevenge::RVNGString &fName) const; |
| 80 |
|
| 81 |
bool getField(int fId, librevenge::RVNGString &text, |
| 82 |
QuattroFormulaInternal::CellReference &ref, |
| 83 |
librevenge::RVNGString const &fileName) const; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
bool getColor(int id, WPSColor &color) const; |
| 91 |
|
| 92 |
bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const; |
| 93 |
|
| 94 |
Vec2f getCellPosition(int sheetId, Vec2i const &cell) const; |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
bool sendPageGraphics(int sheetId) const; |
| 102 |
|
| 103 |
bool sendGraphics(int sheetId, Vec2i const &cell) const; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
std::shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface); |
| 111 |
|
| 112 |
|
| 113 |
void sendHeaderFooter(bool header); |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
bool checkHeader(std::shared_ptr<WPSStream> stream, bool strict); |
| 121 |
|
| 122 |
bool readZones(); |
| 123 |
|
| 124 |
bool readOLEZones(std::shared_ptr<WPSStream> &stream); |
| 125 |
|
| 126 |
bool readZone(std::shared_ptr<WPSStream> &stream); |
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
bool readFieldName(std::shared_ptr<WPSStream> stream); |
| 132 |
|
| 133 |
static bool readCellPosition(std::shared_ptr<WPSStream> stream); |
| 134 |
|
| 135 |
bool readExternalData(std::shared_ptr<WPSStream> stream); |
| 136 |
|
| 137 |
bool readFontDef(std::shared_ptr<WPSStream> stream); |
| 138 |
|
| 139 |
bool readColorList(std::shared_ptr<WPSStream> stream); |
| 140 |
|
| 141 |
bool readStyleName(std::shared_ptr<WPSStream> stream); |
| 142 |
|
| 143 |
bool readHeaderFooter(std::shared_ptr<WPSStream> stream, bool header); |
| 144 |
|
| 145 |
bool readPaneAttribute(std::shared_ptr<WPSStream> stream); |
| 146 |
|
| 147 |
bool readOptimizer(std::shared_ptr<WPSStream> stream); |
| 148 |
|
| 149 |
bool readQueryCommand(std::shared_ptr<WPSStream> stream); |
| 150 |
|
| 151 |
static bool readSerieExtension(std::shared_ptr<WPSStream> stream); |
| 152 |
|
| 153 |
bool readCString(std::shared_ptr<WPSStream> stream, librevenge::RVNGString &string, long maxSize); |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
bool readBlockList(std::shared_ptr<WPSStream> stream); |
| 159 |
|
| 160 |
bool readZone341(std::shared_ptr<WPSStream> stream); |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
bool parseOLEStream(RVNGInputStreamPtr input, std::string const &avoid=""); |
| 166 |
|
| 167 |
bool readOleLinkInfo(std::shared_ptr<WPSStream> stream, librevenge::RVNGString &link); |
| 168 |
|
| 169 |
static bool readOleBOlePart(std::shared_ptr<WPSStream> stream); |
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, std::vector<uint8_t> const &key) const; |
| 175 |
|
| 176 |
std::shared_ptr<WKSContentListener> m_listener; |
| 177 |
|
| 178 |
std::shared_ptr<QuattroParserInternal::State> m_state; |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
std::shared_ptr<QuattroGraph> m_graphParser; |
| 183 |
|
| 184 |
std::shared_ptr<QuattroSpreadsheet> m_spreadsheetParser; |
| 185 |
}; |
| 186 |
|
| 187 |
#endif |
| 188 |
|