CDRParser.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 libcdr 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 __CDRPARSER_H__
#define __CDRPARSER_H__
#include <memory>
#include <vector>
#include <map>
#include <stack>
#include <librevenge-stream/librevenge-stream.h>
#include "CDRTypes.h"
#include "CommonParser.h"
namespace libcdr
{
class CDRCollector;
class CDRParser : protected CommonParser
{
public:
explicit CDRParser(const std::vector<std::unique_ptr<librevenge::RVNGInputStream>> &externalStreams, CDRCollector *collector);
~CDRParser() override;
bool parseRecords(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths = std::vector<unsigned>(), unsigned level = 0);
bool parseWaldo(librevenge::RVNGInputStream *input);
private:
CDRParser();
CDRParser(const CDRParser &);
CDRParser &operator=(const CDRParser &);
bool parseWaldoStructure(librevenge::RVNGInputStream *input, std::stack<WaldoRecordType1> &waldoStack,
const std::map<unsigned, WaldoRecordType1> &records1,
std::map<unsigned, WaldoRecordInfo> &records2);
bool gatherWaldoInformation(librevenge::RVNGInputStream *input, std::vector<WaldoRecordInfo> &records, std::map<unsigned, WaldoRecordInfo> &records2,
std::map<unsigned, WaldoRecordInfo> &records3, std::map<unsigned, WaldoRecordInfo> &records4,
std::map<unsigned, WaldoRecordInfo> &records6, std::map<unsigned, WaldoRecordInfo> &records7,
std::map<unsigned, WaldoRecordInfo> &records8, std::map<unsigned, WaldoRecordInfo> recordsOther);
void readWaldoRecord(librevenge::RVNGInputStream *input, const WaldoRecordInfo &info);
bool parseRecord(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths = std::vector<unsigned>(), unsigned level = 0);
void readRecord(unsigned fourCC, unsigned length, librevenge::RVNGInputStream *input);
double readRectCoord(librevenge::RVNGInputStream *input);
CDRColor readColor(librevenge::RVNGInputStream *input);
void readRectangle(librevenge::RVNGInputStream *input);
void readEllipse(librevenge::RVNGInputStream *input);
void readLineAndCurve(librevenge::RVNGInputStream *input);
void readBitmap(librevenge::RVNGInputStream *input);
void readPageSize(librevenge::RVNGInputStream *input);
void readWaldoBmp(librevenge::RVNGInputStream *input, unsigned length, unsigned id);
void readWaldoBmpf(librevenge::RVNGInputStream *input, unsigned id);
void readWaldoTrfd(librevenge::RVNGInputStream *input);
void readWaldoOutl(librevenge::RVNGInputStream *input);
void readWaldoFill(librevenge::RVNGInputStream *input);
void readWaldoLoda(librevenge::RVNGInputStream *input, unsigned length);
void readOpacity(librevenge::RVNGInputStream *input, unsigned length);
void readTrfd(librevenge::RVNGInputStream *input, unsigned length);
void readFild(librevenge::RVNGInputStream *input, unsigned length);
void readOutl(librevenge::RVNGInputStream *input, unsigned length);
void readLoda(librevenge::RVNGInputStream *input, unsigned length);
void readFlags(librevenge::RVNGInputStream *input, unsigned length);
void readMcfg(librevenge::RVNGInputStream *input, unsigned length);
void readPath(librevenge::RVNGInputStream *input);
void readArrw(librevenge::RVNGInputStream *input, unsigned length);
void readPolygonCoords(librevenge::RVNGInputStream *input);
void readPolygonTransform(librevenge::RVNGInputStream *input);
void readBmp(librevenge::RVNGInputStream *input, unsigned length);
void readBmpf(librevenge::RVNGInputStream *input, unsigned length);
void readPpdt(librevenge::RVNGInputStream *input, unsigned length);
void readFtil(librevenge::RVNGInputStream *input, unsigned length);
void readDisp(librevenge::RVNGInputStream *input, unsigned length);
void readVersion(librevenge::RVNGInputStream *input, unsigned length);
void readIccd(librevenge::RVNGInputStream *input, unsigned length);
void readBBox(librevenge::RVNGInputStream *input, unsigned length);
void readSpnd(librevenge::RVNGInputStream *input, unsigned length);
void readVpat(librevenge::RVNGInputStream *input, unsigned length);
void readUidr(librevenge::RVNGInputStream *input, unsigned length);
void readFont(librevenge::RVNGInputStream *input, unsigned length);
void readStlt(librevenge::RVNGInputStream *input, unsigned length);
void readStyd(librevenge::RVNGInputStream *input);
void readTxsm(librevenge::RVNGInputStream *input, unsigned length);
void readTxsm16(librevenge::RVNGInputStream *input);
void readTxsm6(librevenge::RVNGInputStream *input);
void readTxsm5(librevenge::RVNGInputStream *input);
void readUdta(librevenge::RVNGInputStream *input);
void readArtisticText(librevenge::RVNGInputStream *input);
void readParagraphText(librevenge::RVNGInputStream *input);
bool _redirectX6Chunk(librevenge::RVNGInputStream **input, unsigned &length);
void _readX6StyleString(librevenge::RVNGInputStream *input, unsigned long length, CDRStyle &style);
void _skipX3Optional(librevenge::RVNGInputStream *input);
void _resolveColorPalette(CDRColor &color);
const std::vector<std::unique_ptr<librevenge::RVNGInputStream>> &m_externalStreams;
std::map<unsigned, CDRFont> m_fonts;
std::map<unsigned, CDRFillStyle> m_fillStyles;
std::map<unsigned, CDRLineStyle> m_lineStyles;
std::map<unsigned, CDRPath> m_arrows;
unsigned m_version;
unsigned m_waldoOutlId;
unsigned m_waldoFillId;
};
} // namespace libcdr
#endif // __CDRPARSER_H__
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
CDRTypes.h
CommonParser.h
libcdr::CDRCollector
Definition CDRCollector.h:62
libcdr::CDRParser::readTxsm5
void readTxsm5(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:2911
libcdr::CDRParser::m_externalStreams
const std::vector< std::unique_ptr< librevenge::RVNGInputStream > > & m_externalStreams
Definition CDRParser.h:100
libcdr::CDRParser::readTxsm16
void readTxsm16(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:2692
libcdr::CDRParser::readSpnd
void readSpnd(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2123
libcdr::CDRParser::CDRParser
CDRParser()
libcdr::CDRParser::readWaldoRecord
void readWaldoRecord(librevenge::RVNGInputStream *input, const WaldoRecordInfo &info)
Definition CDRParser.cpp:464
libcdr::CDRParser::readPolygonCoords
void readPolygonCoords(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1871
libcdr::CDRParser::readIccd
void readIccd(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2097
libcdr::CDRParser::parseRecords
bool parseRecords(librevenge::RVNGInputStream *input, const std::vector< unsigned > &blockLengths=std::vector< unsigned >(), unsigned level=0)
Definition CDRParser.cpp:571
libcdr::CDRParser::readMcfg
void readMcfg(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1841
libcdr::CDRParser::readFild
void readFild(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1419
libcdr::CDRParser::CDRParser
CDRParser(const std::vector< std::unique_ptr< librevenge::RVNGInputStream > > &externalStreams, CDRCollector *collector)
Definition CDRParser.cpp:236
libcdr::CDRParser::readWaldoLoda
void readWaldoLoda(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:530
libcdr::CDRParser::readWaldoBmp
void readWaldoBmp(librevenge::RVNGInputStream *input, unsigned length, unsigned id)
Definition CDRParser.cpp:1923
libcdr::CDRParser::readArtisticText
void readArtisticText(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:3120
libcdr::CDRParser::m_fonts
std::map< unsigned, CDRFont > m_fonts
Definition CDRParser.h:102
libcdr::CDRParser::readWaldoFill
void readWaldoFill(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1232
libcdr::CDRParser::readBmp
void readBmp(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1942
libcdr::CDRParser::readUdta
void readUdta(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:2996
libcdr::CDRParser::readVpat
void readVpat(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2131
libcdr::CDRParser::readParagraphText
void readParagraphText(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:3127
libcdr::CDRParser::readStlt
void readStlt(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2204
libcdr::CDRParser::m_arrows
std::map< unsigned, CDRPath > m_arrows
Definition CDRParser.h:105
libcdr::CDRParser::_resolveColorPalette
void _resolveColorPalette(CDRColor &color)
Definition CDRParser.cpp:3262
libcdr::CDRParser::m_lineStyles
std::map< unsigned, CDRLineStyle > m_lineStyles
Definition CDRParser.h:104
libcdr::CDRParser::_redirectX6Chunk
bool _redirectX6Chunk(librevenge::RVNGInputStream **input, unsigned &length)
Definition CDRParser.cpp:2072
libcdr::CDRParser::_readX6StyleString
void _readX6StyleString(librevenge::RVNGInputStream *input, unsigned long length, CDRStyle &style)
Definition CDRParser.cpp:3135
libcdr::CDRParser::readRecord
void readRecord(unsigned fourCC, unsigned length, librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:685
libcdr::CDRParser::readFlags
void readFlags(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1833
libcdr::CDRParser::m_waldoOutlId
unsigned m_waldoOutlId
Definition CDRParser.h:108
libcdr::CDRParser::readPath
void readPath(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1066
libcdr::CDRParser::readPageSize
void readPageSize(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1916
libcdr::CDRParser::_skipX3Optional
void _skipX3Optional(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:3230
libcdr::CDRParser::m_waldoFillId
unsigned m_waldoFillId
Definition CDRParser.h:109
libcdr::CDRParser::readBitmap
void readBitmap(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1131
libcdr::CDRParser::readRectangle
void readRectangle(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:825
libcdr::CDRParser::readWaldoBmpf
void readWaldoBmpf(librevenge::RVNGInputStream *input, unsigned id)
Definition CDRParser.cpp:1998
libcdr::CDRParser::readTxsm6
void readTxsm6(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:2815
libcdr::CDRParser::parseWaldo
bool parseWaldo(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:245
libcdr::CDRParser::readWaldoOutl
void readWaldoOutl(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1199
libcdr::CDRParser::readUidr
void readUidr(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2145
libcdr::CDRParser::readEllipse
void readEllipse(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:941
libcdr::CDRParser::readArrw
void readArrw(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1095
libcdr::CDRParser::parseWaldoStructure
bool parseWaldoStructure(librevenge::RVNGInputStream *input, std::stack< WaldoRecordType1 > &waldoStack, const std::map< unsigned, WaldoRecordType1 > &records1, std::map< unsigned, WaldoRecordInfo > &records2)
Definition CDRParser.cpp:418
libcdr::CDRParser::~CDRParser
~CDRParser() override
Definition CDRParser.cpp:240
libcdr::CDRParser::readColor
CDRColor readColor(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:774
libcdr::CDRParser::readPolygonTransform
void readPolygonTransform(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1897
libcdr::CDRParser::readPpdt
void readPpdt(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2021
libcdr::CDRParser::gatherWaldoInformation
bool gatherWaldoInformation(librevenge::RVNGInputStream *input, std::vector< WaldoRecordInfo > &records, std::map< unsigned, WaldoRecordInfo > &records2, std::map< unsigned, WaldoRecordInfo > &records3, std::map< unsigned, WaldoRecordInfo > &records4, std::map< unsigned, WaldoRecordInfo > &records6, std::map< unsigned, WaldoRecordInfo > &records7, std::map< unsigned, WaldoRecordInfo > &records8, std::map< unsigned, WaldoRecordInfo > recordsOther)
Definition CDRParser.cpp:367
libcdr::CDRParser::readLineAndCurve
void readLineAndCurve(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:1041
libcdr::CDRParser::m_version
unsigned m_version
Definition CDRParser.h:107
libcdr::CDRParser::readFtil
void readFtil(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2046
libcdr::CDRParser::readFont
void readFont(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2156
libcdr::CDRParser::m_fillStyles
std::map< unsigned, CDRFillStyle > m_fillStyles
Definition CDRParser.h:103
libcdr::CDRParser::readTxsm
void readTxsm(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2479
libcdr::CDRParser::CDRParser
CDRParser(const CDRParser &)
libcdr::CDRParser::parseRecord
bool parseRecord(librevenge::RVNGInputStream *input, const std::vector< unsigned > &blockLengths=std::vector< unsigned >(), unsigned level=0)
Definition CDRParser.cpp:588
libcdr::CDRParser::readLoda
void readLoda(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1735
libcdr::CDRParser::readWaldoTrfd
void readWaldoTrfd(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:490
libcdr::CDRParser::readStyd
void readStyd(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:3015
libcdr::CDRParser::readTrfd
void readTrfd(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1326
libcdr::CDRParser::operator=
CDRParser & operator=(const CDRParser &)
libcdr::CDRParser::readVersion
void readVersion(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2061
libcdr::CDRParser::readOpacity
void readOpacity(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1977
libcdr::CDRParser::readOutl
void readOutl(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1674
libcdr::CDRParser::readBBox
void readBBox(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:2112
libcdr::CDRParser::readDisp
void readDisp(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:998
libcdr::CDRParser::readBmpf
void readBmpf(librevenge::RVNGInputStream *input, unsigned length)
Definition CDRParser.cpp:1987
libcdr::CDRParser::readRectCoord
double readRectCoord(librevenge::RVNGInputStream *input)
Definition CDRParser.cpp:767
libcdr::CommonParser::CommonParser
CommonParser(CDRCollector *collector)
Definition CommonParser.cpp:18
libcdr
Definition CDRCollector.h:25
libcdr::CDRColor
Definition CDRTypes.h:54
libcdr::CDRStyle
Definition CDRTypes.h:142
libcdr::WaldoRecordInfo
Definition CDRTypes.h:274