VSDParser.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

VSDParser.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 libvisio 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 __VSDPARSER_H__
11 #define __VSDPARSER_H__
12
13 #include <stdio.h>
14 #include <iostream>
15 #include <vector>
16 #include <stack>
17 #include <map>
18 #include <librevenge/librevenge.h>
19 #include "VSDTypes.h"
20 #include "VSDGeometryList.h"
21 #include "VSDFieldList.h"
22 #include "VSDCharacterList.h"
23 #include "VSDParagraphList.h"
24 #include "VSDShapeList.h"
25 #include "VSDLayerList.h"
26 #include "VSDStencils.h"
27
28 namespace libvisio
29 {
30
31 class VSDCollector;
32
33 struct Pointer
34 {
35 Pointer()
36 : Type(0), Offset(0), Length(0), Format(0), ListSize(0) {}
37 Pointer(const Pointer &ptr)
38 : Type(ptr.Type), Offset(ptr.Offset), Length(ptr.Length), Format(ptr.Format), ListSize(ptr.ListSize) {}
39 unsigned Type;
40 unsigned Offset;
41 unsigned Length;
42 unsigned short Format;
43 unsigned ListSize;
44 };
45
46 class VSDParser
47 {
48 public:
49 explicit VSDParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter, librevenge::RVNGInputStream *container = 0);
50 virtual ~VSDParser();
51 bool parseMain();
52 bool extractStencils();
53
54 protected:
55 // reader functions
56 void readEllipticalArcTo(librevenge::RVNGInputStream *input);
57 void readForeignData(librevenge::RVNGInputStream *input);
58 void readEllipse(librevenge::RVNGInputStream *input);
59 virtual void readLine(librevenge::RVNGInputStream *input);
60 virtual void readFillAndShadow(librevenge::RVNGInputStream *input);
61 virtual void readGeomList(librevenge::RVNGInputStream *input);
62 void readGeometry(librevenge::RVNGInputStream *input);
63 void readMoveTo(librevenge::RVNGInputStream *input);
64 void readLineTo(librevenge::RVNGInputStream *input);
65 void readArcTo(librevenge::RVNGInputStream *input);
66 void readNURBSTo(librevenge::RVNGInputStream *input);
67 void readPolylineTo(librevenge::RVNGInputStream *input);
68 void readInfiniteLine(librevenge::RVNGInputStream *input);
69 void readShapeData(librevenge::RVNGInputStream *input);
70 void readXFormData(librevenge::RVNGInputStream *input);
71 void readXForm1D(librevenge::RVNGInputStream *input);
72 void readTxtXForm(librevenge::RVNGInputStream *input);
73 void readShapeId(librevenge::RVNGInputStream *input);
74 virtual void readShapeList(librevenge::RVNGInputStream *input);
75 void readForeignDataType(librevenge::RVNGInputStream *input);
76 void readPageProps(librevenge::RVNGInputStream *input);
77 virtual void readShape(librevenge::RVNGInputStream *input);
78 void readColours(librevenge::RVNGInputStream *input);
79 void readFont(librevenge::RVNGInputStream *input);
80 void readFontIX(librevenge::RVNGInputStream *input);
81 virtual void readCharList(librevenge::RVNGInputStream *input);
82 virtual void readParaList(librevenge::RVNGInputStream *input);
83 virtual void readPropList(librevenge::RVNGInputStream *input);
84 virtual void readPage(librevenge::RVNGInputStream *input);
85 virtual void readText(librevenge::RVNGInputStream *input);
86 virtual void readCharIX(librevenge::RVNGInputStream *input);
87 virtual void readParaIX(librevenge::RVNGInputStream *input);
88 virtual void readTextBlock(librevenge::RVNGInputStream *input);
89 virtual void readTabsDataList(librevenge::RVNGInputStream *input);
90 virtual void readTabsData(librevenge::RVNGInputStream *input);
91
92 void readNameList(librevenge::RVNGInputStream *input);
93 virtual void readName(librevenge::RVNGInputStream *input);
94
95 virtual void readNameList2(librevenge::RVNGInputStream *input);
96 virtual void readName2(librevenge::RVNGInputStream *input);
97
98 virtual void readFieldList(librevenge::RVNGInputStream *input);
99 virtual void readTextField(librevenge::RVNGInputStream *input);
100
101 virtual void readStyleSheet(librevenge::RVNGInputStream *input);
102 void readPageSheet(librevenge::RVNGInputStream *input);
103
104 void readSplineStart(librevenge::RVNGInputStream *input);
105 void readSplineKnot(librevenge::RVNGInputStream *input);
106
107 void readStencilShape(librevenge::RVNGInputStream *input);
108
109 void readOLEList(librevenge::RVNGInputStream *input);
110 void readOLEData(librevenge::RVNGInputStream *input);
111
112 virtual void readNameIDX(librevenge::RVNGInputStream *input);
113 virtual void readNameIDX123(librevenge::RVNGInputStream *input);
114
115 void readMisc(librevenge::RVNGInputStream *input);
116
117 virtual void readLayerList(librevenge::RVNGInputStream *input);
118 virtual void readLayer(librevenge::RVNGInputStream *input);
119 virtual void readLayerMem(librevenge::RVNGInputStream *input);
120
121 // parser of one pass
122 bool parseDocument(librevenge::RVNGInputStream *input, unsigned shift);
123
124 void parseMetaData();
125
126 // Stream handlers
127 void handleStreams(librevenge::RVNGInputStream *input, unsigned ptrType, unsigned shift, unsigned level);
128 void handleStream(const Pointer &ptr, unsigned idx, unsigned level);
129 void handleChunks(librevenge::RVNGInputStream *input, unsigned level);
130 void handleChunk(librevenge::RVNGInputStream *input);
131 void handleBlob(librevenge::RVNGInputStream *input, unsigned shift, unsigned level);
132
133 virtual void readPointer(librevenge::RVNGInputStream *input, Pointer &ptr);
134 virtual void readPointerInfo(librevenge::RVNGInputStream *input, unsigned ptrType, unsigned shift, unsigned &listSize, int &pointerCount);
135 virtual bool getChunkHeader(librevenge::RVNGInputStream *input);
136 void _handleLevelChange(unsigned level);
137 Colour _colourFromIndex(unsigned idx);
138 void _flushShape();
139 void _nameFromId(VSDName &name, unsigned id, unsigned level);
140
141 virtual unsigned getUInt(librevenge::RVNGInputStream *input);
142 virtual int getInt(librevenge::RVNGInputStream *input);
143
144 librevenge::RVNGInputStream *m_input;
145 librevenge::RVNGDrawingInterface *m_painter;
146 librevenge::RVNGInputStream *m_container;
147 ChunkHeader m_header;
148 VSDCollector *m_collector;
149 VSDShapeList m_shapeList;
150 unsigned m_currentLevel;
151
152 VSDStencils m_stencils;
153 VSDStencil *m_currentStencil;
154 VSDShape m_shape;
155 bool m_isStencilStarted;
156 bool m_isInStyles;
157 unsigned m_currentShapeLevel;
158 unsigned m_currentShapeID;
159
160 unsigned m_currentLayerListLevel;
161
162 bool m_extractStencils;
163 std::vector<Colour> m_colours;
164
165 bool m_isBackgroundPage;
166 bool m_isShapeStarted;
167
168 double m_shadowOffsetX;
169 double m_shadowOffsetY;
170
171 VSDGeometryList *m_currentGeometryList;
172 unsigned m_currentGeomListCount;
173
174 std::map<unsigned, VSDName> m_fonts;
175 std::map<unsigned, VSDName> m_names;
176 std::map<unsigned, std::map<unsigned, VSDName> > m_namesMapMap;
177 VSDName m_currentPageName;
178
179 std::map<unsigned, VSDTabStop> *m_currentTabSet;
180
181 private:
182 VSDParser();
183 VSDParser(const VSDParser &);
184 VSDParser &operator=(const VSDParser &);
185
186 };
187
188 } // namespace libvisio
189
190 #endif // __VSDPARSER_H__
191 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libvisio::VSDParser::readParaIX
virtual void readParaIX(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1905
libvisio::VSDParser::m_input
librevenge::RVNGInputStream * m_input
Definition: VSDParser.h:144
libvisio::VSDParser::readPageSheet
void readPageSheet(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1810
libvisio::VSDParser::~VSDParser
virtual ~VSDParser()
Definition: VSDParser.cpp:33
libvisio::VSDShape
Definition: VSDStencils.h:26
libvisio::VSDParser::readNameIDX
virtual void readNameIDX(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:790
libvisio::VSDParser::m_currentLevel
unsigned m_currentLevel
Definition: VSDParser.h:150
libvisio::VSDParser::m_container
librevenge::RVNGInputStream * m_container
Definition: VSDParser.h:146
libvisio::VSDParser::readLineTo
void readLineTo(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1076
libvisio::VSDParser::readFont
void readFont(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1709
libvisio::VSDParser::readSplineStart
void readSplineStart(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1636
libvisio::VSDParser::readPointer
virtual void readPointer(librevenge::RVNGInputStream *input, Pointer &ptr)
Definition: VSDParser.cpp:195
libvisio::VSDParser::readFillAndShadow
virtual void readFillAndShadow(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1990
libvisio::VSDParser::readNameIDX123
virtual void readNameIDX123(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:810
libvisio::VSDParser::m_isShapeStarted
bool m_isShapeStarted
Definition: VSDParser.h:166
libvisio::VSDParser::VSDParser
VSDParser()
libvisio::VSDParser::handleStream
void handleStream(const Pointer &ptr, unsigned idx, unsigned level)
Definition: VSDParser.cpp:286
libvisio::VSDParser::readOLEList
void readOLEList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:757
libvisio::VSDParser::readGeometry
void readGeometry(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1054
libvisio::VSDParser::m_isBackgroundPage
bool m_isBackgroundPage
Definition: VSDParser.h:165
libvisio::VSDParser::m_shapeList
VSDShapeList m_shapeList
Definition: VSDParser.h:149
libvisio::VSDParser::readText
virtual void readText(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1816
libvisio::VSDParser::readPolylineTo
void readPolylineTo(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1458
libvisio::Pointer::Offset
unsigned Offset
Definition: VSDParser.h:40
libvisio::VSDParser::handleChunk
void handleChunk(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:439
libvisio::VSDParser::m_currentLayerListLevel
unsigned m_currentLayerListLevel
Definition: VSDParser.h:160
libvisio::Colour
Definition: VSDTypes.h:73
libvisio::Pointer
Definition: VSDParser.h:33
libvisio::VSDParser::readPageProps
void readPageProps(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1214
libvisio::VSDParser::m_header
ChunkHeader m_header
Definition: VSDParser.h:147
libvisio::VSDParser::parseMetaData
void parseMetaData()
Definition: VSDParser.cpp:150
libvisio::VSDParser::m_shadowOffsetX
double m_shadowOffsetX
Definition: VSDParser.h:168
libvisio::VSDParser::m_colours
std::vector< Colour > m_colours
Definition: VSDParser.h:163
libvisio::VSDParser::_colourFromIndex
Colour _colourFromIndex(unsigned idx)
Definition: VSDParser.cpp:2161
libvisio::VSDParser::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition: VSDParser.h:145
libvisio::VSDParser::parseDocument
bool parseDocument(librevenge::RVNGInputStream *input, unsigned shift)
Definition: VSDParser.cpp:176
libvisio::VSDParser::m_currentPageName
VSDName m_currentPageName
Definition: VSDParser.h:177
libvisio::VSDParser::m_currentShapeLevel
unsigned m_currentShapeLevel
Definition: VSDParser.h:157
libvisio::VSDParser::readNameList2
virtual void readNameList2(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1668
VSDParagraphList.h
libvisio::VSDParser::handleChunks
void handleChunks(librevenge::RVNGInputStream *input, unsigned level)
Definition: VSDParser.cpp:421
libvisio::VSDParser::readInfiniteLine
void readInfiniteLine(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1557
libvisio::VSDParser::readColours
void readColours(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1690
VSDCharacterList.h
libvisio::VSDParser::readPage
virtual void readPage(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1047
libvisio::VSDParser::readNURBSTo
void readNURBSTo(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1299
libvisio::VSDParser::m_fonts
std::map< unsigned, VSDName > m_fonts
Definition: VSDParser.h:174
VSDGeometryList.h
libvisio::VSDParser::readShapeList
virtual void readShapeList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1164
libvisio::VSDStencils
Definition: VSDStencils.h:78
libvisio::VSDParser::_flushShape
void _flushShape()
Definition: VSDParser.cpp:615
libvisio::VSDParser
Definition: VSDParser.h:46
libvisio::VSDParser::readStencilShape
void readStencilShape(librevenge::RVNGInputStream *input)
libvisio::VSDCollector
Definition: VSDCollector.h:20
libvisio::VSDParser::m_currentTabSet
std::map< unsigned, VSDTabStop > * m_currentTabSet
Definition: VSDParser.h:179
libvisio::Pointer::Length
unsigned Length
Definition: VSDParser.h:41
libvisio::VSDParser::m_currentStencil
VSDStencil * m_currentStencil
Definition: VSDParser.h:153
libvisio::VSDParser::readCharIX
virtual void readCharIX(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1838
libvisio::VSDParser::handleStreams
void handleStreams(librevenge::RVNGInputStream *input, unsigned ptrType, unsigned shift, unsigned level)
Definition: VSDParser.cpp:215
libvisio::VSDParser::readSplineKnot
void readSplineKnot(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1651
VSDStencils.h
libvisio::VSDParser::readParaList
virtual void readParaList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:947
VSDTypes.h
libvisio::VSDParser::m_currentShapeID
unsigned m_currentShapeID
Definition: VSDParser.h:158
libvisio::VSDParser::m_currentGeometryList
VSDGeometryList * m_currentGeometryList
Definition: VSDParser.h:171
libvisio::VSDParser::readFontIX
void readFontIX(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1726
libvisio::VSDParser::readShape
virtual void readShape(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1242
libvisio::VSDParser::handleBlob
void handleBlob(librevenge::RVNGInputStream *input, unsigned shift, unsigned level)
Definition: VSDParser.cpp:405
VSDFieldList.h
libvisio::VSDParser::readLayer
virtual void readLayer(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1007
libvisio::Pointer::ListSize
unsigned ListSize
Definition: VSDParser.h:43
libvisio::VSDParser::m_shadowOffsetY
double m_shadowOffsetY
Definition: VSDParser.h:169
libvisio::VSDParser::_handleLevelChange
void _handleLevelChange(unsigned level)
Definition: VSDParser.cpp:692
libvisio::VSDParser::readEllipse
void readEllipse(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:826
libvisio::VSDParser::readArcTo
void readArcTo(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1087
libvisio::VSDParser::m_isStencilStarted
bool m_isStencilStarted
Definition: VSDParser.h:155
libvisio::VSDParser::readTxtXForm
void readTxtXForm(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1135
libvisio::VSDParser::m_namesMapMap
std::map< unsigned, std::map< unsigned, VSDName > > m_namesMapMap
Definition: VSDParser.h:176
libvisio::VSDParser::readLayerList
virtual void readLayerList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:989
libvisio::VSDParser::readOLEData
void readOLEData(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:761
libvisio::VSDParser::readLine
virtual void readLine(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:845
VSDShapeList.h
libvisio::VSDParser::_nameFromId
void _nameFromId(VSDName &name, unsigned id, unsigned level)
Definition: VSDParser.cpp:37
libvisio::VSDParser::readForeignData
void readForeignData(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:743
libvisio::VSDParser::readLayerMem
virtual void readLayerMem(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1030
libvisio::VSDStencil
Definition: VSDStencils.h:62
libvisio::VSDParser::readPointerInfo
virtual void readPointerInfo(librevenge::RVNGInputStream *input, unsigned ptrType, unsigned shift, unsigned &listSize, int &pointerCount)
Definition: VSDParser.cpp:204
libvisio::VSDParser::readTextBlock
virtual void readTextBlock(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:869
libvisio::VSDParser::getChunkHeader
virtual bool getChunkHeader(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:49
libvisio::VSDParser::readXForm1D
void readXForm1D(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1120
VSDLayerList.h
libvisio
Definition: libvisio_utils.h:73
libvisio::VSDParser::readName2
virtual void readName2(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:2068
libvisio::VSDParser::readMisc
void readMisc(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:2152
libvisio::VSDParser::readXFormData
void readXFormData(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1100
libvisio::ChunkHeader
Definition: VSDTypes.h:61
libvisio::VSDParser::readTabsDataList
virtual void readTabsDataList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:971
libvisio::VSDParser::readNameList
void readNameList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1663
libvisio::VSDParser::m_currentGeomListCount
unsigned m_currentGeomListCount
Definition: VSDParser.h:172
libvisio::VSDParser::readStyleSheet
virtual void readStyleSheet(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1798
libvisio::VSDParser::m_stencils
VSDStencils m_stencils
Definition: VSDParser.h:152
libvisio::Pointer::Type
unsigned Type
Definition: VSDParser.h:39
libvisio::VSDParser::getUInt
virtual unsigned getUInt(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:2168
libvisio::VSDParser::extractStencils
bool extractStencils()
Definition: VSDParser.cpp:189
libvisio::VSDParser::readShapeId
void readShapeId(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1156
libvisio::VSDShapeList
Definition: VSDShapeList.h:19
libvisio::VSDParser::m_shape
VSDShape m_shape
Definition: VSDParser.h:154
libvisio::Pointer::Pointer
Pointer(const Pointer &ptr)
Definition: VSDParser.h:37
libvisio::VSDParser::readEllipticalArcTo
void readEllipticalArcTo(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:723
libvisio::VSDParser::operator=
VSDParser & operator=(const VSDParser &)
libvisio::Pointer::Format
unsigned short Format
Definition: VSDParser.h:42
libvisio::VSDParser::readFieldList
virtual void readFieldList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1673
libvisio::VSDParser::readForeignDataType
void readForeignDataType(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1186
libvisio::VSDParser::readName
virtual void readName(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:2057
libvisio::VSDParser::m_extractStencils
bool m_extractStencils
Definition: VSDParser.h:162
libvisio::VSDParser::readTabsData
virtual void readTabsData(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:776
libvisio::VSDName
Definition: VSDTypes.h:179
libvisio::VSDParser::parseMain
bool parseMain()
Definition: VSDParser.cpp:105
libvisio::VSDParser::m_collector
VSDCollector * m_collector
Definition: VSDParser.h:148
libvisio::VSDParser::readPropList
virtual void readPropList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:967
libvisio::Pointer::Pointer
Pointer()
Definition: VSDParser.h:35
libvisio::VSDParser::getInt
virtual int getInt(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:2173
libvisio::VSDParser::readTextField
virtual void readTextField(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:2083
libvisio::VSDParser::readCharList
virtual void readCharList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:927
libvisio::VSDParser::readGeomList
virtual void readGeomList(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:899
libvisio::VSDParser::readMoveTo
void readMoveTo(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1065
libvisio::VSDGeometryList
Definition: VSDGeometryList.h:47
libvisio::VSDParser::m_isInStyles
bool m_isInStyles
Definition: VSDParser.h:156
libvisio::VSDParser::readShapeData
void readShapeData(librevenge::RVNGInputStream *input)
Definition: VSDParser.cpp:1571
libvisio::VSDParser::m_names
std::map< unsigned, VSDName > m_names
Definition: VSDParser.h:175