1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef PDFOPTIONS_H
8 #define PDFOPTIONS_H
9 
10 /**
11  * @file pdfoptions.h
12  * @author Franz Schmid
13  * @author Craig Ringer
14  * @brief Defines class PDFOptions, used for loading/saving/passing around PDF options
15  */
16 
17 #include <QList>
18 #include <QMap>
19 #include <QString>
20 
21 #include "pdfversion.h"
22 #include "scribusapi.h"
23 #include "scribusstructs.h"
24 
25 struct PDFPresentationData;
26 struct LPIData;
27 class  MarginStruct;
28 
29 /**
30  * @brief PDF Options struture. Capable of verifying its self, but otherwise largely
31  *        a dumb struct.
32  *
33  * If you change this class, please ensure that PDFOptionsIO is
34  * updated to match and scribus/dtd/scribuspdfoptions.dtd is tweaked
35  * if required.
36  *
37  * @sa PDFOptionsIO
38  */
39 class SCRIBUS_API PDFOptions
40 {
41 public:
42 
43 	enum VerifyResults
44 	{
45 		Verify_NoError = 0,
46 		Verify_OptionConflict,
47 		Verify_OptionOutOfRange,
48 		Verify_OtherError
49 	};
50 
51 	enum PDFPageLayout
52 	{
53 		SinglePage = 0,
54 		OneColumn,
55 		TwoColumnLeft,
56 		TwoColumnRight
57 	};
58 
59 	enum PDFCompression
60 	{
61 		Compression_Auto = 0,
62 		Compression_JPEG = 1,
63 		Compression_ZIP  = 2,
64 		Compression_None = 3
65 	};
66 
67 	enum PDFFontEmbedding
68 	{
69 		EmbedFonts = 0,
70 		OutlineFonts = 1,
71 		DontEmbed  = 2
72 	};
73 
74 	/**
75 	 * @author Craig Ringer
76 	 * @brief Sanity check the options defined.
77 	 *
78 	 * Unimplemented, always returns Verify_NoError
79 	 *
80 	 * Checks the PDF option structure for conflicts between mututally
81 	 * exclusive options, ensures all options are within sane ranges,
82 	 * and that there are no nonsensical options values set. If nothing
83 	 * is wrong, returns Verify_NoError, otherwise returns error code from
84 	 * PDFOptions::VerifyResults. If problemDescription is not NULL,
85 	 * it will contain a human-readable description of the error on return.
86 	 *
87 	 * @warning DO NOT *EVER* TEST THE VALUE OF problemDescription. Rely on the
88 	 *          return code instead. problemDescription is subject to
89 	 *          translation and its contents may change without notice.
90 	 *
91 	 * @param problemDescription Error description
92 	 * @return Verify_NoError for sane options, otherwise error code.
93 	 */
94 	PDFOptions::VerifyResults verify(QString* problemDescription);
95 	PDFOptions::VerifyResults verify();
96 
97 	bool exportsLayers() const;
98 	bool supportsEmbeddedOpenTypeFonts() const;
99 	bool supportsOCGs() const;
100 	bool supportsTransparency() const;
101 
102 	bool firstUse { true };
103 	bool Thumbnails { false };
104 	bool Articles { false };
105 	bool useLayers { false };
106 	bool Compress { true };
107 	PDFCompression CompressMethod { Compression_Auto };
108 	int  Quality { 0 };
109 	bool RecalcPic { false };
110 	bool Bookmarks { false };
111 	int  PicRes { 300 };
112 	bool embedPDF { false };
113 	PDFVersion Version { PDFVersion::PDF_14 };
114 	int  Resolution { 300 };
115 	int  Binding { 0 };
116 	PDFFontEmbedding FontEmbedding { EmbedFonts };
117 	QList<QString> EmbedList;
118 	QList<QString> SubsetList;
119 	QList<QString> OutlineList;
120 	bool MirrorH { false };
121 	bool MirrorV { false };
122 	bool doClip { false };
123 	int  RotateDeg { 0 };
124 	bool PresentMode { false };
125 	QString fileName;
126 	bool isGrayscale { false };
127 	bool UseRGB { true };
128 	bool UseProfiles { false };
129 	bool UseProfiles2 { false };
130 	bool UseLPI { false };
131 	bool UseSpotColors { true };
132 	bool doMultiFile { false };
133 	bool openAfterExport { false };
134 	QMap<QString,LPIData> LPISettings;
135 	QString SolidProf;
136 	int  SComp { 3 };
137 	QString ImageProf;
138 	bool EmbeddedI { false };
139 	int  Intent2 { 0 };
140 	QString PrintProf;
141 	QString Info;
142 	int  Intent { 0 };
143 	MarginStruct bleeds;
144 	bool Encrypt { false };
145 	QString PassOwner;
146 	QString PassUser;
147 	int  Permissions { -4 };
148 	int  PageLayout { SinglePage };
149 	bool displayBookmarks { false };
150 	bool displayThumbs { false };
151 	bool displayLayers { false };
152 	bool displayFullscreen { false };
153 	bool hideToolBar { false };
154 	bool hideMenuBar { false };
155 	bool fitWindow { false };
156 	bool cropMarks { false };
157 	bool bleedMarks { false };
158 	bool registrationMarks { false };
159 	bool colorMarks { false };
160 	bool docInfoMarks { false };
161 	bool useDocBleeds { true };
162 	double markLength { 20.0 };
163 	double markOffset { 0.0 };
164 	QString openAction;
165 	int pageRangeSelection { 0 }; // All pages
166 	QString pageRangeString;
167 };
168 
169 #endif
170