1 /*
2  * constant.h
3  * Copyright (C) Martin Singer 2009-2013 <m_power3@users.sourceforge.net>
4  *
5  * pdfchain is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * pdfchain is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __PDFCHAIN_CONSTANT__
20 #define __PDFCHAIN_CONSTANT__
21 
22 #include <iostream>
23 //#include <limits>
24 #include <gtkmm.h>
25 
26 #include "config.h"
27 
28 
29 /*** Precompiler definitions **************************************************/
30 
31 #define PDFCHAIN "PDF Chain"
32 
33 // config.h
34 #ifndef VERSION
35 #define VERSION 0.3.x
36 #endif
37 
38 #ifndef PACKAGE_URL
39 #define PACKAGE_URL "http://pdfchain.sourceforge.net"
40 #endif
41 
42 
43 
44 
45 /*** Constant values **********************************************************/
46 
47 namespace Pdfchain {
48 
49 	// GUI values
50 	const guint BORDER  = 10;
51 	const guint SPACING = 10;
52 	const guint PADDING = 5;
53 /*
54 	const guint BORDER  = 12;
55 	const guint SPACING = 12;
56 	const guint PADDING = 5;
57 */
58 	const std::string APPICON_PATH_A = "/usr/share/pixmaps/pdfchain.png";
59 	const std::string APPICON_PATH_B = "/usr/local/share/pixmaps/pdfchain.png";
60 
61 	// About
62 	namespace About {
63 		const Glib::ustring PROGRAM_NAME    = PDFCHAIN;
64 		const Glib::ustring PROGRAM_VERSION = VERSION;
65 		const Glib::ustring PROJECT_URL     = PACKAGE_URL;
66 	}
67 
68 	// Window
69 	namespace Window {
70 		const Glib::ustring TITLE  = PDFCHAIN;
71 		const int           WIDTH  = 650;
72 		const int           HEIGHT = 530;
73 	}
74 
75 	// Special characters
76 	namespace Char {
77 		const char EOL = '\0';
78 		const char ESC = '\\';
79 	}
80 
81 	// Special characters as strings
82 	namespace String {
83 		const Glib::ustring QUOTE_BEGIN = "\xC2\xBB";	// '>>'
84 		const Glib::ustring QUOTE_END   = "\xC2\xAB";	// '<<'
85 		const Glib::ustring COPYRIGHT   = "\xC2\xA9";	// (c)
86 	}
87 
88 	// Colors
89 	namespace Color {
90 		const Gdk::RGBA RGBA_VALID   = Gdk::RGBA( NULL );		// default
91 		const Gdk::RGBA RGBA_WARNING = Gdk::RGBA( "#ff8000" );	// orange
92 		const Gdk::RGBA RGBA_INVALID = Gdk::RGBA( "#ff0000" );	// red
93 	}
94 
95 	// Count PDF page numbers
96 	namespace Count {
97 		const guint BUFFER_SIZE = 1048576;	// 1 Mebibyte (MiB)
98 
99 		const Glib::ustring TYPE_PAGE_A = "/Type/Page";
100 		const Glib::ustring TYPE_PAGE_B = "/Type /Page";
101 		const Glib::ustring TYPE_PAGE_C = "/Type/Pages";
102 		const Glib::ustring TYPE_PAGE_D = "/Type /Pages";
103 	}
104 
105 	namespace Path {
106 		//const std::string DEFAULT_FOLDER_DOCUMENTS = Glib::get_user_special_dir( G_USER_DIRECTORY_DOCUMENTS );
107 
108 		// Escape characters for the bash
109 		// '\\' backslash is the escape character - must be the first char at this array!
110 		// '\"' doublequote is the quote character for paths
111 		// '`'	backquote
112 		// '$'	dollar
113 		// '\0' NULL is the string terminator - must be the final char at this array!
114 		const char ESCAPE_CHARS[5] = { '\\' , '\"' , '`', '$', '\0' };
115 	}
116 
117 	// Sections
118 	namespace Cat {
119 		const Glib::ustring ALLOWED_SIGNS  = "0123456789 -";
120 		const Glib::ustring ALLOWED_DIGITS = "0123456789";
121 
122 //		const guchar HANDLE_DEFAULT = '0';	//TODO: OLD - delete handles
123 //		const guchar HANDLE_FIRST   = 'A';
124 //		const guchar HANDLE_FINAL   = 'Z';
125 	}
126 
127 	namespace Burst {
128 		//const double ADJUST_UPPER_DIGITS = std::numeric_limits<double>::max();
129 		const double ADJUST_UPPER_DIGITS = 99.0;
130 	}
131 
132 	namespace Attach {
133 		//const double ADJUST_UPPER_PAGE_NUMBERS = std::numeric_limits<double>::max();
134 		const double ADJUST_UPPER_PAGE_NUMBERS = 999999.0;
135 	}
136 
137 	// File Extensions
138 	namespace Extension {
139 		const std::string EXT_PDF  = ".pdf";
140 		const std::string EXT_FDF  = ".fdf";
141 		const std::string EXT_TXT  = ".txt";
142 		const std::string EXT_DUMP = ".dump";
143 	}
144 
145 	// PDFTK commands
146 	namespace Cmd {
147 
148 		// General
149 		const std::string PDFTK          = "pdftk";
150 		const std::string CAT            = "cat";
151 		const std::string SHUFFLE        = "shuffle";
152 		const std::string OUTPUT         = "output";
153 		const std::string PASSWORD_INPUT = "input_pw";
154 
155 		// Cat and Shuffle
156 		const std::string ID_KEEP  = "";						// keep ID
157 		const std::string ID_NEW   = "";						// new ID
158 		const std::string ID_FIRST = "keep_first_id";			// ID of first PDF
159 		const std::string ID_FINAL = "keep_final_id";			// ID of final PDF
160 
161 		const std::string ROTATION_N = "north";					//   0°
162 		const std::string ROTATION_E = "east";					//  90°
163 		const std::string ROTATION_S = "south";					// 180°
164 		const std::string ROTATION_W = "west";					// 270°
165 /*
166 		const std::string ROTATION_N = "N";						//   0°	// TODO: OLD - delete rotation
167 		const std::string ROTATION_E = "E";						//  90°
168 		const std::string ROTATION_S = "S";						// 180°
169 		const std::string ROTATION_W = "W";						// 270°
170 */
171 		const std::string PAGES_ALL  = "";						// 1,2,3,4,5,6
172 		const std::string PAGES_EVEN = "even";					// 2,4,6
173 		const std::string PAGES_ODD  = "odd";					// 1,3,5
174 
175 		// Burst
176 		const std::string BURST     = "burst";
177 		const std::string TEMPLATE  = "%0";						// Complete suffix example: "%04d.pdf"
178 		const std::string EXTENSION = ".pdf";
179 		const std::string COUNT_OCT = "o";
180 		const std::string COUNT_DEC = "d";
181 		const std::string COUNT_HEX = "x";
182 
183 		// Background / Stamp
184 		const std::string BACKGROUND       = "background";
185 		const std::string BACKGROUND_MULTI = "multibackground";
186 		const std::string STAMP            = "stamp";
187 		const std::string STAMP_MULTI      = "multistamp";
188 
189 		// Attachment
190 		const std::string ATTACH_FILES = "attach_files";
191 		const std::string TO_PAGE      = "to_page";
192 
193 		// Features
194 		const std::string ALLOW         = "allow";
195 		const std::string FEATURES_ALL  = "AllFeatures";
196 
197 		const std::string PRINTING           = "Printing";
198 		const std::string DEGRADED_PRINTING  = "DegradedPrinting";
199 		const std::string MODIFY_CONTENTS    = "ModifyContents";
200 		const std::string ASSEMBLY           = "Assembly";
201 		const std::string COPY_CONTENTS      = "CopyContents";
202 		const std::string SCREEN_READERS     = "ScreenReaders";
203 		const std::string MODIFY_ANNOTATIONS = "ModifyAnnotations";
204 		const std::string FILL_IN            = "FillIn";
205 
206 		const std::string PASSWORD_OWNER = "owner_pw";
207 		const std::string PASSWORD_USER  = "user_pw";
208 
209 		//const std::string ENCRYPT_NONE   = "";
210 		const std::string ENCRYPT_40BIT  = "encrypt_40bit";
211 		const std::string ENCRYPT_128BIT = "encrypt_128bit";
212 
213 		// Tools
214 		const std::string UNPACK_FILES          = "unpack_files";
215 		const std::string COMPRESS              = "compress";
216 		const std::string UNCOMPRESS            = "uncompress";
217 		const std::string DUMP_DATA_ANNOTS      = "dump_data_annots";
218 		const std::string DUMP_DATA_FIELDS      = "dump_data_fields";
219 		const std::string DUMP_DATA_FIELDS_UTF8 = "dump_data_fields_utf8";
220 		const std::string DUMP_DATA             = "dump_data";
221 		const std::string DUMP_DATA_UTF8        = "dump_data_utf8";
222 		const std::string UPDATE_INFO           = "update_info";
223 		const std::string UPDATE_INFO_UTF8      = "update_info_utf8";
224 		const std::string GENERATE_FDF          = "generate_fdf";
225 		const std::string FILL_FORM             = "fill_form";
226 		const std::string FLATTEN               = "flatten";
227 		const std::string NEED_APPEARANCES      = "need_appearances";
228 		const std::string DROP_XFA              = "drop_xfa";
229 	}
230 }
231 
232 
233 #endif
234