- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 __MSPUBPARSER2K_H__
11 #define __MSPUBPARSER2K_H__
12
13 #include <vector>
14 #include <map>
15
16 #include "MSPUBParser.h"
17 #include "ShapeType.h"
18
19 namespace libmspub
20 {
21
22 class MSPUBParser2k : public MSPUBParser
23 {
24 static ShapeType getShapeType(unsigned char shapeSpecifier);
25 std::vector<unsigned> m_imageDataChunkIndices;
26 std::vector<unsigned> m_quillColorEntries;
27 std::map<unsigned, std::vector<unsigned> > m_chunkChildIndicesById;
28
29 protected:
30 // helper functions
31 bool parse2kShapeChunk(const ContentChunkReference &chunk, librevenge::RVNGInputStream *input,
32 boost::optional<unsigned> pageSeqNum = boost::optional<unsigned>(),
33 bool topLevelCall = true);
34 void parseShapeLine(librevenge::RVNGInputStream *input, bool isRectangle, unsigned offset, unsigned seqNum);
35 void parseShapeType(librevenge::RVNGInputStream *input,
36 unsigned seqNum, unsigned chunkOffset,
37 bool &isGroup, bool &isLine, bool &isImage, bool &isRectangle,
38 unsigned &flagsOffset);
39 void parseShapeRotation(librevenge::RVNGInputStream *input, bool isGroup, bool isLine, unsigned seqNum,
40 unsigned chunkOffset);
41 void parseShapeFlips(librevenge::RVNGInputStream *input, unsigned flagsOffset, unsigned seqNum,
42 unsigned chunkOffset);
43 void parseShapeCoordinates(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
44 bool parseGroup(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned page);
45 void assignShapeImgIndex(unsigned seqNum);
46 void parseShapeFill(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
47 bool parseContents(librevenge::RVNGInputStream *input);
48 virtual bool parseDocument(librevenge::RVNGInputStream *input);
49 virtual unsigned getColorIndexByQuillEntry(unsigned entry);
50 virtual int translateCoordinateIfNecessary(int coordinate) const;
51 virtual unsigned getFirstLineOffset() const;
52 virtual unsigned getSecondLineOffset() const;
53 virtual unsigned getShapeFillTypeOffset() const;
54 virtual unsigned getShapeFillColorOffset() const;
55 virtual unsigned short getTextMarker() const;
56 virtual unsigned getTextIdOffset() const;
57 static Color getColorBy2kIndex(unsigned char index);
58 static Color getColorBy2kHex(unsigned hex);
59 static unsigned translate2kColorReference(unsigned ref2k);
60 static PageType getPageTypeBySeqNum(unsigned seqNum);
61 virtual void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input);
62 public:
63 explicit MSPUBParser2k(librevenge::RVNGInputStream *input, MSPUBCollector *collector);
64 virtual bool parse();
65 virtual ~MSPUBParser2k();
66 };
67
68 } // namespace libmspub
69
70 #endif // __MSPUBPARSER2K_H__
71
72 /* 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:625
libmspub::MSPUBParser2k::getShapeType
static ShapeType getShapeType(unsigned char shapeSpecifier)
Definition: MSPUBParser2k.cpp:220
libmspub::MSPUBParser2k::m_imageDataChunkIndices
std::vector< unsigned > m_imageDataChunkIndices
Definition: MSPUBParser2k.h:25
libmspub::MSPUBParser2k::parseShapeCoordinates
void parseShapeCoordinates(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:596
libmspub::Color
Definition: MSPUBTypes.h:165
libmspub::MSPUBParser2k::~MSPUBParser2k
virtual ~MSPUBParser2k()
Definition: MSPUBParser2k.cpp:46
libmspub::MSPUBParser2k::parseShapeFlips
void parseShapeFlips(librevenge::RVNGInputStream *input, unsigned flagsOffset, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:612
libmspub::MSPUBParser2k::assignShapeImgIndex
void assignShapeImgIndex(unsigned seqNum)
Definition: MSPUBParser2k.cpp:579
libmspub::MSPUBParser2k
Definition: MSPUBParser2k.h:22
libmspub::MSPUBParser2k::getSecondLineOffset
virtual unsigned getSecondLineOffset() const
Definition: MSPUBParser2k.cpp:692
libmspub::MSPUBParser2k::MSPUBParser2k
MSPUBParser2k(librevenge::RVNGInputStream *input, MSPUBCollector *collector)
Definition: MSPUBParser2k.cpp:25
libmspub::MSPUBParser2k::getPageTypeBySeqNum
static PageType getPageTypeBySeqNum(unsigned seqNum)
Definition: MSPUBParser2k.cpp:764
libmspub::MSPUBParser2k::m_chunkChildIndicesById
std::map< unsigned, std::vector< unsigned > > m_chunkChildIndicesById
Definition: MSPUBParser2k.h:27
libmspub::MSPUBParser2k::parseContents
bool parseContents(librevenge::RVNGInputStream *input)
Definition: MSPUBParser2k.cpp:320
ShapeType.h
libmspub::MSPUBParser2k::translate2kColorReference
static unsigned translate2kColorReference(unsigned ref2k)
Definition: MSPUBParser2k.cpp:204
libmspub::MSPUBParser2k::parseShapeLine
void parseShapeLine(librevenge::RVNGInputStream *input, bool isRectangle, unsigned offset, unsigned seqNum)
Definition: MSPUBParser2k.cpp:697
libmspub::MSPUBParser2k::translateCoordinateIfNecessary
virtual int translateCoordinateIfNecessary(int coordinate) const
Definition: MSPUBParser2k.cpp:607
libmspub::MSPUBParser2k::getColorBy2kIndex
static Color getColorBy2kIndex(unsigned char index)
Definition: MSPUBParser2k.cpp:82
libmspub::MSPUBParser2k::getColorIndexByQuillEntry
virtual unsigned getColorIndexByQuillEntry(unsigned entry)
Definition: MSPUBParser2k.cpp:33
libmspub::MSPUBParser2k::parseShapeRotation
void parseShapeRotation(librevenge::RVNGInputStream *input, bool isGroup, bool isLine, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:463
libmspub::MSPUBParser2k::getTextIdOffset
virtual unsigned getTextIdOffset() const
Definition: MSPUBParser2k.cpp:677
libmspub::MSPUBParser2k::getTextMarker
virtual unsigned short getTextMarker() const
Definition: MSPUBParser2k.cpp:682
libmspub::ContentChunkReference
Definition: MSPUBTypes.h:66
libmspub::MSPUBParser2k::parse2kShapeChunk
bool parse2kShapeChunk(const ContentChunkReference &chunk, librevenge::RVNGInputStream *input, boost::optional< unsigned > pageSeqNum=boost::optional< unsigned >(), bool topLevelCall=true)
Definition: MSPUBParser2k.cpp:479
libmspub::MSPUBParser2k::m_quillColorEntries
std::vector< unsigned > m_quillColorEntries
Definition: MSPUBParser2k.h:26
libmspub::MSPUBParser2k::getFirstLineOffset
virtual unsigned getFirstLineOffset() const
Definition: MSPUBParser2k.cpp:687
libmspub::PageType
PageType
Definition: MSPUBTypes.h:172
libmspub::MSPUBParser2k::parse
virtual bool parse()
Definition: MSPUBParser2k.cpp:735
libmspub::MSPUBParser2k::parseDocument
virtual bool parseDocument(librevenge::RVNGInputStream *input)
Definition: MSPUBParser2k.cpp:448
libmspub::MSPUBParser2k::parseContentsTextIfNecessary
virtual void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input)
Definition: MSPUBParser2k.cpp:316
libmspub::MSPUBParser2k::parseGroup
bool parseGroup(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned page)
Definition: MSPUBParser2k.cpp:562
MSPUBParser.h
libmspub::MSPUBParser2k::getShapeFillTypeOffset
virtual unsigned getShapeFillTypeOffset() const
Definition: MSPUBParser2k.cpp:539
libmspub::MSPUBCollector
Definition: MSPUBCollector.h:46
libmspub::MSPUBParser
Definition: MSPUBParser.h:63
libmspub::MSPUBParser2k::getShapeFillColorOffset
virtual unsigned getShapeFillColorOffset() const
Definition: MSPUBParser2k.cpp:544
libmspub::ShapeType
ShapeType
Definition: ShapeType.h:15
libmspub::MSPUBParser2k::getColorBy2kHex
static Color getColorBy2kHex(unsigned hex)
Definition: MSPUBParser2k.cpp:67
libmspub::MSPUBParser2k::parseShapeFill
void parseShapeFill(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset)
Definition: MSPUBParser2k.cpp:549