| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef LOTUS_H |
| 23 |
#define LOTUS_H |
| 24 |
|
| 25 |
#include <vector> |
| 26 |
|
| 27 |
#include <librevenge-stream/librevenge-stream.h> |
| 28 |
#include "libwps_internal.h" |
| 29 |
#include "libwps_tools_win.h" |
| 30 |
#include "WPSDebug.h" |
| 31 |
|
| 32 |
#include "WKSParser.h" |
| 33 |
|
| 34 |
namespace LotusParserInternal |
| 35 |
{ |
| 36 |
class SubDocument; |
| 37 |
struct State; |
| 38 |
} |
| 39 |
|
| 40 |
class LotusGraph; |
| 41 |
class LotusChart; |
| 42 |
class LotusSpreadsheet; |
| 43 |
class LotusStyleManager; |
| 44 |
class WPSGraphicStyle; |
| 45 |
class WPSOLE1Parser; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
class LotusParser final : public WKSParser |
| 73 |
{ |
| 74 |
friend class LotusParserInternal::SubDocument; |
| 75 |
friend class LotusChart; |
| 76 |
friend class LotusGraph; |
| 77 |
friend class LotusSpreadsheet; |
| 78 |
friend class LotusStyleManager; |
| 79 |
public: |
| 80 |
|
| 81 |
LotusParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, |
| 82 |
libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, |
| 83 |
char const *password=nullptr); |
| 84 |
|
| 85 |
~LotusParser() final; |
| 86 |
|
| 87 |
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final; |
| 88 |
|
| 89 |
bool checkHeader(WPSHeader *header, bool strict=false); |
| 90 |
|
| 91 |
|
| 92 |
struct Link |
| 93 |
{ |
| 94 |
|
| 95 |
Link() : m_name(), m_linkName() |
| 96 |
{ |
| 97 |
} |
| 98 |
|
| 99 |
std::string m_name; |
| 100 |
|
| 101 |
WPSVec3i m_cells[2]; |
| 102 |
|
| 103 |
librevenge::RVNGString m_linkName; |
| 104 |
}; |
| 105 |
protected: |
| 106 |
|
| 107 |
int version() const; |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const; |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
libwps_tools_win::Font::Type getDefaultFontType() const; |
| 119 |
|
| 120 |
std::vector<Link> getLinksList(int lId) const; |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
bool sendChart(int cId, WPSPosition const &pos, WPSGraphicStyle const &style); |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
bool hasGraphics(int sheetId) const; |
| 135 |
|
| 136 |
void sendGraphics(int sheetId); |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
bool getLeftTopPosition(Vec2i const &cell, int spreadsheet, Vec2f &pos) const; |
| 144 |
|
| 145 |
librevenge::RVNGString getSheetName(int id) const; |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
bool updateEmbeddedObject(int id, WPSEmbeddedObject &object) const; |
| 153 |
|
| 154 |
|
| 155 |
bool createZones(); |
| 156 |
|
| 157 |
bool createListener(librevenge::RVNGSpreadsheetInterface *interface); |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
bool parseFormatStream(); |
| 165 |
|
| 166 |
|
| 167 |
bool checkHeader(std::shared_ptr<WPSStream> stream, bool mainStream, bool strict); |
| 168 |
|
| 169 |
bool readZones(std::shared_ptr<WPSStream> stream); |
| 170 |
|
| 171 |
bool readDataZone(std::shared_ptr<WPSStream> stream); |
| 172 |
|
| 173 |
bool readZone(std::shared_ptr<WPSStream> &stream); |
| 174 |
|
| 175 |
bool readZone1(std::shared_ptr<WPSStream> stream); |
| 176 |
|
| 177 |
bool readSheetZone(std::shared_ptr<WPSStream> stream); |
| 178 |
|
| 179 |
static bool readZone4(std::shared_ptr<WPSStream> stream); |
| 180 |
|
| 181 |
static bool readChartZone(std::shared_ptr<WPSStream> stream); |
| 182 |
|
| 183 |
static bool readRefZone(std::shared_ptr<WPSStream> stream); |
| 184 |
|
| 185 |
static bool readZone7(std::shared_ptr<WPSStream> stream); |
| 186 |
|
| 187 |
bool readZone8(std::shared_ptr<WPSStream> stream); |
| 188 |
|
| 189 |
static bool readVersionZone(std::shared_ptr<WPSStream> stream); |
| 190 |
|
| 191 |
static bool readZoneV3(std::shared_ptr<WPSStream> stream); |
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
bool readMacFontName(std::shared_ptr<WPSStream> stream, long endPos); |
| 196 |
|
| 197 |
static bool readFMTStyleName(std::shared_ptr<WPSStream> stream); |
| 198 |
|
| 199 |
bool readLinkZone(std::shared_ptr<WPSStream> stream); |
| 200 |
|
| 201 |
bool readDocumentInfoMac(std::shared_ptr<WPSStream> stream, long endPos); |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
static RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, long endPos, std::vector<uint8_t> const &key); |
| 207 |
|
| 208 |
static std::vector<uint8_t> retrievePasswordKeys(std::vector<uint8_t> const &fileKeys); |
| 209 |
|
| 210 |
std::shared_ptr<WKSContentListener> m_listener; |
| 211 |
|
| 212 |
std::shared_ptr<LotusParserInternal::State> m_state; |
| 213 |
|
| 214 |
std::shared_ptr<LotusStyleManager> m_styleManager; |
| 215 |
|
| 216 |
std::shared_ptr<LotusChart> m_chartParser; |
| 217 |
|
| 218 |
std::shared_ptr<LotusGraph> m_graphParser; |
| 219 |
|
| 220 |
std::shared_ptr<LotusSpreadsheet> m_spreadsheetParser; |
| 221 |
|
| 222 |
std::shared_ptr<WPSOLE1Parser> m_ole1Parser; |
| 223 |
}; |
| 224 |
|
| 225 |
#endif |
| 226 |
|