Main Page
Namespaces
Classes
Files
File List
File Members
VSDTypes.h
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* libvisio
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
* Copyright (C) 2011 Eilidh McAdam <tibbylickle@gmail.com>
18
*
19
*
20
* All Rights Reserved.
21
*
22
* For minor contributions see the git repository.
23
*
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPLv2+"), or
26
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
27
* in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
28
* instead of those above.
29
*/
30
31
#ifndef VSDTYPES_H
32
#define VSDTYPES_H
33
34
#include <vector>
35
#include <libwpd/libwpd.h>
36
37
#define FROM_OPTIONAL(t, u) !!t ? t.get() : u
38
#define ASSIGN_OPTIONAL(t, u) if(!!t) u = t.get()
39
#define MINUS_ONE (unsigned)-1
40
41
namespace
libvisio
42
{
43
struct
XForm
44
{
45
double
pinX
;
46
double
pinY
;
47
double
height
;
48
double
width
;
49
double
pinLocX
;
50
double
pinLocY
;
51
double
angle
;
52
bool
flipX
;
53
bool
flipY
;
54
double
x
;
55
double
y
;
56
XForm
() :
pinX
(0.0),
pinY
(0.0),
height
(0.0),
width
(0.0),
57
pinLocX
(0.0),
pinLocY
(0.0),
angle
(0.0),
58
flipX
(false),
flipY
(false),
x
(0.0),
y
(0.0) {}
59
XForm
(
const
XForm
&xform) :
pinX
(xform.
pinX
),
pinY
(xform.
pinY
),
height
(xform.
height
),
60
width
(xform.
width
),
pinLocX
(xform.
pinLocX
),
pinLocY
(xform.
pinLocY
),
angle
(xform.
angle
),
61
flipX
(xform.
flipX
),
flipY
(xform.
flipY
),
x
(xform.
x
),
y
(xform.
y
) {}
62
63
};
64
65
// Utilities
66
struct
ChunkHeader
67
{
68
ChunkHeader
() :
chunkType
(0),
id
(0),
list
(0),
dataLength
(0),
level
(0),
unknown
(0),
trailer
(0) {}
69
unsigned
chunkType
;
// 4 bytes
70
unsigned
id
;
// 4 bytes
71
unsigned
list
;
// 4 bytes
72
unsigned
dataLength
;
// 4 bytes
73
unsigned
short
level
;
// 2 bytes
74
unsigned
char
unknown
;
// 1 byte
75
unsigned
trailer
;
// Derived
76
};
77
78
struct
Colour
79
{
80
Colour
(
unsigned
char
red,
unsigned
char
green,
unsigned
char
blue,
unsigned
char
alpha)
81
:
r
(red),
g
(green),
b
(blue),
a
(alpha) {}
82
Colour
() :
r
(0),
g
(0),
b
(0),
a
(0) {}
83
inline
bool
operator==
(
const
Colour
&col)
84
{
85
return
((
r
== col.
r
) && (
g
== col.
g
) && (
b
== col.
b
) && (
a
== col.
a
));
86
}
87
inline
bool
operator!=
(
const
Colour
&col)
88
{
89
return
!
operator==
(col);
90
}
91
inline
bool
operator!
()
92
{
93
return
(!
r
&& !
g
&& !
b
&& !
a
);
94
}
95
unsigned
char
r
;
96
unsigned
char
g
;
97
unsigned
char
b
;
98
unsigned
char
a
;
99
};
100
101
struct
NURBSData
102
{
103
double
lastKnot
;
104
unsigned
degree
;
105
unsigned
char
xType
;
106
unsigned
char
yType
;
107
std::vector<double>
knots
;
108
std::vector<double>
weights
;
109
std::vector<std::pair<double, double> >
points
;
110
NURBSData
()
111
:
lastKnot
(0.0),
112
degree
(0),
113
xType
(0x00),
114
yType
(0x00),
115
knots
(),
116
weights
(),
117
points
() {}
118
NURBSData
(
const
NURBSData
&data)
119
:
lastKnot
(data.
lastKnot
),
120
degree
(data.
degree
),
121
xType
(data.
xType
),
122
yType
(data.
yType
),
123
knots
(data.
knots
),
124
weights
(data.
weights
),
125
points
(data.
points
) {}
126
};
127
128
struct
PolylineData
129
{
130
unsigned
char
xType
;
131
unsigned
char
yType
;
132
std::vector<std::pair<double, double> >
points
;
133
PolylineData
()
134
:
xType
(0x00),
135
yType
(0x00),
136
points
() {}
137
};
138
139
140
struct
ForeignData
141
{
142
unsigned
typeId
;
143
unsigned
dataId
;
144
unsigned
type
;
145
unsigned
format
;
146
double
offsetX
;
147
double
offsetY
;
148
double
width
;
149
double
height
;
150
WPXBinaryData
data
;
151
ForeignData
()
152
:
typeId
(0),
153
dataId
(0),
154
type
(0),
155
format
(0),
156
offsetX
(0.0),
157
offsetY
(0.0),
158
width
(0.0),
159
height
(0.0),
160
data
() {}
161
};
162
163
enum
TextFormat
164
{
165
VSD_TEXT_ANSI
= 0,
166
VSD_TEXT_SYMBOL
,
167
VSD_TEXT_GREEK
,
168
VSD_TEXT_TURKISH
,
169
VSD_TEXT_VIETNAMESE
,
170
VSD_TEXT_HEBREW
,
171
VSD_TEXT_ARABIC
,
172
VSD_TEXT_BALTIC
,
173
VSD_TEXT_RUSSIAN
,
174
VSD_TEXT_THAI
,
175
VSD_TEXT_CENTRAL_EUROPE
,
176
VSD_TEXT_JAPANESE
,
177
VSD_TEXT_KOREAN
,
178
VSD_TEXT_CHINESE_SIMPLIFIED
,
179
VSD_TEXT_CHINESE_TRADITIONAL
,
180
VSD_TEXT_UTF8
,
181
VSD_TEXT_UTF16
182
};
183
184
class
VSDName
185
{
186
public
:
187
VSDName
(
const
WPXBinaryData &data,
TextFormat
format)
188
:
m_data
(data),
189
m_format
(format) {}
190
VSDName
() :
m_data
(),
m_format
(
VSD_TEXT_ANSI
) {}
191
VSDName
(
const
VSDName
&name) :
m_data
(name.
m_data
),
m_format
(name.
m_format
) {}
192
bool
empty
()
const
193
{
194
return
!
m_data
.size();
195
}
196
WPXBinaryData
m_data
;
197
TextFormat
m_format
;
198
};
199
200
struct
VSDFont
201
{
202
WPXString
m_name
;
203
TextFormat
m_encoding
;
204
VSDFont
() :
m_name
(
"Arial"
),
m_encoding
(libvisio::
VSD_TEXT_ANSI
) {}
205
VSDFont
(
const
WPXString &name,
const
TextFormat
&encoding) :
206
m_name
(name),
m_encoding
(encoding) {}
207
VSDFont
(
const
VSDFont
&font) :
208
m_name
(font.
m_name
),
m_encoding
(font.
m_encoding
) {}
209
};
210
211
struct
VSDMisc
212
{
213
bool
m_hideText
;
214
VSDMisc
() :
m_hideText
(false) {}
215
VSDMisc
(
const
VSDMisc
&misc) :
m_hideText
(misc.
m_hideText
) {}
216
};
217
218
}
// namespace libvisio
219
220
#endif
/* VSDTYPES_H */
221
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Generated for libvisio by
doxygen
1.8.3.1