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: */
MSPUBParser.h
ShapeType.h
libmspub::MSPUBCollector
Definition MSPUBCollector.h:45
libmspub::MSPUBParser2k::m_imageDataChunkIndices
std::vector< unsigned > m_imageDataChunkIndices
Definition MSPUBParser2k.h:26
libmspub::MSPUBParser2k::getColorBy2kHex
static Color getColorBy2kHex(unsigned hex)
Definition MSPUBParser2k.cpp:97
libmspub::MSPUBParser2k::getSecondLineOffset
virtual unsigned getSecondLineOffset() const
Definition MSPUBParser2k.cpp:735
libmspub::MSPUBParser2k::m_quillColorEntries
std::vector< unsigned > m_quillColorEntries
Definition MSPUBParser2k.h:27
libmspub::MSPUBParser2k::~MSPUBParser2k
~MSPUBParser2k() override
Definition MSPUBParser2k.cpp:76
libmspub::MSPUBParser2k::parseShapeFill
void parseShapeFill(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset)
Definition MSPUBParser2k.cpp:587
libmspub::MSPUBParser2k::getShapeType
static ShapeType getShapeType(unsigned char shapeSpecifier)
Definition MSPUBParser2k.cpp:250
libmspub::MSPUBParser2k::m_chunksBeingRead
std::deque< unsigned > m_chunksBeingRead
Definition MSPUBParser2k.h:29
libmspub::MSPUBParser2k::parse
bool parse() override
Definition MSPUBParser2k.cpp:778
libmspub::MSPUBParser2k::getTextMarker
virtual unsigned short getTextMarker() const
Definition MSPUBParser2k.cpp:725
libmspub::MSPUBParser2k::parseShapeFlips
void parseShapeFlips(librevenge::RVNGInputStream *input, unsigned flagsOffset, unsigned seqNum, unsigned chunkOffset)
Definition MSPUBParser2k.cpp:655
libmspub::MSPUBParser2k::parseDocument
virtual bool parseDocument(librevenge::RVNGInputStream *input)
Definition MSPUBParser2k.cpp:478
libmspub::MSPUBParser2k::getShapeFillTypeOffset
virtual unsigned getShapeFillTypeOffset() const
Definition MSPUBParser2k.cpp:577
libmspub::MSPUBParser2k::parseShapeCoordinates
void parseShapeCoordinates(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset)
Definition MSPUBParser2k.cpp:639
libmspub::MSPUBParser2k::m_chunkChildIndicesById
std::map< unsigned, std::vector< unsigned > > m_chunkChildIndicesById
Definition MSPUBParser2k.h:28
libmspub::MSPUBParser2k::parse2kShapeChunk
bool parse2kShapeChunk(const ContentChunkReference &chunk, librevenge::RVNGInputStream *input, boost::optional< unsigned > pageSeqNum=boost::optional< unsigned >(), bool topLevelCall=true)
Definition MSPUBParser2k.cpp:509
libmspub::MSPUBParser2k::getTextIdOffset
virtual unsigned getTextIdOffset() const
Definition MSPUBParser2k.cpp:720
libmspub::MSPUBParser2k::getColorIndexByQuillEntry
unsigned getColorIndexByQuillEntry(unsigned entry) override
Definition MSPUBParser2k.cpp:63
libmspub::MSPUBParser2k::getColorBy2kIndex
static Color getColorBy2kIndex(unsigned char index)
Definition MSPUBParser2k.cpp:112
libmspub::MSPUBParser2k::parseContentsTextIfNecessary
virtual void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input)
Definition MSPUBParser2k.cpp:346
libmspub::MSPUBParser2k::getFirstLineOffset
virtual unsigned getFirstLineOffset() const
Definition MSPUBParser2k.cpp:730
libmspub::MSPUBParser2k::translate2kColorReference
static unsigned translate2kColorReference(unsigned ref2k)
Definition MSPUBParser2k.cpp:234
libmspub::MSPUBParser2k::getShapeFillColorOffset
virtual unsigned getShapeFillColorOffset() const
Definition MSPUBParser2k.cpp:582
libmspub::MSPUBParser2k::assignShapeImgIndex
void assignShapeImgIndex(unsigned seqNum)
Definition MSPUBParser2k.cpp:622
libmspub::MSPUBParser2k::parseContents
bool parseContents(librevenge::RVNGInputStream *input) override
Definition MSPUBParser2k.cpp:350
libmspub::MSPUBParser2k::MSPUBParser2k
MSPUBParser2k(librevenge::RVNGInputStream *input, MSPUBCollector *collector)
Definition MSPUBParser2k.cpp:54
libmspub::MSPUBParser2k::getPageTypeBySeqNum
static PageType getPageTypeBySeqNum(unsigned seqNum)
Definition MSPUBParser2k.cpp:805
libmspub::MSPUBParser2k::parseShapeLine
void parseShapeLine(librevenge::RVNGInputStream *input, bool isRectangle, unsigned offset, unsigned seqNum)
Definition MSPUBParser2k.cpp:740
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:668
libmspub::MSPUBParser2k::parseGroup
bool parseGroup(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned page)
Definition MSPUBParser2k.cpp:600
libmspub::MSPUBParser2k::parseShapeRotation
void parseShapeRotation(librevenge::RVNGInputStream *input, bool isGroup, bool isLine, unsigned seqNum, unsigned chunkOffset)
Definition MSPUBParser2k.cpp:493
libmspub::MSPUBParser2k::translateCoordinateIfNecessary
virtual int translateCoordinateIfNecessary(int coordinate) const
Definition MSPUBParser2k.cpp:650
libmspub::MSPUBParser::MSPUBParser
MSPUBParser(librevenge::RVNGInputStream *input, MSPUBCollector *collector)
Definition MSPUBParser.cpp:108
libmspub
Definition Arrow.h:14
libmspub::ShapeType
ShapeType
Definition ShapeType.h:16
libmspub::PageType
PageType
Definition MSPUBTypes.h:207
libmspub::Color
Definition MSPUBTypes.h:200
libmspub::ContentChunkReference
Definition MSPUBTypes.h:91