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 #ifndef MS_WKS_DOCUMENT
00035 # define MS_WKS_DOCUMENT
00036
00037 #include <string>
00038 #include <map>
00039 #include <vector>
00040
00041 #include <librevenge/librevenge.h>
00042
00043 #include "libmwaw_internal.hxx"
00044
00045 #include "MWAWDebug.hxx"
00046 #include "MWAWCell.hxx"
00047
00048 namespace MsWksDocumentInternal
00049 {
00050 struct State;
00051
00052 class SubDocument;
00053 }
00054
00055 class MsWksParser;
00056 class MsWksDBParser;
00057 class MsWksDRParser;
00058 class MsWksSSParser;
00059 class MsWks4Zone;
00060
00061 class MsWksGraph;
00062 class MsWks3Text;
00063 class MsWks4Text;
00064
00067 class MsWksDocument
00068 {
00069 friend class MsWksDocumentInternal::SubDocument;
00070 friend class MsWksParser;
00071 friend class MsWks4Zone;
00072 friend class MsWksDBParser;
00073 friend class MsWksDRParser;
00074 friend class MsWksSSParser;
00075 public:
00077 enum ZoneType { Z_MAIN, Z_HEADER, Z_FOOTER, Z_NONE };
00079 struct Zone {
00081 Zone(ZoneType type=Z_NONE, int zoneId=-1) : m_type(type), m_zoneId(zoneId), m_textId(-1) {}
00083 ZoneType m_type;
00085 int m_zoneId;
00087 int m_textId;
00088 };
00089
00090 public:
00091
00093 MsWksDocument(MWAWInputStreamPtr input, MWAWParser &parser);
00095 virtual ~MsWksDocument();
00096
00098 int version() const;
00100 void setVersion(int vers);
00102 MWAWDocument::Kind getKind() const;
00104 void setKind(MWAWDocument::Kind kind);
00105
00107 MWAWInputStreamPtr &getInput()
00108 {
00109 return m_input;
00110 }
00112 MWAWParser &getMainParser()
00113 {
00114 return *m_parser;
00115 }
00117 shared_ptr<MsWksGraph> getGraphParser()
00118 {
00119 return m_graphParser;
00120 }
00122 shared_ptr<MsWks3Text> getTextParser3();
00124 shared_ptr<MsWks4Text> getTextParser4();
00126 libmwaw::DebugFile &ascii()
00127 {
00128 return m_asciiFile;
00129 }
00130
00131
00132
00133
00134
00136 bool checkHeader3(MWAWHeader *header, bool strict=false);
00138 long getLengthOfFileHeader3() const;
00140 bool readPrintInfo();
00142 bool readDocumentInfo(long sz=-1);
00144 bool readZone(Zone &zone);
00146 bool readGroupHeaderFooter(bool header, int check);
00147
00148
00149
00150
00151
00153 bool createOLEZones(MWAWInputStreamPtr input);
00155 std::vector<std::string> const &getUnparsedOLEZones() const;
00156
00157
00158
00159
00161 bool hasHeader() const;
00163 bool hasFooter() const;
00165 float getHeaderFooterHeight(bool header) const;
00167 void getPageSpanList(std::vector<MWAWPageSpan> &pagesList, int &numPages);
00169 static bool getColor(int id, MWAWColor &col, int vers);
00171 static std::vector<MWAWColor> const &getPalette(int vers);
00172
00174 std::multimap<int, Zone> &getTypeZoneMap();
00176 Zone getZone(ZoneType type) const;
00178 int getNewZoneId() const;
00180 std::multimap<std::string, MWAWEntry> &getEntryMap();
00181
00182
00183
00185 void sendZone(int zoneType);
00186
00187
00188
00190 void newPage(int page, bool softBreak=false);
00192 void sendFootnoteContent(int noteId);
00194 void sendFootnote(int id);
00196 void sendText(int id);
00197
00198
00199
00201 void sendOLE(int id, MWAWPosition const &pos, MWAWGraphicStyle const &style);
00203 void sendRBIL(int id, MWAWVec2i const &sz);
00205 void sendTextbox(MWAWEntry const &entry, std::string const &frame);
00206
00207 protected:
00208
00209
00210
00211
00213 bool readCellInFormula(MWAWCellContent::FormulaInstruction &instr, bool is2D);
00215 bool readDBString(long endPos, std::string &res);
00217 bool readDBNumber(long endPos, double &res, bool &isNan, std::string &str);
00218
00219 bool readFormula(long endPos, MWAWCellContent &content, std::string &extra);
00220
00221 protected:
00222
00223
00224
00225
00227 void initAsciiFile(std::string const &name);
00228
00229 private:
00230 MsWksDocument(MsWksDocument const &orig);
00231 MsWksDocument &operator=(MsWksDocument const &orig);
00232
00233
00234
00235
00236
00237 protected:
00239 shared_ptr<MsWksDocumentInternal::State> m_state;
00240 public:
00242 shared_ptr<MWAWParserState> m_parserState;
00243
00244 protected:
00246 MWAWParser *m_parser;
00248 MsWksDocument *m_parentDocument;
00250 MWAWInputStreamPtr m_input;
00252 libmwaw::DebugFile m_asciiFile;
00253
00255 shared_ptr<MsWksGraph> m_graphParser;
00257 shared_ptr<MsWks3Text> m_textParser3;
00259 shared_ptr<MsWks4Text> m_textParser4;
00260
00262 typedef void (MWAWParser::* NewPage)(int page, bool softBreak);
00263
00265 NewPage m_newPage;
00266 };
00267 #endif
00268