| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef QUATTRO9_SPREADSHEET_H |
| 23 |
#define QUATTRO9_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 Quattro9SpreadsheetInternal |
| 39 |
{ |
| 40 |
struct CellData; |
| 41 |
class SpreadSheet; |
| 42 |
struct State; |
| 43 |
} |
| 44 |
|
| 45 |
namespace Quattro9ParserInternal |
| 46 |
{ |
| 47 |
struct TextEntry; |
| 48 |
} |
| 49 |
|
| 50 |
class Quattro9Parser; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
class Quattro9Spreadsheet |
| 57 |
{ |
| 58 |
public: |
| 59 |
friend class Quattro9Parser; |
| 60 |
|
| 61 |
|
| 62 |
explicit Quattro9Spreadsheet(Quattro9Parser &parser); |
| 63 |
|
| 64 |
~Quattro9Spreadsheet(); |
| 65 |
|
| 66 |
void setListener(WKSContentListenerPtr &listen) |
| 67 |
{ |
| 68 |
m_listener = listen; |
| 69 |
} |
| 70 |
|
| 71 |
void cleanState(); |
| 72 |
|
| 73 |
void updateState(); |
| 74 |
|
| 75 |
protected: |
| 76 |
|
| 77 |
int version() const; |
| 78 |
|
| 79 |
QuattroFormulaManager::CellReferenceFunction getReadCellReferenceFunction(); |
| 80 |
|
| 81 |
|
| 82 |
int getNumSpreadsheets() const; |
| 83 |
|
| 84 |
librevenge::RVNGString getSheetName(int id) const; |
| 85 |
|
| 86 |
void sendSpreadsheet(int sheetId); |
| 87 |
|
| 88 |
Vec2f getPosition(int sheetId, Vec2i const &cell) const; |
| 89 |
|
| 90 |
void addDLLIdName(int id, librevenge::RVNGString const &name, bool func1); |
| 91 |
|
| 92 |
void addUserFormat(int id, librevenge::RVNGString const &name); |
| 93 |
|
| 94 |
void addDocumentStrings(std::shared_ptr<WPSStream> const &stream, |
| 95 |
std::vector<Quattro9ParserInternal::TextEntry> const &entries); |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
void sendCellContent(Quattro9SpreadsheetInternal::CellData const *cell, Vec2i pos, int sheetId, int numRepeated); |
| 103 |
|
| 104 |
|
| 105 |
bool readCellStyles(std::shared_ptr<WPSStream> const &stream); |
| 106 |
|
| 107 |
bool readDocumentFormulas(std::shared_ptr<WPSStream> const &stream); |
| 108 |
|
| 109 |
bool readBeginSheet(std::shared_ptr<WPSStream> const &stream, int &sheetId); |
| 110 |
|
| 111 |
bool readEndSheet(std::shared_ptr<WPSStream> const &stream); |
| 112 |
|
| 113 |
static bool readPageBreak(std::shared_ptr<WPSStream> const &stream); |
| 114 |
|
| 115 |
bool readMergedCells(std::shared_ptr<WPSStream> const &stream); |
| 116 |
|
| 117 |
bool readColRowDefault(std::shared_ptr<WPSStream> const &stream); |
| 118 |
|
| 119 |
bool readColRowDimension(std::shared_ptr<WPSStream> const &stream); |
| 120 |
|
| 121 |
bool readColRowDimensions(std::shared_ptr<WPSStream> const &stream); |
| 122 |
|
| 123 |
bool readBeginColumn(std::shared_ptr<WPSStream> const &stream); |
| 124 |
|
| 125 |
bool readEndColumn(std::shared_ptr<WPSStream> const &stream); |
| 126 |
|
| 127 |
bool readCellList(std::shared_ptr<WPSStream> const &stream); |
| 128 |
|
| 129 |
bool readCellResult(std::shared_ptr<WPSStream> const &stream); |
| 130 |
|
| 131 |
|
| 132 |
static bool readCell(std::shared_ptr<WPSStream> const &stream, Vec2i actPos, WKSContentListener::FormulaInstruction &instr, int sheetId, librevenge::RVNGString const &fName); |
| 133 |
|
| 134 |
bool readCellReference(std::shared_ptr<WPSStream> const &stream, long endPos, |
| 135 |
QuattroFormulaInternal::CellReference &ref, |
| 136 |
Vec2i const &pos=Vec2i(0,0), int sheetId=0) const; |
| 137 |
|
| 138 |
|
| 139 |
private: |
| 140 |
Quattro9Spreadsheet(Quattro9Spreadsheet const &orig) = delete; |
| 141 |
Quattro9Spreadsheet &operator=(Quattro9Spreadsheet const &orig) = delete; |
| 142 |
std::shared_ptr<WKSContentListener> m_listener; |
| 143 |
|
| 144 |
Quattro9Parser &m_mainParser; |
| 145 |
|
| 146 |
std::shared_ptr<Quattro9SpreadsheetInternal::State> m_state; |
| 147 |
}; |
| 148 |
|
| 149 |
#endif |
| 150 |
|