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
67 {
68  unsigned chunkType; // 4 bytes
69  unsigned id; // 4 bytes
70  unsigned list; // 4 bytes
71  unsigned dataLength; // 4 bytes
72  unsigned short level; // 2 bytes
73  unsigned char unknown; // 1 byte
74  unsigned trailer; // Derived
75 };
76 
77 struct Colour
78 {
79  Colour(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
80  : r(red), g(green), b(blue), a(alpha) {}
81  Colour() : r(0), g(0), b(0), a(0) {}
82  unsigned char r;
83  unsigned char g;
84  unsigned char b;
85  unsigned char a;
86 };
87 
88 struct NURBSData
89 {
90  double lastKnot;
91  unsigned degree;
92  unsigned char xType;
93  unsigned char yType;
94  std::vector<double> knots;
95  std::vector<double> weights;
96  std::vector<std::pair<double, double> > points;
98  : lastKnot(0.0),
99  degree(0),
100  xType(0x00),
101  yType(0x00),
102  knots(),
103  weights(),
104  points() {}
105  NURBSData(const NURBSData &data)
106  : lastKnot(data.lastKnot),
107  degree(data.degree),
108  xType(data.xType),
109  yType(data.yType),
110  knots(data.knots),
111  weights(data.weights),
112  points(data.points) {}
113 };
114 
116 {
117  unsigned char xType;
118  unsigned char yType;
119  std::vector<std::pair<double, double> > points;
121  : xType(0x00),
122  yType(0x00),
123  points() {}
124 };
125 
126 
128 {
129  unsigned typeId;
130  unsigned dataId;
131  unsigned type;
132  unsigned format;
133  double offsetX;
134  double offsetY;
135  double width;
136  double height;
137  WPXBinaryData data;
139  : typeId(0),
140  dataId(0),
141  type(0),
142  format(0),
143  offsetX(0.0),
144  offsetY(0.0),
145  width(0.0),
146  height(0.0),
147  data() {}
148 };
149 
151 {
164 };
165 
166 class VSDName
167 {
168 public:
169  VSDName(const WPXBinaryData &data, TextFormat format)
170  : m_data(data),
171  m_format(format) {}
173  VSDName(const VSDName &name) : m_data(name.m_data), m_format(name.m_format) {}
174  WPXBinaryData m_data;
176 };
177 
178 struct VSDFont
179 {
180  WPXString m_name;
182  VSDFont() : m_name("Arial"), m_encoding(libvisio::VSD_TEXT_ANSI) {}
183  VSDFont(const WPXString &name, const TextFormat &encoding) :
184  m_name(name), m_encoding(encoding) {}
185  VSDFont(const VSDFont &font) :
186  m_name(font.m_name), m_encoding(font.m_encoding) {}
187 };
188 
189 } // namespace libvisio
190 
191 #endif /* VSDTYPES_H */
192 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libvisio by doxygen 1.8.1.2