VSDXTypes.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 VSDXTYPES_H
32 #define VSDXTYPES_H
33 
34 #include <libwpd/libwpd.h>
35 
36 namespace libvisio
37 {
38 struct XForm
39 {
40  double pinX;
41  double pinY;
42  double height;
43  double width;
44  double pinLocX;
45  double pinLocY;
46  double angle;
47  bool flipX;
48  bool flipY;
49  double x;
50  double y;
51  XForm() : pinX(0.0), pinY(0.0), height(0.0), width(0.0),
52  pinLocX(0.0), pinLocY(0.0), angle(0.0),
53  flipX(false), flipY(false), x(0.0), y(0.0) {}
54 };
55 
56 // Utilities
58 {
59  unsigned chunkType; // 4 bytes
60  unsigned id; // 4 bytes
61  unsigned list; // 4 bytes
62  unsigned dataLength; // 4 bytes
63  unsigned short level; // 2 bytes
64  unsigned char unknown; // 1 byte
65  unsigned trailer; // Derived
66 };
67 
68 struct Colour
69 {
70  Colour(unsigned red, unsigned char green, unsigned char blue, unsigned char alpha)
71  : r(red), g(green), b(blue), a(alpha) {}
72  Colour() : r(0), g(0), b(0), a(0) {}
73  unsigned char r;
74  unsigned char g;
75  unsigned char b;
76  unsigned char a;
77 };
78 
79 struct NURBSData
80 {
81  double lastKnot;
82  unsigned degree;
83  unsigned char xType;
84  unsigned char yType;
85  std::vector<double> knots;
86  std::vector<double> weights;
87  std::vector<std::pair<double, double> > points;
89  : lastKnot(0.0),
90  degree(0),
91  xType(0x00),
92  yType(0x00),
93  knots(),
94  weights(),
95  points() {}
96  NURBSData(const NURBSData &data)
97  : lastKnot(data.lastKnot),
98  degree(data.degree),
99  xType(data.xType),
100  yType(data.yType),
101  knots(data.knots),
102  weights(data.weights),
103  points(data.points) {}
105  {
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  return *this;
114  }
115 };
116 
118 {
119  unsigned char xType;
120  unsigned char yType;
121  std::vector<std::pair<double, double> > points;
123  : xType(0x00),
124  yType(0x00),
125  points() {}
127  : xType(data.xType),
128  yType(data.yType),
129  points(data.points) {}
131  {
132  xType = data.xType;
133  yType = data.yType;
134  points = data.points;
135  return *this;
136  }
137 };
138 
139 
141 {
142  unsigned typeId;
143  unsigned dataId;
144  unsigned typeLevel;
145  unsigned dataLevel;
146  unsigned type;
147  unsigned format;
148  double offsetX;
149  double offsetY;
150  double width;
151  double height;
152  WPXBinaryData data;
154  : typeId(0),
155  dataId(0),
156  typeLevel(0),
157  dataLevel(0),
158  type(0),
159  format(0),
160  offsetX(0.0),
161  offsetY(0.0),
162  width(0.0),
163  height(0.0),
164  data() {}
166  : typeId(fd.typeId),
167  dataId(fd.dataId),
168  typeLevel(fd.typeLevel),
169  dataLevel(fd.dataLevel),
170  type(fd.type),
171  format(fd.format),
172  offsetX(fd.offsetX),
173  offsetY(fd.offsetY),
174  width(fd.width),
175  height(fd.height),
176  data(fd.data) {}
177 };
178 
180 
181 class VSDXName
182 {
183 public:
184  VSDXName(const WPXBinaryData &data, TextFormat format)
185  : m_data(data),
186  m_format(format) {}
188  VSDXName(const VSDXName &element)
189  : m_data(element.m_data),
190  m_format(element.m_format) {}
191  VSDXName &operator=(const VSDXName &element)
192  {
193  m_data = element.m_data;
194  m_format = element.m_format;
195  return *this;
196  }
197  WPXBinaryData m_data;
199 };
200 
201 } // namespace libvisio
202 
203 #endif /* VSDXTYPES_H */
204 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libvisio by doxygen 1.8.1