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 WRITER_PLS_PARSER
00039 # define WRITER_PLS_PARSER
00040
00041 #include <vector>
00042
00043 #include "MWAWDebug.hxx"
00044 #include "MWAWEntry.hxx"
00045 #include "MWAWInputStream.hxx"
00046
00047 #include "MWAWParser.hxx"
00048
00049 namespace WriterPlsParserInternal
00050 {
00051 struct State;
00052 struct Font;
00053 struct Line;
00054 struct ParagraphData;
00055 struct ParagraphInfo;
00056 class SubDocument;
00057 }
00058
00064 class WriterPlsParser : public MWAWTextParser
00065 {
00066 friend class WriterPlsParserInternal::SubDocument;
00067
00068 public:
00070 WriterPlsParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
00072 virtual ~WriterPlsParser();
00073
00075 bool checkHeader(MWAWHeader *header, bool strict=false);
00076
00077
00078 void parse(librevenge::RVNGTextInterface *documentInterface);
00079
00080 protected:
00082 void init();
00083
00085 void createDocument(librevenge::RVNGTextInterface *documentInterface);
00086
00088 bool createZones();
00089
00091 bool readPrintInfo();
00092
00094 bool readWindowsInfo(int zone);
00095
00097 bool sendWindow(int zone, MWAWVec2i limits = MWAWVec2i(-1,-1));
00098
00100 bool readWindowsZone(int zone);
00101
00103 bool readPageInfo(int zone);
00104
00106 bool readColInfo(int zone);
00107
00109 bool readParagraphInfo(int zone);
00110
00112 bool findSection(int zone, MWAWVec2i limits, MWAWSection &sec);
00113
00115 bool readSection(WriterPlsParserInternal::ParagraphInfo const &info, bool mainBlock);
00116
00118 bool readText(WriterPlsParserInternal::ParagraphInfo const &info);
00119
00121 bool readTable(WriterPlsParserInternal::ParagraphInfo const &info);
00122
00124 bool readGraphic(WriterPlsParserInternal::ParagraphInfo const &info);
00125
00127 bool readUnknown(WriterPlsParserInternal::ParagraphInfo const &info);
00128
00130 double getTextHeight() const;
00131
00133 void newPage(int number);
00134
00135
00136
00137
00138
00140 bool readParagraphData(WriterPlsParserInternal::ParagraphInfo const &info, bool hasFonts,
00141 WriterPlsParserInternal::ParagraphData &data);
00143 MWAWParagraph getParagraph(WriterPlsParserInternal::ParagraphData const &data);
00145 bool readFonts(int nFonts, int type,
00146 std::vector<WriterPlsParserInternal::Font> &fonts);
00147
00149 bool readLines(WriterPlsParserInternal::ParagraphInfo const &info,
00150 int nLines, std::vector<WriterPlsParserInternal::Line> &lines);
00151
00152 protected:
00153
00154
00155
00156
00158 shared_ptr<WriterPlsParserInternal::State> m_state;
00159 };
00160 #endif
00161