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 <librevenge/librevenge.h>
15 
16 #define FROM_OPTIONAL(t, u) !!t ? t.get() : u
17 #define ASSIGN_OPTIONAL(t, u) if(!!t) u = t.get()
18 #define MINUS_ONE (unsigned)-1
19 
20 namespace libvisio
21 {
22 struct 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) : pinX(xform.pinX), pinY(xform.pinY), height(xform.height),
39  width(xform.width), pinLocX(xform.pinLocX), pinLocY(xform.pinLocY), angle(xform.angle),
40  flipX(xform.flipX), flipY(xform.flipY), x(xform.x), y(xform.y) {}
41 
42 };
43 
44 struct XForm1D
45 {
46  double beginX;
47  double beginY;
48  unsigned beginId;
49  double endX;
50  double endY;
51  unsigned endId;
52  XForm1D() : beginX(0.0), beginY(0.0), beginId(MINUS_ONE),
53  endX(0.0), endY(0.0), endId(MINUS_ONE) {}
54  XForm1D(const XForm1D &xform1d) : beginX(xform1d.beginX),
55  beginY(xform1d.beginY), beginId(xform1d.beginId),
56  endX(xform1d.endX), endY(xform1d.endY), endId(xform1d.endId) {}
57 };
58 
59 // Utilities
61 {
62  ChunkHeader() : chunkType(0), id(0), list(0), dataLength(0), level(0), unknown(0), trailer(0) {}
63  unsigned chunkType; // 4 bytes
64  unsigned id; // 4 bytes
65  unsigned list; // 4 bytes
66  unsigned dataLength; // 4 bytes
67  unsigned short level; // 2 bytes
68  unsigned char unknown; // 1 byte
69  unsigned trailer; // Derived
70 };
71 
72 struct Colour
73 {
74  Colour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
75  : r(red), g(green), b(blue), a(alpha) {}
76  Colour() : r(0), g(0), b(0), a(0) {}
77  inline bool operator==(const Colour &col)
78  {
79  return ((r == col.r) && (g == col.g) && (b == col.b) && (a == col.a));
80  }
81  inline bool operator!=(const Colour &col)
82  {
83  return !operator==(col);
84  }
85  inline bool operator!()
86  {
87  return (!r && !g && !b && !a);
88  }
89  unsigned char r;
90  unsigned char g;
91  unsigned char b;
92  unsigned char a;
93 };
94 
95 struct NURBSData
96 {
97  double lastKnot;
98  unsigned degree;
99  unsigned char xType;
100  unsigned char yType;
101  std::vector<double> knots;
102  std::vector<double> weights;
103  std::vector<std::pair<double, double> > points;
105  : lastKnot(0.0),
106  degree(0),
107  xType(0x00),
108  yType(0x00),
109  knots(),
110  weights(),
111  points() {}
112  NURBSData(const NURBSData &data)
113  : lastKnot(data.lastKnot),
114  degree(data.degree),
115  xType(data.xType),
116  yType(data.yType),
117  knots(data.knots),
118  weights(data.weights),
119  points(data.points) {}
120 };
121 
123 {
124  unsigned char xType;
125  unsigned char yType;
126  std::vector<std::pair<double, double> > points;
128  : xType(0x00),
129  yType(0x00),
130  points() {}
131 };
132 
133 
135 {
136  unsigned typeId;
137  unsigned dataId;
138  unsigned type;
139  unsigned format;
140  double offsetX;
141  double offsetY;
142  double width;
143  double height;
144  librevenge::RVNGBinaryData data;
146  : typeId(0),
147  dataId(0),
148  type(0),
149  format(0),
150  offsetX(0.0),
151  offsetY(0.0),
152  width(0.0),
153  height(0.0),
154  data() {}
155 };
156 
158 {
176 };
177 
178 class VSDName
179 {
180 public:
181  VSDName(const librevenge::RVNGBinaryData &data, TextFormat format)
182  : m_data(data),
183  m_format(format) {}
185  VSDName(const VSDName &name) : m_data(name.m_data), m_format(name.m_format) {}
186  bool empty() const
187  {
188  return !m_data.size();
189  }
190  librevenge::RVNGBinaryData m_data;
192 };
193 
194 struct VSDFont
195 {
196  librevenge::RVNGString m_name;
198  VSDFont() : m_name("Arial"), m_encoding(libvisio::VSD_TEXT_ANSI) {}
199  VSDFont(const librevenge::RVNGString &name, const TextFormat &encoding) :
200  m_name(name), m_encoding(encoding) {}
201  VSDFont(const VSDFont &font) :
202  m_name(font.m_name), m_encoding(font.m_encoding) {}
203 };
204 
205 struct VSDMisc
206 {
208  VSDMisc() : m_hideText(false) {}
209  VSDMisc(const VSDMisc &misc) : m_hideText(misc.m_hideText) {}
210 };
211 
212 } // namespace libvisio
213 
214 #endif /* VSDTYPES_H */
215 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: VSDTypes.h:168
unsigned id
Definition: VSDTypes.h:64
VSDFont()
Definition: VSDTypes.h:198
VSDName(const librevenge::RVNGBinaryData &data, TextFormat format)
Definition: VSDTypes.h:181
double beginY
Definition: VSDTypes.h:47
librevenge::RVNGString m_name
Definition: VSDTypes.h:196
librevenge::RVNGBinaryData m_data
Definition: VSDTypes.h:190
Colour()
Definition: VSDTypes.h:76
Definition: VSDTypes.h:172
double x
Definition: VSDTypes.h:33
std::vector< double > weights
Definition: VSDTypes.h:102
TextFormat m_format
Definition: VSDTypes.h:191
double width
Definition: VSDTypes.h:27
bool m_hideText
Definition: VSDTypes.h:207
unsigned char xType
Definition: VSDTypes.h:124
Definition: VSDTypes.h:160
Definition: VSDTypes.h:95
XForm1D()
Definition: VSDTypes.h:52
Definition: VSDTypes.h:72
Definition: VSDTypes.h:166
PolylineData()
Definition: VSDTypes.h:127
double offsetY
Definition: VSDTypes.h:141
unsigned char b
Definition: VSDTypes.h:91
unsigned chunkType
Definition: VSDTypes.h:63
XForm()
Definition: VSDTypes.h:35
librevenge::RVNGBinaryData data
Definition: VSDTypes.h:144
bool operator!=(const Colour &col)
Definition: VSDTypes.h:81
TextFormat m_encoding
Definition: VSDTypes.h:197
Definition: VSDTypes.h:174
VSDMisc(const VSDMisc &misc)
Definition: VSDTypes.h:209
bool flipX
Definition: VSDTypes.h:31
Definition: VSDTypes.h:205
double pinLocX
Definition: VSDTypes.h:28
double angle
Definition: VSDTypes.h:30
bool empty() const
Definition: VSDTypes.h:186
Definition: VSDTypes.h:164
ForeignData()
Definition: VSDTypes.h:145
double pinLocY
Definition: VSDTypes.h:29
Definition: VSDTypes.h:162
unsigned endId
Definition: VSDTypes.h:51
unsigned char xType
Definition: VSDTypes.h:99
double offsetX
Definition: VSDTypes.h:140
NURBSData()
Definition: VSDTypes.h:104
double pinX
Definition: VSDTypes.h:24
VSDName(const VSDName &name)
Definition: VSDTypes.h:185
Definition: VSDTypes.h:170
unsigned dataId
Definition: VSDTypes.h:137
XForm(const XForm &xform)
Definition: VSDTypes.h:38
VSDFont(const librevenge::RVNGString &name, const TextFormat &encoding)
Definition: VSDTypes.h:199
Definition: VSDTypes.h:165
std::vector< double > knots
Definition: VSDTypes.h:101
unsigned format
Definition: VSDTypes.h:139
double endY
Definition: VSDTypes.h:50
Definition: VSDTypes.h:175
bool operator!()
Definition: VSDTypes.h:85
unsigned char yType
Definition: VSDTypes.h:100
double y
Definition: VSDTypes.h:34
unsigned degree
Definition: VSDTypes.h:98
unsigned char g
Definition: VSDTypes.h:90
double height
Definition: VSDTypes.h:26
TextFormat
Definition: VSDTypes.h:157
XForm1D(const XForm1D &xform1d)
Definition: VSDTypes.h:54
double lastKnot
Definition: VSDTypes.h:97
VSDName()
Definition: VSDTypes.h:184
unsigned type
Definition: VSDTypes.h:138
bool operator==(const Colour &col)
Definition: VSDTypes.h:77
Definition: VSDTypes.h:134
Definition: VSDTypes.h:163
double endX
Definition: VSDTypes.h:49
VSDFont(const VSDFont &font)
Definition: VSDTypes.h:201
unsigned char a
Definition: VSDTypes.h:92
#define MINUS_ONE
Definition: VSDTypes.h:18
Definition: libvisio_utils.h:68
double beginX
Definition: VSDTypes.h:46
std::vector< std::pair< double, double > > points
Definition: VSDTypes.h:126
Definition: VSDTypes.h:60
std::vector< std::pair< double, double > > points
Definition: VSDTypes.h:103
unsigned char unknown
Definition: VSDTypes.h:68
Definition: VSDTypes.h:173
Colour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
Definition: VSDTypes.h:74
Definition: VSDTypes.h:161
Definition: VSDTypes.h:171
NURBSData(const NURBSData &data)
Definition: VSDTypes.h:112
unsigned beginId
Definition: VSDTypes.h:48
unsigned list
Definition: VSDTypes.h:65
double height
Definition: VSDTypes.h:143
Definition: VSDTypes.h:44
ChunkHeader()
Definition: VSDTypes.h:62
Definition: VSDTypes.h:122
bool flipY
Definition: VSDTypes.h:32
unsigned short level
Definition: VSDTypes.h:67
Definition: VSDTypes.h:22
unsigned dataLength
Definition: VSDTypes.h:66
unsigned char yType
Definition: VSDTypes.h:125
unsigned char r
Definition: VSDTypes.h:89
double pinY
Definition: VSDTypes.h:25
Definition: VSDTypes.h:178
VSDMisc()
Definition: VSDTypes.h:208
Definition: VSDTypes.h:194
double width
Definition: VSDTypes.h:142
Definition: VSDTypes.h:159
Definition: VSDTypes.h:169
unsigned trailer
Definition: VSDTypes.h:69
unsigned typeId
Definition: VSDTypes.h:136
Definition: VSDTypes.h:167

Generated for libvisio by doxygen 1.8.9.1