MSPUBTypes.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 __MSPUBTYPES_H__
11 #define __MSPUBTYPES_H__
12
13 #include <vector>
14 #include <string>
15 #include <boost/optional.hpp>
16 #include "MSPUBBlockType.h"
17 #include "MSPUBBlockID.h"
18 #include "MSPUBContentChunkType.h"
19 #include "MSPUBConstants.h"
20 #include "ListInfo.h"
21
22 namespace libmspub
23 {
24 enum BorderPosition
25 {
26 INSIDE_SHAPE,
27 HALF_INSIDE_SHAPE,
28 OUTSIDE_SHAPE
29 };
30
31 enum SuperSubType
32 {
33 NO_SUPER_SUB,
34 SUPERSCRIPT,
35 SUBSCRIPT
36 };
37
38 enum Alignment
39 {
40 LEFT = 0,
41 CENTER = 2,
42 RIGHT = 1,
43 JUSTIFY = 6
44 };
45
46 struct EscherContainerInfo
47 {
48 unsigned short initial;
49 unsigned short type;
50 unsigned long contentsLength;
51 unsigned long contentsOffset;
52 };
53
54 struct MSPUBBlockInfo
55 {
56 MSPUBBlockInfo() : id((MSPUBBlockID)0), type((MSPUBBlockType)0), startPosition(0), dataOffset(0), dataLength(0), data(0), stringData() { }
57 MSPUBBlockID id;
58 MSPUBBlockType type;
59 unsigned long startPosition;
60 unsigned long dataOffset;
61 unsigned long dataLength;
62 unsigned data;
63 std::vector<unsigned char> stringData;
64 };
65
66 struct ContentChunkReference
67 {
68 ContentChunkReference() : type((MSPUBContentChunkType)0), offset(0), end(0), seqNum(0), parentSeqNum(0) { }
69 ContentChunkReference(MSPUBContentChunkType t, unsigned long o, unsigned long e, unsigned sn, unsigned psn) :
70 type(t), offset(o), end(e), seqNum(sn), parentSeqNum(psn) {}
71 MSPUBContentChunkType type;
72 unsigned long offset;
73 unsigned long end; //offset of the last element plus one.
74 unsigned seqNum;
75 unsigned parentSeqNum;
76 };
77
78 struct QuillChunkReference
79 {
80 QuillChunkReference() : length(0), offset(0), id(0), name(), name2() { }
81 unsigned long length;
82 unsigned long offset;
83 unsigned short id;
84 std::string name;
85 std::string name2;
86 };
87
88 struct CharacterStyle
89 {
90 CharacterStyle() :
91 underline(), italic(), bold(),
92 textSizeInPt(), colorIndex(-1), fontIndex(), superSubType(NO_SUPER_SUB)
93 {
94 }
95 CharacterStyle(bool u, bool i, bool b,
96 boost::optional<double> tSIP = boost::optional<double>(),
97 int cI = -1,
98 boost::optional<unsigned> fI = boost::optional<unsigned>(),
99 SuperSubType sst = NO_SUPER_SUB) :
100 underline(u), italic(i), bold(b), textSizeInPt(tSIP), colorIndex(cI), fontIndex(fI), superSubType(sst) { }
101 bool underline;
102 bool italic;
103 bool bold;
104 boost::optional<double> textSizeInPt;
105 int colorIndex;
106 boost::optional<unsigned> fontIndex;
107 SuperSubType superSubType;
108 };
109
110 enum LineSpacingType
111 {
112 LINE_SPACING_SP,
113 LINE_SPACING_PT
114 };
115
116 struct LineSpacingInfo
117 {
118 LineSpacingType m_type;
119 double m_amount;
120 LineSpacingInfo() : m_type(LINE_SPACING_SP), m_amount(1)
121 {
122 }
123 LineSpacingInfo(LineSpacingType type, double amount) :
124 m_type(type), m_amount(amount)
125 {
126 }
127 };
128
129 struct ParagraphStyle
130 {
131 boost::optional<Alignment> m_align;
132 boost::optional<unsigned> m_defaultCharStyleIndex;
133 boost::optional<LineSpacingInfo> m_lineSpacing;
134 boost::optional<unsigned> m_spaceBeforeEmu;
135 boost::optional<unsigned> m_spaceAfterEmu;
136 boost::optional<int> m_firstLineIndentEmu;
137 boost::optional<unsigned> m_leftIndentEmu;
138 boost::optional<unsigned> m_rightIndentEmu;
139 boost::optional<ListInfo> m_listInfo;
140 std::vector<unsigned> m_tabStopsInEmu;
141 boost::optional<unsigned> m_dropCapLines;
142 boost::optional<unsigned> m_dropCapLetters;
143 ParagraphStyle() :
144 m_align(), m_defaultCharStyleIndex(), m_lineSpacing(), m_spaceBeforeEmu(),
145 m_spaceAfterEmu(), m_firstLineIndentEmu(), m_leftIndentEmu(),
146 m_rightIndentEmu(), m_listInfo(), m_tabStopsInEmu(), m_dropCapLines(), m_dropCapLetters()
147 {
148 }
149 };
150
151 struct TextSpan
152 {
153 TextSpan(const std::vector<unsigned char> &c, const CharacterStyle &s) : chars(c), style(s) { }
154 std::vector<unsigned char> chars;
155 CharacterStyle style;
156 };
157
158 struct TextParagraph
159 {
160 TextParagraph(const std::vector<TextSpan> &sp, const ParagraphStyle &st) : spans(sp), style(st) { }
161 std::vector<TextSpan> spans;
162 ParagraphStyle style;
163 };
164
165 struct Color
166 {
167 Color() : r(0), g(0), b(0) { }
168 Color(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) { }
169 unsigned char r, g, b;
170 };
171
172 enum PageType
173 {
174 MASTER,
175 NORMAL,
176 DUMMY_PAGE
177 };
178
179 enum ImgType
180 {
181 UNKNOWN,
182 PNG,
183 JPEG,
184 WMF,
185 EMF,
186 TIFF,
187 DIB,
188 PICT,
189 JPEGCMYK
190 };
191
192 } // namespace libmspub
193
194 #endif /* __MSPUBTYPES_H__ */
195 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libmspub::MASTER
Definition: MSPUBTypes.h:174
libmspub::JUSTIFY
Definition: MSPUBTypes.h:43
libmspub::EscherContainerInfo::initial
unsigned short initial
Definition: MSPUBTypes.h:48
libmspub::HALF_INSIDE_SHAPE
Definition: MSPUBTypes.h:27
libmspub::ContentChunkReference::offset
unsigned long offset
Definition: MSPUBTypes.h:72
libmspub::TextParagraph
Definition: MSPUBTypes.h:158
libmspub::TextParagraph::TextParagraph
TextParagraph(const std::vector< TextSpan > &sp, const ParagraphStyle &st)
Definition: MSPUBTypes.h:160
libmspub::MSPUBContentChunkType
MSPUBContentChunkType
Definition: MSPUBContentChunkType.h:15
MSPUBContentChunkType.h
libmspub::EscherContainerInfo::contentsLength
unsigned long contentsLength
Definition: MSPUBTypes.h:50
MSPUBConstants.h
libmspub::Color
Definition: MSPUBTypes.h:165
libmspub::CharacterStyle::colorIndex
int colorIndex
Definition: MSPUBTypes.h:105
libmspub::SuperSubType
SuperSubType
Definition: MSPUBTypes.h:31
libmspub::TextSpan
Definition: MSPUBTypes.h:151
libmspub::LineSpacingInfo::m_amount
double m_amount
Definition: MSPUBTypes.h:119
libmspub::ContentChunkReference::seqNum
unsigned seqNum
Definition: MSPUBTypes.h:74
libmspub::JPEG
Definition: MSPUBTypes.h:183
libmspub::OUTSIDE_SHAPE
Definition: MSPUBTypes.h:28
libmspub::TextParagraph::style
ParagraphStyle style
Definition: MSPUBTypes.h:162
libmspub::LEFT
Definition: MSPUBTypes.h:40
libmspub::QuillChunkReference::name2
std::string name2
Definition: MSPUBTypes.h:85
libmspub::WMF
Definition: MSPUBTypes.h:184
ListInfo.h
libmspub::LINE_SPACING_SP
Definition: MSPUBTypes.h:112
libmspub::CharacterStyle::bold
bool bold
Definition: MSPUBTypes.h:103
libmspub::Color::Color
Color(unsigned char red, unsigned char green, unsigned char blue)
Definition: MSPUBTypes.h:168
libmspub::TextSpan::style
CharacterStyle style
Definition: MSPUBTypes.h:155
libmspub::TextSpan::TextSpan
TextSpan(const std::vector< unsigned char > &c, const CharacterStyle &s)
Definition: MSPUBTypes.h:153
libmspub::ParagraphStyle::m_defaultCharStyleIndex
boost::optional< unsigned > m_defaultCharStyleIndex
Definition: MSPUBTypes.h:132
libmspub::MSPUBBlockInfo
Definition: MSPUBTypes.h:54
libmspub::CharacterStyle::underline
bool underline
Definition: MSPUBTypes.h:101
libmspub::LineSpacingType
LineSpacingType
Definition: MSPUBTypes.h:110
libmspub::Color::r
unsigned char r
Definition: MSPUBTypes.h:169
libmspub::DIB
Definition: MSPUBTypes.h:187
libmspub::MSPUBBlockInfo::type
MSPUBBlockType type
Definition: MSPUBTypes.h:58
libmspub::MSPUBBlockInfo::MSPUBBlockInfo
MSPUBBlockInfo()
Definition: MSPUBTypes.h:56
libmspub::MSPUBBlockInfo::dataOffset
unsigned long dataOffset
Definition: MSPUBTypes.h:60
libmspub::CharacterStyle::CharacterStyle
CharacterStyle(bool u, bool i, bool b, boost::optional< double > tSIP=boost::optional< double >(), int cI=-1, boost::optional< unsigned > fI=boost::optional< unsigned >(), SuperSubType sst=NO_SUPER_SUB)
Definition: MSPUBTypes.h:95
libmspub::ParagraphStyle::m_dropCapLines
boost::optional< unsigned > m_dropCapLines
Definition: MSPUBTypes.h:141
libmspub::BorderPosition
BorderPosition
Definition: MSPUBTypes.h:24
libmspub::SUBSCRIPT
Definition: MSPUBTypes.h:35
libmspub::QuillChunkReference::name
std::string name
Definition: MSPUBTypes.h:84
libmspub::EMF
Definition: MSPUBTypes.h:185
libmspub::TextSpan::chars
std::vector< unsigned char > chars
Definition: MSPUBTypes.h:154
libmspub::CENTER
Definition: MSPUBTypes.h:41
libmspub::INSIDE_SHAPE
Definition: MSPUBTypes.h:26
libmspub::ContentChunkReference::type
MSPUBContentChunkType type
Definition: MSPUBTypes.h:71
MSPUBBlockType.h
libmspub::TIFF
Definition: MSPUBTypes.h:186
libmspub::ParagraphStyle::m_spaceAfterEmu
boost::optional< unsigned > m_spaceAfterEmu
Definition: MSPUBTypes.h:135
libmspub::ParagraphStyle::m_align
boost::optional< Alignment > m_align
Definition: MSPUBTypes.h:131
libmspub::LineSpacingInfo
Definition: MSPUBTypes.h:116
libmspub::EscherContainerInfo::type
unsigned short type
Definition: MSPUBTypes.h:49
libmspub::ContentChunkReference
Definition: MSPUBTypes.h:66
libmspub::MSPUBBlockType
MSPUBBlockType
Definition: MSPUBBlockType.h:15
libmspub::ParagraphStyle::m_rightIndentEmu
boost::optional< unsigned > m_rightIndentEmu
Definition: MSPUBTypes.h:138
libmspub::ParagraphStyle::m_tabStopsInEmu
std::vector< unsigned > m_tabStopsInEmu
Definition: MSPUBTypes.h:140
libmspub::SUPERSCRIPT
Definition: MSPUBTypes.h:34
libmspub::Alignment
Alignment
Definition: MSPUBTypes.h:38
libmspub::ContentChunkReference::parentSeqNum
unsigned parentSeqNum
Definition: MSPUBTypes.h:75
libmspub::UNKNOWN
Definition: MSPUBTypes.h:181
libmspub::ParagraphStyle::m_listInfo
boost::optional< ListInfo > m_listInfo
Definition: MSPUBTypes.h:139
libmspub::NO_SUPER_SUB
Definition: MSPUBTypes.h:33
libmspub::ParagraphStyle::m_spaceBeforeEmu
boost::optional< unsigned > m_spaceBeforeEmu
Definition: MSPUBTypes.h:134
libmspub::PageType
PageType
Definition: MSPUBTypes.h:172
libmspub::ImgType
ImgType
Definition: MSPUBTypes.h:179
libmspub::MSPUBBlockInfo::stringData
std::vector< unsigned char > stringData
Definition: MSPUBTypes.h:63
libmspub::QuillChunkReference::QuillChunkReference
QuillChunkReference()
Definition: MSPUBTypes.h:80
libmspub::JPEGCMYK
Definition: MSPUBTypes.h:189
libmspub::ParagraphStyle::m_firstLineIndentEmu
boost::optional< int > m_firstLineIndentEmu
Definition: MSPUBTypes.h:136
MSPUBBlockID.h
libmspub::ContentChunkReference::ContentChunkReference
ContentChunkReference(MSPUBContentChunkType t, unsigned long o, unsigned long e, unsigned sn, unsigned psn)
Definition: MSPUBTypes.h:69
libmspub::MSPUBBlockInfo::dataLength
unsigned long dataLength
Definition: MSPUBTypes.h:61
libmspub::EscherContainerInfo
Definition: MSPUBTypes.h:46
libmspub::CharacterStyle::textSizeInPt
boost::optional< double > textSizeInPt
Definition: MSPUBTypes.h:104
libmspub::QuillChunkReference::id
unsigned short id
Definition: MSPUBTypes.h:83
libmspub::CharacterStyle::fontIndex
boost::optional< unsigned > fontIndex
Definition: MSPUBTypes.h:106
libmspub::PNG
Definition: MSPUBTypes.h:182
libmspub::ParagraphStyle
Definition: MSPUBTypes.h:129
libmspub::RIGHT
Definition: MSPUBTypes.h:42
libmspub
Definition: Arrow.h:13
libmspub::LINE_SPACING_PT
Definition: MSPUBTypes.h:113
libmspub::QuillChunkReference::length
unsigned long length
Definition: MSPUBTypes.h:81
libmspub::QuillChunkReference
Definition: MSPUBTypes.h:78
libmspub::ParagraphStyle::m_lineSpacing
boost::optional< LineSpacingInfo > m_lineSpacing
Definition: MSPUBTypes.h:133
libmspub::CharacterStyle
Definition: MSPUBTypes.h:88
libmspub::ParagraphStyle::m_leftIndentEmu
boost::optional< unsigned > m_leftIndentEmu
Definition: MSPUBTypes.h:137
libmspub::EscherContainerInfo::contentsOffset
unsigned long contentsOffset
Definition: MSPUBTypes.h:51
libmspub::MSPUBBlockInfo::id
MSPUBBlockID id
Definition: MSPUBTypes.h:57
libmspub::TextParagraph::spans
std::vector< TextSpan > spans
Definition: MSPUBTypes.h:161
libmspub::CharacterStyle::italic
bool italic
Definition: MSPUBTypes.h:102
libmspub::Color::Color
Color()
Definition: MSPUBTypes.h:167
libmspub::DUMMY_PAGE
Definition: MSPUBTypes.h:176
libmspub::ContentChunkReference::end
unsigned long end
Definition: MSPUBTypes.h:73
libmspub::LineSpacingInfo::LineSpacingInfo
LineSpacingInfo()
Definition: MSPUBTypes.h:120
libmspub::MSPUBBlockID
MSPUBBlockID
Definition: MSPUBBlockID.h:15
libmspub::ContentChunkReference::ContentChunkReference
ContentChunkReference()
Definition: MSPUBTypes.h:68
libmspub::MSPUBBlockInfo::data
unsigned data
Definition: MSPUBTypes.h:62
libmspub::LineSpacingInfo::m_type
LineSpacingType m_type
Definition: MSPUBTypes.h:118
libmspub::NORMAL
Definition: MSPUBTypes.h:175
libmspub::PICT
Definition: MSPUBTypes.h:188
libmspub::ParagraphStyle::m_dropCapLetters
boost::optional< unsigned > m_dropCapLetters
Definition: MSPUBTypes.h:142
libmspub::MSPUBBlockInfo::startPosition
unsigned long startPosition
Definition: MSPUBTypes.h:59
libmspub::CharacterStyle::CharacterStyle
CharacterStyle()
Definition: MSPUBTypes.h:90
libmspub::CharacterStyle::superSubType
SuperSubType superSubType
Definition: MSPUBTypes.h:107
libmspub::QuillChunkReference::offset
unsigned long offset
Definition: MSPUBTypes.h:82
libmspub::LineSpacingInfo::LineSpacingInfo
LineSpacingInfo(LineSpacingType type, double amount)
Definition: MSPUBTypes.h:123
libmspub::ParagraphStyle::ParagraphStyle
ParagraphStyle()
Definition: MSPUBTypes.h:143