QXP4Parser.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 QXP4PARSER_H_INCLUDED
#define QXP4PARSER_H_INCLUDED
#include "QXPParser.h"
#include <vector>
namespace libqxp
{
class QXP4Deobfuscator;
class QXP4Header;
class QXP4Parser : public QXPParser
{
public:
QXP4Parser(const std::shared_ptr<librevenge::RVNGInputStream> &input, librevenge::RVNGDrawingInterface *painter, const std::shared_ptr<QXP4Header> &header);
enum class ShapeType
{
UNKNOWN,
LINE,
ORTHOGONAL_LINE,
BEZIER_LINE,
RECTANGLE,
ROUNDED_RECTANGLE,
CONCAVE_RECTANGLE,
BEVELED_RECTANGLE,
OVAL,
BEZIER_BOX
};
struct ObjectHeader
{
boost::optional<Color> fillColor;
Color color;
unsigned contentIndex;
unsigned linkId;
unsigned oleId;
unsigned gradientId;
double rotation;
double skew;
bool hflip;
bool vflip;
ContentType contentType;
ShapeType shapeType;
BoxType boxType;
CornerType cornerType;
ObjectHeader()
: fillColor(), color(), contentIndex(0), linkId(0), oleId(0), gradientId(0),
rotation(0), skew(0), hflip(false), vflip(false),
contentType(ContentType::UNKNOWN), shapeType(ShapeType::UNKNOWN),
boxType(BoxType::UNKNOWN), cornerType(CornerType::DEFAULT)
{ }
};
private:
struct ColorBlockSpec
{
unsigned offset;
unsigned padding;
ColorBlockSpec()
: offset(0), padding(0)
{ }
};
const std::shared_ptr<QXP4Header> m_header;
std::vector<std::vector<TabStop>> m_paragraphTabStops;
bool parseDocument(const std::shared_ptr<librevenge::RVNGInputStream> &docStream, QXPCollector &collector) override;
bool parsePages(const std::shared_ptr<librevenge::RVNGInputStream> &stream, QXPCollector &collector) override;
void parseColors(const std::shared_ptr<librevenge::RVNGInputStream> &docStream);
ColorBlockSpec parseColorBlockSpec(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
void parseColor(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const std::vector<ColorBlockSpec> &blocks);
void skipParagraphStylesheets(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
CharFormat parseCharFormat(const std::shared_ptr<librevenge::RVNGInputStream> &stream) override;
void parseLineStyles(const std::shared_ptr<librevenge::RVNGInputStream> &docStream);
void skipTemplates(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
void parseTabStops(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
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, QXP4Deobfuscator &deobfuscate);
void parseObject(const std::shared_ptr<librevenge::RVNGInputStream> &stream, QXP4Deobfuscator &deobfuscate, QXPCollector &collector, const Page &page, unsigned index);
ObjectHeader parseObjectHeader(const std::shared_ptr<librevenge::RVNGInputStream> &stream, QXP4Deobfuscator &deobfuscate);
void parseLine(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parseBezierLine(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parseBezierEmptyBox(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 parseBezierPictureBox(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 parseLineText(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parseBezierText(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, QXPCollector &collector);
void parseBezierTextBox(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 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);
bool readRunaround(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
void readLinkedTextSettings(const std::shared_ptr<librevenge::RVNGInputStream> &stream, LinkedTextSettings &settings);
void readTextSettings(const std::shared_ptr<librevenge::RVNGInputStream> &stream, TextSettings &settings);
void readTextPathSettings(const std::shared_ptr<librevenge::RVNGInputStream> &stream, TextPathSettings &settings);
void readOleObject(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
void readPictureSettings(const std::shared_ptr<librevenge::RVNGInputStream> &stream, std::shared_ptr<PictureBox> &picturebox);
void readImageData(const std::shared_ptr<librevenge::RVNGInputStream> &stream);
void readBezierData(const std::shared_ptr<librevenge::RVNGInputStream> &stream, std::vector<CurveComponent> &curveComponents, Rect &bbox);
void skipTextObjectEnd(const std::shared_ptr<librevenge::RVNGInputStream> &stream, const ObjectHeader &header, const LinkedTextSettings &linkedTextSettings);
};
}
#endif // QXP4PARSER_H_INCLUDED
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
QXPParser.h
libqxp::QXP4Deobfuscator
Definition QXP4Deobfuscator.h:20
libqxp::QXP4Header
Definition QXP4Header.h:23
libqxp::QXP4Parser::parseHJ
std::shared_ptr< HJ > parseHJ(const std::shared_ptr< librevenge::RVNGInputStream > &stream) override
Definition QXP4Parser.cpp:447
libqxp::QXP4Parser::readRunaround
bool readRunaround(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:1023
libqxp::QXP4Parser::parseLine
void parseLine(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:666
libqxp::QXP4Parser::parseLineText
void parseLineText(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:802
libqxp::QXP4Parser::skipTextObjectEnd
void skipTextObjectEnd(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, const LinkedTextSettings &linkedTextSettings)
Definition QXP4Parser.cpp:1176
libqxp::QXP4Parser::m_paragraphTabStops
std::vector< std::vector< TabStop > > m_paragraphTabStops
Definition QXP4Parser.h:84
libqxp::QXP4Parser::parseGroup
void parseGroup(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector, const Page &page, unsigned index)
Definition QXP4Parser.cpp:976
libqxp::QXP4Parser::QXP4Parser
QXP4Parser(const std::shared_ptr< librevenge::RVNGInputStream > &input, librevenge::RVNGDrawingInterface *painter, const std::shared_ptr< QXP4Header > &header)
Definition QXP4Parser.cpp:50
libqxp::QXP4Parser::parseBezierTextBox
void parseBezierTextBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:884
libqxp::QXP4Parser::parseDocument
bool parseDocument(const std::shared_ptr< librevenge::RVNGInputStream > &docStream, QXPCollector &collector) override
Definition QXP4Parser.cpp:57
libqxp::QXP4Parser::readTextPathSettings
void readTextPathSettings(const std::shared_ptr< librevenge::RVNGInputStream > &stream, TextPathSettings &settings)
Definition QXP4Parser.cpp:1051
libqxp::QXP4Parser::skipTemplates
void skipTemplates(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:332
libqxp::QXP4Parser::parseColor
void parseColor(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const std::vector< ColorBlockSpec > &blocks)
Definition QXP4Parser.cpp:173
libqxp::QXP4Parser::parseBezierEmptyBox
void parseBezierEmptyBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:696
libqxp::QXP4Parser::readOleObject
void readOleObject(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:1092
libqxp::QXP4Parser::parseEmptyBox
void parseEmptyBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:715
libqxp::QXP4Parser::parseTextBox
void parseTextBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:928
libqxp::QXP4Parser::skipParagraphStylesheets
void skipParagraphStylesheets(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:197
libqxp::QXP4Parser::parseBezierLine
void parseBezierLine(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:682
libqxp::QXP4Parser::readPictureSettings
void readPictureSettings(const std::shared_ptr< librevenge::RVNGInputStream > &stream, std::shared_ptr< PictureBox > &picturebox)
Definition QXP4Parser.cpp:1098
libqxp::QXP4Parser::parseBezierPictureBox
void parseBezierPictureBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:738
libqxp::QXP4Parser::parseParagraphFormat
ParagraphFormat parseParagraphFormat(const std::shared_ptr< librevenge::RVNGInputStream > &stream) override
Definition QXP4Parser.cpp:395
libqxp::QXP4Parser::readFrame
Frame readFrame(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:999
libqxp::QXP4Parser::readTextSettings
void readTextSettings(const std::shared_ptr< librevenge::RVNGInputStream > &stream, TextSettings &settings)
Definition QXP4Parser.cpp:1036
libqxp::QXP4Parser::parseBezierText
void parseBezierText(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:844
libqxp::QXP4Parser::parseObject
void parseObject(const std::shared_ptr< librevenge::RVNGInputStream > &stream, QXP4Deobfuscator &deobfuscate, QXPCollector &collector, const Page &page, unsigned index)
Definition QXP4Parser.cpp:466
libqxp::QXP4Parser::parseCharFormat
CharFormat parseCharFormat(const std::shared_ptr< librevenge::RVNGInputStream > &stream) override
Definition QXP4Parser.cpp:227
libqxp::QXP4Parser::parseObjectHeader
ObjectHeader parseObjectHeader(const std::shared_ptr< librevenge::RVNGInputStream > &stream, QXP4Deobfuscator &deobfuscate)
Definition QXP4Parser.cpp:551
libqxp::QXP4Parser::parseTabStops
void parseTabStops(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:357
libqxp::QXP4Parser::ShapeType
ShapeType
Definition QXP4Parser.h:28
libqxp::QXP4Parser::ShapeType::CONCAVE_RECTANGLE
@ CONCAVE_RECTANGLE
Definition QXP4Parser.h:35
libqxp::QXP4Parser::ShapeType::LINE
@ LINE
Definition QXP4Parser.h:30
libqxp::QXP4Parser::ShapeType::BEVELED_RECTANGLE
@ BEVELED_RECTANGLE
Definition QXP4Parser.h:36
libqxp::QXP4Parser::ShapeType::BEZIER_BOX
@ BEZIER_BOX
Definition QXP4Parser.h:38
libqxp::QXP4Parser::ShapeType::RECTANGLE
@ RECTANGLE
Definition QXP4Parser.h:33
libqxp::QXP4Parser::ShapeType::ROUNDED_RECTANGLE
@ ROUNDED_RECTANGLE
Definition QXP4Parser.h:34
libqxp::QXP4Parser::ShapeType::OVAL
@ OVAL
Definition QXP4Parser.h:37
libqxp::QXP4Parser::ShapeType::BEZIER_LINE
@ BEZIER_LINE
Definition QXP4Parser.h:32
libqxp::QXP4Parser::ShapeType::ORTHOGONAL_LINE
@ ORTHOGONAL_LINE
Definition QXP4Parser.h:31
libqxp::QXP4Parser::readBezierData
void readBezierData(const std::shared_ptr< librevenge::RVNGInputStream > &stream, std::vector< CurveComponent > &curveComponents, Rect &bbox)
Definition QXP4Parser.cpp:1115
libqxp::QXP4Parser::m_header
const std::shared_ptr< QXP4Header > m_header
Definition QXP4Parser.h:82
libqxp::QXP4Parser::parsePictureBox
void parsePictureBox(const std::shared_ptr< librevenge::RVNGInputStream > &stream, const ObjectHeader &header, QXPCollector &collector)
Definition QXP4Parser.cpp:768
libqxp::QXP4Parser::parseLineStyles
void parseLineStyles(const std::shared_ptr< librevenge::RVNGInputStream > &docStream)
Definition QXP4Parser.cpp:253
libqxp::QXP4Parser::readLinkedTextSettings
void readLinkedTextSettings(const std::shared_ptr< librevenge::RVNGInputStream > &stream, LinkedTextSettings &settings)
Definition QXP4Parser.cpp:1030
libqxp::QXP4Parser::parsePages
bool parsePages(const std::shared_ptr< librevenge::RVNGInputStream > &stream, QXPCollector &collector) override
Definition QXP4Parser.cpp:95
libqxp::QXP4Parser::parsePage
Page parsePage(const std::shared_ptr< librevenge::RVNGInputStream > &stream, QXP4Deobfuscator &deobfuscate)
Definition QXP4Parser.cpp:458
libqxp::QXP4Parser::readImageData
void readImageData(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:1109
libqxp::QXP4Parser::parseColorBlockSpec
ColorBlockSpec parseColorBlockSpec(const std::shared_ptr< librevenge::RVNGInputStream > &stream)
Definition QXP4Parser.cpp:164
libqxp::QXP4Parser::parseColors
void parseColors(const std::shared_ptr< librevenge::RVNGInputStream > &docStream)
Definition QXP4Parser.cpp:121
libqxp::QXPCollector
Definition QXPCollector.h:28
libqxp::QXPParser::QXPParser
QXPParser(const QXPParser &other)=delete
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::Color
Definition QXPTypes.h:69
libqxp::Frame
Definition QXPTypes.h:345
libqxp::LinkedTextSettings
Definition QXPTypes.h:362
libqxp::Page
Definition QXPTypes.h:546
libqxp::ParagraphFormat
Definition QXPTypes.h:248
libqxp::QXP4Parser::ColorBlockSpec
Definition QXP4Parser.h:73
libqxp::QXP4Parser::ColorBlockSpec::ColorBlockSpec
ColorBlockSpec()
Definition QXP4Parser.h:77
libqxp::QXP4Parser::ColorBlockSpec::padding
unsigned padding
Definition QXP4Parser.h:75
libqxp::QXP4Parser::ColorBlockSpec::offset
unsigned offset
Definition QXP4Parser.h:74
libqxp::QXP4Parser::ObjectHeader
Definition QXP4Parser.h:42
libqxp::QXP4Parser::ObjectHeader::cornerType
CornerType cornerType
Definition QXP4Parser.h:61
libqxp::QXP4Parser::ObjectHeader::oleId
unsigned oleId
Definition QXP4Parser.h:48
libqxp::QXP4Parser::ObjectHeader::gradientId
unsigned gradientId
Definition QXP4Parser.h:49
libqxp::QXP4Parser::ObjectHeader::boxType
BoxType boxType
Definition QXP4Parser.h:60
libqxp::QXP4Parser::ObjectHeader::linkId
unsigned linkId
Definition QXP4Parser.h:47
libqxp::QXP4Parser::ObjectHeader::contentIndex
unsigned contentIndex
Definition QXP4Parser.h:46
libqxp::QXP4Parser::ObjectHeader::ObjectHeader
ObjectHeader()
Definition QXP4Parser.h:63
libqxp::QXP4Parser::ObjectHeader::contentType
ContentType contentType
Definition QXP4Parser.h:57
libqxp::QXP4Parser::ObjectHeader::vflip
bool vflip
Definition QXP4Parser.h:55
libqxp::QXP4Parser::ObjectHeader::skew
double skew
Definition QXP4Parser.h:52
libqxp::QXP4Parser::ObjectHeader::rotation
double rotation
Definition QXP4Parser.h:51
libqxp::QXP4Parser::ObjectHeader::shapeType
ShapeType shapeType
Definition QXP4Parser.h:58
libqxp::QXP4Parser::ObjectHeader::hflip
bool hflip
Definition QXP4Parser.h:54
libqxp::QXP4Parser::ObjectHeader::fillColor
boost::optional< Color > fillColor
Definition QXP4Parser.h:43
libqxp::QXP4Parser::ObjectHeader::color
Color color
Definition QXP4Parser.h:44
libqxp::Rect
Definition QXPTypes.h:47
libqxp::TextPathSettings
Definition QXPTypes.h:416
libqxp::TextSettings
Definition QXPTypes.h:387