MSPUBTypes.h Source File documentation

MSPUBTypes.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * This file is part of the libmspub project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef INCLUDED_MSPUBTYPES_H
11#define INCLUDED_MSPUBTYPES_H
12
13#include <string>
14#include <vector>
15
16#include <boost/optional.hpp>
17
18#include "ListInfo.h"
19#include "MSPUBBlockID.h"
20#include "MSPUBBlockType.h"
21#include "MSPUBConstants.h"
22#include "MSPUBContentChunkType.h"
23
24namespace libmspub
25{
26 enum BorderPosition
27{
28 INSIDE_SHAPE,
29 HALF_INSIDE_SHAPE,
30 OUTSIDE_SHAPE
31};
32
33 enum SuperSubType
34{
35 NO_SUPER_SUB,
36 SUPERSCRIPT,
37 SUBSCRIPT
38};
39
40 enum class Underline
41{
42 None,
43 Single,
44 WordsOnly,
45 Double,
46 Dotted,
47 Thick,
48 Dash,
49 DotDash,
50 DotDotDash,
51 Wave,
52 ThickWave,
53 ThickDot,
54 ThickDash,
55 ThickDotDash,
56 ThickDotDotDash,
57 LongDash,
58 ThickLongDash,
59 DoubleWave,
60};
61
62 enum Alignment
63{
64 LEFT = 0,
65 CENTER = 2,
66 RIGHT = 1,
67 JUSTIFY = 6
68};
69
70 struct EscherContainerInfo
71{
72 unsigned short initial;
73 unsigned short type;
74 unsigned long contentsLength;
75 unsigned long contentsOffset;
76};
77
78 struct MSPUBBlockInfo
79{
80 MSPUBBlockInfo() : id(0), type(0), startPosition(0), dataOffset(0), dataLength(0), data(0), stringData() { }
81 unsigned id;
82 unsigned type;
83 unsigned long startPosition;
84 unsigned long dataOffset;
85 unsigned long dataLength;
86 unsigned data;
87 std::vector<unsigned char> stringData;
88};
89
90 struct ContentChunkReference
91{
92 ContentChunkReference() : type(0), offset(0), end(0), seqNum(0), parentSeqNum(0) { }
93 ContentChunkReference(unsigned t, unsigned long o, unsigned long e, unsigned sn, unsigned psn) :
94 type(t), offset(o), end(e), seqNum(sn), parentSeqNum(psn) {}
95 unsigned type;
96 unsigned long offset;
97 unsigned long end; //offset of the last element plus one.
98 unsigned seqNum;
99 unsigned parentSeqNum;
100};
101
102 struct QuillChunkReference
103{
104 QuillChunkReference() : length(0), offset(0), id(0), name(), name2() { }
105 unsigned long length;
106 unsigned long offset;
107 unsigned short id;
108 std::string name;
109 std::string name2;
110};
111
112 struct CharacterStyle
113{
114 CharacterStyle() :
115 underline(), italic(), bold(),
116 textSizeInPt(), colorIndex(-1), fontIndex(), superSubType(NO_SUPER_SUB)
117 , outline(false)
118 , shadow(false)
119 , smallCaps(false)
120 , allCaps(false)
121 , emboss(false)
122 , engrave(false)
123 , textScale()
124 , lcid()
125 {
126 }
127 boost::optional<Underline> underline;
128 bool italic;
129 bool bold;
130 boost::optional<double> textSizeInPt;
131 int colorIndex;
132 boost::optional<unsigned> fontIndex;
133 SuperSubType superSubType;
134 bool outline;
135 bool shadow;
136 bool smallCaps;
137 bool allCaps;
138 bool emboss;
139 bool engrave;
140 boost::optional<double> textScale;
141 boost::optional<unsigned> lcid;
142};
143
144 enum LineSpacingType
145{
146 LINE_SPACING_SP,
147 LINE_SPACING_PT
148};
149
150 struct LineSpacingInfo
151{
152 LineSpacingType m_type;
153 double m_amount;
154 LineSpacingInfo() : m_type(LINE_SPACING_SP), m_amount(1)
155 {
156 }
157 LineSpacingInfo(LineSpacingType type, double amount) :
158 m_type(type), m_amount(amount)
159 {
160 }
161};
162
163 struct ParagraphStyle
164{
165 boost::optional<Alignment> m_align;
166 boost::optional<unsigned> m_defaultCharStyleIndex;
167 boost::optional<LineSpacingInfo> m_lineSpacing;
168 boost::optional<unsigned> m_spaceBeforeEmu;
169 boost::optional<unsigned> m_spaceAfterEmu;
170 boost::optional<int> m_firstLineIndentEmu;
171 boost::optional<unsigned> m_leftIndentEmu;
172 boost::optional<unsigned> m_rightIndentEmu;
173 boost::optional<ListInfo> m_listInfo;
174 std::vector<unsigned> m_tabStopsInEmu;
175 boost::optional<unsigned> m_dropCapLines;
176 boost::optional<unsigned> m_dropCapLetters;
177 ParagraphStyle() :
178 m_align(), m_defaultCharStyleIndex(), m_lineSpacing(), m_spaceBeforeEmu(),
179 m_spaceAfterEmu(), m_firstLineIndentEmu(), m_leftIndentEmu(),
180 m_rightIndentEmu(), m_listInfo(), m_tabStopsInEmu(), m_dropCapLines(), m_dropCapLetters()
181 {
182 }
183};
184
185 struct TextSpan
186{
187 TextSpan(const std::vector<unsigned char> &c, const CharacterStyle &s) : chars(c), style(s) { }
188 std::vector<unsigned char> chars;
189 CharacterStyle style;
190};
191
192 struct TextParagraph
193{
194 TextParagraph(const std::vector<TextSpan> &sp, const ParagraphStyle &st) : spans(sp), style(st) { }
195 std::vector<TextSpan> spans;
196 ParagraphStyle style;
197};
198
199 struct Color
200{
201 Color() : r(0), g(0), b(0) { }
202 Color(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) { }
203 unsigned char r, g, b;
204};
205
206 enum PageType
207{
208 MASTER,
209 NORMAL,
210 DUMMY_PAGE
211};
212
213 enum ImgType
214{
215 UNKNOWN,
216 PNG,
217 JPEG,
218 WMF,
219 EMF,
220 TIFF,
221 DIB,
222 PICT,
223 JPEGCMYK
224};
225
226} // namespace libmspub
227
228#endif /* INCLUDED_MSPUBTYPES_H */
229/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
ListInfo.h
MSPUBBlockID.h
MSPUBBlockType.h
MSPUBConstants.h
MSPUBContentChunkType.h
libmspub
Definition Arrow.h:14
libmspub::PageType
PageType
Definition MSPUBTypes.h:207
libmspub::MASTER
@ MASTER
Definition MSPUBTypes.h:208
libmspub::NORMAL
@ NORMAL
Definition MSPUBTypes.h:209
libmspub::DUMMY_PAGE
@ DUMMY_PAGE
Definition MSPUBTypes.h:210
libmspub::SuperSubType
SuperSubType
Definition MSPUBTypes.h:34
libmspub::NO_SUPER_SUB
@ NO_SUPER_SUB
Definition MSPUBTypes.h:35
libmspub::SUBSCRIPT
@ SUBSCRIPT
Definition MSPUBTypes.h:37
libmspub::SUPERSCRIPT
@ SUPERSCRIPT
Definition MSPUBTypes.h:36
libmspub::LineSpacingType
LineSpacingType
Definition MSPUBTypes.h:145
libmspub::LINE_SPACING_SP
@ LINE_SPACING_SP
Definition MSPUBTypes.h:146
libmspub::LINE_SPACING_PT
@ LINE_SPACING_PT
Definition MSPUBTypes.h:147
libmspub::Alignment
Alignment
Definition MSPUBTypes.h:63
libmspub::RIGHT
@ RIGHT
Definition MSPUBTypes.h:66
libmspub::JUSTIFY
@ JUSTIFY
Definition MSPUBTypes.h:67
libmspub::LEFT
@ LEFT
Definition MSPUBTypes.h:64
libmspub::CENTER
@ CENTER
Definition MSPUBTypes.h:65
libmspub::Underline
Underline
Definition MSPUBTypes.h:41
libmspub::Underline::ThickLongDash
@ ThickLongDash
libmspub::Underline::WordsOnly
@ WordsOnly
libmspub::Underline::Thick
@ Thick
libmspub::Underline::LongDash
@ LongDash
libmspub::Underline::DoubleWave
@ DoubleWave
libmspub::Underline::DotDotDash
@ DotDotDash
libmspub::Underline::ThickDash
@ ThickDash
libmspub::Underline::Single
@ Single
libmspub::Underline::None
@ None
libmspub::Underline::ThickDotDash
@ ThickDotDash
libmspub::Underline::Dotted
@ Dotted
libmspub::Underline::DotDash
@ DotDash
libmspub::Underline::ThickDotDotDash
@ ThickDotDotDash
libmspub::Underline::ThickWave
@ ThickWave
libmspub::Underline::Double
@ Double
libmspub::Underline::Wave
@ Wave
libmspub::Underline::ThickDot
@ ThickDot
libmspub::BorderPosition
BorderPosition
Definition MSPUBTypes.h:27
libmspub::OUTSIDE_SHAPE
@ OUTSIDE_SHAPE
Definition MSPUBTypes.h:30
libmspub::HALF_INSIDE_SHAPE
@ HALF_INSIDE_SHAPE
Definition MSPUBTypes.h:29
libmspub::INSIDE_SHAPE
@ INSIDE_SHAPE
Definition MSPUBTypes.h:28
libmspub::ImgType
ImgType
Definition MSPUBTypes.h:214
libmspub::PNG
@ PNG
Definition MSPUBTypes.h:216
libmspub::TIFF
@ TIFF
Definition MSPUBTypes.h:220
libmspub::EMF
@ EMF
Definition MSPUBTypes.h:219
libmspub::UNKNOWN
@ UNKNOWN
Definition MSPUBTypes.h:215
libmspub::JPEG
@ JPEG
Definition MSPUBTypes.h:217
libmspub::DIB
@ DIB
Definition MSPUBTypes.h:221
libmspub::WMF
@ WMF
Definition MSPUBTypes.h:218
libmspub::PICT
@ PICT
Definition MSPUBTypes.h:222
libmspub::JPEGCMYK
@ JPEGCMYK
Definition MSPUBTypes.h:223
libmspub::CharacterStyle
Definition MSPUBTypes.h:113
libmspub::CharacterStyle::textSizeInPt
boost::optional< double > textSizeInPt
Definition MSPUBTypes.h:130
libmspub::CharacterStyle::CharacterStyle
CharacterStyle()
Definition MSPUBTypes.h:114
libmspub::CharacterStyle::textScale
boost::optional< double > textScale
Definition MSPUBTypes.h:140
libmspub::CharacterStyle::bold
bool bold
Definition MSPUBTypes.h:129
libmspub::CharacterStyle::engrave
bool engrave
Definition MSPUBTypes.h:139
libmspub::CharacterStyle::superSubType
SuperSubType superSubType
Definition MSPUBTypes.h:133
libmspub::CharacterStyle::emboss
bool emboss
Definition MSPUBTypes.h:138
libmspub::CharacterStyle::allCaps
bool allCaps
Definition MSPUBTypes.h:137
libmspub::CharacterStyle::italic
bool italic
Definition MSPUBTypes.h:128
libmspub::CharacterStyle::underline
boost::optional< Underline > underline
Definition MSPUBTypes.h:127
libmspub::CharacterStyle::lcid
boost::optional< unsigned > lcid
Definition MSPUBTypes.h:141
libmspub::CharacterStyle::shadow
bool shadow
Definition MSPUBTypes.h:135
libmspub::CharacterStyle::fontIndex
boost::optional< unsigned > fontIndex
Definition MSPUBTypes.h:132
libmspub::CharacterStyle::outline
bool outline
Definition MSPUBTypes.h:134
libmspub::CharacterStyle::smallCaps
bool smallCaps
Definition MSPUBTypes.h:136
libmspub::CharacterStyle::colorIndex
int colorIndex
Definition MSPUBTypes.h:131
libmspub::Color
Definition MSPUBTypes.h:200
libmspub::Color::Color
Color()
Definition MSPUBTypes.h:201
libmspub::Color::r
unsigned char r
Definition MSPUBTypes.h:203
libmspub::Color::Color
Color(unsigned char red, unsigned char green, unsigned char blue)
Definition MSPUBTypes.h:202
libmspub::Color::b
unsigned char b
Definition MSPUBTypes.h:203
libmspub::Color::g
unsigned char g
Definition MSPUBTypes.h:203
libmspub::ContentChunkReference
Definition MSPUBTypes.h:91
libmspub::ContentChunkReference::parentSeqNum
unsigned parentSeqNum
Definition MSPUBTypes.h:99
libmspub::ContentChunkReference::seqNum
unsigned seqNum
Definition MSPUBTypes.h:98
libmspub::ContentChunkReference::end
unsigned long end
Definition MSPUBTypes.h:97
libmspub::ContentChunkReference::offset
unsigned long offset
Definition MSPUBTypes.h:96
libmspub::ContentChunkReference::ContentChunkReference
ContentChunkReference()
Definition MSPUBTypes.h:92
libmspub::ContentChunkReference::type
unsigned type
Definition MSPUBTypes.h:95
libmspub::ContentChunkReference::ContentChunkReference
ContentChunkReference(unsigned t, unsigned long o, unsigned long e, unsigned sn, unsigned psn)
Definition MSPUBTypes.h:93
libmspub::Dash
Definition Dash.h:50
libmspub::EscherContainerInfo
Definition MSPUBTypes.h:71
libmspub::EscherContainerInfo::initial
unsigned short initial
Definition MSPUBTypes.h:72
libmspub::EscherContainerInfo::type
unsigned short type
Definition MSPUBTypes.h:73
libmspub::EscherContainerInfo::contentsOffset
unsigned long contentsOffset
Definition MSPUBTypes.h:75
libmspub::EscherContainerInfo::contentsLength
unsigned long contentsLength
Definition MSPUBTypes.h:74
libmspub::LineSpacingInfo
Definition MSPUBTypes.h:151
libmspub::LineSpacingInfo::LineSpacingInfo
LineSpacingInfo(LineSpacingType type, double amount)
Definition MSPUBTypes.h:157
libmspub::LineSpacingInfo::m_amount
double m_amount
Definition MSPUBTypes.h:153
libmspub::LineSpacingInfo::m_type
LineSpacingType m_type
Definition MSPUBTypes.h:152
libmspub::LineSpacingInfo::LineSpacingInfo
LineSpacingInfo()
Definition MSPUBTypes.h:154
libmspub::MSPUBBlockInfo
Definition MSPUBTypes.h:79
libmspub::MSPUBBlockInfo::id
unsigned id
Definition MSPUBTypes.h:81
libmspub::MSPUBBlockInfo::dataLength
unsigned long dataLength
Definition MSPUBTypes.h:85
libmspub::MSPUBBlockInfo::startPosition
unsigned long startPosition
Definition MSPUBTypes.h:83
libmspub::MSPUBBlockInfo::type
unsigned type
Definition MSPUBTypes.h:82
libmspub::MSPUBBlockInfo::MSPUBBlockInfo
MSPUBBlockInfo()
Definition MSPUBTypes.h:80
libmspub::MSPUBBlockInfo::dataOffset
unsigned long dataOffset
Definition MSPUBTypes.h:84
libmspub::MSPUBBlockInfo::data
unsigned data
Definition MSPUBTypes.h:86
libmspub::MSPUBBlockInfo::stringData
std::vector< unsigned char > stringData
Definition MSPUBTypes.h:87
libmspub::ParagraphStyle
Definition MSPUBTypes.h:164
libmspub::ParagraphStyle::m_firstLineIndentEmu
boost::optional< int > m_firstLineIndentEmu
Definition MSPUBTypes.h:170
libmspub::ParagraphStyle::m_leftIndentEmu
boost::optional< unsigned > m_leftIndentEmu
Definition MSPUBTypes.h:171
libmspub::ParagraphStyle::m_rightIndentEmu
boost::optional< unsigned > m_rightIndentEmu
Definition MSPUBTypes.h:172
libmspub::ParagraphStyle::m_defaultCharStyleIndex
boost::optional< unsigned > m_defaultCharStyleIndex
Definition MSPUBTypes.h:166
libmspub::ParagraphStyle::m_listInfo
boost::optional< ListInfo > m_listInfo
Definition MSPUBTypes.h:173
libmspub::ParagraphStyle::m_tabStopsInEmu
std::vector< unsigned > m_tabStopsInEmu
Definition MSPUBTypes.h:174
libmspub::ParagraphStyle::m_lineSpacing
boost::optional< LineSpacingInfo > m_lineSpacing
Definition MSPUBTypes.h:167
libmspub::ParagraphStyle::m_dropCapLines
boost::optional< unsigned > m_dropCapLines
Definition MSPUBTypes.h:175
libmspub::ParagraphStyle::m_align
boost::optional< Alignment > m_align
Definition MSPUBTypes.h:165
libmspub::ParagraphStyle::m_spaceAfterEmu
boost::optional< unsigned > m_spaceAfterEmu
Definition MSPUBTypes.h:169
libmspub::ParagraphStyle::ParagraphStyle
ParagraphStyle()
Definition MSPUBTypes.h:177
libmspub::ParagraphStyle::m_spaceBeforeEmu
boost::optional< unsigned > m_spaceBeforeEmu
Definition MSPUBTypes.h:168
libmspub::ParagraphStyle::m_dropCapLetters
boost::optional< unsigned > m_dropCapLetters
Definition MSPUBTypes.h:176
libmspub::QuillChunkReference
Definition MSPUBTypes.h:103
libmspub::QuillChunkReference::name2
std::string name2
Definition MSPUBTypes.h:109
libmspub::QuillChunkReference::QuillChunkReference
QuillChunkReference()
Definition MSPUBTypes.h:104
libmspub::QuillChunkReference::name
std::string name
Definition MSPUBTypes.h:108
libmspub::QuillChunkReference::offset
unsigned long offset
Definition MSPUBTypes.h:106
libmspub::QuillChunkReference::id
unsigned short id
Definition MSPUBTypes.h:107
libmspub::QuillChunkReference::length
unsigned long length
Definition MSPUBTypes.h:105
libmspub::TextParagraph
Definition MSPUBTypes.h:193
libmspub::TextParagraph::TextParagraph
TextParagraph(const std::vector< TextSpan > &sp, const ParagraphStyle &st)
Definition MSPUBTypes.h:194
libmspub::TextParagraph::spans
std::vector< TextSpan > spans
Definition MSPUBTypes.h:195
libmspub::TextParagraph::style
ParagraphStyle style
Definition MSPUBTypes.h:196
libmspub::TextSpan
Definition MSPUBTypes.h:186
libmspub::TextSpan::style
CharacterStyle style
Definition MSPUBTypes.h:189
libmspub::TextSpan::chars
std::vector< unsigned char > chars
Definition MSPUBTypes.h:188
libmspub::TextSpan::TextSpan
TextSpan(const std::vector< unsigned char > &c, const CharacterStyle &s)
Definition MSPUBTypes.h:187