| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef QUATTRO_SPREADSHEET_H |
| 23 |
#define QUATTRO_SPREADSHEET_H |
| 24 |
|
| 25 |
#include <ostream> |
| 26 |
#include <map> |
| 27 |
#include <vector> |
| 28 |
|
| 29 |
#include <librevenge-stream/librevenge-stream.h> |
| 30 |
|
| 31 |
#include "libwps_internal.h" |
| 32 |
|
| 33 |
#include "WPSDebug.h" |
| 34 |
#include "WKSContentListener.h" |
| 35 |
|
| 36 |
#include "QuattroFormula.h" |
| 37 |
|
| 38 |
namespace QuattroSpreadsheetInternal |
| 39 |
{ |
| 40 |
class Cell; |
| 41 |
class SpreadSheet; |
| 42 |
struct State; |
| 43 |
} |
| 44 |
|
| 45 |
class QuattroParser; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
class QuattroSpreadsheet |
| 52 |
{ |
| 53 |
public: |
| 54 |
friend class QuattroParser; |
| 55 |
|
| 56 |
|
| 57 |
explicit QuattroSpreadsheet(QuattroParser &parser); |
| 58 |
|
| 59 |
~QuattroSpreadsheet(); |
| 60 |
|
| 61 |
void setListener(WKSContentListenerPtr &listen) |
| 62 |
{ |
| 63 |
m_listener = listen; |
| 64 |
} |
| 65 |
|
| 66 |
void cleanState(); |
| 67 |
|
| 68 |
void updateState(); |
| 69 |
|
| 70 |
protected: |
| 71 |
|
| 72 |
int version() const; |
| 73 |
|
| 74 |
QuattroFormulaManager::CellReferenceFunction getReadCellReferenceFunction(); |
| 75 |
|
| 76 |
|
| 77 |
int getNumSpreadsheets() const; |
| 78 |
|
| 79 |
librevenge::RVNGString getSheetName(int id) const; |
| 80 |
|
| 81 |
void sendSpreadsheet(int sheetId, std::vector<Vec2i> const &listGraphicCells); |
| 82 |
|
| 83 |
Vec2f getPosition(int sheetId, Vec2i const &cell) const; |
| 84 |
|
| 85 |
void sendCellContent(QuattroSpreadsheetInternal::Cell const &cell, int sheetId); |
| 86 |
|
| 87 |
|
| 88 |
void addDLLIdName(int id, librevenge::RVNGString const &name, bool func1); |
| 89 |
|
| 90 |
void addUserFormat(int id, librevenge::RVNGString const &name); |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
bool readCell(std::shared_ptr<WPSStream> const &stream); |
| 99 |
|
| 100 |
bool readSheetSize(std::shared_ptr<WPSStream> const &stream); |
| 101 |
|
| 102 |
bool readColumnRowDefaultSize(std::shared_ptr<WPSStream> const &stream); |
| 103 |
|
| 104 |
bool readColumnSize(std::shared_ptr<WPSStream> const &stream); |
| 105 |
|
| 106 |
bool readRowSize(std::shared_ptr<WPSStream> const &stream); |
| 107 |
|
| 108 |
bool readRowRangeSize(std::shared_ptr<WPSStream> const &stream); |
| 109 |
|
| 110 |
|
| 111 |
bool readBeginEndSheet(std::shared_ptr<WPSStream> const &stream, int &sheetId); |
| 112 |
|
| 113 |
bool readSheetName(std::shared_ptr<WPSStream> const &stream); |
| 114 |
|
| 115 |
bool readCellStyle(std::shared_ptr<WPSStream> const &stream); |
| 116 |
|
| 117 |
|
| 118 |
static bool readViewInfo(std::shared_ptr<WPSStream> const &stream); |
| 119 |
|
| 120 |
|
| 121 |
static bool readCell(std::shared_ptr<WPSStream> const &stream, Vec2i actPos, WKSContentListener::FormulaInstruction &instr, int sheetId, librevenge::RVNGString const &fName); |
| 122 |
|
| 123 |
static void updateCellWithUserFormat(QuattroSpreadsheetInternal::Cell &cell, librevenge::RVNGString const &format); |
| 124 |
|
| 125 |
bool readCellReference(std::shared_ptr<WPSStream> const &stream, long endPos, |
| 126 |
QuattroFormulaInternal::CellReference &ref, |
| 127 |
Vec2i const &pos=Vec2i(0,0), int sheetId=0) const; |
| 128 |
|
| 129 |
private: |
| 130 |
QuattroSpreadsheet(QuattroSpreadsheet const &orig) = delete; |
| 131 |
QuattroSpreadsheet &operator=(QuattroSpreadsheet const &orig) = delete; |
| 132 |
std::shared_ptr<WKSContentListener> m_listener; |
| 133 |
|
| 134 |
QuattroParser &m_mainParser; |
| 135 |
|
| 136 |
std::shared_ptr<QuattroSpreadsheetInternal::State> m_state; |
| 137 |
}; |
| 138 |
|
| 139 |
#endif |
| 140 |
|