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