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_DOCUMENT
00039 # define CLARIS_WKS_DOCUMENT
00040
00041 #include <vector>
00042
00043 #include "libmwaw_internal.hxx"
00044
00045 #include "MWAWPosition.hxx"
00046
00047 #include "ClarisWksStruct.hxx"
00048
00049 class MWAWSection;
00050
00051 namespace ClarisWksDocumentInternal
00052 {
00053 class SubDocument;
00054
00055 struct State;
00056 }
00057
00058 class ClarisWksParser;
00059 class ClarisWksBMParser;
00060 class ClarisWksPRParser;
00061 class ClarisWksSSParser;
00062
00063 class ClarisWksDatabase;
00064 class ClarisWksGraph;
00065 class ClarisWksStyleManager;
00066 class ClarisWksPresentation;
00067 class ClarisWksSpreadsheet;
00068 class ClarisWksTable;
00069 class ClarisWksText;
00070
00072 class ClarisWksDocument
00073 {
00074 public:
00075 friend class ClarisWksParser;
00076 friend class ClarisWksBMParser;
00077 friend class ClarisWksPRParser;
00078 friend class ClarisWksSSParser;
00079 friend class ClarisWksDocumentInternal::SubDocument;
00081 ClarisWksDocument(MWAWParser &parser);
00083 ~ClarisWksDocument();
00084
00086 bool checkHeader(MWAWHeader *header, bool strict=false);
00087
00089 bool createZones();
00090
00092 int numPages() const;
00094 MWAWVec2i getDocumentPages();
00096 double getTextHeight() const;
00098 MWAWVec2f getPageLeftTop() const;
00100 void updatePageSpanList(std::vector<MWAWPageSpan> &spanList);
00102 void updatePageSpanList(std::vector<MWAWPageSpan> &spanList, MWAWPageSpan &master);
00103
00105 MWAWSection getMainSection() const;
00107 shared_ptr<ClarisWksStruct::DSET> getZone(int zId) const;
00109 void updateChildPositions();
00111 void newPage(int page, bool softBreak=false);
00113 std::vector<int> const &getMainZonesList() const;
00115 void forceParsed(int zoneId);
00117 bool canSendZoneAsGraphic(int number) const;
00119 bool sendZone(int zoneId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition());
00121 void sendFootnote(int zoneId);
00122
00124 MWAWParser &getMainParser()
00125 {
00126 return *m_parser;
00127 }
00129 shared_ptr<ClarisWksStyleManager> getStyleManager()
00130 {
00131 return m_styleManager;
00132 }
00134 shared_ptr<ClarisWksDatabase> getDatabaseParser()
00135 {
00136 return m_databaseParser;
00137 }
00139 shared_ptr<ClarisWksGraph> getGraphParser()
00140 {
00141 return m_graphParser;
00142 }
00144 shared_ptr<ClarisWksPresentation> getPresentationParser()
00145 {
00146 return m_presentationParser;
00147 }
00149 shared_ptr<ClarisWksSpreadsheet> getSpreadsheetParser()
00150 {
00151 return m_spreadsheetParser;
00152 }
00154 shared_ptr<ClarisWksTable> getTableParser()
00155 {
00156 return m_tableParser;
00157 }
00159 shared_ptr<ClarisWksText> getTextParser()
00160 {
00161 return m_textParser;
00162 }
00163
00165 bool readZone();
00167 bool readDocHeader();
00169 bool readDocInfo();
00171 bool readPrintInfo();
00172
00173
00174
00176 bool readEndTable(long &eof);
00177
00178
00179 bool readCPRT(MWAWEntry const &entry);
00180
00181
00182 bool readMARKList(MWAWEntry const &entry);
00183
00184 bool readURL(long endPos);
00185
00186 bool readBookmark(long endPos);
00187
00188 bool readDocumentMark(long endPos);
00189
00190 bool readEndMark(long endPos);
00191
00192
00193 bool readDSUM(MWAWEntry const &entry, bool inHeader);
00194
00195 bool readSNAP(MWAWEntry const &entry);
00196
00197 bool readTNAM(MWAWEntry const &entry);
00198
00199
00200
00201
00202
00206 shared_ptr<ClarisWksStruct::DSET> readDSET(bool &complete);
00208 void typeMainZones();
00210 int typeMainZonesRec(int zId, ClarisWksStruct::DSET::Position type, int maxHeight);
00212 bool exploreZonesGraph();
00214 bool exploreZonesGraphRec(int zId, std::set<int> ¬DoneList);
00216 void cleanZonesGraph();
00217
00219 bool readStructCellZone(char const *zoneName, bool hasEntete, std::vector<MWAWVec2i> &res);
00220
00221 bool readStringList(char const *zoneName, bool hasEntete, std::vector<std::string> &res);
00222
00224 bool readZoneA();
00226 void checkOrdering(std::vector<int16_t> &vec16, std::vector<int32_t> &vec32) const;
00227
00228
00229 protected:
00231 MWAWPageSpan getFinalPageSpan() const;
00233 shared_ptr<ClarisWksDocumentInternal::State> m_state;
00234 public:
00236 shared_ptr<MWAWParserState> m_parserState;
00237
00238 protected:
00240 MWAWParser *m_parser;
00242 shared_ptr<ClarisWksStyleManager> m_styleManager;
00243
00245 shared_ptr<ClarisWksDatabase> m_databaseParser;
00247 shared_ptr<ClarisWksGraph> m_graphParser;
00249 shared_ptr<ClarisWksPresentation> m_presentationParser;
00251 shared_ptr<ClarisWksSpreadsheet> m_spreadsheetParser;
00253 shared_ptr<ClarisWksTable> m_tableParser;
00255 shared_ptr<ClarisWksText> m_textParser;
00256
00257
00258
00259
00260
00262 typedef void (MWAWParser::* NewPage)(int page, bool softBreak);
00264 typedef void (MWAWParser::* SendFootnote)(int zoneId);
00265
00267 NewPage m_newPage;
00269 SendFootnote m_sendFootnote;
00270
00271 private:
00272 ClarisWksDocument(ClarisWksDocument const &orig);
00273 ClarisWksDocument operator=(ClarisWksDocument const &orig);
00274 };
00275
00276 #endif
00277