MSPUBParser2k.h Source File documentation

MSPUBParser2k.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libmspub project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef INCLUDED_MSPUBPARSER2K_H
11 #define INCLUDED_MSPUBPARSER2K_H
12
13 #include <deque>
14 #include <vector>
15 #include <map>
16
17 #include "MSPUBParser.h"
18 #include "ShapeType.h"
19
20 namespace libmspub
21 {
22
23 class MSPUBParser2k : public MSPUBParser
24 {
25 static ShapeType getShapeType(unsigned char shapeSpecifier);
26 std::vector<unsigned> m_imageDataChunkIndices;
27 std::vector<unsigned> m_quillColorEntries;
28 std::map<unsigned, std::vector<unsigned> > m_chunkChildIndicesById;
29 std::deque<unsigned> m_chunksBeingRead;
30
31 protected:
32 // helper functions
33 bool parse2kShapeChunk(const ContentChunkReference &chunk, librevenge::RVNGInputStream *input,
34 boost::optional<unsigned> pageSeqNum = boost::optional<unsigned>(),
35 bool topLevelCall = true);
36 void parseShapeLine(librevenge::RVNGInputStream *input, bool isRectangle, unsigned offset, unsigned seqNum);
37 void parseShapeType(librevenge::RVNGInputStream *input,
38 unsigned seqNum, unsigned chunkOffset,
39 bool &isGroup, bool &isLine, bool &isImage, bool &isRectangle,
40 unsigned &flagsOffset);
41 void parseShapeRotation(librevenge::RVNGInputStream *input, bool isGroup, bool isLine, unsigned seqNum,
42 unsigned chunkOffset);
43 void parseShapeFlips(librevenge::RVNGInputStream *input, unsigned flagsOffset, unsigned seqNum,
44 unsigned chunkOffset);
45 void parseShapeCoordinates(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
46 bool parseGroup(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned page);
47 void assignShapeImgIndex(unsigned seqNum);
48 void parseShapeFill(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
49 bool parseContents(librevenge::RVNGInputStream *input) override;
50 virtual bool parseDocument(librevenge::RVNGInputStream *input);
51 unsigned getColorIndexByQuillEntry(unsigned entry) override;
52 virtual int translateCoordinateIfNecessary(int coordinate) const;
53 virtual unsigned getFirstLineOffset() const;
54 virtual unsigned getSecondLineOffset() const;
55 virtual unsigned getShapeFillTypeOffset() const;
56 virtual unsigned getShapeFillColorOffset() const;
57 virtual unsigned short getTextMarker() const;
58 virtual unsigned getTextIdOffset() const;
59 static Color getColorBy2kIndex(unsigned char index);
60 static Color getColorBy2kHex(unsigned hex);
61 static unsigned translate2kColorReference(unsigned ref2k);
62 static PageType getPageTypeBySeqNum(unsigned seqNum);
63 virtual void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input);
64 public:
65 explicit MSPUBParser2k(librevenge::RVNGInputStream *input, MSPUBCollector *collector);
66 bool parse() override;
67 ~MSPUBParser2k() override;
68 };
69
70 } // namespace libmspub
71
72 #endif // INCLUDED_MSPUBPARSER2K_H
73
74 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libmspub::MSPUBParser2k::parseShapeType
void parseShapeType(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset, bool &isGroup, bool &isLine, bool &isImage, bool &isRectangle, unsigned &flagsOffset)
Definition: MSPUBParser2k.cpp:660
libmspub::MSPUBParser2k::getShapeType
static ShapeType getShapeType(unsigned char shapeSpecifier)
Definition: MSPUBParser2k.cpp:244
libmspub::MSPUBParser2k::m_imageDataChunkIndices
std::vector< unsigned > m_imageDataChunkIndices
Definition: MSPUBParser2k.h:26
libmspub::MSPUBParser2k::parse
bool parse() override
Definition: MSPUBParser2k.cpp:770
libmspub::MSPUBParser2k::getTextIdOffset
virtual unsigned getTextIdOffset() const
Definition: MSPUBParser2k.cpp:712
libmspub::MSPUBParser2k::parseShapeCoordinates
void parseShapeCoordinates(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:631
libmspub::Color
Definition: MSPUBTypes.h:199
libmspub::MSPUBParser2k::parseShapeFlips
void parseShapeFlips(librevenge::RVNGInputStream *input, unsigned flagsOffset, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:647
libmspub::MSPUBParser2k::getShapeFillColorOffset
virtual unsigned getShapeFillColorOffset() const
Definition: MSPUBParser2k.cpp:574
libmspub::MSPUBParser2k::assignShapeImgIndex
void assignShapeImgIndex(unsigned seqNum)
Definition: MSPUBParser2k.cpp:614
libmspub::MSPUBParser2k
Definition: MSPUBParser2k.h:23
libmspub::MSPUBParser2k::getShapeFillTypeOffset
virtual unsigned getShapeFillTypeOffset() const
Definition: MSPUBParser2k.cpp:569
libmspub::MSPUBParser2k::MSPUBParser2k
MSPUBParser2k(librevenge::RVNGInputStream *input, MSPUBCollector *collector)
Definition: MSPUBParser2k.cpp:48
libmspub::MSPUBParser2k::getPageTypeBySeqNum
static PageType getPageTypeBySeqNum(unsigned seqNum)
Definition: MSPUBParser2k.cpp:797
libmspub::MSPUBParser2k::m_chunkChildIndicesById
std::map< unsigned, std::vector< unsigned > > m_chunkChildIndicesById
Definition: MSPUBParser2k.h:28
ShapeType.h
libmspub::MSPUBParser2k::translateCoordinateIfNecessary
virtual int translateCoordinateIfNecessary(int coordinate) const
Definition: MSPUBParser2k.cpp:642
libmspub::MSPUBParser2k::translate2kColorReference
static unsigned translate2kColorReference(unsigned ref2k)
Definition: MSPUBParser2k.cpp:228
libmspub::MSPUBParser2k::parseShapeLine
void parseShapeLine(librevenge::RVNGInputStream *input, bool isRectangle, unsigned offset, unsigned seqNum)
Definition: MSPUBParser2k.cpp:732
libmspub::MSPUBParser2k::getColorBy2kIndex
static Color getColorBy2kIndex(unsigned char index)
Definition: MSPUBParser2k.cpp:106
libmspub::MSPUBParser2k::parseShapeRotation
void parseShapeRotation(librevenge::RVNGInputStream *input, bool isGroup, bool isLine, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:487
libmspub::ContentChunkReference
Definition: MSPUBTypes.h:90
libmspub::MSPUBParser2k::~MSPUBParser2k
~MSPUBParser2k() override
Definition: MSPUBParser2k.cpp:70
libmspub::MSPUBParser2k::parse2kShapeChunk
bool parse2kShapeChunk(const ContentChunkReference &chunk, librevenge::RVNGInputStream *input, boost::optional< unsigned > pageSeqNum=boost::optional< unsigned >(), bool topLevelCall=true)
Definition: MSPUBParser2k.cpp:503
libmspub::MSPUBParser2k::m_quillColorEntries
std::vector< unsigned > m_quillColorEntries
Definition: MSPUBParser2k.h:27
libmspub::PageType
PageType
Definition: MSPUBTypes.h:206
libmspub::MSPUBParser2k::getColorIndexByQuillEntry
unsigned getColorIndexByQuillEntry(unsigned entry) override
Definition: MSPUBParser2k.cpp:57
libmspub::MSPUBParser2k::parseDocument
virtual bool parseDocument(librevenge::RVNGInputStream *input)
Definition: MSPUBParser2k.cpp:472
libmspub::MSPUBParser2k::parseContentsTextIfNecessary
virtual void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input)
Definition: MSPUBParser2k.cpp:340
libmspub::MSPUBParser2k::parseGroup
bool parseGroup(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned page)
Definition: MSPUBParser2k.cpp:592
libmspub::MSPUBParser2k::getTextMarker
virtual unsigned short getTextMarker() const
Definition: MSPUBParser2k.cpp:717
libmspub
Definition: Arrow.h:13
libmspub::MSPUBParser2k::m_chunksBeingRead
std::deque< unsigned > m_chunksBeingRead
Definition: MSPUBParser2k.h:29
libmspub::MSPUBParser2k::getFirstLineOffset
virtual unsigned getFirstLineOffset() const
Definition: MSPUBParser2k.cpp:722
MSPUBParser.h
libmspub::MSPUBParser2k::getSecondLineOffset
virtual unsigned getSecondLineOffset() const
Definition: MSPUBParser2k.cpp:727
libmspub::MSPUBCollector
Definition: MSPUBCollector.h:43
libmspub::MSPUBParser
Definition: MSPUBParser.h:62
libmspub::MSPUBParser2k::parseContents
bool parseContents(librevenge::RVNGInputStream *input) override
Definition: MSPUBParser2k.cpp:344
libmspub::ShapeType
ShapeType
Definition: ShapeType.h:15
libmspub::MSPUBParser2k::getColorBy2kHex
static Color getColorBy2kHex(unsigned hex)
Definition: MSPUBParser2k.cpp:91
libmspub::MSPUBParser2k::parseShapeFill
void parseShapeFill(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:579