Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __MSPUBPARSER2K_H__
00011 #define __MSPUBPARSER2K_H__
00012
00013 #include <vector>
00014 #include <map>
00015
00016 #include "MSPUBParser.h"
00017 #include "ShapeType.h"
00018
00019 namespace libmspub
00020 {
00021
00022 class MSPUBParser2k : public MSPUBParser
00023 {
00024 static ShapeType getShapeType(unsigned char shapeSpecifier);
00025 std::vector<unsigned> m_imageDataChunkIndices;
00026 std::vector<unsigned> m_quillColorEntries;
00027 std::map<unsigned, std::vector<unsigned> > m_chunkChildIndicesById;
00028
00029 protected:
00030
00031 bool parse2kShapeChunk(const ContentChunkReference &chunk, librevenge::RVNGInputStream *input,
00032 boost::optional<unsigned> pageSeqNum = boost::optional<unsigned>(),
00033 bool topLevelCall = true);
00034 void parseShapeLine(librevenge::RVNGInputStream *input, bool isRectangle, unsigned offset, unsigned seqNum);
00035 void parseShapeType(librevenge::RVNGInputStream *input,
00036 unsigned seqNum, unsigned chunkOffset,
00037 bool &isGroup, bool &isLine, bool &isImage, bool &isRectangle,
00038 unsigned &flagsOffset);
00039 void parseShapeRotation(librevenge::RVNGInputStream *input, bool isGroup, bool isLine, unsigned seqNum,
00040 unsigned chunkOffset);
00041 void parseShapeFlips(librevenge::RVNGInputStream *input, unsigned flagsOffset, unsigned seqNum,
00042 unsigned chunkOffset);
00043 void parseShapeCoordinates(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
00044 bool parseGroup(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned page);
00045 void assignShapeImgIndex(unsigned seqNum);
00046 void parseShapeFill(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
00047 bool parseContents(librevenge::RVNGInputStream *input);
00048 virtual bool parseDocument(librevenge::RVNGInputStream *input);
00049 virtual unsigned getColorIndexByQuillEntry(unsigned entry);
00050 virtual int translateCoordinateIfNecessary(int coordinate) const;
00051 virtual unsigned getFirstLineOffset() const;
00052 virtual unsigned getSecondLineOffset() const;
00053 virtual unsigned getShapeFillTypeOffset() const;
00054 virtual unsigned getShapeFillColorOffset() const;
00055 virtual unsigned short getTextMarker() const;
00056 virtual unsigned getTextIdOffset() const;
00057 static Color getColorBy2kIndex(unsigned char index);
00058 static Color getColorBy2kHex(unsigned hex);
00059 static unsigned translate2kColorReference(unsigned ref2k);
00060 static PageType getPageTypeBySeqNum(unsigned seqNum);
00061 virtual void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input);
00062 public:
00063 explicit MSPUBParser2k(librevenge::RVNGInputStream *input, MSPUBCollector *collector);
00064 virtual bool parse();
00065 virtual ~MSPUBParser2k();
00066 };
00067
00068 }
00069
00070 #endif // __MSPUBPARSER2K_H__
00071
00072