Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef CLARIS_WKS_DBASE_CONTENT
00039 # define CLARIS_WKS_DBASE_CONTENT
00040
00041 #include <iostream>
00042 #include <map>
00043 #include <vector>
00044
00045 #include "libmwaw_internal.hxx"
00046
00047 #include "MWAWCell.hxx"
00048 #include "MWAWEntry.hxx"
00049 #include "MWAWFont.hxx"
00050
00051 #include "ClarisWksStyleManager.hxx"
00052
00053 class ClarisWksDocument;
00054
00056 class ClarisWksDbaseContent
00057 {
00058 public:
00059 struct Record;
00060
00062 ClarisWksDbaseContent(ClarisWksDocument &document, bool spreadsheet);
00064 ~ClarisWksDbaseContent();
00066 bool readContent();
00067
00069 bool getExtrema(MWAWVec2i &min, MWAWVec2i &max) const;
00071 bool getRecordList(std::vector<int> &list) const;
00072
00074 bool get(MWAWVec2i const &pos, Record &data) const;
00076 bool send(MWAWVec2i const &pos);
00078 void setDatabaseFormats(std::vector<ClarisWksStyleManager::CellFormat> const &format);
00080 struct Record {
00082 Record() : m_style(-1), m_format(), m_hAlign(MWAWCell::HALIGN_DEFAULT), m_fileFormat(0),
00083 m_content(), m_valueType(MWAWCellContent::C_UNKNOWN), m_hasNaNValue(false), m_backgroundColor(MWAWColor::white()), m_font(3,9), m_borders(0)
00084 {
00085 }
00087 void updateFormulaCells(MWAWVec2i const &removeDelta);
00089 int m_style;
00091 MWAWCell::Format m_format;
00093 MWAWCell::HorizontalAlignment m_hAlign;
00095 int m_fileFormat;
00097 MWAWCellContent m_content;
00099 MWAWCellContent::Type m_valueType;
00101 bool m_hasNaNValue;
00103 MWAWColor m_backgroundColor;
00105 MWAWFont m_font;
00107 int m_borders;
00108 };
00109 protected:
00111 struct Column {
00113 Column() : m_idRecordMap()
00114 {
00115 }
00117 std::map<int,Record> m_idRecordMap;
00118 };
00119
00121 bool readColumnList();
00123 bool readColumn(int c);
00125 bool readRecordList(MWAWVec2i const &where, Column &col);
00127 bool readRecordSS(MWAWVec2i const &where, long pos, Record &record);
00129 bool readRecordSSV1(MWAWVec2i const &where, long pos, Record &record);
00131 bool readRecordDB(MWAWVec2i const &where, long pos, Record &record);
00132
00134 void send(double val, bool isNotaNumber, ClarisWksStyleManager::CellFormat const &format);
00135
00136
00137
00138
00139
00141 bool readCellInFormula(MWAWVec2i const &pos, MWAWCellContent::FormulaInstruction &instr);
00143 bool readString(long endPos, std::string &res);
00145 bool readNumber(long endPos, double &res, bool &isNan);
00147 bool readFormula(MWAWVec2i const &cPos, long endPos,
00148 std::vector<MWAWCellContent::FormulaInstruction> &formula, std::string &error);
00149
00151 int m_version;
00153 bool m_isSpreadsheet;
00154
00156 ClarisWksDocument &m_document;
00158 MWAWParserStatePtr m_parserState;
00159
00161 std::map<int, Column> m_idColumnMap;
00163 std::vector<ClarisWksStyleManager::CellFormat> m_dbFormatList;
00164 };
00165 #endif
00166
00167
00168