VSDTypes.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libvisio project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef VSDTYPES_H
#define VSDTYPES_H
#include <vector>
#include <map>
#include <librevenge/librevenge.h>
#define ASSIGN_OPTIONAL(t, u) if(!!t) u = t.value()
#define MINUS_ONE (unsigned)-1
namespace libvisio
{
struct XForm
{
double pinX;
double pinY;
double height;
double width;
double pinLocX;
double pinLocY;
double angle;
bool flipX;
bool flipY;
double x;
double y;
XForm() : pinX(0.0), pinY(0.0), height(0.0), width(0.0),
pinLocX(0.0), pinLocY(0.0), angle(0.0),
flipX(false), flipY(false), x(0.0), y(0.0) {}
XForm(const XForm &xform) = default;
XForm &operator=(const XForm &xform) = default;
};
struct XForm1D
{
double beginX;
double beginY;
unsigned beginId;
double endX;
double endY;
unsigned endId;
XForm1D() : beginX(0.0), beginY(0.0), beginId(MINUS_ONE),
endX(0.0), endY(0.0), endId(MINUS_ONE) {}
XForm1D(const XForm1D &xform1d) : beginX(xform1d.beginX),
beginY(xform1d.beginY), beginId(xform1d.beginId),
endX(xform1d.endX), endY(xform1d.endY), endId(xform1d.endId) {}
};
// Utilities
struct ChunkHeader
{
ChunkHeader() : chunkType(0), id(0), list(0), dataLength(0), level(0), unknown(0), trailer(0) {}
unsigned chunkType; // 4 bytes
unsigned id; // 4 bytes
unsigned list; // 4 bytes
unsigned dataLength; // 4 bytes
unsigned short level; // 2 bytes
unsigned char unknown; // 1 byte
unsigned trailer; // Derived
};
struct Colour
{
Colour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
: r(red), g(green), b(blue), a(alpha) {}
Colour() : r(0), g(0), b(0), a(0) {}
inline bool operator==(const Colour &col) const
{
return ((r == col.r) && (g == col.g) && (b == col.b) && (a == col.a));
}
inline bool operator!=(const Colour &col) const
{
return !operator==(col);
}
inline bool operator!() const
{
return (!r && !g && !b && !a);
}
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
};
struct NURBSData
{
double lastKnot;
unsigned degree;
unsigned char xType;
unsigned char yType;
std::vector<double> knots;
std::vector<double> weights;
std::vector<std::pair<double, double> > points;
NURBSData()
: lastKnot(0.0),
degree(0),
xType(0x00),
yType(0x00),
knots(),
weights(),
points() {}
NURBSData(const NURBSData &data) = default;
NURBSData &operator=(const NURBSData &data) = default;
};
struct PolylineData
{
unsigned char xType;
unsigned char yType;
std::vector<std::pair<double, double> > points;
PolylineData()
: xType(0x00),
yType(0x00),
points() {}
};
struct ForeignData
{
unsigned typeId;
unsigned dataId;
unsigned type;
unsigned format;
double offsetX;
double offsetY;
double width;
double height;
librevenge::RVNGBinaryData data;
ForeignData()
: typeId(0),
dataId(0),
type(0),
format(0),
offsetX(0.0),
offsetY(0.0),
width(0.0),
height(0.0),
data() {}
};
enum TextFormat
{
VSD_TEXT_ANSI = 0,
VSD_TEXT_SYMBOL,
VSD_TEXT_GREEK,
VSD_TEXT_TURKISH,
VSD_TEXT_VIETNAMESE,
VSD_TEXT_HEBREW,
VSD_TEXT_ARABIC,
VSD_TEXT_BALTIC,
VSD_TEXT_RUSSIAN,
VSD_TEXT_THAI,
VSD_TEXT_CENTRAL_EUROPE,
VSD_TEXT_JAPANESE,
VSD_TEXT_KOREAN,
VSD_TEXT_CHINESE_SIMPLIFIED,
VSD_TEXT_CHINESE_TRADITIONAL,
VSD_TEXT_UTF8,
VSD_TEXT_UTF16
};
class VSDName
{
public:
VSDName(const librevenge::RVNGBinaryData &data, TextFormat format)
: m_data(data),
m_format(format) {}
VSDName() : m_data(), m_format(VSD_TEXT_ANSI) {}
VSDName(const VSDName &name) = default;
VSDName &operator=(const VSDName &name) = default;
bool empty() const
{
return !m_data.size();
}
void clear()
{
m_data.clear();
m_format = VSD_TEXT_ANSI;
}
librevenge::RVNGBinaryData m_data;
TextFormat m_format;
};
struct VSDFont
{
librevenge::RVNGString m_name;
TextFormat m_encoding;
VSDFont() : m_name("Arial"), m_encoding(libvisio::VSD_TEXT_ANSI) {}
VSDFont(const librevenge::RVNGString &name, const TextFormat &encoding) :
m_name(name), m_encoding(encoding) {}
VSDFont(const VSDFont &font) :
m_name(font.m_name), m_encoding(font.m_encoding) {}
};
struct VSDMisc
{
bool m_hideText;
VSDMisc() : m_hideText(false) {}
VSDMisc(const VSDMisc &misc) = default;
VSDMisc &operator=(const VSDMisc &misc) = default;
};
struct VSDTabStop
{
double m_position;
unsigned char m_alignment;
unsigned char m_leader;
VSDTabStop() : m_position(0.0), m_alignment(0), m_leader(0) {}
VSDTabStop(const VSDTabStop &tabStop) :
m_position(tabStop.m_position), m_alignment(tabStop.m_alignment),
m_leader(tabStop.m_leader) {}
};
struct VSDTabSet
{
unsigned m_numChars;
std::map<unsigned, VSDTabStop> m_tabStops;
VSDTabSet() : m_numChars(0), m_tabStops() {}
VSDTabSet(const VSDTabSet &tabSet) :
m_numChars(tabSet.m_numChars), m_tabStops(tabSet.m_tabStops) {}
};
struct VSDBullet
{
librevenge::RVNGString m_bulletStr;
librevenge::RVNGString m_bulletFont;
double m_bulletFontSize;
double m_textPosAfterBullet;
VSDBullet()
: m_bulletStr(),
m_bulletFont(),
m_bulletFontSize(0.0),
m_textPosAfterBullet(0.0) {}
VSDBullet(const VSDBullet &bullet) = default;
VSDBullet &operator=(const VSDBullet &bullet) = default;
inline bool operator==(const VSDBullet &bullet) const
{
return ((m_bulletStr == bullet.m_bulletStr) &&
(m_bulletFont == bullet.m_bulletFont) &&
(m_bulletFontSize == bullet.m_bulletFontSize) &&
(m_textPosAfterBullet == bullet.m_textPosAfterBullet));
}
inline bool operator!=(const VSDBullet &bullet) const
{
return !operator==(bullet);
}
inline bool operator!() const
{
return m_bulletStr.empty();
}
};
} // namespace libvisio
#endif /* VSDTYPES_H */
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
MINUS_ONE
#define MINUS_ONE
Definition VSDTypes.h:18
libvisio::VSDName::VSDName
VSDName(const VSDName &name)=default
libvisio::VSDName::m_format
TextFormat m_format
Definition VSDTypes.h:189
libvisio::VSDName::VSDName
VSDName(const librevenge::RVNGBinaryData &data, TextFormat format)
Definition VSDTypes.h:173
libvisio::VSDName::operator=
VSDName & operator=(const VSDName &name)=default
libvisio::VSDName::m_data
librevenge::RVNGBinaryData m_data
Definition VSDTypes.h:188
libvisio::VSDName::empty
bool empty() const
Definition VSDTypes.h:179
libvisio::VSDName::VSDName
VSDName()
Definition VSDTypes.h:176
libvisio::VSDName::clear
void clear()
Definition VSDTypes.h:183
libvisio
Definition libvisio_utils.h:47
libvisio::TextFormat
TextFormat
Definition VSDTypes.h:150
libvisio::VSD_TEXT_ARABIC
@ VSD_TEXT_ARABIC
Definition VSDTypes.h:157
libvisio::VSD_TEXT_HEBREW
@ VSD_TEXT_HEBREW
Definition VSDTypes.h:156
libvisio::VSD_TEXT_CHINESE_SIMPLIFIED
@ VSD_TEXT_CHINESE_SIMPLIFIED
Definition VSDTypes.h:164
libvisio::VSD_TEXT_CENTRAL_EUROPE
@ VSD_TEXT_CENTRAL_EUROPE
Definition VSDTypes.h:161
libvisio::VSD_TEXT_THAI
@ VSD_TEXT_THAI
Definition VSDTypes.h:160
libvisio::VSD_TEXT_TURKISH
@ VSD_TEXT_TURKISH
Definition VSDTypes.h:154
libvisio::VSD_TEXT_SYMBOL
@ VSD_TEXT_SYMBOL
Definition VSDTypes.h:152
libvisio::VSD_TEXT_RUSSIAN
@ VSD_TEXT_RUSSIAN
Definition VSDTypes.h:159
libvisio::VSD_TEXT_BALTIC
@ VSD_TEXT_BALTIC
Definition VSDTypes.h:158
libvisio::VSD_TEXT_KOREAN
@ VSD_TEXT_KOREAN
Definition VSDTypes.h:163
libvisio::VSD_TEXT_JAPANESE
@ VSD_TEXT_JAPANESE
Definition VSDTypes.h:162
libvisio::VSD_TEXT_CHINESE_TRADITIONAL
@ VSD_TEXT_CHINESE_TRADITIONAL
Definition VSDTypes.h:165
libvisio::VSD_TEXT_UTF8
@ VSD_TEXT_UTF8
Definition VSDTypes.h:166
libvisio::VSD_TEXT_ANSI
@ VSD_TEXT_ANSI
Definition VSDTypes.h:151
libvisio::VSD_TEXT_VIETNAMESE
@ VSD_TEXT_VIETNAMESE
Definition VSDTypes.h:155
libvisio::VSD_TEXT_GREEK
@ VSD_TEXT_GREEK
Definition VSDTypes.h:153
libvisio::VSD_TEXT_UTF16
@ VSD_TEXT_UTF16
Definition VSDTypes.h:167
libvisio::ChunkHeader::chunkType
unsigned chunkType
Definition VSDTypes.h:61
libvisio::ChunkHeader::level
unsigned short level
Definition VSDTypes.h:65
libvisio::ChunkHeader::unknown
unsigned char unknown
Definition VSDTypes.h:66
libvisio::ChunkHeader::id
unsigned id
Definition VSDTypes.h:62
libvisio::ChunkHeader::trailer
unsigned trailer
Definition VSDTypes.h:67
libvisio::ChunkHeader::ChunkHeader
ChunkHeader()
Definition VSDTypes.h:60
libvisio::ChunkHeader::dataLength
unsigned dataLength
Definition VSDTypes.h:64
libvisio::ChunkHeader::list
unsigned list
Definition VSDTypes.h:63
libvisio::Colour::r
unsigned char r
Definition VSDTypes.h:87
libvisio::Colour::a
unsigned char a
Definition VSDTypes.h:90
libvisio::Colour::operator==
bool operator==(const Colour &col) const
Definition VSDTypes.h:75
libvisio::Colour::Colour
Colour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
Definition VSDTypes.h:72
libvisio::Colour::operator!=
bool operator!=(const Colour &col) const
Definition VSDTypes.h:79
libvisio::Colour::b
unsigned char b
Definition VSDTypes.h:89
libvisio::Colour::g
unsigned char g
Definition VSDTypes.h:88
libvisio::Colour::operator!
bool operator!() const
Definition VSDTypes.h:83
libvisio::Colour::Colour
Colour()
Definition VSDTypes.h:74
libvisio::ForeignData::ForeignData
ForeignData()
Definition VSDTypes.h:137
libvisio::ForeignData::height
double height
Definition VSDTypes.h:135
libvisio::ForeignData::dataId
unsigned dataId
Definition VSDTypes.h:129
libvisio::ForeignData::data
librevenge::RVNGBinaryData data
Definition VSDTypes.h:136
libvisio::ForeignData::width
double width
Definition VSDTypes.h:134
libvisio::ForeignData::typeId
unsigned typeId
Definition VSDTypes.h:128
libvisio::ForeignData::format
unsigned format
Definition VSDTypes.h:131
libvisio::ForeignData::type
unsigned type
Definition VSDTypes.h:130
libvisio::ForeignData::offsetX
double offsetX
Definition VSDTypes.h:132
libvisio::ForeignData::offsetY
double offsetY
Definition VSDTypes.h:133
libvisio::NURBSData::points
std::vector< std::pair< double, double > > points
Definition VSDTypes.h:101
libvisio::NURBSData::knots
std::vector< double > knots
Definition VSDTypes.h:99
libvisio::NURBSData::weights
std::vector< double > weights
Definition VSDTypes.h:100
libvisio::NURBSData::NURBSData
NURBSData()
Definition VSDTypes.h:102
libvisio::NURBSData::NURBSData
NURBSData(const NURBSData &data)=default
libvisio::NURBSData::lastKnot
double lastKnot
Definition VSDTypes.h:95
libvisio::NURBSData::degree
unsigned degree
Definition VSDTypes.h:96
libvisio::NURBSData::yType
unsigned char yType
Definition VSDTypes.h:98
libvisio::NURBSData::operator=
NURBSData & operator=(const NURBSData &data)=default
libvisio::NURBSData::xType
unsigned char xType
Definition VSDTypes.h:97
libvisio::PolylineData::points
std::vector< std::pair< double, double > > points
Definition VSDTypes.h:118
libvisio::PolylineData::yType
unsigned char yType
Definition VSDTypes.h:117
libvisio::PolylineData::xType
unsigned char xType
Definition VSDTypes.h:116
libvisio::PolylineData::PolylineData
PolylineData()
Definition VSDTypes.h:119
libvisio::VSDBullet::VSDBullet
VSDBullet()
Definition VSDTypes.h:237
libvisio::VSDBullet::operator==
bool operator==(const VSDBullet &bullet) const
Definition VSDTypes.h:244
libvisio::VSDBullet::operator!
bool operator!() const
Definition VSDTypes.h:255
libvisio::VSDBullet::m_bulletFontSize
double m_bulletFontSize
Definition VSDTypes.h:235
libvisio::VSDBullet::VSDBullet
VSDBullet(const VSDBullet &bullet)=default
libvisio::VSDBullet::operator!=
bool operator!=(const VSDBullet &bullet) const
Definition VSDTypes.h:251
libvisio::VSDBullet::m_bulletFont
librevenge::RVNGString m_bulletFont
Definition VSDTypes.h:234
libvisio::VSDBullet::operator=
VSDBullet & operator=(const VSDBullet &bullet)=default
libvisio::VSDBullet::m_textPosAfterBullet
double m_textPosAfterBullet
Definition VSDTypes.h:236
libvisio::VSDBullet::m_bulletStr
librevenge::RVNGString m_bulletStr
Definition VSDTypes.h:233
libvisio::VSDFont::VSDFont
VSDFont()
Definition VSDTypes.h:196
libvisio::VSDFont::VSDFont
VSDFont(const VSDFont &font)
Definition VSDTypes.h:199
libvisio::VSDFont::m_encoding
TextFormat m_encoding
Definition VSDTypes.h:195
libvisio::VSDFont::m_name
librevenge::RVNGString m_name
Definition VSDTypes.h:194
libvisio::VSDFont::VSDFont
VSDFont(const librevenge::RVNGString &name, const TextFormat &encoding)
Definition VSDTypes.h:197
libvisio::VSDMisc::VSDMisc
VSDMisc()
Definition VSDTypes.h:206
libvisio::VSDMisc::m_hideText
bool m_hideText
Definition VSDTypes.h:205
libvisio::VSDMisc::operator=
VSDMisc & operator=(const VSDMisc &misc)=default
libvisio::VSDMisc::VSDMisc
VSDMisc(const VSDMisc &misc)=default
libvisio::VSDTabSet::m_tabStops
std::map< unsigned, VSDTabStop > m_tabStops
Definition VSDTypes.h:225
libvisio::VSDTabSet::VSDTabSet
VSDTabSet(const VSDTabSet &tabSet)
Definition VSDTypes.h:227
libvisio::VSDTabSet::m_numChars
unsigned m_numChars
Definition VSDTypes.h:224
libvisio::VSDTabSet::VSDTabSet
VSDTabSet()
Definition VSDTypes.h:226
libvisio::VSDTabStop::VSDTabStop
VSDTabStop(const VSDTabStop &tabStop)
Definition VSDTypes.h:217
libvisio::VSDTabStop::m_leader
unsigned char m_leader
Definition VSDTypes.h:215
libvisio::VSDTabStop::m_alignment
unsigned char m_alignment
Definition VSDTypes.h:214
libvisio::VSDTabStop::VSDTabStop
VSDTabStop()
Definition VSDTypes.h:216
libvisio::VSDTabStop::m_position
double m_position
Definition VSDTypes.h:213
libvisio::XForm1D::beginId
unsigned beginId
Definition VSDTypes.h:46
libvisio::XForm1D::beginY
double beginY
Definition VSDTypes.h:45
libvisio::XForm1D::XForm1D
XForm1D(const XForm1D &xform1d)
Definition VSDTypes.h:52
libvisio::XForm1D::endId
unsigned endId
Definition VSDTypes.h:49
libvisio::XForm1D::beginX
double beginX
Definition VSDTypes.h:44
libvisio::XForm1D::endY
double endY
Definition VSDTypes.h:48
libvisio::XForm1D::XForm1D
XForm1D()
Definition VSDTypes.h:50
libvisio::XForm1D::endX
double endX
Definition VSDTypes.h:47
libvisio::XForm::pinX
double pinX
Definition VSDTypes.h:24
libvisio::XForm::pinLocY
double pinLocY
Definition VSDTypes.h:29
libvisio::XForm::width
double width
Definition VSDTypes.h:27
libvisio::XForm::pinY
double pinY
Definition VSDTypes.h:25
libvisio::XForm::XForm
XForm()
Definition VSDTypes.h:35
libvisio::XForm::height
double height
Definition VSDTypes.h:26
libvisio::XForm::x
double x
Definition VSDTypes.h:33
libvisio::XForm::angle
double angle
Definition VSDTypes.h:30
libvisio::XForm::XForm
XForm(const XForm &xform)=default
libvisio::XForm::flipY
bool flipY
Definition VSDTypes.h:32
libvisio::XForm::flipX
bool flipX
Definition VSDTypes.h:31
libvisio::XForm::pinLocX
double pinLocX
Definition VSDTypes.h:28
libvisio::XForm::y
double y
Definition VSDTypes.h:34
libvisio::XForm::operator=
XForm & operator=(const XForm &xform)=default