LRFTypes.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libe-book project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef LRFTYPES_H_INCLUDED
00011 #define LRFTYPES_H_INCLUDED
00012 
00013 #include <deque>
00014 #include <map>
00015 #include <string>
00016 
00017 #include <boost/optional.hpp>
00018 
00019 namespace libebook
00020 {
00021 
00022 enum LRFImageType
00023 {
00024   LRF_IMAGE_TYPE_UNKNOWN = 0,
00025   LRF_IMAGE_TYPE_JPEG = 0x11,
00026   LRF_IMAGE_TYPE_PNG = 0x12,
00027   LRF_IMAGE_TYPE_BMP = 0x13,
00028   LRF_IMAGE_TYPE_GIF = 0x14
00029 };
00030 
00031 enum LRFEmptyLinePosition
00032 {
00033   LRF_EMPTY_LINE_POSITION_UNKNOWN,
00034   LRF_EMPTY_LINE_POSITION_BEFORE,
00035   LRF_EMPTY_LINE_POSITION_AFTER
00036 };
00037 
00038 enum LRFEmptyLineMode
00039 {
00040   LRF_EMPTY_LINE_MODE_NONE,
00041   LRF_EMPTY_LINE_MODE_SOLID,
00042   LRF_EMPTY_LINE_MODE_DASHED,
00043   LRF_EMPTY_LINE_MODE_DOUBLE,
00044   LRF_EMPTY_LINE_MODE_DOTTED
00045 };
00046 
00047 enum LRFAlign
00048 {
00049   LRF_ALIGN_START,
00050   LRF_ALIGN_END,
00051   LRF_ALIGN_CENTER
00052 };
00053 
00054 struct LRFBookInfo
00055 {
00056   LRFBookInfo();
00057 
00058   std::string author;
00059   std::string title;
00060   std::string bookID;
00061   std::string publisher;
00062   boost::optional<std::string> label;
00063   std::deque<std::string> categories;
00064   std::string classification;
00065   boost::optional<std::string> freeText;
00066 };
00067 
00068 struct LRFDocInfo
00069 {
00070   LRFDocInfo();
00071 
00072   std::string language;
00073   std::string creator;
00074   std::string creationDate;
00075   std::string producer;
00076   unsigned page;
00077 };
00078 
00079 struct LRFMetadata
00080 {
00081   LRFMetadata();
00082 
00083   LRFBookInfo bookInfo;
00084   LRFDocInfo docInfo;
00085   boost::optional<std::string> keyword;
00086 };
00087 
00088 struct LRFColor
00089 {
00090   LRFColor();
00091   explicit LRFColor(unsigned color);
00092   LRFColor(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 0);
00093 
00094   unsigned char r;
00095   unsigned char g;
00096   unsigned char b;
00097   unsigned char a;
00098 };
00099 
00100 struct LRFEmptyLine
00101 {
00102   LRFEmptyLine();
00103 
00104   LRFEmptyLinePosition m_position;
00105   LRFEmptyLineMode m_mode;
00106 };
00107 
00108 struct LRFAttributes
00109 {
00110   LRFAttributes();
00111 
00112   boost::optional<unsigned> fontSize;
00113   boost::optional<unsigned> fontWidth;
00114   boost::optional<unsigned> fontEscapement;
00115   boost::optional<unsigned> fontOrientation;
00116   boost::optional<unsigned> fontWeight;
00117   boost::optional<std::string> fontFacename;
00118   boost::optional<LRFColor> textColor;
00119   boost::optional<LRFColor> textBgColor;
00120   boost::optional<unsigned> wordSpace;
00121   boost::optional<unsigned> letterSpace;
00122   boost::optional<unsigned> baseLineSkip;
00123   boost::optional<unsigned> lineSpace;
00124   boost::optional<unsigned> parIndent;
00125   boost::optional<unsigned> parSkip;
00126   boost::optional<unsigned> height;
00127   boost::optional<unsigned> width;
00128   boost::optional<unsigned> locationX;
00129   boost::optional<unsigned> locationY;
00130   bool italic;
00131   bool sup;
00132   bool sub;
00133   bool heading;
00134   boost::optional<LRFEmptyLine> emptyLine;
00135   boost::optional<LRFAlign> align;
00136   boost::optional<unsigned> topSkip;
00137   boost::optional<unsigned> topMargin;
00138   boost::optional<unsigned> oddSideMargin;
00139   boost::optional<unsigned> evenSideMargin;
00140 };
00141 
00142 typedef std::map<unsigned, LRFAttributes> LRFAttributeMap_t;
00143 
00144 }
00145 
00146 #endif // LRFTYPES_H_INCLUDED
00147 
00148 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */