CDRParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libcdr project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef __CDRPARSER_H__
11 #define __CDRPARSER_H__
12
13 #include <stdio.h>
14 #include <iostream>
15 #include <vector>
16 #include <map>
17 #include <stack>
18 #include <librevenge-stream/librevenge-stream.h>
19 #include "CDRTypes.h"
20 #include "CommonParser.h"
21
22 namespace libcdr
23 {
24
25 class CDRCollector;
26
27 class CDRParser : protected CommonParser
28 {
29 public:
30 explicit CDRParser(const std::vector<librevenge::RVNGInputStream *> &externalStreams, CDRCollector *collector);
31 virtual ~CDRParser();
32 bool parseRecords(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths = std::vector<unsigned>(), unsigned level = 0);
33 bool parseWaldo(librevenge::RVNGInputStream *input);
34
35 private:
36 CDRParser();
37 CDRParser(const CDRParser &);
38 CDRParser &operator=(const CDRParser &);
39 bool parseWaldoStructure(librevenge::RVNGInputStream *input, std::stack<WaldoRecordType1> &waldoStack,
40 const std::map<unsigned, WaldoRecordType1> &records1,
41 std::map<unsigned, WaldoRecordInfo> &records2);
42 bool gatherWaldoInformation(librevenge::RVNGInputStream *input, std::vector<WaldoRecordInfo> &records, std::map<unsigned, WaldoRecordInfo> &records2,
43 std::map<unsigned, WaldoRecordInfo> &records3, std::map<unsigned, WaldoRecordInfo> &records4,
44 std::map<unsigned, WaldoRecordInfo> &records6, std::map<unsigned, WaldoRecordInfo> &records7,
45 std::map<unsigned, WaldoRecordInfo> &records8, std::map<unsigned, WaldoRecordInfo> recordsOther);
46 void readWaldoRecord(librevenge::RVNGInputStream *input, const WaldoRecordInfo &info);
47 bool parseRecord(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths = std::vector<unsigned>(), unsigned level = 0);
48 void readRecord(unsigned fourCC, unsigned length, librevenge::RVNGInputStream *input);
49 double readRectCoord(librevenge::RVNGInputStream *input);
50 CDRColor readColor(librevenge::RVNGInputStream *input);
51
52 void readRectangle(librevenge::RVNGInputStream *input);
53 void readEllipse(librevenge::RVNGInputStream *input);
54 void readLineAndCurve(librevenge::RVNGInputStream *input);
55 void readBitmap(librevenge::RVNGInputStream *input);
56 void readPageSize(librevenge::RVNGInputStream *input);
57 void readWaldoBmp(librevenge::RVNGInputStream *input, unsigned length, unsigned id);
58 void readWaldoBmpf(librevenge::RVNGInputStream *input, unsigned id);
59 void readWaldoTrfd(librevenge::RVNGInputStream *input);
60 void readWaldoOutl(librevenge::RVNGInputStream *input);
61 void readWaldoFill(librevenge::RVNGInputStream *input);
62 void readWaldoLoda(librevenge::RVNGInputStream *input, unsigned length);
63 void readOpacity(librevenge::RVNGInputStream *input, unsigned length);
64 void readTrfd(librevenge::RVNGInputStream *input, unsigned length);
65 void readFild(librevenge::RVNGInputStream *input, unsigned length);
66 void readOutl(librevenge::RVNGInputStream *input, unsigned length);
67 void readLoda(librevenge::RVNGInputStream *input, unsigned length);
68 void readFlags(librevenge::RVNGInputStream *input, unsigned length);
69 void readMcfg(librevenge::RVNGInputStream *input, unsigned length);
70 void readPath(librevenge::RVNGInputStream *input);
71 void readArrw(librevenge::RVNGInputStream *input, unsigned length);
72 void readPolygonCoords(librevenge::RVNGInputStream *input);
73 void readPolygonTransform(librevenge::RVNGInputStream *input);
74 void readBmp(librevenge::RVNGInputStream *input, unsigned length);
75 void readBmpf(librevenge::RVNGInputStream *input, unsigned length);
76 void readPpdt(librevenge::RVNGInputStream *input, unsigned length);
77 void readFtil(librevenge::RVNGInputStream *input, unsigned length);
78 void readDisp(librevenge::RVNGInputStream *input, unsigned length);
79 void readVersion(librevenge::RVNGInputStream *input, unsigned length);
80 void readIccd(librevenge::RVNGInputStream *input, unsigned length);
81 void readBBox(librevenge::RVNGInputStream *input, unsigned length);
82 void readSpnd(librevenge::RVNGInputStream *input, unsigned length);
83 void readVpat(librevenge::RVNGInputStream *input, unsigned length);
84 void readUidr(librevenge::RVNGInputStream *input, unsigned length);
85 void readFont(librevenge::RVNGInputStream *input, unsigned length);
86 void readStlt(librevenge::RVNGInputStream *input, unsigned length);
87 void readStyd(librevenge::RVNGInputStream *input);
88 void readTxsm(librevenge::RVNGInputStream *input, unsigned length);
89 void readTxsm16(librevenge::RVNGInputStream *input);
90 void readTxsm6(librevenge::RVNGInputStream *input);
91 void readTxsm5(librevenge::RVNGInputStream *input);
92 void readUdta(librevenge::RVNGInputStream *input);
93 void readArtisticText(librevenge::RVNGInputStream *input);
94 void readParagraphText(librevenge::RVNGInputStream *input);
95
96 bool _redirectX6Chunk(librevenge::RVNGInputStream **input, unsigned &length);
97 void _readX6StyleString(librevenge::RVNGInputStream *input, unsigned length, CDRStyle &style);
98
99 std::vector<librevenge::RVNGInputStream *> m_externalStreams;
100
101 std::map<unsigned, CDRFont> m_fonts;
102 std::map<unsigned, CDRFillStyle> m_fillStyles;
103 std::map<unsigned, CDRLineStyle> m_lineStyles;
104 std::map<unsigned, CDRPath> m_arrows;
105
106 unsigned m_version;
107 unsigned m_waldoOutlId;
108 unsigned m_waldoFillId;
109
110 };
111
112 } // namespace libcdr
113
114 #endif // __CDRPARSER_H__
115 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRParser::_redirectX6Chunk
bool _redirectX6Chunk(librevenge::RVNGInputStream **input, unsigned &length)
Definition: CDRParser.cpp:2420
libcdr::CommonParser
Definition: CommonParser.h:22
libcdr::CDRParser::readLineAndCurve
void readLineAndCurve(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:1377
libcdr::CDRParser::readFlags
void readFlags(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2181
libcdr::CDRParser::readFont
void readFont(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2504
libcdr::CDRParser::~CDRParser
virtual ~CDRParser()
Definition: CDRParser.cpp:160
libcdr::CDRParser::readMcfg
void readMcfg(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2189
libcdr::CDRParser::readUidr
void readUidr(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2493
libcdr::CDRParser::readLoda
void readLoda(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2083
libcdr::CDRParser::readWaldoBmpf
void readWaldoBmpf(librevenge::RVNGInputStream *input, unsigned id)
Definition: CDRParser.cpp:2346
libcdr::CDRParser::readEllipse
void readEllipse(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:1270
libcdr::CDRParser::readPolygonCoords
void readPolygonCoords(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:2219
libcdr::CDRParser::readVersion
void readVersion(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2409
libcdr::CDRParser::m_waldoOutlId
unsigned m_waldoOutlId
Definition: CDRParser.h:107
libcdr::CDRParser::parseRecord
bool parseRecord(librevenge::RVNGInputStream *input, const std::vector< unsigned > &blockLengths=std::vector< unsigned >(), unsigned level=0)
Definition: CDRParser.cpp:502
libcdr::CDRParser::readFild
void readFild(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:1755
libcdr::CDRParser::readBmpf
void readBmpf(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2335
libcdr::CDRParser::m_version
unsigned m_version
Definition: CDRParser.h:106
libcdr::CDRParser::readIccd
void readIccd(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2445
libcdr::CDRParser::readArtisticText
void readArtisticText(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:3379
libcdr::CDRParser::readRectCoord
double readRectCoord(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:678
libcdr::CDRParser::readTxsm16
void readTxsm16(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:3002
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:338
libcdr::CDRParser::CDRParser
CDRParser()
libcdr::CDRParser::m_waldoFillId
unsigned m_waldoFillId
Definition: CDRParser.h:108
libcdr::CDRParser::readOpacity
void readOpacity(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2325
libcdr::CDRParser::m_fonts
std::map< unsigned, CDRFont > m_fonts
Definition: CDRParser.h:101
libcdr::CDRParser::readWaldoBmp
void readWaldoBmp(librevenge::RVNGInputStream *input, unsigned length, unsigned id)
Definition: CDRParser.cpp:2271
libcdr::CDRParser::readStyd
void readStyd(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:3274
libcdr::CDRParser::m_externalStreams
std::vector< librevenge::RVNGInputStream * > m_externalStreams
Definition: CDRParser.h:99
libcdr::CDRParser::readWaldoFill
void readWaldoFill(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:1568
libcdr::CDRParser::readWaldoTrfd
void readWaldoTrfd(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:410
libcdr::CDRParser::readVpat
void readVpat(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2479
libcdr::CDRParser::readDisp
void readDisp(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:1334
libcdr
Definition: CDRCollector.h:29
libcdr::CDRParser::readRecord
void readRecord(unsigned fourCC, unsigned length, librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:596
libcdr::CDRParser::m_fillStyles
std::map< unsigned, CDRFillStyle > m_fillStyles
Definition: CDRParser.h:102
CommonParser.h
libcdr::CDRParser::readWaldoRecord
void readWaldoRecord(librevenge::RVNGInputStream *input, const WaldoRecordInfo &info)
Definition: CDRParser.cpp:384
libcdr::CDRParser::m_arrows
std::map< unsigned, CDRPath > m_arrows
Definition: CDRParser.h:104
libcdr::CDRParser::readPpdt
void readPpdt(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2369
libcdr::CDRParser::readTxsm6
void readTxsm6(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:3107
libcdr::CDRParser::readTxsm
void readTxsm(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2828
libcdr::WaldoRecordInfo
Definition: CDRTypes.h:268
libcdr::CDRParser::readParagraphText
void readParagraphText(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:3386
libcdr::CDRParser::readFtil
void readFtil(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2394
libcdr::CDRParser::readArrw
void readArrw(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:1431
libcdr::CDRParser::readWaldoOutl
void readWaldoOutl(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:1535
libcdr::CDRParser::readPath
void readPath(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:1402
libcdr::CDRParser::readStlt
void readStlt(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2552
libcdr::CDRParser
Definition: CDRParser.h:27
libcdr::CDRParser::readSpnd
void readSpnd(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2471
libcdr::CDRParser::readTrfd
void readTrfd(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:1662
libcdr::CDRParser::operator=
CDRParser & operator=(const CDRParser &)
libcdr::CDRParser::readColor
CDRColor readColor(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:685
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:287
libcdr::CDRParser::m_lineStyles
std::map< unsigned, CDRLineStyle > m_lineStyles
Definition: CDRParser.h:103
CDRTypes.h
libcdr::CDRParser::readTxsm5
void readTxsm5(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:3181
libcdr::CDRParser::readOutl
void readOutl(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2022
libcdr::CDRColor
Definition: CDRTypes.h:52
libcdr::CDRParser::readWaldoLoda
void readWaldoLoda(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:450
libcdr::CDRParser::readPageSize
void readPageSize(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:2264
libcdr::CDRParser::readPolygonTransform
void readPolygonTransform(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:2245
libcdr::CDRParser::parseRecords
bool parseRecords(librevenge::RVNGInputStream *input, const std::vector< unsigned > &blockLengths=std::vector< unsigned >(), unsigned level=0)
Definition: CDRParser.cpp:487
libcdr::CDRParser::readBitmap
void readBitmap(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:1467
libcdr::CDRParser::readRectangle
void readRectangle(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:1158
libcdr::CDRParser::parseWaldo
bool parseWaldo(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:165
libcdr::CDRParser::readBBox
void readBBox(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2460
libcdr::CDRParser::_readX6StyleString
void _readX6StyleString(librevenge::RVNGInputStream *input, unsigned length, CDRStyle &style)
Definition: CDRParser.cpp:3394
libcdr::CDRParser::readBmp
void readBmp(librevenge::RVNGInputStream *input, unsigned length)
Definition: CDRParser.cpp:2290
libcdr::CDRStyle
Definition: CDRTypes.h:136
libcdr::CDRParser::readUdta
void readUdta(librevenge::RVNGInputStream *input)
Definition: CDRParser.cpp:3255
libcdr::CDRCollector
Definition: CDRCollector.h:63