1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* 3 * This file is part of the libe-book 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 BBEBTYPES_H_INCLUDED 11 #define BBEBTYPES_H_INCLUDED 12 13 #include <deque> 14 #include <map> 15 #include <string> 16 17 #include <boost/optional.hpp> 18 19 namespace libebook 20 { 21 22 enum BBeBImageType 23 { 24 BBEB_IMAGE_TYPE_UNKNOWN = 0, 25 BBEB_IMAGE_TYPE_JPEG = 0x11, 26 BBEB_IMAGE_TYPE_PNG = 0x12, 27 BBEB_IMAGE_TYPE_BMP = 0x13, 28 BBEB_IMAGE_TYPE_GIF = 0x14 29 }; 30 31 enum BBeBEmptyLinePosition 32 { 33 BBEB_EMPTY_LINE_POSITION_UNKNOWN, 34 BBEB_EMPTY_LINE_POSITION_BEFORE, 35 BBEB_EMPTY_LINE_POSITION_AFTER 36 }; 37 38 enum BBeBEmptyLineMode 39 { 40 BBEB_EMPTY_LINE_MODE_NONE, 41 BBEB_EMPTY_LINE_MODE_SOLID, 42 BBEB_EMPTY_LINE_MODE_DASHED, 43 BBEB_EMPTY_LINE_MODE_DOUBLE, 44 BBEB_EMPTY_LINE_MODE_DOTTED 45 }; 46 47 enum BBeBAlign 48 { 49 BBEB_ALIGN_START, 50 BBEB_ALIGN_END, 51 BBEB_ALIGN_CENTER 52 }; 53 54 struct BBeBBookInfo 55 { 56 BBeBBookInfo(); 57 58 std::string author; 59 std::string title; 60 std::string bookID; 61 std::string publisher; 62 boost::optional<std::string> label; 63 std::deque<std::string> categories; 64 std::string classification; 65 boost::optional<std::string> freeText; 66 }; 67 68 struct BBeBDocInfo 69 { 70 BBeBDocInfo(); 71 72 std::string language; 73 std::string creator; 74 std::string creationDate; 75 std::string producer; 76 unsigned page; 77 }; 78 79 struct BBeBMetadata 80 { 81 BBeBMetadata(); 82 83 BBeBBookInfo bookInfo; 84 BBeBDocInfo docInfo; 85 boost::optional<std::string> keyword; 86 }; 87 88 struct BBeBColor 89 { 90 BBeBColor(); 91 explicit BBeBColor(unsigned color); 92 BBeBColor(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 0); 93 94 unsigned char r; 95 unsigned char g; 96 unsigned char b; 97 unsigned char a; 98 }; 99 100 struct BBeBEmptyLine 101 { 102 BBeBEmptyLine(); 103 104 BBeBEmptyLinePosition m_position; 105 BBeBEmptyLineMode m_mode; 106 }; 107 108 struct BBeBAttributes 109 { 110 BBeBAttributes(); 111 112 boost::optional<unsigned> fontSize; 113 boost::optional<unsigned> fontWidth; 114 boost::optional<unsigned> fontEscapement; 115 boost::optional<unsigned> fontOrientation; 116 boost::optional<unsigned> fontWeight; 117 boost::optional<std::string> fontFacename; 118 boost::optional<BBeBColor> textColor; 119 boost::optional<BBeBColor> textBgColor; 120 boost::optional<unsigned> wordSpace; 121 boost::optional<unsigned> letterSpace; 122 boost::optional<unsigned> baseLineSkip; 123 boost::optional<unsigned> lineSpace; 124 boost::optional<unsigned> parIndent; 125 boost::optional<unsigned> parSkip; 126 boost::optional<unsigned> height; 127 boost::optional<unsigned> width; 128 boost::optional<unsigned> locationX; 129 boost::optional<unsigned> locationY; 130 bool italic; 131 bool sup; 132 bool sub; 133 bool heading; 134 boost::optional<BBeBEmptyLine> emptyLine; 135 boost::optional<BBeBAlign> align; 136 boost::optional<unsigned> topSkip; 137 boost::optional<unsigned> topMargin; 138 boost::optional<unsigned> oddSideMargin; 139 boost::optional<unsigned> evenSideMargin; 140 }; 141 142 typedef std::map<unsigned, BBeBAttributes> BBeBAttributeMap_t; 143 144 } 145 146 #endif // BBEBTYPES_H_INCLUDED 147 148 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ 149