00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __MSPUBTYPES_H__
00031 #define __MSPUBTYPES_H__
00032
00033 #include <vector>
00034 #include <string>
00035 #include <boost/optional.hpp>
00036 #include "MSPUBBlockType.h"
00037 #include "MSPUBBlockID.h"
00038 #include "MSPUBContentChunkType.h"
00039 #include "MSPUBConstants.h"
00040 #include "ListInfo.h"
00041
00042 namespace libmspub
00043 {
00044 enum BorderPosition
00045 {
00046 INSIDE_SHAPE,
00047 HALF_INSIDE_SHAPE,
00048 OUTSIDE_SHAPE
00049 };
00050
00051 enum SuperSubType
00052 {
00053 NO_SUPER_SUB,
00054 SUPERSCRIPT,
00055 SUBSCRIPT
00056 };
00057
00058 enum Alignment
00059 {
00060 LEFT = 0,
00061 CENTER = 2,
00062 RIGHT = 1,
00063 JUSTIFY = 6
00064 };
00065
00066 struct EscherContainerInfo
00067 {
00068 unsigned short initial;
00069 unsigned short type;
00070 unsigned long contentsLength;
00071 unsigned long contentsOffset;
00072 };
00073
00074 struct MSPUBBlockInfo
00075 {
00076 MSPUBBlockInfo() : id((MSPUBBlockID)0), type((MSPUBBlockType)0), startPosition(0), dataOffset(0), dataLength(0), data(0), stringData() { }
00077 MSPUBBlockID id;
00078 MSPUBBlockType type;
00079 unsigned long startPosition;
00080 unsigned long dataOffset;
00081 unsigned long dataLength;
00082 unsigned data;
00083 std::vector<unsigned char> stringData;
00084 };
00085
00086 struct ContentChunkReference
00087 {
00088 ContentChunkReference() : type((MSPUBContentChunkType)0), offset(0), end(0), seqNum(0), parentSeqNum(0) { }
00089 ContentChunkReference(MSPUBContentChunkType t, unsigned long o, unsigned long e, unsigned sn, unsigned psn) :
00090 type(t), offset(o), end(e), seqNum(sn), parentSeqNum(psn) {}
00091 MSPUBContentChunkType type;
00092 unsigned long offset;
00093 unsigned long end;
00094 unsigned seqNum;
00095 unsigned parentSeqNum;
00096 };
00097
00098 struct QuillChunkReference
00099 {
00100 QuillChunkReference() : length(0), offset(0), id(0), name(), name2() { }
00101 unsigned long length;
00102 unsigned long offset;
00103 unsigned short id;
00104 std::string name;
00105 std::string name2;
00106 };
00107
00108 struct CharacterStyle
00109 {
00110 CharacterStyle() :
00111 underline(), italic(), bold(),
00112 textSizeInPt(), colorIndex(-1), fontIndex(), superSubType(NO_SUPER_SUB)
00113 {
00114 }
00115 CharacterStyle(bool u, bool i, bool b,
00116 boost::optional<double> tSIP = boost::optional<double>(),
00117 int cI = -1,
00118 boost::optional<unsigned> fI = boost::optional<unsigned>(),
00119 SuperSubType sst = NO_SUPER_SUB) :
00120 underline(u), italic(i), bold(b), textSizeInPt(tSIP), colorIndex(cI), fontIndex(fI), superSubType(sst) { }
00121 bool underline;
00122 bool italic;
00123 bool bold;
00124 boost::optional<double> textSizeInPt;
00125 int colorIndex;
00126 boost::optional<unsigned> fontIndex;
00127 SuperSubType superSubType;
00128 };
00129
00130 enum LineSpacingType
00131 {
00132 LINE_SPACING_SP,
00133 LINE_SPACING_PT
00134 };
00135
00136 struct LineSpacingInfo
00137 {
00138 LineSpacingType m_type;
00139 double m_amount;
00140 LineSpacingInfo() : m_type(LINE_SPACING_SP), m_amount(1)
00141 {
00142 }
00143 LineSpacingInfo(LineSpacingType type, double amount) :
00144 m_type(type), m_amount(amount)
00145 {
00146 }
00147 };
00148
00149 struct ParagraphStyle
00150 {
00151 boost::optional<Alignment> m_align;
00152 boost::optional<unsigned> m_defaultCharStyleIndex;
00153 boost::optional<LineSpacingInfo> m_lineSpacing;
00154 boost::optional<unsigned> m_spaceBeforeEmu;
00155 boost::optional<unsigned> m_spaceAfterEmu;
00156 boost::optional<int> m_firstLineIndentEmu;
00157 boost::optional<unsigned> m_leftIndentEmu;
00158 boost::optional<unsigned> m_rightIndentEmu;
00159 boost::optional<ListInfo> m_listInfo;
00160 std::vector<unsigned> m_tabStopsInEmu;
00161 boost::optional<unsigned> m_dropCapLines;
00162 boost::optional<unsigned> m_dropCapLetters;
00163 ParagraphStyle() :
00164 m_align(), m_defaultCharStyleIndex(), m_lineSpacing(), m_spaceBeforeEmu(),
00165 m_spaceAfterEmu(), m_firstLineIndentEmu(), m_leftIndentEmu(),
00166 m_rightIndentEmu(), m_listInfo(), m_tabStopsInEmu(), m_dropCapLines(), m_dropCapLetters()
00167 {
00168 }
00169 };
00170
00171 struct TextSpan
00172 {
00173 TextSpan(const std::vector<unsigned char> &c, const CharacterStyle &s) : chars(c), style(s) { }
00174 std::vector<unsigned char> chars;
00175 CharacterStyle style;
00176 };
00177
00178 struct TextParagraph
00179 {
00180 TextParagraph(const std::vector<TextSpan> &sp, const ParagraphStyle &st) : spans(sp), style(st) { }
00181 std::vector<TextSpan> spans;
00182 ParagraphStyle style;
00183 };
00184
00185 struct Color
00186 {
00187 Color() : r(0), g(0), b(0) { }
00188 Color(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) { }
00189 unsigned char r, g, b;
00190 };
00191
00192 enum PageType
00193 {
00194 MASTER,
00195 NORMAL,
00196 DUMMY_PAGE
00197 };
00198
00199 enum ImgType
00200 {
00201 UNKNOWN,
00202 PNG,
00203 JPEG,
00204 WMF,
00205 EMF,
00206 TIFF,
00207 DIB,
00208 PICT,
00209 JPEGCMYK
00210 };
00211
00212 }
00213
00214 #endif
00215