MSPUBTypes.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libmspub project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_MSPUBTYPES_H
#define INCLUDED_MSPUBTYPES_H
#include <string>
#include <vector>
#include <boost/optional.hpp>
#include "ListInfo.h"
#include "MSPUBBlockID.h"
#include "MSPUBBlockType.h"
#include "MSPUBConstants.h"
#include "MSPUBContentChunkType.h"
namespace libmspub
{
enum BorderPosition
{
INSIDE_SHAPE,
HALF_INSIDE_SHAPE,
OUTSIDE_SHAPE
};
enum SuperSubType
{
NO_SUPER_SUB,
SUPERSCRIPT,
SUBSCRIPT
};
enum class Underline
{
None,
Single,
WordsOnly,
Double,
Dotted,
Thick,
Dash,
DotDash,
DotDotDash,
Wave,
ThickWave,
ThickDot,
ThickDash,
ThickDotDash,
ThickDotDotDash,
LongDash,
ThickLongDash,
DoubleWave,
};
enum Alignment
{
LEFT = 0,
CENTER = 2,
RIGHT = 1,
JUSTIFY = 6
};
struct EscherContainerInfo
{
unsigned short initial;
unsigned short type;
unsigned long contentsLength;
unsigned long contentsOffset;
};
struct MSPUBBlockInfo
{
MSPUBBlockInfo() : id(0), type(0), startPosition(0), dataOffset(0), dataLength(0), data(0), stringData() { }
unsigned id;
unsigned type;
unsigned long startPosition;
unsigned long dataOffset;
unsigned long dataLength;
unsigned data;
std::vector<unsigned char> stringData;
};
struct ContentChunkReference
{
ContentChunkReference() : type(0), offset(0), end(0), seqNum(0), parentSeqNum(0) { }
ContentChunkReference(unsigned t, unsigned long o, unsigned long e, unsigned sn, unsigned psn) :
type(t), offset(o), end(e), seqNum(sn), parentSeqNum(psn) {}
unsigned type;
unsigned long offset;
unsigned long end; //offset of the last element plus one.
unsigned seqNum;
unsigned parentSeqNum;
};
struct QuillChunkReference
{
QuillChunkReference() : length(0), offset(0), id(0), name(), name2() { }
unsigned long length;
unsigned long offset;
unsigned short id;
std::string name;
std::string name2;
};
struct CharacterStyle
{
CharacterStyle() :
underline(), italic(), bold(),
textSizeInPt(), colorIndex(-1), fontIndex(), superSubType(NO_SUPER_SUB)
, outline(false)
, shadow(false)
, smallCaps(false)
, allCaps(false)
, emboss(false)
, engrave(false)
, textScale()
, lcid()
{
}
boost::optional<Underline> underline;
bool italic;
bool bold;
boost::optional<double> textSizeInPt;
int colorIndex;
boost::optional<unsigned> fontIndex;
SuperSubType superSubType;
bool outline;
bool shadow;
bool smallCaps;
bool allCaps;
bool emboss;
bool engrave;
boost::optional<double> textScale;
boost::optional<unsigned> lcid;
};
enum LineSpacingType
{
LINE_SPACING_SP,
LINE_SPACING_PT
};
struct LineSpacingInfo
{
LineSpacingType m_type;
double m_amount;
LineSpacingInfo() : m_type(LINE_SPACING_SP), m_amount(1)
{
}
LineSpacingInfo(LineSpacingType type, double amount) :
m_type(type), m_amount(amount)
{
}
};
struct ParagraphStyle
{
boost::optional<Alignment> m_align;
boost::optional<unsigned> m_defaultCharStyleIndex;
boost::optional<LineSpacingInfo> m_lineSpacing;
boost::optional<unsigned> m_spaceBeforeEmu;
boost::optional<unsigned> m_spaceAfterEmu;
boost::optional<int> m_firstLineIndentEmu;
boost::optional<unsigned> m_leftIndentEmu;
boost::optional<unsigned> m_rightIndentEmu;
boost::optional<ListInfo> m_listInfo;
std::vector<unsigned> m_tabStopsInEmu;
boost::optional<unsigned> m_dropCapLines;
boost::optional<unsigned> m_dropCapLetters;
ParagraphStyle() :
m_align(), m_defaultCharStyleIndex(), m_lineSpacing(), m_spaceBeforeEmu(),
m_spaceAfterEmu(), m_firstLineIndentEmu(), m_leftIndentEmu(),
m_rightIndentEmu(), m_listInfo(), m_tabStopsInEmu(), m_dropCapLines(), m_dropCapLetters()
{
}
};
struct TextSpan
{
TextSpan(const std::vector<unsigned char> &c, const CharacterStyle &s) : chars(c), style(s) { }
std::vector<unsigned char> chars;
CharacterStyle style;
};
struct TextParagraph
{
TextParagraph(const std::vector<TextSpan> &sp, const ParagraphStyle &st) : spans(sp), style(st) { }
std::vector<TextSpan> spans;
ParagraphStyle style;
};
struct Color
{
Color() : r(0), g(0), b(0) { }
Color(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) { }
unsigned char r, g, b;
};
enum PageType
{
MASTER,
NORMAL,
DUMMY_PAGE
};
enum ImgType
{
UNKNOWN,
PNG,
JPEG,
WMF,
EMF,
TIFF,
DIB,
PICT,
JPEGCMYK
};
} // namespace libmspub
#endif /* INCLUDED_MSPUBTYPES_H */
/* 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
Definition MSPUBTypes.h:58
libmspub::Underline::WordsOnly
@ WordsOnly
Definition MSPUBTypes.h:44
libmspub::Underline::Thick
@ Thick
Definition MSPUBTypes.h:47
libmspub::Underline::LongDash
@ LongDash
Definition MSPUBTypes.h:57
libmspub::Underline::DoubleWave
@ DoubleWave
Definition MSPUBTypes.h:59
libmspub::Underline::DotDotDash
@ DotDotDash
Definition MSPUBTypes.h:50
libmspub::Underline::ThickDash
@ ThickDash
Definition MSPUBTypes.h:54
libmspub::Underline::Single
@ Single
Definition MSPUBTypes.h:43
libmspub::Underline::None
@ None
Definition MSPUBTypes.h:42
libmspub::Underline::ThickDotDash
@ ThickDotDash
Definition MSPUBTypes.h:55
libmspub::Underline::Dotted
@ Dotted
Definition MSPUBTypes.h:46
libmspub::Underline::DotDash
@ DotDash
Definition MSPUBTypes.h:49
libmspub::Underline::ThickDotDotDash
@ ThickDotDotDash
Definition MSPUBTypes.h:56
libmspub::Underline::ThickWave
@ ThickWave
Definition MSPUBTypes.h:52
libmspub::Underline::Double
@ Double
Definition MSPUBTypes.h:45
libmspub::Underline::Wave
@ Wave
Definition MSPUBTypes.h:51
libmspub::Underline::ThickDot
@ ThickDot
Definition MSPUBTypes.h:53
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::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::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::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::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::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::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::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