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: */

Generated for libcdr by doxygen 1.8.1.2