MSPUBTypes.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libmspub
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) 2012 Brennan Vincent <brennanv@email.arizona.edu>
17  * Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
18  *
19  * All Rights Reserved.
20  *
21  * For minor contributions see the git repository.
22  *
23  * Alternatively, the contents of this file may be used under the terms of
24  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
25  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
26  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
27  * instead of those above.
28  */
29 
30 #ifndef __MSPUBTYPES_H__
31 #define __MSPUBTYPES_H__
32 
33 #include <vector>
34 #include <string>
35 #include <boost/optional.hpp>
36 #include "MSPUBBlockType.h"
37 #include "MSPUBBlockID.h"
38 #include "MSPUBContentChunkType.h"
39 #include "MSPUBConstants.h"
40 #include "ListInfo.h"
41 
42 namespace libmspub
43 {
45 {
49 };
50 
52 {
56 };
57 
59 {
60  LEFT = 0,
61  CENTER = 2,
62  RIGHT = 1,
63  JUSTIFY = 6
64 };
65 
67 {
68  unsigned short initial;
69  unsigned short type;
70  unsigned long contentsLength;
71  unsigned long contentsOffset;
72 };
73 
75 {
79  unsigned long startPosition;
80  unsigned long dataOffset;
81  unsigned long dataLength;
82  unsigned data;
83  std::vector<unsigned char> stringData;
84 };
85 
87 {
89  ContentChunkReference(MSPUBContentChunkType t, unsigned long o, unsigned long e, unsigned sn, unsigned psn) :
90  type(t), offset(o), end(e), seqNum(sn), parentSeqNum(psn) {}
92  unsigned long offset;
93  unsigned long end; //offset of the last element plus one.
94  unsigned seqNum;
95  unsigned parentSeqNum;
96 };
97 
99 {
100  QuillChunkReference() : length(0), offset(0), id(0), name(), name2() { }
101  unsigned long length;
102  unsigned long offset;
103  unsigned short id;
104  std::string name;
105  std::string name2;
106 };
107 
109 {
111  underline(), italic(), bold(),
113  {
114  }
115  CharacterStyle(bool u, bool i, bool b,
116  boost::optional<double> tSIP = boost::optional<double>(),
117  int cI = -1,
118  boost::optional<unsigned> fI = boost::optional<unsigned>(),
119  SuperSubType sst = NO_SUPER_SUB) :
120  underline(u), italic(i), bold(b), textSizeInPt(tSIP), colorIndex(cI), fontIndex(fI), superSubType(sst) { }
121  bool underline;
122  bool italic;
123  bool bold;
124  boost::optional<double> textSizeInPt;
126  boost::optional<unsigned> fontIndex;
128 };
129 
131 {
134 };
135 
137 {
139  double m_amount;
141  {
142  }
143  LineSpacingInfo(LineSpacingType type, double amount) :
144  m_type(type), m_amount(amount)
145  {
146  }
147 };
148 
150 {
151  boost::optional<Alignment> m_align;
152  boost::optional<unsigned> m_defaultCharStyleIndex;
153  boost::optional<LineSpacingInfo> m_lineSpacing;
154  boost::optional<unsigned> m_spaceBeforeEmu;
155  boost::optional<unsigned> m_spaceAfterEmu;
156  boost::optional<int> m_firstLineIndentEmu;
157  boost::optional<unsigned> m_leftIndentEmu;
158  boost::optional<unsigned> m_rightIndentEmu;
159  boost::optional<ListInfo> m_listInfo;
160  std::vector<unsigned> m_tabStopsInEmu;
161  boost::optional<unsigned> m_dropCapLines;
162  boost::optional<unsigned> m_dropCapLetters;
167  {
168  }
169 };
170 
171 struct TextSpan
172 {
173  TextSpan(const std::vector<unsigned char> &c, const CharacterStyle &s) : chars(c), style(s) { }
174  std::vector<unsigned char> chars;
176 };
177 
179 {
180  TextParagraph(const std::vector<TextSpan> &sp, const ParagraphStyle &st) : spans(sp), style(st) { }
181  std::vector<TextSpan> spans;
183 };
184 
185 struct Color
186 {
187  Color() : r(0), g(0), b(0) { }
188  Color(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) { }
189  unsigned char r, g, b;
190 };
191 
193 {
197 };
198 
200 {
210 };
211 
212 } // namespace libmspub
213 
214 #endif /* __MSPUBTYPES_H__ */
215 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libmspub by doxygen 1.8.3.1