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 RAG_TIME_5_PARSER
00035 # define RAG_TIME_5_PARSER
00036
00037 #include <map>
00038 #include <string>
00039 #include <set>
00040 #include <vector>
00041
00042 #include "MWAWDebug.hxx"
00043 #include "MWAWInputStream.hxx"
00044
00045 #include "MWAWParser.hxx"
00046
00047 #include "RagTime5StructManager.hxx"
00048 #include "RagTime5ClusterManager.hxx"
00049
00050 namespace RagTime5ParserInternal
00051 {
00052 struct DocInfoFieldParser;
00053 struct State;
00054 class SubDocument;
00055 }
00056
00057 class RagTime5Graph;
00058 class RagTime5Spreadsheet;
00059 class RagTime5StructManager;
00060 class RagTime5Text;
00061 class RagTime5Zone;
00062 class RagTime5ClusterManager;
00063
00069 class RagTime5Parser : public MWAWTextParser
00070 {
00071 friend class RagTime5Graph;
00072 friend class RagTime5Spreadsheet;
00073 friend class RagTime5Text;
00074 friend class RagTime5ClusterManager;
00075 friend struct RagTime5ParserInternal::DocInfoFieldParser;
00076 friend class RagTime5ParserInternal::SubDocument;
00077
00078 public:
00080 RagTime5Parser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
00082 virtual ~RagTime5Parser();
00083
00085 bool checkHeader(MWAWHeader *header, bool strict=false);
00086
00087
00088 void parse(librevenge::RVNGTextInterface *documentInterface);
00089
00090 protected:
00092 void init();
00093
00094
00095
00096
00097
00099 shared_ptr<RagTime5ClusterManager> getClusterManager();
00101 shared_ptr<RagTime5StructManager> getStructManager();
00102
00104 bool readChartCluster(RagTime5Zone &zone, int zoneType);
00106 bool readGraphicCluster(RagTime5Zone &zone, int zoneType);
00108 bool readPictureCluster(RagTime5Zone &zone, int zoneType);
00110 bool readSpreadsheetCluster(RagTime5Zone &zone, int zoneType);
00112 bool readTextCluster(RagTime5Zone &zone, int zoneType);
00113
00115 void createDocument(librevenge::RVNGTextInterface *documentInterface);
00117 bool sendZones();
00118
00120 void newPage(int number);
00121
00123 bool createZones();
00125 bool findDataZones(MWAWEntry const &entry);
00127 shared_ptr<RagTime5Zone> getDataZone(int dataId) const;
00129 bool update(RagTime5Zone &zone);
00131 bool readZoneData(RagTime5Zone &zone);
00133 bool unpackZone(RagTime5Zone &zone, MWAWEntry const &entry, std::vector<unsigned char> &data);
00135 bool unpackZone(RagTime5Zone &zone);
00136
00138 bool readClusterZones();
00140 bool readClusterZone(RagTime5Zone &zone, int type=-1);
00142 bool readClusterLinkList(RagTime5Zone &zone,
00143 RagTime5ClusterManager::Link const &link);
00145 bool readClusterLinkList(RagTime5ClusterManager::Link const &link,
00146 RagTime5ClusterManager::Link const &nameLink,
00147 std::vector<int> &list, std::string const &name="");
00148
00150 bool readString(RagTime5Zone &zone, std::string &string);
00152 bool readUnicodeString(RagTime5Zone &zone);
00154 bool readLongListWithSize(int dataId, int fSz, std::vector<long> &list, std::string const &zoneName="");
00156 bool readPositions(int posId, std::vector<long> &listPosition);
00158 bool readLongList(RagTime5ClusterManager::Link const &link, std::vector<long> &list);
00160 bool readUnicodeStringList(RagTime5ClusterManager::Link const &link, std::map<int, librevenge::RVNGString> &idToStringMap);
00161
00163 bool readDocumentVersion(RagTime5Zone &zone);
00165 bool readClusterRootData(RagTime5ClusterManager::ClusterRoot &cluster);
00167 bool readFormats(RagTime5ClusterManager::Cluster &cluster);
00169 bool readClusterFieldsData(RagTime5ClusterManager::Cluster &cluster);
00171 bool readClusterLayoutData(RagTime5ClusterManager::ClusterLayout &cluster);
00173 bool readClusterPipelineData(RagTime5ClusterManager::Cluster &cluster);
00175 bool readDocInfoClusterData(RagTime5Zone &zone, MWAWEntry const &entry);
00177 bool readClusterScriptData(RagTime5ClusterManager::ClusterScript &cluster);
00179 bool readUnknownClusterBData(RagTime5ClusterManager::Cluster &cluster);
00181 bool readUnknownClusterCData(RagTime5ClusterManager::Cluster &cluster);
00182
00184 bool readStructZone(RagTime5ClusterManager::Cluster &cluster, RagTime5StructManager::FieldParser &parser, int headerSz);
00186 bool readStructData(RagTime5Zone &zone, long endPos, int n, int headerSz,
00187 RagTime5StructManager::FieldParser &parser, librevenge::RVNGString const &dataName);
00189 bool readStructMainZone(RagTime5Zone &zone);
00190
00192 bool readListZone(RagTime5ClusterManager::Link const &link);
00194 bool readListZone(RagTime5ClusterManager::Link const &link, RagTime5StructManager::DataParser &parser);
00196 bool readFixedSizeZone(RagTime5ClusterManager::Link const &link, std::string const &name);
00198 bool readFixedSizeZone(RagTime5ClusterManager::Link const &link, RagTime5StructManager::DataParser &parser);
00199
00201 bool checkClusterList(std::vector<int> const &list);
00203 void flushExtra();
00204
00205 protected:
00206
00207
00208
00209
00211 shared_ptr<RagTime5ParserInternal::State> m_state;
00213 shared_ptr<RagTime5Graph> m_graphParser;
00215 shared_ptr<RagTime5Spreadsheet> m_spreadsheetParser;
00217 shared_ptr<RagTime5Text> m_textParser;
00219 shared_ptr<RagTime5StructManager> m_structManager;
00221 shared_ptr<RagTime5ClusterManager> m_clusterManager;
00222 };
00223 #endif
00224