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 #ifndef MS_WRITE_H
00023 #define MS_WRITE_H
00024
00025 #include <vector>
00026
00027 #include <librevenge-stream/librevenge-stream.h>
00028 #include "libwps_internal.h"
00029 #include "libwps_tools_win.h"
00030
00031 #include "WPSParser.h"
00032 #include "WPSEntry.h"
00033 #include "WPSPageSpan.h"
00034
00035 namespace MSWriteParserInternal
00036 {
00037 class SubDocument;
00038 struct Paragraph;
00039 struct Font;
00040 }
00041
00046 class MSWriteParser : public WPSParser
00047 {
00048 friend class MSWriteParserInternal::SubDocument;
00049 friend struct MSWriteParserInternal::Paragraph;
00050 friend struct MSWriteParserInternal::Font;
00051
00052 public:
00053 MSWriteParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
00054 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::WIN3_WEUROPE);
00055
00056
00057 ~MSWriteParser();
00058 void parse(librevenge::RVNGTextInterface *const documentInterface);
00059
00060 private:
00061 MSWriteParser(const MSWriteParser &);
00062 MSWriteParser &operator=(const MSWriteParser &);
00063
00064 shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
00065 void readFIB();
00066 void readFFNTB();
00067 void readSECT();
00068 void readPAP();
00069 void readCHP();
00070 void findZones();
00071 void readText(WPSEntry e);
00072 void processObject(WPSPosition &pos, unsigned long lastPos);
00073 bool processDDB(librevenge::RVNGBinaryData &bmpdata, WPSPosition &pos, unsigned width, unsigned height, unsigned byte_width, unsigned planes, unsigned bits_pixel, unsigned size);
00074 bool processDIB(librevenge::RVNGBinaryData &bmpdata, unsigned size);
00075 bool processWMF(librevenge::RVNGBinaryData &wmfdata, unsigned size);
00076 void processEmbeddedOLE(WPSPosition &pos, unsigned long lastPos);
00077 bool processStaticOLE(librevenge::RVNGBinaryData &, std::string &mimetype, WPSPosition &pos, unsigned long lastPos);
00078 bool readString(std::string &res, unsigned long lastPos);
00079 unsigned insertString(const unsigned char *str, unsigned size, libwps_tools_win::Font::Type type);
00080
00082 bool checkFilePosition(uint32_t pos) const
00083 {
00084 return pos<=m_fileLength;
00085 }
00086
00088 uint32_t m_fileLength;
00089 uint32_t m_fcMac;
00090
00091 std::vector<MSWriteParserInternal::Paragraph> m_paragraphList;
00092 std::vector<MSWriteParserInternal::Font> m_fontList;
00093 std::vector<librevenge::RVNGString> m_fonts;
00094 WPSPageSpan m_pageSpan;
00095 libwps_tools_win::Font::Type m_fontType;
00096
00097 shared_ptr<WPSContentListener> m_listener;
00098
00099 WPSEntry m_Main, m_Header, m_Footer;
00100 bool m_HeaderPage1, m_FooterPage1;
00101 };
00102
00103 #endif
00104