VSDTypes.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 VSDTYPES_H
11#define VSDTYPES_H
12
13#include <vector>
14#include <map>
15#include <librevenge/librevenge.h>
16
17#define ASSIGN_OPTIONAL(t, u) if(!!t) u = t.get()
18#define MINUS_ONE (unsigned)-1
19
20namespace libvisio
21{
22struct XForm
23{
24 double pinX;
25 double pinY;
26 double height;
27 double width;
28 double pinLocX;
29 double pinLocY;
30 double angle;
31 bool flipX;
32 bool flipY;
33 double x;
34 double y;
35 XForm() : pinX(0.0), pinY(0.0), height(0.0), width(0.0),
36 pinLocX(0.0), pinLocY(0.0), angle(0.0),
37 flipX(false), flipY(false), x(0.0), y(0.0) {}
38 XForm(const XForm &xform) = default;
39 XForm &operator=(const XForm &xform) = default;
40};
41
42struct XForm1D
43{
44 double beginX;
45 double beginY;
46 unsigned beginId;
47 double endX;
48 double endY;
49 unsigned endId;
51 endX(0.0), endY(0.0), endId(MINUS_ONE) {}
52 XForm1D(const XForm1D &xform1d) : beginX(xform1d.beginX),
53 beginY(xform1d.beginY), beginId(xform1d.beginId),
54 endX(xform1d.endX), endY(xform1d.endY), endId(xform1d.endId) {}
55};
56
57// Utilities
59{
60 ChunkHeader() : chunkType(0), id(0), list(0), dataLength(0), level(0), unknown(0), trailer(0) {}
61 unsigned chunkType; // 4 bytes
62 unsigned id; // 4 bytes
63 unsigned list; // 4 bytes
64 unsigned dataLength; // 4 bytes
65 unsigned short level; // 2 bytes
66 unsigned char unknown; // 1 byte
67 unsigned trailer; // Derived
68};
69
70struct Colour
71{
72 Colour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
73 : r(red), g(green), b(blue), a(alpha) {}
74 Colour() : r(0), g(0), b(0), a(0) {}
75 inline bool operator==(const Colour &col) const
76 {
77 return ((r == col.r) && (g == col.g) && (b == col.b) && (a == col.a));
78 }
79 inline bool operator!=(const Colour &col) const
80 {
81 return !operator==(col);
82 }
83 inline bool operator!() const
84 {
85 return (!r && !g && !b && !a);
86 }
87 unsigned char r;
88 unsigned char g;
89 unsigned char b;
90 unsigned char a;
91};
92
94{
95 double lastKnot;
96 unsigned degree;
97 unsigned char xType;
98 unsigned char yType;
99 std::vector<double> knots;
100 std::vector<double> weights;
101 std::vector<std::pair<double, double> > points;
103 : lastKnot(0.0),
104 degree(0),
105 xType(0x00),
106 yType(0x00),
107 knots(),
108 weights(),
109 points() {}
110 NURBSData(const NURBSData &data) = default;
111 NURBSData &operator=(const NURBSData &data) = default;
112};
113
115{
116 unsigned char xType;
117 unsigned char yType;
118 std::vector<std::pair<double, double> > points;
120 : xType(0x00),
121 yType(0x00),
122 points() {}
123};
124
125
127{
128 unsigned typeId;
129 unsigned dataId;
130 unsigned type;
131 unsigned format;
132 double offsetX;
133 double offsetY;
134 double width;
135 double height;
136 librevenge::RVNGBinaryData data;
138 : typeId(0),
139 dataId(0),
140 type(0),
141 format(0),
142 offsetX(0.0),
143 offsetY(0.0),
144 width(0.0),
145 height(0.0),
146 data() {}
147};
148
169
171{
172public:
173 VSDName(const librevenge::RVNGBinaryData &data, TextFormat format)
174 : m_data(data),
175 m_format(format) {}
177 VSDName(const VSDName &name) = default;
178 VSDName &operator=(const VSDName &name) = default;
179 bool empty() const
180 {
181 return !m_data.size();
182 }
183 void clear()
184 {
185 m_data.clear();
187 }
188 librevenge::RVNGBinaryData m_data;
190};
191
193{
194 librevenge::RVNGString m_name;
197 VSDFont(const librevenge::RVNGString &name, const TextFormat &encoding) :
198 m_name(name), m_encoding(encoding) {}
199 VSDFont(const VSDFont &font) :
200 m_name(font.m_name), m_encoding(font.m_encoding) {}
201};
202
204{
206 VSDMisc() : m_hideText(false) {}
207 VSDMisc(const VSDMisc &misc) = default;
208 VSDMisc &operator=(const VSDMisc &misc) = default;
209};
210
212{
214 unsigned char m_alignment;
215 unsigned char m_leader;
217 VSDTabStop(const VSDTabStop &tabStop) :
218 m_position(tabStop.m_position), m_alignment(tabStop.m_alignment),
219 m_leader(tabStop.m_leader) {}
220};
221
223{
224 unsigned m_numChars;
225 std::map<unsigned, VSDTabStop> m_tabStops;
227 VSDTabSet(const VSDTabSet &tabSet) :
228 m_numChars(tabSet.m_numChars), m_tabStops(tabSet.m_tabStops) {}
229};
230
232{
233 librevenge::RVNGString m_bulletStr;
234 librevenge::RVNGString m_bulletFont;
242 VSDBullet(const VSDBullet &bullet) = default;
243 VSDBullet &operator=(const VSDBullet &bullet) = default;
244 inline bool operator==(const VSDBullet &bullet) const
245 {
246 return ((m_bulletStr == bullet.m_bulletStr) &&
247 (m_bulletFont == bullet.m_bulletFont) &&
250 }
251 inline bool operator!=(const VSDBullet &bullet) const
252 {
253 return !operator==(bullet);
254 }
255 inline bool operator!() const
256 {
257 return m_bulletStr.empty();
258 }
259};
260
261} // namespace libvisio
262
263#endif /* VSDTYPES_H */
264/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
#define MINUS_ONE
Definition VSDTypes.h:18
VSDName(const VSDName &name)=default
TextFormat m_format
Definition VSDTypes.h:189
VSDName(const librevenge::RVNGBinaryData &data, TextFormat format)
Definition VSDTypes.h:173
VSDName & operator=(const VSDName &name)=default
librevenge::RVNGBinaryData m_data
Definition VSDTypes.h:188
bool empty() const
Definition VSDTypes.h:179
VSDName()
Definition VSDTypes.h:176
void clear()
Definition VSDTypes.h:183
Definition libvisio_utils.h:49
TextFormat
Definition VSDTypes.h:150
@ VSD_TEXT_ARABIC
Definition VSDTypes.h:157
@ VSD_TEXT_HEBREW
Definition VSDTypes.h:156
@ VSD_TEXT_CHINESE_SIMPLIFIED
Definition VSDTypes.h:164
@ VSD_TEXT_CENTRAL_EUROPE
Definition VSDTypes.h:161
@ VSD_TEXT_THAI
Definition VSDTypes.h:160
@ VSD_TEXT_TURKISH
Definition VSDTypes.h:154
@ VSD_TEXT_SYMBOL
Definition VSDTypes.h:152
@ VSD_TEXT_RUSSIAN
Definition VSDTypes.h:159
@ VSD_TEXT_BALTIC
Definition VSDTypes.h:158
@ VSD_TEXT_KOREAN
Definition VSDTypes.h:163
@ VSD_TEXT_JAPANESE
Definition VSDTypes.h:162
@ VSD_TEXT_CHINESE_TRADITIONAL
Definition VSDTypes.h:165
@ VSD_TEXT_UTF8
Definition VSDTypes.h:166
@ VSD_TEXT_ANSI
Definition VSDTypes.h:151
@ VSD_TEXT_VIETNAMESE
Definition VSDTypes.h:155
@ VSD_TEXT_GREEK
Definition VSDTypes.h:153
@ VSD_TEXT_UTF16
Definition VSDTypes.h:167
unsigned chunkType
Definition VSDTypes.h:61
unsigned short level
Definition VSDTypes.h:65
unsigned char unknown
Definition VSDTypes.h:66
unsigned id
Definition VSDTypes.h:62
unsigned trailer
Definition VSDTypes.h:67
ChunkHeader()
Definition VSDTypes.h:60
unsigned dataLength
Definition VSDTypes.h:64
unsigned list
Definition VSDTypes.h:63
unsigned char r
Definition VSDTypes.h:87
unsigned char a
Definition VSDTypes.h:90
bool operator==(const Colour &col) const
Definition VSDTypes.h:75
Colour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
Definition VSDTypes.h:72
bool operator!=(const Colour &col) const
Definition VSDTypes.h:79
unsigned char b
Definition VSDTypes.h:89
unsigned char g
Definition VSDTypes.h:88
bool operator!() const
Definition VSDTypes.h:83
Colour()
Definition VSDTypes.h:74
ForeignData()
Definition VSDTypes.h:137
double height
Definition VSDTypes.h:135
unsigned dataId
Definition VSDTypes.h:129
librevenge::RVNGBinaryData data
Definition VSDTypes.h:136
double width
Definition VSDTypes.h:134
unsigned typeId
Definition VSDTypes.h:128
unsigned format
Definition VSDTypes.h:131
unsigned type
Definition VSDTypes.h:130
double offsetX
Definition VSDTypes.h:132
double offsetY
Definition VSDTypes.h:133
std::vector< std::pair< double, double > > points
Definition VSDTypes.h:101
std::vector< double > knots
Definition VSDTypes.h:99
std::vector< double > weights
Definition VSDTypes.h:100
NURBSData()
Definition VSDTypes.h:102
NURBSData(const NURBSData &data)=default
double lastKnot
Definition VSDTypes.h:95
unsigned degree
Definition VSDTypes.h:96
unsigned char yType
Definition VSDTypes.h:98
NURBSData & operator=(const NURBSData &data)=default
unsigned char xType
Definition VSDTypes.h:97
std::vector< std::pair< double, double > > points
Definition VSDTypes.h:118
unsigned char yType
Definition VSDTypes.h:117
unsigned char xType
Definition VSDTypes.h:116
PolylineData()
Definition VSDTypes.h:119
VSDBullet()
Definition VSDTypes.h:237
bool operator==(const VSDBullet &bullet) const
Definition VSDTypes.h:244
bool operator!() const
Definition VSDTypes.h:255
double m_bulletFontSize
Definition VSDTypes.h:235
VSDBullet(const VSDBullet &bullet)=default
bool operator!=(const VSDBullet &bullet) const
Definition VSDTypes.h:251
librevenge::RVNGString m_bulletFont
Definition VSDTypes.h:234
VSDBullet & operator=(const VSDBullet &bullet)=default
double m_textPosAfterBullet
Definition VSDTypes.h:236
librevenge::RVNGString m_bulletStr
Definition VSDTypes.h:233
VSDFont()
Definition VSDTypes.h:196
VSDFont(const VSDFont &font)
Definition VSDTypes.h:199
TextFormat m_encoding
Definition VSDTypes.h:195
librevenge::RVNGString m_name
Definition VSDTypes.h:194
VSDFont(const librevenge::RVNGString &name, const TextFormat &encoding)
Definition VSDTypes.h:197
VSDMisc()
Definition VSDTypes.h:206
bool m_hideText
Definition VSDTypes.h:205
VSDMisc & operator=(const VSDMisc &misc)=default
VSDMisc(const VSDMisc &misc)=default
std::map< unsigned, VSDTabStop > m_tabStops
Definition VSDTypes.h:225
VSDTabSet(const VSDTabSet &tabSet)
Definition VSDTypes.h:227
unsigned m_numChars
Definition VSDTypes.h:224
VSDTabSet()
Definition VSDTypes.h:226
VSDTabStop(const VSDTabStop &tabStop)
Definition VSDTypes.h:217
unsigned char m_leader
Definition VSDTypes.h:215
unsigned char m_alignment
Definition VSDTypes.h:214
VSDTabStop()
Definition VSDTypes.h:216
double m_position
Definition VSDTypes.h:213
unsigned beginId
Definition VSDTypes.h:46
double beginY
Definition VSDTypes.h:45
XForm1D(const XForm1D &xform1d)
Definition VSDTypes.h:52
unsigned endId
Definition VSDTypes.h:49
double beginX
Definition VSDTypes.h:44
double endY
Definition VSDTypes.h:48
XForm1D()
Definition VSDTypes.h:50
double endX
Definition VSDTypes.h:47
double pinX
Definition VSDTypes.h:24
double pinLocY
Definition VSDTypes.h:29
double width
Definition VSDTypes.h:27
double pinY
Definition VSDTypes.h:25
XForm()
Definition VSDTypes.h:35
double height
Definition VSDTypes.h:26
double x
Definition VSDTypes.h:33
double angle
Definition VSDTypes.h:30
XForm(const XForm &xform)=default
bool flipY
Definition VSDTypes.h:32
bool flipX
Definition VSDTypes.h:31
double pinLocX
Definition VSDTypes.h:28
double y
Definition VSDTypes.h:34
XForm & operator=(const XForm &xform)=default

Generated for libvisio by doxygen 1.14.0