CDRParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libcdr
3  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License or as specified alternatively below. You may obtain a copy of
8  * the License at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * Major Contributor(s):
16  * Copyright (C) 2011 Fridrich Strba <fridrich.strba@bluewin.ch>
17  *
18  *
19  * All Rights Reserved.
20  *
21  * For minor contributions see the git repository.
22  *
23  * Alternatively, the contents of this file may be used under the terms of
24  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
25  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
26  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
27  * instead of those above.
28  */
29 
30 #ifndef __CDRPARSER_H__
31 #define __CDRPARSER_H__
32 
33 #include <stdio.h>
34 #include <iostream>
35 #include <vector>
36 #include <map>
37 #include <stack>
38 #include <libwpd-stream/libwpd-stream.h>
39 #include "CDRTypes.h"
40 #include "CommonParser.h"
41 
42 namespace libcdr
43 {
44 
45 class CDRCollector;
46 
47 class CDRParser : protected CommonParser
48 {
49 public:
50  explicit CDRParser(const std::vector<WPXInputStream *> &externalStreams, CDRCollector *collector);
51  virtual ~CDRParser();
52  bool parseRecords(WPXInputStream *input, unsigned *blockLengths = 0, unsigned level = 0);
53  bool parseWaldo(WPXInputStream *input);
54 
55 private:
56  CDRParser();
57  CDRParser(const CDRParser &);
58  CDRParser &operator=(const CDRParser &);
59  bool parseWaldoStructure(WPXInputStream *input, std::stack<WaldoRecordType1> &waldoStack,
60  const std::map<unsigned, WaldoRecordType1> &records1,
61  std::map<unsigned, WaldoRecordInfo> &records2);
62  bool gatherWaldoInformation(WPXInputStream *input, std::vector<WaldoRecordInfo> &records, std::map<unsigned, WaldoRecordInfo> &records2,
63  std::map<unsigned, WaldoRecordInfo> &records3, std::map<unsigned, WaldoRecordInfo> &records4,
64  std::map<unsigned, WaldoRecordInfo> &records6, std::map<unsigned, WaldoRecordInfo> &records7,
65  std::map<unsigned, WaldoRecordInfo> &records8, std::map<unsigned, WaldoRecordInfo> recordsOther);
66  void readWaldoRecord(WPXInputStream *input, const WaldoRecordInfo &info);
67  bool parseRecord(WPXInputStream *input, unsigned *blockLengths = 0, unsigned level = 0);
68  void readRecord(unsigned fourCC, unsigned length, WPXInputStream *input);
69  double readRectCoord(WPXInputStream *input);
70  CDRColor readColor(WPXInputStream *input);
71 
72  void readRectangle(WPXInputStream *input);
73  void readEllipse(WPXInputStream *input);
74  void readLineAndCurve(WPXInputStream *input);
75  void readBitmap(WPXInputStream *input);
76  void readPageSize(WPXInputStream *input);
77  void readWaldoBmp(WPXInputStream *input, unsigned length, unsigned id);
78  void readWaldoBmpf(WPXInputStream *input, unsigned id);
79  void readWaldoTrfd(WPXInputStream *input);
80  void readWaldoOutl(WPXInputStream *input);
81  void readWaldoFill(WPXInputStream *input);
82  void readWaldoLoda(WPXInputStream *input, unsigned length);
83  void readOpacity(WPXInputStream *input, unsigned length);
84  void readTrfd(WPXInputStream *input, unsigned length);
85  void readFild(WPXInputStream *input, unsigned length);
86  void readOutl(WPXInputStream *input, unsigned length);
87  void readLoda(WPXInputStream *input, unsigned length);
88  void readFlags(WPXInputStream *input, unsigned length);
89  void readMcfg(WPXInputStream *input, unsigned length);
90  void readPath(WPXInputStream *input);
91  void readPolygonCoords(WPXInputStream *input);
92  void readPolygonTransform(WPXInputStream *input);
93  void readBmp(WPXInputStream *input, unsigned length);
94  void readBmpf(WPXInputStream *input, unsigned length);
95  void readPpdt(WPXInputStream *input, unsigned length);
96  void readFtil(WPXInputStream *input, unsigned length);
97  void readDisp(WPXInputStream *input, unsigned length);
98  void readVersion(WPXInputStream *input, unsigned length);
99  void readIccd(WPXInputStream *input, unsigned length);
100  void readBBox(WPXInputStream *input, unsigned length);
101  void readSpnd(WPXInputStream *input, unsigned length);
102  void readVpat(WPXInputStream *input, unsigned length);
103  void readUidr(WPXInputStream *input, unsigned length);
104  void readFont(WPXInputStream *input, unsigned length);
105  void readStlt(WPXInputStream *input, unsigned length);
106  void readStyd(WPXInputStream *input);
107  void readTxsm(WPXInputStream *input, unsigned length);
108  void readTxsm16(WPXInputStream *input);
109  void readTxsm6(WPXInputStream *input);
110  void readTxsm5(WPXInputStream *input);
111  void readArtisticText(WPXInputStream *input);
112  void readParagraphText(WPXInputStream *input);
113 
114  bool _redirectX6Chunk(WPXInputStream **input, unsigned &length);
115 
116  std::vector<WPXInputStream *> m_externalStreams;
117 
118  std::map<unsigned, CDRFont> m_fonts;
119  std::map<unsigned, CDRFillStyle> m_fillStyles;
120  std::map<unsigned, CDRLineStyle> m_lineStyles;
121 
122  unsigned m_version;
123 
124 };
125 
126 } // namespace libcdr
127 
128 #endif // __CDRPARSER_H__
129 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
void readSpnd(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2463
void readUidr(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2485
void readIccd(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2437
void readTrfd(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:1659
void readBitmap(WPXInputStream *input)
Definition: CDRParser.cpp:1481
Definition: CommonParser.h:43
void readWaldoTrfd(WPXInputStream *input)
Definition: CDRParser.cpp:508
void readStlt(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2544
void readStyd(WPXInputStream *input)
Definition: CDRParser.cpp:3233
void readWaldoLoda(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:548
void readFlags(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2144
void readWaldoFill(WPXInputStream *input)
Definition: CDRParser.cpp:1566
double readRectCoord(WPXInputStream *input)
Definition: CDRParser.cpp:772
virtual ~CDRParser()
Definition: CDRParser.cpp:259
void readVersion(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2401
void readLoda(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2058
void readWaldoBmp(WPXInputStream *input, unsigned length, unsigned id)
Definition: CDRParser.cpp:2229
void readBBox(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2452
bool parseRecord(WPXInputStream *input, unsigned *blockLengths=0, unsigned level=0)
Definition: CDRParser.cpp:600
void readPpdt(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2366
void readPolygonTransform(WPXInputStream *input)
Definition: CDRParser.cpp:2203
unsigned m_version
Definition: CDRParser.h:122
void readMcfg(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2152
void readDisp(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:1397
CDRColor readColor(WPXInputStream *input)
Definition: CDRParser.cpp:779
std::map< unsigned, CDRFont > m_fonts
Definition: CDRParser.h:118
void readFild(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:1743
void readBmp(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2248
void readEllipse(WPXInputStream *input)
Definition: CDRParser.cpp:1335
bool parseWaldo(WPXInputStream *input)
Definition: CDRParser.cpp:264
void readOpacity(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2307
std::map< unsigned, CDRFillStyle > m_fillStyles
Definition: CDRParser.h:119
void readTxsm(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2826
void readWaldoBmpf(WPXInputStream *input, unsigned id)
Definition: CDRParser.cpp:2343
bool parseRecords(WPXInputStream *input, unsigned *blockLengths=0, unsigned level=0)
Definition: CDRParser.cpp:585
void readRectangle(WPXInputStream *input)
Definition: CDRParser.cpp:1225
void readVpat(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2471
void readOutl(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2009
Definition: CDRTypes.h:274
void readFtil(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2386
bool parseWaldoStructure(WPXInputStream *input, std::stack< WaldoRecordType1 > &waldoStack, const std::map< unsigned, WaldoRecordType1 > &records1, std::map< unsigned, WaldoRecordInfo > &records2)
Definition: CDRParser.cpp:437
std::vector< WPXInputStream * > m_externalStreams
Definition: CDRParser.h:116
void readTxsm16(WPXInputStream *input)
Definition: CDRParser.cpp:2997
bool gatherWaldoInformation(WPXInputStream *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:386
void readBmpf(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2317
void readTxsm5(WPXInputStream *input)
Definition: CDRParser.cpp:3163
void readPageSize(WPXInputStream *input)
Definition: CDRParser.cpp:2222
Definition: CDRParser.h:47
bool _redirectX6Chunk(WPXInputStream **input, unsigned &length)
Definition: CDRParser.cpp:2412
CDRParser & operator=(const CDRParser &)
std::map< unsigned, CDRLineStyle > m_lineStyles
Definition: CDRParser.h:120
void readWaldoRecord(WPXInputStream *input, const WaldoRecordInfo &info)
Definition: CDRParser.cpp:482
void readFont(WPXInputStream *input, unsigned length)
Definition: CDRParser.cpp:2496
void readTxsm6(WPXInputStream *input)
Definition: CDRParser.cpp:3093
Definition: CDRTypes.h:71
void readWaldoOutl(WPXInputStream *input)
Definition: CDRParser.cpp:1542
void readParagraphText(WPXInputStream *input)
Definition: CDRParser.cpp:3334
void readPath(WPXInputStream *input)
Definition: CDRParser.cpp:1460
void readPolygonCoords(WPXInputStream *input)
Definition: CDRParser.cpp:2182
void readRecord(unsigned fourCC, unsigned length, WPXInputStream *input)
Definition: CDRParser.cpp:694
Definition: CDRCollector.h:79
void readLineAndCurve(WPXInputStream *input)
Definition: CDRParser.cpp:1440
void readArtisticText(WPXInputStream *input)
Definition: CDRParser.cpp:3327

Generated for libcdr by doxygen 1.8.5