MSPUBTypes.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* libmspub
00003  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License or as specified alternatively below. You may obtain a copy of
00008  * the License at http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * Major Contributor(s):
00016  * Copyright (C) 2012 Brennan Vincent <brennanv@email.arizona.edu>
00017  * Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
00018  *
00019  * All Rights Reserved.
00020  *
00021  * For minor contributions see the git repository.
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
00025  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
00026  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
00027  * instead of those above.
00028  */
00029 
00030 #ifndef __MSPUBTYPES_H__
00031 #define __MSPUBTYPES_H__
00032 
00033 #include <vector>
00034 #include <string>
00035 #include "MSPUBBlockType.h"
00036 #include "MSPUBBlockID.h"
00037 #include "MSPUBContentChunkType.h"
00038 #include "MSPUBConstants.h"
00039 
00040 namespace libmspub
00041 {
00042 enum BorderPosition
00043 {
00044   INSIDE_SHAPE,
00045   HALF_INSIDE_SHAPE,
00046   OUTSIDE_SHAPE
00047 };
00048 
00049 enum Alignment
00050 {
00051   LEFT = 0,
00052   CENTER = 2,
00053   RIGHT = 1,
00054   JUSTIFY = 6
00055 };
00056 
00057 struct EscherContainerInfo
00058 {
00059   unsigned short initial;
00060   unsigned short type;
00061   unsigned long contentsLength;
00062   unsigned long contentsOffset;
00063 };
00064 
00065 struct MSPUBBlockInfo
00066 {
00067   MSPUBBlockInfo() : id((MSPUBBlockID)0), type((MSPUBBlockType)0), startPosition(0), dataOffset(0), dataLength(0), data(0), stringData() { }
00068   MSPUBBlockID id;
00069   MSPUBBlockType type;
00070   unsigned long startPosition;
00071   unsigned long dataOffset;
00072   unsigned long dataLength;
00073   unsigned data;
00074   std::vector<unsigned char> stringData;
00075 };
00076 
00077 struct ContentChunkReference
00078 {
00079   ContentChunkReference() : type((MSPUBContentChunkType)0), offset(0), end(0), seqNum(0), parentSeqNum(0) { }
00080   ContentChunkReference(MSPUBContentChunkType t, unsigned long o, unsigned long e, unsigned sn, unsigned psn) :
00081     type(t), offset(o), end(e), seqNum(sn), parentSeqNum(psn) {}
00082   MSPUBContentChunkType type;
00083   unsigned long offset;
00084   unsigned long end; //offset of the last element plus one.
00085   unsigned seqNum;
00086   unsigned parentSeqNum;
00087 };
00088 
00089 struct QuillChunkReference
00090 {
00091   QuillChunkReference() : length(0), offset(0), id(0), name(), name2() { }
00092   unsigned long length;
00093   unsigned long offset;
00094   unsigned short id;
00095   std::string name;
00096   std::string name2;
00097 };
00098 
00099 struct CharacterStyle
00100 {
00101   CharacterStyle(bool u, bool i, bool b, int tSIP = -1, int cI = -1, unsigned fI = 0) :
00102     underline(u), italic(i), bold(b), textSizeInPt(tSIP), colorIndex(cI), fontIndex(fI) { }
00103   bool underline;
00104   bool italic;
00105   bool bold;
00106   int textSizeInPt;
00107   int colorIndex;
00108   unsigned fontIndex;
00109 };
00110 
00111 struct ParagraphStyle
00112 {
00113   ParagraphStyle(Alignment a = (Alignment)-1, unsigned dCSI = 0, unsigned ls = LINE_SPACING_UNIT, unsigned sb = 0, unsigned sa = 0, int fli = 0, unsigned li = 0, unsigned ri = 0) : align(a), defaultCharStyleIndex(dCSI), lineSpacing(ls), spaceBeforeEmu(sb), spaceAfterEmu(sa), firstLineIndentEmu(fli), leftIndentEmu(li), rightIndentEmu(ri) { }
00114   Alignment align;
00115   unsigned defaultCharStyleIndex;
00116   unsigned lineSpacing;
00117   unsigned spaceBeforeEmu;
00118   unsigned spaceAfterEmu;
00119   int firstLineIndentEmu;
00120   unsigned leftIndentEmu;
00121   unsigned rightIndentEmu;
00122 };
00123 
00124 struct TextSpan
00125 {
00126   TextSpan(std::vector<unsigned char> c, CharacterStyle s) : chars(c), style(s) { }
00127   std::vector<unsigned char> chars;
00128   CharacterStyle style;
00129 };
00130 
00131 struct TextParagraph
00132 {
00133   TextParagraph(std::vector<TextSpan> sp, ParagraphStyle st) : spans(sp), style(st) { }
00134   std::vector<TextSpan> spans;
00135   ParagraphStyle style;
00136 };
00137 
00138 struct Color
00139 {
00140   Color() : r(0), g(0), b(0) { }
00141   Color(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) { }
00142   unsigned char r, g, b;
00143 };
00144 
00145 enum PageType
00146 {
00147   MASTER,
00148   NORMAL,
00149   DUMMY_PAGE
00150 };
00151 
00152 enum ImgType
00153 {
00154   UNKNOWN,
00155   PNG,
00156   JPEG,
00157   WMF,
00158   EMF,
00159   TIFF,
00160   DIB,
00161   PICT
00162 };
00163 
00164 } // namespace libmspub
00165 
00166 #endif /* __MSPUBTYPES_H__ */
00167 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */