MSPUBParser2k.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libmspub project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_MSPUBPARSER2K_H
#define INCLUDED_MSPUBPARSER2K_H
#include <deque>
#include <vector>
#include <map>
#include "MSPUBParser.h"
#include "ShapeType.h"
namespace libmspub
{
class MSPUBParser2k : public MSPUBParser
{
static ShapeType getShapeType(unsigned char shapeSpecifier);
std::vector<unsigned> m_imageDataChunkIndices;
std::vector<unsigned> m_quillColorEntries;
std::map<unsigned, std::vector<unsigned> > m_chunkChildIndicesById;
std::deque<unsigned> m_chunksBeingRead;
protected:
// helper functions
bool parse2kShapeChunk(const ContentChunkReference &chunk, librevenge::RVNGInputStream *input,
boost::optional<unsigned> pageSeqNum = boost::optional<unsigned>(),
bool topLevelCall = true);
void parseShapeLine(librevenge::RVNGInputStream *input, bool isRectangle, unsigned offset, unsigned seqNum);
void parseShapeType(librevenge::RVNGInputStream *input,
unsigned seqNum, unsigned chunkOffset,
bool &isGroup, bool &isLine, bool &isImage, bool &isRectangle,
unsigned &flagsOffset);
void parseShapeRotation(librevenge::RVNGInputStream *input, bool isGroup, bool isLine, unsigned seqNum,
unsigned chunkOffset);
void parseShapeFlips(librevenge::RVNGInputStream *input, unsigned flagsOffset, unsigned seqNum,
unsigned chunkOffset);
void parseShapeCoordinates(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
bool parseGroup(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned page);
void assignShapeImgIndex(unsigned seqNum);
void parseShapeFill(librevenge::RVNGInputStream *input, unsigned seqNum, unsigned chunkOffset);
bool parseContents(librevenge::RVNGInputStream *input) override;
virtual bool parseDocument(librevenge::RVNGInputStream *input);
unsigned getColorIndexByQuillEntry(unsigned entry) override;
virtual int translateCoordinateIfNecessary(int coordinate) const;
virtual unsigned getFirstLineOffset() const;
virtual unsigned getSecondLineOffset() const;
virtual unsigned getShapeFillTypeOffset() const;
virtual unsigned getShapeFillColorOffset() const;
virtual unsigned short getTextMarker() const;
virtual unsigned getTextIdOffset() const;
static Color getColorBy2kIndex(unsigned char index);
static Color getColorBy2kHex(unsigned hex);
static unsigned translate2kColorReference(unsigned ref2k);
static PageType getPageTypeBySeqNum(unsigned seqNum);
virtual void parseContentsTextIfNecessary(librevenge::RVNGInputStream *input);
public:
explicit MSPUBParser2k(librevenge::RVNGInputStream *input, MSPUBCollector *collector);
bool parse() override;
~MSPUBParser2k() override;
};
} // namespace libmspub
#endif // INCLUDED_MSPUBPARSER2K_H
/* 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