| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef LOTUS_SPREADSHEET_H |
| 23 |
#define LOTUS_SPREADSHEET_H |
| 24 |
|
| 25 |
#include <ostream> |
| 26 |
#include <vector> |
| 27 |
|
| 28 |
#include <librevenge-stream/librevenge-stream.h> |
| 29 |
|
| 30 |
#include "libwps_internal.h" |
| 31 |
|
| 32 |
#include "WPSDebug.h" |
| 33 |
#include "WKSContentListener.h" |
| 34 |
|
| 35 |
namespace LotusSpreadsheetInternal |
| 36 |
{ |
| 37 |
class Cell; |
| 38 |
class Spreadsheet; |
| 39 |
struct Style; |
| 40 |
struct State; |
| 41 |
struct Table123Styles; |
| 42 |
class SubDocument; |
| 43 |
} |
| 44 |
|
| 45 |
class LotusParser; |
| 46 |
class LotusStyleManager; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
class LotusSpreadsheet |
| 53 |
{ |
| 54 |
public: |
| 55 |
friend class LotusParser; |
| 56 |
friend class LotusSpreadsheetInternal::SubDocument; |
| 57 |
|
| 58 |
|
| 59 |
explicit LotusSpreadsheet(LotusParser &parser); |
| 60 |
|
| 61 |
~LotusSpreadsheet(); |
| 62 |
|
| 63 |
void cleanState(); |
| 64 |
|
| 65 |
void updateState(); |
| 66 |
|
| 67 |
void setListener(WKSContentListenerPtr &listen) |
| 68 |
{ |
| 69 |
m_listener = listen; |
| 70 |
} |
| 71 |
|
| 72 |
void setLastSpreadsheetId(int id); |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
bool getLeftTopPosition(Vec2i const &cell, int spreadsheet, Vec2f &pos); |
| 78 |
protected: |
| 79 |
|
| 80 |
int version() const; |
| 81 |
|
| 82 |
bool hasSomeSpreadsheetData() const; |
| 83 |
|
| 84 |
|
| 85 |
void sendSpreadsheet(int sheetId); |
| 86 |
|
| 87 |
librevenge::RVNGString getSheetName(int id) const; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
void sendRowContent(LotusSpreadsheetInternal::Spreadsheet const &sheet, int row, LotusSpreadsheetInternal::Table123Styles const *table123Styles); |
| 93 |
|
| 94 |
void sendCellContent(LotusSpreadsheetInternal::Cell const &cell, |
| 95 |
LotusSpreadsheetInternal::Style const &style, int numRepeated=1); |
| 96 |
|
| 97 |
void sendText(RVNGInputStreamPtr &input, long endPos, LotusSpreadsheetInternal::Style const &style) const; |
| 98 |
|
| 99 |
void sendTextNote(RVNGInputStreamPtr &input, WPSEntry const &entry) const; |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
bool readSheetName(std::shared_ptr<WPSStream> stream); |
| 110 |
|
| 111 |
bool readSheetName1B(std::shared_ptr<WPSStream> stream, long endPos); |
| 112 |
|
| 113 |
|
| 114 |
bool readCellsFormat801(std::shared_ptr<WPSStream> stream, WPSVec3i const &minC, WPSVec3i const &maxC, int typeZone); |
| 115 |
|
| 116 |
bool readColumnDefinition(std::shared_ptr<WPSStream> stream); |
| 117 |
|
| 118 |
bool readColumnSizes(std::shared_ptr<WPSStream> stream); |
| 119 |
|
| 120 |
bool readRowFormats(std::shared_ptr<WPSStream> stream); |
| 121 |
|
| 122 |
bool readRowFormat(std::shared_ptr<WPSStream> stream, LotusSpreadsheetInternal::Style &style, int &numCell, long endPos); |
| 123 |
|
| 124 |
bool readRowSizes(std::shared_ptr<WPSStream> stream, long endPos); |
| 125 |
|
| 126 |
|
| 127 |
bool readCell(std::shared_ptr<WPSStream> stream); |
| 128 |
|
| 129 |
bool readCellName(std::shared_ptr<WPSStream> stream); |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
bool readSheetHeader(std::shared_ptr<WPSStream> stream); |
| 135 |
|
| 136 |
bool readExtraRowFormats(std::shared_ptr<WPSStream> stream); |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
static bool readNote(std::shared_ptr<WPSStream> stream, long endPos); |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
bool readCell(WPSStream &stream, int sId, bool isList, WKSContentListener::FormulaInstruction &instr); |
| 147 |
|
| 148 |
bool readFormula(WPSStream &stream, long endPos, int sId, bool newFormula, |
| 149 |
std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error); |
| 150 |
|
| 151 |
static bool parseVariable(std::string const &variable, WKSContentListener::FormulaInstruction &instr); |
| 152 |
|
| 153 |
static std::string getDebugStringForText(std::string const &text); |
| 154 |
private: |
| 155 |
LotusSpreadsheet(LotusSpreadsheet const &orig) = delete; |
| 156 |
LotusSpreadsheet &operator=(LotusSpreadsheet const &orig) = delete; |
| 157 |
std::shared_ptr<WKSContentListener> m_listener; |
| 158 |
|
| 159 |
LotusParser &m_mainParser; |
| 160 |
|
| 161 |
std::shared_ptr<LotusStyleManager> m_styleManager; |
| 162 |
|
| 163 |
std::shared_ptr<LotusSpreadsheetInternal::State> m_state; |
| 164 |
}; |
| 165 |
|
| 166 |
#endif |
| 167 |
|