MSPUBParser97.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libmspub project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __MSPUBPARSER97_H__
00011 #define __MSPUBPARSER97_H__
00012 
00013 #include "MSPUBParser2k.h"
00014 
00015 namespace libmspub
00016 {
00017 class MSPUBParser97 : public MSPUBParser2k
00018 {
00019   struct TextInfo97
00020   {
00021     std::vector<unsigned char> m_chars;
00022     std::vector<unsigned> m_paragraphEnds;
00023     std::vector<unsigned> m_shapeEnds;
00024     TextInfo97(const std::vector<unsigned char> &chars,
00025                const std::vector<unsigned> &paragraphEnds,
00026                const std::vector<unsigned> &shapeEnds)
00027       : m_chars(chars), m_paragraphEnds(paragraphEnds),
00028         m_shapeEnds(shapeEnds)
00029     {
00030     }
00031   };
00032 
00033   struct SpanInfo97
00034   {
00035     unsigned m_spanEnd;
00036     CharacterStyle m_style;
00037     SpanInfo97(unsigned spanEnd, const CharacterStyle &style)
00038       : m_spanEnd(spanEnd), m_style(style)
00039     {
00040     }
00041   };
00042 
00043   bool m_isBanner;
00044 
00045   bool parseDocument(librevenge::RVNGInputStream *input);
00046   int translateCoordinateIfNecessary(int coordinate) const;
00047   unsigned getFirstLineOffset() const;
00048   unsigned getSecondLineOffset() const;
00049   unsigned getShapeFillTypeOffset() const;
00050   unsigned getShapeFillColorOffset() const;
00051   unsigned short getTextMarker() const;
00052   unsigned getTextIdOffset() const;
00053   CharacterStyle readCharacterStyle(librevenge::RVNGInputStream *input,
00054                                     unsigned length);
00055   void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input);
00056   std::vector<SpanInfo97> getSpansInfo(librevenge::RVNGInputStream *input,
00057                                        unsigned prop1Index, unsigned prop2Index, unsigned prop3Index,
00058                                        unsigned prop3End);
00059   TextInfo97 getTextInfo(librevenge::RVNGInputStream *input, unsigned length);
00060 public:
00061   MSPUBParser97(librevenge::RVNGInputStream *input, MSPUBCollector *collector);
00062   bool parse();
00063 };
00064 }
00065 
00066 #endif //  __MSPUBPARSER97_H__
00067 
00068 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */