QXP33Parser.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 libqxp 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 QXP33PARSER_H_INCLUDED
#define QXP33PARSER_H_INCLUDED
#include "libqxp_utils.h"
#include "QXPParser.h"
#include <string>
namespace libqxp
{
class QXP33Deobfuscator;
class QXP33Header;
class QXP33Parser : public QXPParser
{
public:
QXP33Parser(const std::shared_ptr<librevenge::RVNGInputStream> &input, librevenge::RVNGDrawingInterface *painter, const std::shared_ptr<QXP33Header> &header);
enum class ShapeType
{
UNKNOWN,
LINE,
ORTHOGONAL_LINE,
RECTANGLE,
CORNERED_RECTANGLE,
OVAL,
POLYGON
};
struct ObjectHeader
{
boost::optional<Fill> fill;
bool runaround;
unsigned contentIndex;
unsigned linkId;
unsigned gradientId;
double rotation;
double skew;
bool hflip;
bool vflip;
CornerType cornerType;
double cornerRadius;
ContentType contentType;
ShapeType shapeType;
Rect boundingBox;
BoxType boxType;
ObjectHeader()
: fill(), runaround(false), contentIndex(0), linkId(0), gradientId(0),
rotation(0), skew(0), hflip(false), vflip(false), cornerType(CornerType::DEFAULT),
cornerRadius(0), contentType(ContentType::UNKNOWN), shapeType(ShapeType::UNKNOWN), boundingBox(),
boxType(BoxType::UNKNOWN)
{ }
};
private:
const std::shared_ptr<QXP33Header> m_header;
bool parseDocument(const std::shared_ptr<librevenge::RVNGInputStream> &docStream, QXPCollector &collector) override;
bool parsePages(const std::shared_ptr<librevenge::RVNGInputStream> &pagesStream, QXPCollector &collector) override;
void parseColors(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
CharFormat parseCharFormat(const std::shared_ptr<librevenge::RVNGInputStream> &stream) override;
ParagraphFormat parseParagraphFormat(const std::shared_ptr<librevenge::RVNGInputStream> &stream) override;
std::shared_ptr<HJ> parseHJ(const std::shared_ptr<librevenge::RVNGInputStream> &stream) override;
Page parsePage(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
void parseObject(const std::shared_ptr<librevenge::RVNGInputStream> &stream, QXP33Deobfuscator &deobfuscate, QXPCollector &collector, const Page &page, unsigned index);
ObjectHeader parseObjectHeader(const std::shared_ptr<librevenge::RVNGInputStream> &stream, QXP33Deobfuscator &deobfuscate);
void readObjectFlags(const std::shared_ptr<librevenge::RVNGInputStream> &stream, bool &noColor, bool &noRunaround);
void parseLine(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parseTextBox(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parsePictureBox(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parseEmptyBox(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parseGroup(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector, const Page &page, unsigned index);
Frame readFrame(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
std::vector<Point> readPolygonData(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
std::string readName(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
};
}
#endif // QXP33PARSER_H_INCLUDED
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
QXPParser.h
libqxp::QXP33Deobfuscator
Definition QXP33Deobfuscator.h:20
libqxp::QXP33Header
Definition QXP33Header.h:21
libqxp::QXP33Parser::readName
std::string readName(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP33Parser.cpp:726
libqxp::QXP33Parser::parseObjectHeader
ObjectHeader parseObjectHeader(const std::shared_ptr< librevenge::RVNGInputStream > &stream, QXP33Deobfuscator &deobfuscate)
Definition QXP33Parser.cpp:292
libqxp::QXP33Parser::parseLine
void parseLine(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP33Parser.cpp:485
libqxp::QXP33Parser::parsePictureBox
void parsePictureBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP33Parser.cpp:573
libqxp::QXP33Parser::readFrame
Frame readFrame(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP33Parser.cpp:694
libqxp::QXP33Parser::parseCharFormat
CharFormat parseCharFormat(const std::shared_ptr< librevenge::RVNGInputStream > &stream) override
Definition QXP33Parser.cpp:160
libqxp::QXP33Parser::parseHJ
std::shared_ptr< HJ > parseHJ(const std::shared_ptr< librevenge::RVNGInputStream > &stream) override
Definition QXP33Parser.cpp:234
libqxp::QXP33Parser::readObjectFlags
void readObjectFlags(const std::shared_ptr< librevenge::RVNGInputStream > &stream, bool &noColor, bool &noRunaround)
Definition QXP33Parser.cpp:472
libqxp::QXP33Parser::parseParagraphFormat
ParagraphFormat parseParagraphFormat(const std::shared_ptr< librevenge::RVNGInputStream > &stream) override
Definition QXP33Parser.cpp:186
libqxp::QXP33Parser::parseEmptyBox
void parseEmptyBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP33Parser.cpp:651
libqxp::QXP33Parser::ShapeType
ShapeType
Definition QXP33Parser.h:30
libqxp::QXP33Parser::ShapeType::LINE
@ LINE
Definition QXP33Parser.h:32
libqxp::QXP33Parser::ShapeType::CORNERED_RECTANGLE
@ CORNERED_RECTANGLE
Definition QXP33Parser.h:35
libqxp::QXP33Parser::ShapeType::RECTANGLE
@ RECTANGLE
Definition QXP33Parser.h:34
libqxp::QXP33Parser::ShapeType::OVAL
@ OVAL
Definition QXP33Parser.h:36
libqxp::QXP33Parser::ShapeType::ORTHOGONAL_LINE
@ ORTHOGONAL_LINE
Definition QXP33Parser.h:33
libqxp::QXP33Parser::ShapeType::POLYGON
@ POLYGON
Definition QXP33Parser.h:37
libqxp::QXP33Parser::m_header
const std::shared_ptr< QXP33Header > m_header
Definition QXP33Parser.h:74
libqxp::QXP33Parser::parsePage
Page parsePage(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP33Parser.cpp:245
libqxp::QXP33Parser::parseObject
void parseObject(const std::shared_ptr< librevenge::RVNGInputStream > &stream, QXP33Deobfuscator &deobfuscate, QXPCollector &collector, const Page &page, unsigned index)
Definition QXP33Parser.cpp:253
libqxp::QXP33Parser::parseDocument
bool parseDocument(const std::shared_ptr< librevenge::RVNGInputStream > &docStream, QXPCollector &collector) override
Definition QXP33Parser.cpp:71
libqxp::QXP33Parser::QXP33Parser
QXP33Parser(const std::shared_ptr< librevenge::RVNGInputStream > &input, librevenge::RVNGDrawingInterface *painter, const std::shared_ptr< QXP33Header > &header)
Definition QXP33Parser.cpp:65
libqxp::QXP33Parser::parseGroup
void parseGroup(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector, const Page &page, unsigned index)
Definition QXP33Parser.cpp:675
libqxp::QXP33Parser::parseTextBox
void parseTextBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP33Parser.cpp:504
libqxp::QXP33Parser::parseColors
void parseColors(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP33Parser.cpp:130
libqxp::QXP33Parser::readPolygonData
std::vector< Point > readPolygonData(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP33Parser.cpp:705
libqxp::QXP33Parser::parsePages
bool parsePages(const std::shared_ptr< librevenge::RVNGInputStream > &pagesStream, QXPCollector &collector) override
Definition QXP33Parser.cpp:103
libqxp::QXPCollector
Definition QXPCollector.h:28
libqxp::QXPParser::QXPParser
QXPParser(const QXPParser &other)=delete
libqxp_utils.h
libqxp
Definition libqxp_utils.cpp:25
libqxp::CornerType
CornerType
Definition QXPTypes.h:470
libqxp::CornerType::DEFAULT
@ DEFAULT
Definition QXPTypes.h:471
libqxp::BoxType
BoxType
Definition QXPTypes.h:478
libqxp::UNKNOWN
@ UNKNOWN
Definition QXPHeader.h:24
libqxp::ContentType
ContentType
Definition QXPTypes.h:266
libqxp::CharFormat
Definition QXPTypes.h:145
libqxp::Frame
Definition QXPTypes.h:345
libqxp::Page
Definition QXPTypes.h:546
libqxp::ParagraphFormat
Definition QXPTypes.h:248
libqxp::QXP33Parser::ObjectHeader
Definition QXP33Parser.h:41
libqxp::QXP33Parser::ObjectHeader::boundingBox
Rect boundingBox
Definition QXP33Parser.h:61
libqxp::QXP33Parser::ObjectHeader::linkId
unsigned linkId
Definition QXP33Parser.h:47
libqxp::QXP33Parser::ObjectHeader::fill
boost::optional< Fill > fill
Definition QXP33Parser.h:42
libqxp::QXP33Parser::ObjectHeader::hflip
bool hflip
Definition QXP33Parser.h:53
libqxp::QXP33Parser::ObjectHeader::rotation
double rotation
Definition QXP33Parser.h:50
libqxp::QXP33Parser::ObjectHeader::shapeType
ShapeType shapeType
Definition QXP33Parser.h:59
libqxp::QXP33Parser::ObjectHeader::boxType
BoxType boxType
Definition QXP33Parser.h:63
libqxp::QXP33Parser::ObjectHeader::runaround
bool runaround
Definition QXP33Parser.h:44
libqxp::QXP33Parser::ObjectHeader::gradientId
unsigned gradientId
Definition QXP33Parser.h:48
libqxp::QXP33Parser::ObjectHeader::contentType
ContentType contentType
Definition QXP33Parser.h:58
libqxp::QXP33Parser::ObjectHeader::cornerRadius
double cornerRadius
Definition QXP33Parser.h:56
libqxp::QXP33Parser::ObjectHeader::vflip
bool vflip
Definition QXP33Parser.h:54
libqxp::QXP33Parser::ObjectHeader::contentIndex
unsigned contentIndex
Definition QXP33Parser.h:46
libqxp::QXP33Parser::ObjectHeader::cornerType
CornerType cornerType
Definition QXP33Parser.h:55
libqxp::QXP33Parser::ObjectHeader::skew
double skew
Definition QXP33Parser.h:51
libqxp::QXP33Parser::ObjectHeader::ObjectHeader
ObjectHeader()
Definition QXP33Parser.h:65
libqxp::Rect
Definition QXPTypes.h:47