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 /***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15 #include "tabpdfoptions.h"
16 
17 
18 #include <QAbstractItemView>
19 #include <QCheckBox>
20 #include <QComboBox>
21 #include <QGridLayout>
22 #include <QGroupBox>
23 #include <QHBoxLayout>
24 #include <QLabel>
25 #include <QLineEdit>
26 #include <QListWidget>
27 #include <QListWidgetItem>
28 #include <QPixmap>
29 #include <QPushButton>
30 #include <QSignalBlocker>
31 #include <QSpacerItem>
32 #include <QSpinBox>
33 #include <QStandardItem>
34 #include <QToolButton>
35 #include <QVBoxLayout>
36 
37 #include "iconmanager.h"
38 #include "pageitemiterator.h"
39 #include "pdfoptions.h"
40 #include "prefsmanager.h"
41 #include "scconfig.h"
42 #include "scribuscore.h"
43 #include "scribusview.h"
44 #include "ui/createrange.h"
45 #include "ui/scrspinbox.h"
46 #include "units.h"
47 #include "usertaskstructs.h"
48 #include "util.h"
49 
TabPDFOptions(QWidget * parent,PDFOptions & Optionen,const SCFonts & AllFonts,const ProfilesL & PDFXProfiles,const QMap<QString,int> & DocFonts,ScribusDoc * doc)50 TabPDFOptions::TabPDFOptions(QWidget* parent, PDFOptions & Optionen,
51 								const SCFonts &AllFonts,
52 								const ProfilesL & PDFXProfiles,
53 								const QMap<QString, int> & DocFonts,
54 								ScribusDoc * doc )
55 	: QTabWidget( parent ),
56 	// Private members
57 	unitRatio(unitGetRatioFromIndex(doc->unitIndex())),
58 	m_Doc(doc),
59 	AllFonts(AllFonts),
60 	Opts(Optionen)
61 {
62 	setupUi(this);
63 
64 	// General tab
65 	rangeGroupLayout->setAlignment( Qt::AlignTop );
66 	pageNrButton->setIcon(IconManager::instance().loadIcon("ellipsis.png"));
67 	MirrorH->setIcon(IconManager::instance().loadIcon("16/flip-object-horizontal.png"));
68 	MirrorH->setCheckable( true );
69 	MirrorV->setIcon(IconManager::instance().loadIcon("16/flip-object-vertical.png"));
70 	MirrorV->setCheckable( true );
71 
72 	fileOptionsLayout->setAlignment( Qt::AlignTop );
73 	cms = (ScCore->haveCMS() && m_Doc->HasCMS);
74 	PDFVersionCombo->setPDFXEnabled(cms && (!PDFXProfiles.isEmpty()));
75 	Resolution->setMaximum( 4000 );
76 	Resolution->setMinimum( 35 );
77 	Resolution->setSuffix( tr( " dpi" ) );
78 #ifndef HAVE_PODOFO
79 	EmbedPDF->setEnabled(false);
80 #endif
81 
82 	imageQualityLayout->setAlignment( Qt::AlignTop );
83 	ValC->setSuffix( tr( " dpi" ) );
84 	ValC->setMaximum( 4000 );
85 	ValC->setMinimum( 35 );
86 
87 	// Fonts tab
88 	groupFontLayout->setAlignment( Qt::AlignTop );
89 	EmbedList->setMaximumHeight(300);
90 	EmbedList->setSelectionMode(QListWidget::ExtendedSelection);
91 	SubsetList->setMaximumHeight(300);
92 	SubsetList->setSelectionMode(QListWidget::ExtendedSelection);
93 	ToSubset->setIcon(IconManager::instance().loadIcon("22/go-next.png"));
94 	FromSubset->setIcon(IconManager::instance().loadIcon("22/go-previous.png"));
95 
96 	// Presentation tab
97 	effectsLayout->setAlignment( Qt::AlignTop );
98 	PageTime->setSuffix( tr( " sec" ) );
99 	PageTime->setMaximum( 3600 );
100 	PageTime->setMinimum( 0 );
101 	EffectTime->setSuffix( tr( " sec" ) );
102 	EffectTime->setMaximum( 3600 );
103 	EffectTime->setMinimum( 1 );
104 
105 	// Viewer tab
106 	groupDisplayLayout->setAlignment( Qt::AlignTop );
107 	pageLayoutLayout->setAlignment( Qt::AlignTop );
108 	groupNavigationLayout->setAlignment( Qt::AlignTop );
109 	groupJavaLayout->setAlignment( Qt::AlignTop );
110 
111 	// Security tab
112 	groupPassLayout->setAlignment( Qt::AlignTop );
113 	groupSecSetLayout->setAlignment( Qt::AlignTop );
114 
115 	// Color tab
116 	colorGroupLayout->setAlignment( Qt::AlignTop );
117 	lpiGroupLayout->setAlignment( Qt::AlignTop );
118 
119 	LPIfreq->setMinimum(10);
120 	LPIfreq->setMaximum(1000);
121 
122 	LPIangle->setMinimum(-180);
123 	LPIangle->setMaximum(180);
124 
125 	SelLPIcolor = LPIcolor->currentText();
126 
127 	solidColorsGroupLayout->setAlignment( Qt::AlignTop );
128 	imageProfileGroupLayout->setAlignment( Qt::AlignTop );
129 
130 	// Prepress tab
131 	markGroupLayout->setAlignment( Qt::AlignTop );
132 	markLength->setNewUnit(m_Doc->unitIndex());
133 	markLength->setMinimum(1 * unitRatio);
134 	markLength->setMaximum(3000 * unitRatio);
135 
136 	markOffset->setNewUnit(m_Doc->unitIndex());
137 	markOffset->setMinimum(0);
138 	markOffset->setMaximum(3000 * unitRatio);
139 
140 	bleedGroupLayout->setAlignment( Qt::AlignTop );
141 
142 	BleedTop->setNewUnit(m_Doc->unitIndex());
143 	BleedTop->setMinimum(0);
144 	BleedTop->setMaximum(3000 * unitRatio);
145 
146 	BleedBottom->setNewUnit(m_Doc->unitIndex());
147 	BleedBottom->setMinimum(0);
148 	BleedBottom->setMaximum(3000 * unitRatio);
149 
150 	BleedLeft->setNewUnit(m_Doc->unitIndex());
151 	BleedLeft->setMinimum(0);
152 	BleedLeft->setMaximum(3000 * unitRatio);
153 
154 	BleedRight->setNewUnit(m_Doc->unitIndex());
155 	BleedRight->setMinimum(0);
156 	BleedRight->setMaximum(3000 * unitRatio);
157 
158 	X3GroupLayout->setAlignment( Qt::AlignTop );
159 
160 	restoreDefaults(Optionen, AllFonts, PDFXProfiles, DocFonts);
161 
162 	connect(fontEmbeddingCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(EmbeddingModeChange()));
163 	connect(EmbedFonts, SIGNAL(clicked()), this, SLOT(EmbedAll()));
164 	connect(EmbedList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelEFont(QListWidgetItem*)));
165 	connect(SubsetFonts, SIGNAL(clicked()), this, SLOT(SubsetAll()));
166 	connect(SubsetList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelSFont(QListWidgetItem*)));
167 	connect(ToSubset, SIGNAL(clicked()), this, SLOT(PutToSubset()));
168 	connect(FromSubset, SIGNAL(clicked()), this, SLOT(RemoveSubset()));
169 	connect(PagePrev, SIGNAL(clicked()), this, SLOT(PagePr()));
170 	connect(Pages, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(SetPgEff(QListWidgetItem*,QListWidgetItem*)));
171 	connect(EffectType, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
172 	connect(EDirection_2_2, SIGNAL(activated(int)), this, SLOT(ValidDI(int)));
173 	connect(CheckBox10, SIGNAL(clicked()), this, SLOT(DoEffects()));
174 	connect(EonAllPg, SIGNAL(clicked()), this, SLOT(EffectOnAll()));
175 	connect(InfoString, SIGNAL(textChanged(const QString &)), this, SLOT(checkInfo()));
176 	connect(InfoString, SIGNAL(editingFinished()), this, SLOT(checkInfo()));
177 	connect(docBleeds, SIGNAL(clicked()), this, SLOT(doDocBleeds()));
178 
179 	connect(AllPages, SIGNAL(toggled(bool)), this, SLOT(SelRange(bool)));
180 	connect(pageNrButton, SIGNAL(clicked()), this, SLOT(createPageNumberRange()));
181 	connect(DSColor, SIGNAL(clicked()), this, SLOT(DoDownsample()));
182 	connect(MirrorH, SIGNAL(clicked()), this, SLOT(PDFMirror()));
183 	connect(MirrorV, SIGNAL(clicked()), this, SLOT(PDFMirror()));
184 	connect(RotateDeg, SIGNAL(activated(int)), this, SLOT(Rotation(int)));
185 	connect(OutCombo, SIGNAL(activated(int)), this, SLOT(EnablePr(int)));
186 	connect(EmbedProfs, SIGNAL(clicked()), this, SLOT(EnablePG()));
187 	connect(EmbedProfs2, SIGNAL(clicked()), this, SLOT(EnablePGI()));
188 	connect(NoEmbedded, SIGNAL(clicked()), this, SLOT(EnablePGI2()));
189 	connect(PDFVersionCombo, SIGNAL(activated(int)), this, SLOT(EnablePDFX(int)));
190 	connect(Encry, SIGNAL(clicked()), this, SLOT(ToggleEncr()));
191 	connect(UseLPI, SIGNAL(clicked()), this, SLOT(EnableLPI2()));
192 	connect(LPIcolor, SIGNAL(activated(int)), this, SLOT(SelLPIcol(int)));
193 	connect(CMethod, SIGNAL(activated(int)), this, SLOT(handleCompressionMethod(int)));
194 
195 	// Tooltips : General tab
196 	RotateDeg->setToolTip( "<qt>" + tr( "Automatically rotate the exported pages" ) + "</qt>" );
197 	AllPages->setToolTip( "<qt>" + tr( "Export all pages to PDF" ) + "</qt>" );
198 	OnlySome->setToolTip( "<qt>" + tr( "Export a range of pages to PDF" ) );
199 	PageNr->setToolTip( "<qt>" + tr( "Insert a comma separated list of tokens where "
200 											"a token can be * for all the pages, 1-5 for "
201 											"a range of pages or a single page number") + "</qt>" );
202 	pageNrButton->setToolTip( "<qt>" + tr( "Create a range of pages" ) + "</qt>");
203 	ClipMarg->setToolTip( "<qt>" + tr( "Do not show objects outside the margins in the exported file" ) + "</qt>" );
204 	MirrorH->setToolTip( "<qt>" + tr( "Mirror Page(s) horizontally" ) + "</qt>" );
205 	MirrorV->setToolTip( "<qt>" + tr( "Mirror Page(s) vertically" ) + "</qt>" );
206 	PDFVersionCombo->setToolTip( "<qt>" + tr( "Determines the PDF compatibility.<br/><b>PDF 1.3</b>, which is the earliest supported version, gives the widest compatibility with printers' RIPS.<br/><b>PDF 1.4</b>, which is the default version, supports features such as transparency and 128 bit encryption.<br/><b>PDF 1.5</b> is necessary when you wish to preserve objects in separate layers within the PDF.<br/><b>PDF/X-1a</b> is for blind exchange with colors strictly specified in CMYK or spot colors.<br/><b>PDF/X-3</b> is for exporting the PDF when you want color managed RGB for commercial printing and is selectable when you have activated color management. Use only when advised by your printer or in some cases printing to a 4 color digital color laser printer.<br/><b>PDF/X-4</b> is an extension of PDF/X-3 to support transparency and layering." ) + "</qt>");
207 	ComboBind->setToolTip( "<qt>" + tr( "Determines the binding of pages in the PDF. Unless you know you need to change it leave the default choice - Left." ) + "</qt>" );
208 	CheckBox1->setToolTip( "<qt>" + tr( "Generates thumbnails of each page in the PDF. Some viewers can use the thumbnails for navigation." ) + "</qt>" );
209 	Article->setToolTip( "<qt>" + tr( "Generate PDF Articles, which is useful for navigating linked articles in a PDF" ) + "</qt>" );
210 	useLayers->setToolTip( "<qt>" + tr( "Layers in your document are exported to the PDF. Only available if PDF 1.5 is chosen." ) + "</qt>" );
211 	CheckBM->setToolTip( "<qt>" + tr( "Embed the bookmarks you created in your document. These are useful for navigating long PDF documents." ) + "</qt>" );
212 	Resolution->setToolTip( "<qt>" + tr( "Export resolution of text and vector graphics. This does not affect the resolution of bitmap images like photos." ) + "</qt>" );
213 	EmbedPDF->setToolTip( "<qt>" + tr( "Export PDFs in image frames as embedded PDFs. This does *not* yet take care of colorspaces, so you should know what you are doing before setting this to 'true'." ) + "</qt>" );
214 	Compression->setToolTip( "<qt>" + tr( "Enables lossless compression of text and graphics. Unless you have a reason, leave this checked. This reduces PDF file size." ) + "</qt>" );
215 	CMethod->setToolTip( "<qt>" + tr( "Method of compression to use for images. Automatic allows Scribus to choose the best method. ZIP is lossless and good for images with solid colors. JPEG is better at creating smaller PDF files which have many photos (with slight image quality loss possible). Leave it set to Automatic unless you have a need for special compression options." ) + "</qt>");
216 	CQuality->setToolTip( "<qt>" + tr( "Compression quality levels for lossy compression methods: Minimum (25%), Low (50%), Medium (75%), High (85%), Maximum (95%). Note that a quality level does not directly determine the size of the resulting image - both size and quality loss vary from image to image at any given quality level. Even with Maximum selected, there is always some quality loss with jpeg." ) + "</qt>");
217 	DSColor->setToolTip( "<qt>" + tr( "Limits the resolution of your bitmap images to the selected DPI. Images with a lower resolution will be left untouched. Leaving this unchecked will render them at their native resolution. Enabling this will increase memory usage and slow down export." ) + "</qt>" );
218 	ValC->setToolTip( "<qt>" + tr( "DPI (Dots Per Inch) for image export") + "</qt>" );
219 
220 	// Tooltips : Fonts tab
221 	EmbedFonts->setToolTip( "<qt>" + tr( "Embed fonts into the PDF. Embedding the fonts will preserve the layout and appearance of your document." ) + "</qt>");
222 	CheckBox10->setToolTip( "<qt>" + tr( "Enables presentation effects when using Adobe&#174; Reader&#174; and other PDF viewers which support this in full screen mode." ) + "</qt>");
223 	SubsetFonts->setToolTip( "<qt>" + tr("Embed only subset fonts with glyphs used in the document into the PDF.") + "</qt>");
224 
225 	// Tooltips : Presentation tab
226 	PagePrev->setToolTip( "<qt>" + tr( "Show page previews of each page listed above." ) + "</qt>");
227 	PageTime->setToolTip( "<qt>" + tr( "Length of time the page is shown before the presentation starts on the selected page. Setting 0 will disable automatic page transition." ) + "</qt>" );
228 	EffectTime->setToolTip( "<qt>" + tr( "Length of time the effect runs. A shorter time will speed up the effect, a longer one will slow it down." ) + "</qt>" );
229 	EffectType->setToolTip( "<qt>" + tr( "Type of the display effect." ) + "</qt>" );
230 	EDirection->setToolTip( "<qt>" + tr( "Direction of the effect of moving lines for the split and blind effects." ) + "</qt>" );
231 	EDirection_2->setToolTip( "<qt>" + tr( "Starting position for the box and split effects." ) + "</qt>" );
232 	EDirection_2_2->setToolTip( "<qt>" + tr( "Direction of the glitter or wipe effects." ) + "</qt>" );
233 	EonAllPg->setToolTip( "<qt>" + tr( "Apply the selected effect to all pages." ) + "</qt>" );
234 
235 	// Tooltips : Viewer tab
236 	singlePage->setToolTip( "<qt>" + tr( "Show the document in single page mode" ) + "</qt>" );
237 	continuousPages->setToolTip( "<qt>" + tr( "Show the document in single page mode with the pages displayed continuously end to end like a scroll" ) + "</qt>" );
238 	facingPagesLeft->setToolTip( "<qt>" + tr( "Show the document with facing pages, starting with the first page displayed on the left" ) + "</qt>" );
239 	facingPagesRight->setToolTip( "<qt>" + tr( "Show the document with facing pages, starting with the first page displayed on the right" ) + "</qt>" );
240 	useViewDefault->setToolTip( "<qt>" + tr( "Use the viewer's defaults or the user's preferences if set differently from the viewer defaults" ) + "</qt>" );
241 	useFullScreen->setToolTip( "<qt>" + tr( "Enables viewing the document in full screen" ) + "</qt>" );
242 	useBookmarks->setToolTip( "<qt>" + tr( "Display the bookmarks upon opening" ) + "</qt>" );
243 	useThumbnails->setToolTip( "<qt>" + tr( "Display the page thumbnails upon opening" ) + "</qt>" );
244 	useLayers2->setToolTip( "<qt>" + tr( "Forces the displaying of layers. Useful only for PDF 1.5+." ) + "</qt>" );
245 	hideToolBar->setToolTip( "<qt>" + tr( "Hides the Tool Bar which has selection and other editing capabilities" ) + "</qt>" );
246 	hideMenuBar->setToolTip( "<qt>" + tr( "Hides the Menu Bar for the viewer, the PDF will display in a plain window" ) + "</qt>" );
247 	fitWindow->setToolTip( "<qt>" + tr( "Fit the document page or pages to the available space in the viewer window" ) + "</qt>" );
248 
249 	// Tooltips : Security Tab
250 	Encry->setToolTip( "<qt>" + tr( "Enable the security features in your exported PDF. If you selected PDF 1.3, the PDF will be protected by 40 bit encryption. If you selected PDF 1.4, the PDF will be protected by 128 bit encryption. Disclaimer: PDF encryption is not as reliable as GPG or PGP encryption and does have some limitations." ) + "</qt>" );
251 	PassOwner->setToolTip( "<qt>" + tr( "Choose an owner password which enables or disables all the security features in your exported PDF" ) + "</qt>" );
252 	PassUser->setToolTip( "<qt>" + tr( "Choose a password for users to be able to read your PDF" ) + "</qt>" );
253 	PrintSec->setToolTip( "<qt>" + tr( "Allow printing of the PDF. If unchecked, printing is prevented." ) + "</qt>" );
254 	ModifySec->setToolTip( "<qt>" + tr( "Allow modifying of the PDF. If unchecked, modifying the PDF is prevented." ) + "</qt>" );
255 	CopySec->setToolTip( "<qt>" + tr( "Allow copying of text or graphics from the PDF. If unchecked, text and graphics cannot be copied." ) + "</qt>" );
256 	AddSec->setToolTip( "<qt>" + tr( "Allow adding annotations and fields to the PDF. If unchecked, editing annotations and fields is prevented." ) + "</qt>" );
257 
258 	// Tooltips : Color tab
259 	OutCombo->setToolTip( "<qt>" + tr( "Color model for the output of your PDF. Choose Screen/Web for PDFs which are used for screen display and for printing on typical inkjets. Choose Printer when printing to a true 4 color CMYK printer. Choose Grayscale when you want a grey scale PDF." ) + "</qt>" );
260 	UseLPI->setToolTip( "<qt>" + tr( "This is an advanced setting which is not enabled by default. This should only be enabled when specifically requested by your printer and they have given you the exact details needed. Otherwise, your exported PDF may not print properly and is truly not portable across systems." ) + "</qt>" );
261 	EmbedProfs->setToolTip( "<qt>" + tr( "Embed a color profile for solid colors" ) + "</qt>" );
262 	SolidPr->setToolTip( "<qt>" + tr( "Color profile for solid colors" ) + "</qt>" );
263 	IntendS->setToolTip( "<qt>" + tr( "Rendering intent for solid colors" ) + "</qt>" );
264 	EmbedProfs2->setToolTip( "<qt>" + tr( "Embed a color profile for images" ) + "</qt>" );
265 	NoEmbedded->setToolTip( "<qt>" + tr( "Do not use color profiles that are embedded in source images" ) + "</qt>" );
266 	ImageP->setToolTip( "<qt>" + tr( "Color profile for images" ) + "</qt>" );
267 	IntendI->setToolTip( "<qt>" + tr( "Rendering intent for images" ) + "</qt>" );
268 	useSpot->setToolTip("<qt>" + tr( "Enables Spot Colors to be converted to composite colors. Unless you are planning to print spot colors at a commercial printer, this is probably best left enabled." ) + "</qt>");
269 
270 	// Tooltips : PrePress tab
271 	cropMarks->setToolTip( "<qt>" + tr( "Creates crop marks in the PDF indicating where the paper should be cut or trimmed after printing" ) + "</qt>" );
272 	bleedMarks->setToolTip( "<qt>" + tr( "This creates bleed marks which are indicated by  _ . _ and show the bleed limit" ) + "</qt>" );
273 	registrationMarks->setToolTip( "<qt>" + tr( "Add registration marks to each separation" ) + "</qt>" );
274 	colorMarks->setToolTip( "<qt>" + tr( "Add color calibration bars" ) + "</qt>" );
275 	docInfoMarks->setToolTip( "<qt>" + tr( "Add document information which includes the document title and page numbers" ) + "</qt>" );
276 	markLength->setToolTip( "<qt>" + tr( "Indicate the size of crops'marks" ) + "</qt>" );
277 	markOffset->setToolTip( "<qt>" + tr( "Indicate the distance offset for the registration marks" ) + "</qt>" );
278 	BleedTop->setToolTip( "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
279 	BleedBottom->setToolTip( "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
280 	BleedLeft->setToolTip( "<qt>" + tr( "Distance for bleed from the left of the physical page" ) + "</qt>" );
281 	BleedRight->setToolTip( "<qt>" + tr( "Distance for bleed from the right of the physical page" )  + "</qt>");
282 	docBleeds->setToolTip( "<qt>" + tr( "Use the existing bleed settings from the document preferences" ) + "</qt>" );
283 	PrintProfC->setToolTip( "<qt>" + tr( "Output profile for printing. If possible, get some guidance from your printer on profile selection." ) + "</qt>" );
284 	InfoString->setToolTip( "<qt>" + tr( "Mandatory string for PDF/X or the PDF will fail PDF/X conformance. We recommend you use the title of the document." ) + "</qt>" );
285 }
286 
fontEmbeddingMode()287 PDFOptions::PDFFontEmbedding TabPDFOptions::fontEmbeddingMode()
288 {
289 	return fontEmbeddingCombo->embeddingMode();
290 }
291 
fontsToEmbed()292 QStringList TabPDFOptions::fontsToEmbed()
293 {
294 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
295 	if (embeddingMode != PDFOptions::EmbedFonts)
296 		return QStringList();
297 
298 	QStringList fonts;
299 	for (int i = 0; i < EmbedList->count(); ++i)
300 		fonts.append(EmbedList->item(i)->text());
301 	return fonts;
302 }
303 
fontsToSubset()304 QStringList TabPDFOptions::fontsToSubset()
305 {
306 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
307 	if (embeddingMode != PDFOptions::EmbedFonts)
308 		return QStringList();
309 
310 	QStringList fonts;
311 	for (int i = 0; i < SubsetList->count(); ++i)
312 		fonts.append(SubsetList->item(i)->text());
313 	return fonts;
314 }
315 
fontsToOutline()316 QStringList TabPDFOptions::fontsToOutline()
317 {
318 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
319 	if (embeddingMode != PDFOptions::OutlineFonts)
320 		return QStringList();
321 
322 	return m_docFonts;
323 }
324 
restoreDefaults(PDFOptions & Optionen,const SCFonts & AllFonts,const ProfilesL & PDFXProfiles,const QMap<QString,int> & DocFonts)325 void TabPDFOptions::restoreDefaults(PDFOptions & Optionen,
326 									const SCFonts &AllFonts,
327 									const ProfilesL & PDFXProfiles,
328 									const QMap<QString, int> & DocFonts)
329 {
330 	AllPages->setChecked( true );
331 	PageNr->setEnabled(false);
332 	pageNrButton->setEnabled(false);
333 
334 	AllPages->setChecked(Opts.pageRangeSelection == 0);
335 	OnlySome->setChecked(Opts.pageRangeSelection != 0);
336 	if (OnlySome->isChecked())
337 	{
338 		PageNr->setEnabled(true);
339 		PageNr->setText(Opts.pageRangeString);
340 		pageNrButton->setEnabled(true);
341 	}
342 
343 	RotateDeg->setCurrentIndex(Opts.RotateDeg / 90);
344 	MirrorH->setChecked(Opts.MirrorH);
345 	MirrorV->setChecked(Opts.MirrorV);
346 	ClipMarg->setChecked(Opts.doClip);
347 	bool cmsUse = (ScCore->haveCMS() && m_Doc->HasCMS);
348 	if (!cmsUse)
349 		PDFVersionCombo->setVersion(PDFVersion::PDF_14);
350 	PDFVersionCombo->setVersion(Opts.Version);
351 	ComboBind->setCurrentIndex(Opts.Binding);
352 	CheckBox1->setChecked(Opts.Thumbnails);
353 	Article->setChecked(Opts.Articles);
354 	CheckBM->setChecked(Opts.Bookmarks);
355 	useLayers->setChecked(Opts.useLayers);
356 	useLayers->setEnabled(Opts.Version.supportsOCGs());
357 	Resolution->setValue(Opts.Resolution);
358 	EmbedPDF->setChecked(Opts.embedPDF);
359 	Compression->setChecked( Opts.Compress );
360 	CMethod->setCurrentIndex(Opts.CompressMethod);
361 	CQuality->setCurrentIndex(Opts.Quality);
362 	if (Opts.CompressMethod == 3)
363 		CQuality->setEnabled(false);
364 	DSColor->setChecked(Opts.RecalcPic);
365 	ValC->setValue(Opts.PicRes);
366 	ValC->setEnabled(DSColor->isChecked());
367 
368 	m_docFonts = DocFonts.keys();
369 	if (Opts.Version == PDFVersion::PDF_X1a ||
370 		Opts.Version == PDFVersion::PDF_X3  ||
371 		Opts.Version == PDFVersion::PDF_X4 )
372 	{
373 		if (Opts.FontEmbedding != PDFOptions::EmbedFonts &&
374 			Opts.FontEmbedding != PDFOptions::OutlineFonts)
375 		{
376 			Opts.FontEmbedding = PDFOptions::EmbedFonts;
377 		}
378 	}
379 	fontEmbeddingCombo->setCurrentIndex((int) Opts.FontEmbedding);
380 
381 	EmbedList->clearSelection();
382 	EmbedList->setEnabled(Opts.FontEmbedding == PDFOptions::EmbedFonts);
383 	EmbedFonts->setEnabled(Opts.FontEmbedding == PDFOptions::EmbedFonts);
384 	SubsetList->clearSelection();
385 	SubsetList->setEnabled(Opts.FontEmbedding == PDFOptions::EmbedFonts);
386 	SubsetFonts->setEnabled(Opts.FontEmbedding == PDFOptions::EmbedFonts);
387 	ToSubset->setEnabled(false); // Will be enabled when user select a font in appropriate list
388 	FromSubset->setEnabled(false); // Will be enabled when user select a font in appropriate list
389 
390 //	Build a list of all Fonts used in Annotations;
391 	int pageItOptions = PageItemIterator::IterateInGroups | PageItemIterator::IterateInDocItems | PageItemIterator::IterateInMasterItems | PageItemIterator::IterateInFrameItems;
392 	for (PageItemIterator it(m_Doc, pageItOptions); *it; ++it)
393 	{
394 		PageItem *currItem = *it;
395 		if (((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText)) && (currItem->isAnnotation()))
396 		{
397 			int annotType  = currItem->annotation().Type();
398 			bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
399 			if (currItem->itemText.length() > 0 || mustEmbed)
400 				m_annotationFonts.insert(currItem->itemText.defaultStyle().charStyle().font().replacementName(), QString());
401 		}
402 	}
403 	ToSubset->setEnabled(false);
404 	FromSubset->setEnabled(false);
405 
406 	if ((Opts.EmbedList.count() == 0) && (Opts.SubsetList.count() == 0) && (Opts.firstUse))
407 		EmbedAll();
408 	else
409 	{
410 		EmbedList->clear();
411 		SubsetList->clear();
412 		for (int fe = 0; fe < m_docFonts.count(); ++ fe)
413 		{
414 			QString fontName = m_docFonts.at(fe);
415 			const ScFace fontFace = AllFonts[fontName];
416 			if (Opts.EmbedList.contains(fontName) && (!fontFace.isOTF() || Opts.supportsEmbeddedOpenTypeFonts()) && !fontFace.subset())
417 				addFontItem(fontName, EmbedList);
418 			else
419 			{
420 				addFontItem(fontName, SubsetList);
421 				if (!Opts.SubsetList.contains(fontName))
422 					Opts.SubsetList.append(fontName);
423 			}
424 		}
425 		QMap<QString, QString>::Iterator itAnn;
426 		for (itAnn = m_annotationFonts.begin(); itAnn != m_annotationFonts.end(); ++itAnn)
427 		{
428 			QList<QListWidgetItem *> itEmbed = EmbedList->findItems(itAnn.key(), Qt::MatchExactly);
429 			if (itEmbed.count() == 0)
430 			{
431 				QListWidgetItem* item = addFontItem(itAnn.key(), EmbedList);
432 				item->setFlags(Qt::ItemIsEnabled);
433 			}
434 			QList<QListWidgetItem *> itSubset = SubsetList->findItems(itAnn.key(), Qt::MatchExactly);
435 			for (int itOut = 0; itOut < itSubset.count(); ++itOut)
436 			{
437 				QListWidgetItem* item = itSubset[itOut];
438 				delete SubsetList->takeItem(SubsetList->row(item));
439 			}
440 		}
441 	}
442 	CheckBox10->setChecked(Opts.PresentMode);
443 	PagePrev->setChecked(false);
444 	Pages->clear();
445 	QString tmp;
446 	for (int pg = 0; pg < m_Doc->Pages->count(); ++pg)
447 	{
448 		Pages->addItem( tr("Page")+" "+tmp.setNum(pg+1));
449 		EffVal.append(m_Doc->Pages->at(pg)->PresentVals);
450 	}
451 	PageTime->setValue(EffVal[0].pageViewDuration);
452 	EffectTime->setValue(EffVal[0].pageEffectDuration);
453 	bool df = true;
454 	if ((Opts.displayBookmarks) || (Opts.displayFullscreen) || (Opts.displayLayers) || (Opts.displayThumbs))
455 		df = false;
456 	if (df)
457 		useViewDefault->setChecked(df);
458 	useFullScreen->setChecked(Opts.displayFullscreen);
459 	useBookmarks->setChecked(Opts.displayBookmarks);
460 	useThumbnails->setChecked(Opts.displayThumbs);
461 	useLayers2->setChecked(Opts.displayLayers);
462 	hideToolBar->setChecked(Opts.hideToolBar);
463 	hideMenuBar->setChecked(Opts.hideMenuBar);
464 	fitWindow->setChecked(Opts.fitWindow);
465 	actionCombo->clear();
466 	actionCombo->addItem( tr("No Script"));
467 	for (auto itja = m_Doc->JavaScripts.begin(); itja != m_Doc->JavaScripts.end(); ++itja)
468 		actionCombo->addItem(itja.key());
469 	if (m_Doc->JavaScripts.contains(Opts.openAction))
470 		setCurrentComboItem(actionCombo, Opts.openAction);
471 	if (Opts.PageLayout == PDFOptions::SinglePage)
472 		singlePage->setChecked(true);
473 	else if (Opts.PageLayout == PDFOptions::OneColumn)
474 		continuousPages->setChecked(true);
475 	else if (Opts.PageLayout == PDFOptions::TwoColumnLeft)
476 		facingPagesLeft->setChecked(true);
477 	else if (Opts.PageLayout == PDFOptions::TwoColumnRight)
478 		facingPagesRight->setChecked(true);
479 	useLayers2->setEnabled(Opts.Version.supportsOCGs());
480 
481 	Encry->setChecked( Opts.Encrypt );
482 	PassOwner->setText(Opts.PassOwner);
483 	PassUser->setText(Opts.PassUser);
484 	PrintSec->setChecked( Opts.Permissions & 4 );
485 	ModifySec->setChecked( Opts.Permissions & 8 );
486 	CopySec->setChecked( Opts.Permissions & 16 );
487 	AddSec->setChecked( Opts.Permissions & 32 );
488 	if (!Encry->isChecked())
489 	{
490 		groupSecSet->setEnabled(false);
491 		groupPass->setEnabled(false);
492 	}
493 
494 	if (Opts.UseRGB)
495 		OutCombo->setCurrentIndex(0);
496 	else if (Opts.isGrayscale)
497 		OutCombo->setCurrentIndex(2);
498 	else
499 		OutCombo->setCurrentIndex(1);
500 	useSpot->setChecked(!Opts.UseSpotColors);
501 	UseLPI->setChecked(Opts.UseLPI);
502 	QMap<QString,LPIData>::Iterator itlp;
503 	LPIcolor->clear();
504 	for (itlp = Opts.LPISettings.begin(); itlp != Opts.LPISettings.end(); ++itlp)
505 		LPIcolor->addItem( itlp.key() );
506 	LPIcolor->setCurrentIndex(0);
507 
508 	LPIfreq->setValue(Opts.LPISettings[LPIcolor->currentText()].Frequency);
509 	LPIangle->setValue(Opts.LPISettings[LPIcolor->currentText()].Angle);
510 	LPIfunc->setCurrentIndex(Opts.LPISettings[LPIcolor->currentText()].SpotFunc);
511 	EmbedProfs->setChecked(Opts.UseProfiles);
512 	EmbedProfs2->setChecked(Opts.UseProfiles2);
513 	NoEmbedded->setChecked(Opts.EmbeddedI);
514 	if ((Opts.UseRGB) || (Opts.isGrayscale))
515 	{
516 		solidsProfileGroup->setEnabled(false);
517 		imageProfileGroup->setEnabled(false);
518 		EnablePr(0);
519 	}
520 	else
521 		EnablePr(1);
522 	EnablePG();
523 	EnablePGI();
524 	QString tp = Opts.SolidProf;
525 	if (!ScCore->InputProfiles.contains(tp))
526 		tp = m_Doc->cmsSettings().DefaultSolidColorRGBProfile;
527 	ProfilesL::Iterator itp;
528 	ProfilesL::Iterator itpend=ScCore->InputProfiles.end();
529 	SolidPr->clear();
530 	for (itp = ScCore->InputProfiles.begin(); itp != itpend; ++itp)
531 	{
532 		SolidPr->addItem(itp.key());
533 		if (itp.key() == tp)
534 		{
535 			if (cmsUse)
536 				SolidPr->setCurrentIndex(SolidPr->count()-1);
537 		}
538 	}
539 	if (cmsUse)
540 		IntendS->setCurrentIndex(Opts.Intent);
541 	QString tp1 = Opts.ImageProf;
542 	if (!ScCore->InputProfiles.contains(tp1))
543 		tp1 = m_Doc->cmsSettings().DefaultSolidColorRGBProfile;
544 	ProfilesL::Iterator itp2;
545 	ProfilesL::Iterator itp2end=ScCore->InputProfiles.end();
546 	ImageP->clear();
547 	for (itp2 = ScCore->InputProfiles.begin(); itp2 != itp2end; ++itp2)
548 	{
549 		ImageP->addItem(itp2.key());
550 		if (itp2.key() == tp1)
551 		{
552 			if (cmsUse)
553 				ImageP->setCurrentIndex(ImageP->count()-1);
554 		}
555 	}
556 	if (cmsUse)
557 		IntendI->setCurrentIndex(Opts.Intent2);
558 	if (!cmsUse)
559 	{
560 		solidsProfileGroup->hide();
561 		imageProfileGroup->hide();
562 	}
563 
564 	ProfilesL::const_iterator itp3;
565 	QString tp3 = Opts.PrintProf;
566 	if (!PDFXProfiles.contains(tp3))
567 		tp3 = m_Doc->cmsSettings().DefaultPrinterProfile;
568 	PrintProfC->clear();
569 	for (itp3 = PDFXProfiles.constBegin(); itp3 != PDFXProfiles.constEnd(); ++itp3)
570 	{
571 		PrintProfC->addItem(itp3.key());
572 		if (itp3.key() == tp3)
573 			PrintProfC->setCurrentIndex(PrintProfC->count()-1);
574 	}
575 	if (!Opts.Info.isEmpty())
576 		InfoString->setText(Opts.Info);
577 	else
578 	{
579 		QFileInfo fi(m_Doc->documentFileName());
580 		InfoString->setText(fi.fileName());
581 	}
582 
583 	BleedTop->setValue(Opts.bleeds.top()*unitRatio);
584 	BleedBottom->setValue(Opts.bleeds.bottom()*unitRatio);
585 	BleedRight->setValue(Opts.bleeds.right()*unitRatio);
586 	BleedLeft->setValue(Opts.bleeds.left()*unitRatio);
587 	docBleeds->setChecked(Opts.useDocBleeds);
588 	doDocBleeds();
589 
590 	markLength->setValue(Opts.markLength*unitRatio);
591 	markOffset->setValue(Opts.markOffset*unitRatio);
592 	cropMarks->setChecked(Opts.cropMarks);
593 	bleedMarks->setChecked(Opts.bleedMarks);
594 	registrationMarks->setChecked(Opts.registrationMarks);
595 	colorMarks->setChecked(Opts.colorMarks);
596 	docInfoMarks->setChecked(Opts.docInfoMarks);
597 	if (!cmsUse)
598 		X3Group->setEnabled(false);
599 	if (cmsUse && (Opts.Version == PDFVersion::PDF_X1a) && (!PDFXProfiles.isEmpty()))
600 		EnablePDFX(3);
601 	else if (cmsUse && (Opts.Version == PDFVersion::PDF_X3) && (!PDFXProfiles.isEmpty()))
602 		EnablePDFX(4);
603 	else if (cmsUse && (Opts.Version == PDFVersion::PDF_X4) && (!PDFXProfiles.isEmpty()))
604 		EnablePDFX(5);
605 	else
606 		X3Group->setEnabled(false);
607 
608 	EffectType->clear();
609 	EffectType->addItem( tr("No Effect"));
610 	EffectType->addItem( tr("Blinds"));
611 	EffectType->addItem( tr("Box"));
612 	EffectType->addItem( tr("Dissolve"));
613 	EffectType->addItem( tr("Glitter"));
614 	EffectType->addItem( tr("Split"));
615 	EffectType->addItem( tr("Wipe"));
616 	if (Opts.Version.supportsPDF15PresentationEffects())
617 	{
618 		EffectType->addItem( tr("Push"));
619 		EffectType->addItem( tr("Cover"));
620 		EffectType->addItem( tr("Uncover"));
621 		EffectType->addItem( tr("Fade"));
622 	}
623 	Pages->setCurrentRow(0);
624 	SetEffOpts(0);
625 	Pages->setEnabled(false);
626 	Effects->setEnabled(false);
627 	PagePrev->setEnabled(false);
628 	DoEffects();
629 	if (CheckBox10->isChecked())
630 	{
631 		PageTime->setValue(EffVal[0].pageViewDuration);
632 		EffectTime->setValue(EffVal[0].pageEffectDuration);
633 		EffectType->setCurrentIndex(EffVal[0].effectType);
634 		EDirection->setCurrentIndex(EffVal[0].Dm);
635 		EDirection_2->setCurrentIndex(EffVal[0].M);
636 		EDirection_2_2->setCurrentIndex(EffVal[0].Di);
637 		SetEffOpts(EffectType->currentIndex());
638 	}
639 	if (m_Doc->pagePositioning() != 0)
640 	{
641 		bleedLeftLabel->setText( tr( "Inside:" ) );
642 		bleedRightLabel->setText( tr( "Outside:" ) );
643 	}
644 }
645 
handleCompressionMethod(int ind)646 void TabPDFOptions::handleCompressionMethod(int ind)
647 {
648 	CQuality->setDisabled(ind == 3);
649 }
650 
storeValues(PDFOptions & pdfOptions)651 void TabPDFOptions::storeValues(PDFOptions& pdfOptions)
652 {
653 	pdfOptions.Thumbnails = CheckBox1->isChecked();
654 	pdfOptions.Compress = Compression->isChecked();
655 	pdfOptions.CompressMethod = (PDFOptions::PDFCompression) CMethod->currentIndex();
656 	pdfOptions.Quality = CQuality->currentIndex();
657 	pdfOptions.Resolution = Resolution->value();
658 	pdfOptions.RecalcPic = DSColor->isChecked();
659 	pdfOptions.PicRes = ValC->value();
660 	pdfOptions.Bookmarks = CheckBM->isChecked();
661 	pdfOptions.Binding = ComboBind->currentIndex();
662 	pdfOptions.MirrorH = MirrorH->isChecked();
663 	pdfOptions.MirrorV = MirrorV->isChecked();
664 	pdfOptions.RotateDeg = RotateDeg->currentIndex() * 90;
665 	pdfOptions.pageRangeSelection = AllPages->isChecked() ? 0 : 1;
666 	pdfOptions.pageRangeString = PageNr->text();
667 	pdfOptions.Articles = Article->isChecked();
668 	pdfOptions.FontEmbedding =  fontEmbeddingCombo->embeddingMode();
669 	pdfOptions.Encrypt = Encry->isChecked();
670 	pdfOptions.UseLPI = UseLPI->isChecked();
671 	pdfOptions.UseSpotColors = !useSpot->isChecked();
672 	pdfOptions.doMultiFile = false;
673 	pdfOptions.cropMarks  = cropMarks->isChecked();
674 	pdfOptions.bleedMarks = bleedMarks->isChecked();
675 	pdfOptions.registrationMarks = registrationMarks->isChecked();
676 	pdfOptions.colorMarks = colorMarks->isChecked();
677 	pdfOptions.docInfoMarks = docInfoMarks->isChecked();
678 	pdfOptions.markLength = markLength->value() / unitRatio;
679 	pdfOptions.markOffset = markOffset->value() / unitRatio;
680 	pdfOptions.useDocBleeds = docBleeds->isChecked();
681 	pdfOptions.bleeds.setBottom(BleedBottom->value() / unitRatio);
682 	pdfOptions.bleeds.setTop(BleedTop->value() / unitRatio);
683 	pdfOptions.bleeds.setLeft(BleedLeft->value() / unitRatio);
684 	pdfOptions.bleeds.setRight(BleedRight->value() / unitRatio);
685 	pdfOptions.doClip = ClipMarg->isChecked();
686 	if (Encry->isChecked())
687 	{
688 		int Perm = -64;
689 		if (PDFVersionCombo->version() == PDFVersion::PDF_14)
690 			Perm &= ~0x00240000;
691 		if (PrintSec->isChecked())
692 			Perm += 4;
693 		if (ModifySec->isChecked())
694 			Perm += 8;
695 		if (CopySec->isChecked())
696 			Perm += 16;
697 		if (AddSec->isChecked())
698 			Perm += 32;
699 		pdfOptions.Permissions = Perm;
700 		pdfOptions.PassOwner = PassOwner->text();
701 		pdfOptions.PassUser = PassUser->text();
702 	}
703 	pdfOptions.Version = PDFVersionCombo->version();
704 	if (OutCombo->currentIndex() == 0)
705 	{
706 		pdfOptions.isGrayscale = false;
707 		pdfOptions.UseRGB = true;
708 		pdfOptions.UseProfiles = false;
709 		pdfOptions.UseProfiles2 = false;
710 	}
711 	else if (OutCombo->currentIndex() == 2)
712 	{
713 		pdfOptions.isGrayscale = true;
714 		pdfOptions.UseRGB = false;
715 		pdfOptions.UseProfiles = false;
716 		pdfOptions.UseProfiles2 = false;
717 	}
718 	else
719 	{
720 		pdfOptions.isGrayscale = false;
721 		pdfOptions.UseRGB = false;
722 		if (/*CMSuse*/ ScCore->haveCMS())
723 		{
724 			pdfOptions.UseProfiles = EmbedProfs->isChecked();
725 			pdfOptions.UseProfiles2 = EmbedProfs2->isChecked();
726 			pdfOptions.Intent = IntendS->currentIndex();
727 			pdfOptions.Intent2 = IntendI->currentIndex();
728 			pdfOptions.EmbeddedI = NoEmbedded->isChecked();
729 			pdfOptions.SolidProf = SolidPr->currentText();
730 			pdfOptions.ImageProf = ImageP->currentText();
731 			pdfOptions.PrintProf = PrintProfC->currentText();
732 		}
733 	}
734 }
735 
doDocBleeds()736 void TabPDFOptions::doDocBleeds()
737 {
738 	if (docBleeds->isChecked())
739 	{
740 		Opts.bleeds.setTop(BleedTop->value() / unitRatio);
741 		Opts.bleeds.setBottom(BleedBottom->value() / unitRatio);
742 		Opts.bleeds.setRight(BleedRight->value() / unitRatio);
743 		Opts.bleeds.setLeft(BleedLeft->value() / unitRatio);
744 		BleedTop->setValue(m_Doc->bleeds()->top()*unitRatio);
745 		BleedBottom->setValue(m_Doc->bleeds()->bottom()*unitRatio);
746 		BleedRight->setValue(m_Doc->bleeds()->right()*unitRatio);
747 		BleedLeft->setValue(m_Doc->bleeds()->left()*unitRatio);
748 		BleedTop->setEnabled(false);
749 		BleedBottom->setEnabled(false);
750 		BleedRight->setEnabled(false);
751 		BleedLeft->setEnabled(false);
752 	}
753 	else
754 	{
755 		BleedTop->setValue(Opts.bleeds.top()*unitRatio);
756 		BleedBottom->setValue(Opts.bleeds.bottom()*unitRatio);
757 		BleedRight->setValue(Opts.bleeds.right()*unitRatio);
758 		BleedLeft->setValue(Opts.bleeds.left()*unitRatio);
759 		BleedTop->setEnabled(true);
760 		BleedBottom->setEnabled(true);
761 		BleedRight->setEnabled(true);
762 		BleedLeft->setEnabled(true);
763 	}
764 }
765 
checkInfo()766 void TabPDFOptions::checkInfo()
767 {
768 	if ((PDFVersionCombo->versionIsPDFX()) && (InfoString->text().isEmpty()))
769 		emit noInfo();
770 	else
771 		emit hasInfo();
772 }
773 
ToggleEncr()774 void TabPDFOptions::ToggleEncr()
775 {
776 	bool setter = Encry->isChecked();
777 	groupSecSet->setEnabled(setter);
778 	groupPass->setEnabled(setter);
779 }
780 
enableCMS(bool enable)781 void TabPDFOptions::enableCMS(bool enable)
782 {
783 	QSignalBlocker blocker(PDFVersionCombo);
784 	PDFVersion currVersion = PDFVersionCombo->version();
785 	PDFVersionCombo->setPDFXEnabled(enable);
786 	cms = enable;
787 	if (!enable)
788 		currVersion = qMax(PDFVersion::PDF_13, qMin((PDFVersion::Version) currVersion, PDFVersion::PDF_16));
789 	PDFVersionCombo->setVersion(currVersion);
790 	EnablePr(1);
791 }
792 
EnablePDFX(int)793 void TabPDFOptions::EnablePDFX(int /*a*/)
794 {
795 	PDFVersion pdfVer = PDFVersionCombo->version();
796 
797 	useLayers->setEnabled(pdfVer.supportsOCGs());
798 	if (useLayers2)
799 		useLayers2->setEnabled(pdfVer.supportsOCGs());
800 
801 	int currentEff = EffectType->currentIndex();
802 	disconnect(EffectType, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
803 	EffectType->clear();
804 	EffectType->addItem( tr("No Effect"));
805 	EffectType->addItem( tr("Blinds"));
806 	EffectType->addItem( tr("Box"));
807 	EffectType->addItem( tr("Dissolve"));
808 	EffectType->addItem( tr("Glitter"));
809 	EffectType->addItem( tr("Split"));
810 	EffectType->addItem( tr("Wipe"));
811 	if (pdfVer.supportsPDF15PresentationEffects())
812 	{
813 		EffectType->addItem( tr("Push"));
814 		EffectType->addItem( tr("Cover"));
815 		EffectType->addItem( tr("Uncover"));
816 		EffectType->addItem( tr("Fade"));
817 		EffectType->setCurrentIndex(currentEff);
818 	}
819 	else
820 	{
821 		if (currentEff > 6)
822 		{
823 			currentEff = 0;
824 			EffectType->setCurrentIndex(0);
825 			SetEffOpts(0);
826 			for (int pg = 0; pg < m_Doc->Pages->count(); ++pg)
827 			{
828 				if (EffVal[pg].effectType > 6)
829 					EffVal[pg].effectType = 0;
830 			}
831 		}
832 		else
833 			EffectType->setCurrentIndex(currentEff);
834 	}
835 	connect(EffectType, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
836 
837 	if (!pdfVer.isPDFX())  // not PDF/X
838 	{
839 		checkEmbeddableFonts();
840 		fontEmbeddingCombo->setNoEmbeddingEnabled(true);
841 		X3Group->setEnabled(false);
842 		setTabEnabled(indexOf(tabSecurity), true);
843 		OutCombo->setEnabled(true);
844 		EmbedProfs->setEnabled(true);
845 		EmbedProfs2->setEnabled(true);
846 		emit hasInfo();
847 
848 		CheckBox10->setEnabled(true);
849 		EmbedFonts->setEnabled(true);
850 		EnablePr(OutCombo->currentIndex());
851 		return;
852 	}
853 
854 	// PDF/X is selected
855 	disconnect(OutCombo, SIGNAL(activated(int)), this, SLOT(EnablePr(int)));
856 	OutCombo->setCurrentIndex(1);
857 	OutCombo->setEnabled(false);
858 	EnablePr(1);
859 	if (pdfVer == PDFVersion::PDF_X1a) // X1, no profile embedding
860 	{
861 		EmbedProfs->setChecked(false);
862 		EmbedProfs->setEnabled(false);
863 		EmbedProfs2->setChecked(false);
864 		EmbedProfs2->setEnabled(false);
865 	}
866 	if (pdfVer == PDFVersion::PDF_X3 || pdfVer == PDFVersion::PDF_X4) // X3 or X4, enforcing color profiles on images
867 	{
868 		EmbedProfs->setEnabled(true);
869 		EmbedProfs2->setChecked(true);
870 		EmbedProfs2->setEnabled(false);
871 	}
872 
873 	PDFOptions::PDFFontEmbedding oldEmbeddingMode = fontEmbeddingCombo->embeddingMode();
874 	fontEmbeddingCombo->setNoEmbeddingEnabled(false);
875 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
876 
877 	if (oldEmbeddingMode != embeddingMode)
878 		EmbedList->clearSelection();
879 	EmbedList->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
880 	EmbedFonts->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
881 	if (oldEmbeddingMode != embeddingMode)
882 		SubsetList->clearSelection();
883 	SubsetList->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
884 	SubsetFonts->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
885 	ToSubset->setEnabled(false); // Will be enabled when user select a font in appropriate list
886 	FromSubset->setEnabled(false); // Will be enabled when user select a font in appropriate list
887 
888 	EmbedAll();
889 	CheckBox10->setChecked(false);
890 	CheckBox10->setEnabled(false);
891 	if (InfoString->text().isEmpty())
892 		emit noInfo();
893 	else
894 		emit hasInfo();
895 
896 	EnablePGI();
897 	X3Group->setEnabled(true);
898 	setTabEnabled(indexOf(tabSecurity), false);
899 	connect(OutCombo, SIGNAL(activated(int)), this, SLOT(EnablePr(int)));
900 }
901 
EnablePGI()902 void TabPDFOptions::EnablePGI()
903 {
904 	if (EmbedProfs2->isChecked())
905 	{
906 		NoEmbedded->setEnabled(true);
907 		bool setter = NoEmbedded->isChecked();
908 		imageProfileLabel->setEnabled(setter);
909 		imageIntentLabel->setEnabled(setter);
910 		ImageP->setEnabled(setter);
911 		IntendI->setEnabled(setter);
912 	}
913 	else
914 	{
915 		imageProfileLabel->setEnabled(false);
916 		imageIntentLabel->setEnabled(false);
917 		ImageP->setEnabled(false);
918 		IntendI->setEnabled(false);
919 		NoEmbedded->setEnabled(false);
920 	}
921 }
922 
EnablePGI2()923 void TabPDFOptions::EnablePGI2()
924 {
925 	bool setter = NoEmbedded->isChecked();
926 	imageProfileLabel->setEnabled(setter);
927 	imageIntentLabel->setEnabled(setter);
928 	ImageP->setEnabled(setter);
929 	IntendI->setEnabled(setter);
930 }
931 
EnablePG()932 void TabPDFOptions::EnablePG()
933 {
934 	bool setter = EmbedProfs->isChecked();
935 	solidsProfileLabel->setEnabled(setter);
936 	solidsIntentLabel->setEnabled(setter);
937 	SolidPr->setEnabled(setter);
938 	IntendS->setEnabled(setter);
939 }
940 
EnablePr(int a)941 void TabPDFOptions::EnablePr(int a)
942 {
943 	EnableLPI(a);
944 	bool setter = false;
945 	if (a == 1)
946 		setter = !PDFVersionCombo->versionIs(PDFVersion::PDF_X1a);
947 
948 	solidsProfileGroup->setEnabled(setter);
949 	imageProfileGroup->setEnabled(setter);
950 }
951 
EnableLPI(int a)952 void TabPDFOptions::EnableLPI(int a)
953 {
954 	if (a == 1)
955 	{
956 		QString tp = Opts.SolidProf;
957 		if (!ScCore->InputProfiles.contains(tp))
958 			tp = m_Doc->cmsSettings().DefaultSolidColorRGBProfile;
959 		SolidPr->clear();
960 		ProfilesL::Iterator itp;
961 		ProfilesL::Iterator itpend=ScCore->InputProfiles.end();
962 		for (itp = ScCore->InputProfiles.begin(); itp != itpend; ++itp)
963 		{
964 			SolidPr->addItem(itp.key());
965 			if (itp.key() == tp)
966 			{
967 				if (cms)
968 					SolidPr->setCurrentIndex(SolidPr->count()-1);
969 			}
970 		}
971 		if (cms)
972 			IntendS->setCurrentIndex(Opts.Intent);
973 		QString tp1 = Opts.ImageProf;
974 		if (!ScCore->InputProfiles.contains(tp1))
975 			tp1 = m_Doc->cmsSettings().DefaultSolidColorRGBProfile;
976 		ImageP->clear();
977 		ProfilesL::Iterator itp2;
978 		ProfilesL::Iterator itp2end=ScCore->InputProfiles.end();
979 		for (itp2 = ScCore->InputProfiles.begin(); itp2 != itp2end; ++itp2)
980 		{
981 			ImageP->addItem(itp2.key());
982 			if (itp2.key() == tp1)
983 			{
984 				if (cms)
985 					ImageP->setCurrentIndex(ImageP->count()-1);
986 			}
987 		}
988 		if (cms)
989 			IntendI->setCurrentIndex(Opts.Intent2);
990 		if (cms)
991 		{
992 			solidsProfileGroup->show();
993 			imageProfileGroup->show();
994 		}
995 		else
996 		{
997 			solidsProfileGroup->hide();
998 			imageProfileGroup->hide();
999 		}
1000 		useSpot->show();
1001 		UseLPI->show();
1002 		if (UseLPI->isChecked())
1003 			LPIgroup->show();
1004 		else
1005 			LPIgroup->hide();
1006 	}
1007 	else
1008 	{
1009 		useSpot->hide();
1010 		UseLPI->hide();
1011 		LPIgroup->hide();
1012 	}
1013 }
1014 
EnableLPI2()1015 void TabPDFOptions::EnableLPI2()
1016 {
1017 	if (UseLPI->isChecked())
1018 		LPIgroup->show();
1019 	else
1020 		LPIgroup->hide();
1021 }
1022 
SelLPIcol(int c)1023 void TabPDFOptions::SelLPIcol(int c)
1024 {
1025 	// XXX Optionen or Opts changed here
1026 	Opts.LPISettings[SelLPIcolor].Frequency = LPIfreq->value();
1027 	Opts.LPISettings[SelLPIcolor].Angle = LPIangle->value();
1028 	Opts.LPISettings[SelLPIcolor].SpotFunc = LPIfunc->currentIndex();
1029 	LPIfreq->setValue(Opts.LPISettings[LPIcolor->itemText(c)].Frequency);
1030 	LPIangle->setValue(Opts.LPISettings[LPIcolor->itemText(c)].Angle);
1031 	LPIfunc->setCurrentIndex(Opts.LPISettings[LPIcolor->itemText(c)].SpotFunc);
1032 	SelLPIcolor = LPIcolor->itemText(c);
1033 }
1034 
SelRange(bool e)1035 void TabPDFOptions::SelRange(bool e)
1036 {
1037 	bool setter = !e;
1038 	PageNr->setEnabled( setter );
1039 	pageNrButton->setEnabled( setter );
1040 	if (!setter)
1041 		CheckBM->setChecked(false);
1042 }
1043 
EffectOnAll()1044 void TabPDFOptions::EffectOnAll()
1045 {
1046 	for (int pg = 0; pg < m_Doc->Pages->count(); ++pg)
1047 	{
1048 		EffVal[pg].pageViewDuration = PageTime->value();
1049 		EffVal[pg].pageEffectDuration = EffectTime->value();
1050 		EffVal[pg].effectType = EffectType->currentIndex();
1051 		EffVal[pg].Dm = EDirection->currentIndex();
1052 		EffVal[pg].M = EDirection_2->currentIndex();
1053 		EffVal[pg].Di = EDirection_2_2->currentIndex();
1054 	}
1055 }
1056 
PDFMirror()1057 void TabPDFOptions::PDFMirror()
1058 {
1059 	// XXX Optionen or Opts changed here
1060 	Opts.MirrorH = MirrorH->isChecked();
1061 	Opts.MirrorV = MirrorV->isChecked();
1062 }
1063 
Rotation(int value)1064 void TabPDFOptions::Rotation( int value )
1065 {
1066 	Opts.RotateDeg = value * 90;
1067 }
1068 
DoEffects()1069 void TabPDFOptions::DoEffects()
1070 {
1071 	bool setter = CheckBox10->isChecked();
1072 	Pages->setEnabled(setter);
1073 	Effects->setEnabled(setter);
1074 	PagePrev->setEnabled(setter);
1075 }
1076 
ValidDI(int nr)1077 void TabPDFOptions::ValidDI(int nr)
1078 {
1079 	// Qt4 if (!EDirection_2_2->listBox()->item(nr)->isSelectable())
1080 	QStandardItem* si = dynamic_cast<QStandardItem*>(EDirection_2_2->view()->children().at(nr));
1081 	if ( !(si && si->isSelectable()) )
1082 		EDirection_2_2->setCurrentIndex(0);
1083 }
1084 
SetPgEff(QListWidgetItem *,QListWidgetItem * previous)1085 void TabPDFOptions::SetPgEff(QListWidgetItem* /*current*/, QListWidgetItem* previous)
1086 {
1087 	int currentRow = Pages->currentRow();
1088 	if (currentRow < 0)
1089 		return;
1090 
1091 	int previousRow = 0;
1092 	if (previous)
1093 		previousRow = Pages->row(previous);
1094 
1095 	EffVal[previousRow].pageViewDuration = PageTime->value();
1096 	EffVal[previousRow].pageEffectDuration = EffectTime->value();
1097 	EffVal[previousRow].effectType = EffectType->currentIndex();
1098 	EffVal[previousRow].Dm = EDirection->currentIndex();
1099 	EffVal[previousRow].M = EDirection_2->currentIndex();
1100 	EffVal[previousRow].Di = EDirection_2_2->currentIndex();
1101 	SetEffOpts(EffVal[currentRow].effectType);
1102 	PageTime->setValue(EffVal[currentRow].pageViewDuration);
1103 	EffectTime->setValue(EffVal[currentRow].pageEffectDuration);
1104 	EffectType->setCurrentIndex(EffVal[currentRow].effectType);
1105 	EDirection->setCurrentIndex(EffVal[currentRow].Dm);
1106 	EDirection_2->setCurrentIndex(EffVal[currentRow].M);
1107 	EDirection_2_2->setCurrentIndex(EffVal[currentRow].Di);
1108 }
1109 
SetEffOpts(int nr)1110 void TabPDFOptions::SetEffOpts(int nr)
1111 {
1112 	// Qt4
1113 // 	EDirection_2_2->listBox()->item(2)->setSelectable(false);
1114 // 	EDirection_2_2->listBox()->item(3)->setSelectable(false);
1115 // 	EDirection_2_2->listBox()->item(4)->setSelectable(false);
1116 	QStandardItem* si = dynamic_cast<QStandardItem*>(EDirection_2_2->view()->children().at(2));
1117 	if (si) si->setSelectable(false);
1118 	si = dynamic_cast<QStandardItem*>(EDirection_2_2->view()->children().at(3));
1119 	if (si) si->setSelectable(false);
1120 	si = dynamic_cast<QStandardItem*>(EDirection_2_2->view()->children().at(4));
1121 	if (si) si->setSelectable(false);
1122 	switch (nr)
1123 	{
1124 	case 0:
1125 	case 3:
1126 	case 10:
1127 		EDirection->setEnabled(false);
1128 		EDirection_2->setEnabled(false);
1129 		EDirection_2_2->setEnabled(false);
1130 		break;
1131 	case 1:
1132 		EDirection->setEnabled(true);
1133 		EDirection_2->setEnabled(false);
1134 		EDirection_2_2->setEnabled(false);
1135 		break;
1136 	case 2:
1137 		EDirection->setEnabled(false);
1138 		EDirection_2->setEnabled(true);
1139 		EDirection_2_2->setEnabled(false);
1140 		break;
1141 	case 4:
1142 	case 6:
1143 	case 7:
1144 	case 8:
1145 	case 9:
1146 		EDirection->setEnabled(false);
1147 		EDirection_2->setEnabled(false);
1148 		EDirection_2_2->setEnabled(true);
1149 		if (nr == 6)
1150 		{
1151 			// Qt4
1152 /*			EDirection_2_2->listBox()->item(2)->setSelectable(true);
1153 			EDirection_2_2->listBox()->item(3)->setSelectable(true);*/
1154 			si = dynamic_cast<QStandardItem*>(EDirection_2_2->view()->children().at(2));
1155 			if (si) si->setSelectable(true);
1156 			si = dynamic_cast<QStandardItem*>(EDirection_2_2->view()->children().at(3));
1157 			if (si) si->setSelectable(true);
1158 		}
1159 		else {
1160 			// Qt4
1161 			// 			EDirection_2_2->listBox()->item(4)->setSelectable(true);
1162 			si = dynamic_cast<QStandardItem*>(EDirection_2_2->view()->children().at(4));
1163 			if (si) si->setSelectable(true);
1164 		}
1165 		break;
1166 	case 5:
1167 		EDirection->setEnabled(true);
1168 		EDirection_2->setEnabled(true);
1169 		EDirection_2_2->setEnabled(false);
1170 		break;
1171 	}
1172 }
1173 
PagePr()1174 void TabPDFOptions::PagePr()
1175 {
1176 	connect(Pages, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(SetPgEff(QListWidgetItem*,QListWidgetItem*)));
1177 	QString tmp;
1178 	QPixmap pm;
1179 	int ci = Pages->currentRow();
1180 	int pgMaxX = 0;
1181 	int pgMaxY = 0;
1182 	Pages->clear();
1183 	if (PagePrev->isChecked())
1184 	{
1185 		for (int pg = 0; pg < m_Doc->Pages->count(); ++pg)
1186 		{
1187 			pm=QPixmap::fromImage(m_Doc->view()->PageToPixmap(pg, 70));
1188 			pgMaxX = qMax(pgMaxX, pm.width());
1189 			pgMaxY = qMax(pgMaxY, pm.height());
1190 			new QListWidgetItem( pm, tr("Page")+" "+tmp.setNum(pg+1), Pages);
1191 		}
1192 		Pages->setIconSize(QSize(pgMaxX, pgMaxY));
1193 	}
1194 	else
1195 	{
1196 		for (int pg = 0; pg < m_Doc->Pages->count(); ++pg)
1197 		{
1198 			new QListWidgetItem( tr("Page")+" "+tmp.setNum(pg+1), Pages);
1199 		}
1200 	}
1201 	if (ci != -1)
1202 		Pages->setCurrentRow(ci);
1203 	else
1204 		Pages->clearSelection();
1205 	connect(Pages, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(SetPgEff(QListWidgetItem*,QListWidgetItem*)));
1206 }
1207 
DoDownsample()1208 void TabPDFOptions::DoDownsample()
1209 {
1210 	if (DSColor->isChecked())
1211 	{
1212 		ValC->setEnabled(true);
1213 		if (ValC->value() > Resolution->value())
1214 			ValC->setValue(Resolution->value());
1215 //		ValC->setMaximum(Resolution->value());
1216 //		ValC->setMinimum(35);
1217 	}
1218 	else
1219 		ValC->setEnabled(false);
1220 }
1221 
EmbeddingModeChange()1222 void TabPDFOptions::EmbeddingModeChange()
1223 {
1224 	PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingCombo->embeddingMode();
1225 
1226 	EmbedList->clearSelection();
1227 	EmbedList->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1228 	EmbedFonts->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1229 	SubsetList->clearSelection();
1230 	SubsetList->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1231 	SubsetFonts->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1232 	ToSubset->setEnabled(false); // Will be enabled when user select a font in appropriate list
1233 	FromSubset->setEnabled(false); // Will be enabled when user select a font in appropriate list
1234 }
1235 
RemoveSubset()1236 void TabPDFOptions::RemoveSubset()
1237 {
1238 	PDFVersion pdfVer = PDFVersionCombo->version();
1239 
1240 	QList<QListWidgetItem*> selection = SubsetList->selectedItems();
1241 	for (int i = 0; i < selection.count() ; ++i)
1242 	{
1243 		QListWidgetItem* fontItem = selection[i];
1244 		QString currentFont = fontItem->text();
1245 		const ScFace fontFace = AllFonts[currentFont];
1246 		if (fontFace.isOTF() && !pdfVer.supportsEmbeddedOpenTypeFonts())
1247 			continue;
1248 		if (fontFace.subset())
1249 			continue;
1250 		addFontItem(currentFont, EmbedList);
1251 		int currentRow = SubsetList->row(fontItem);
1252 		delete SubsetList->takeItem(currentRow);
1253 	}
1254 
1255 	SubsetList->clearSelection();
1256 	FromSubset->setEnabled(false);
1257 }
1258 
PutToSubset()1259 void TabPDFOptions::PutToSubset()
1260 {
1261 	QList<QListWidgetItem*> selection = EmbedList->selectedItems();
1262 	for (int i = 0; i < selection.count() ; ++i)
1263 	{
1264 		QListWidgetItem* fontItem = selection[i];
1265 		QString currentFont = fontItem->text();
1266 		if (SubsetList->count() != 0)
1267 		{
1268 			if (SubsetList->findItems(currentFont, Qt::MatchExactly).count() == 0)
1269 				addFontItem(currentFont, SubsetList);
1270 		}
1271 		else
1272 		{
1273 			addFontItem(currentFont, SubsetList);
1274 		}
1275 		int itemRow = EmbedList->row(fontItem);
1276 		delete EmbedList->takeItem(itemRow);
1277 	}
1278 
1279 	EmbedList->clearSelection();
1280 	ToSubset->setEnabled(false);
1281 }
1282 
SelEFont(QListWidgetItem *)1283 void TabPDFOptions::SelEFont(QListWidgetItem*)
1284 {
1285 	QList<QListWidgetItem*> selection = EmbedList->selectedItems();
1286 	bool enableToSubset = (selection.count() > 0);
1287 
1288 	ToSubset->setEnabled(enableToSubset);
1289 	FromSubset->setEnabled(false);
1290 	SubsetList->clearSelection();
1291 }
1292 
SelSFont(QListWidgetItem *)1293 void TabPDFOptions::SelSFont(QListWidgetItem*)
1294 {
1295 	PDFVersion pdfVer = PDFVersionCombo->version();
1296 	QList<QListWidgetItem*> selection = SubsetList->selectedItems();
1297 	int enabledForEmbedding = selection.count();
1298 
1299 	for (int i = 0; i < selection.count(); ++i)
1300 	{
1301 		const QListWidgetItem* item = selection.at(i);
1302 		const ScFace face = AllFonts[item->text()];
1303 		if (face.isOTF() && !pdfVer.supportsEmbeddedOpenTypeFonts())
1304 			enabledForEmbedding--;
1305 		else if (face.subset())
1306 			enabledForEmbedding--;
1307 	}
1308 
1309 	FromSubset->setEnabled(enabledForEmbedding > 0);
1310 	ToSubset->setEnabled(false);
1311 	EmbedList->clearSelection();
1312 }
1313 
EmbedAll()1314 void TabPDFOptions::EmbedAll()
1315 {
1316 	PDFVersion pdfVer = PDFVersionCombo->version();
1317 
1318 	EmbedList->clear();
1319 	SubsetList->clear();
1320 	ToSubset->setEnabled(false);
1321 	FromSubset->setEnabled(false);
1322 
1323 	for (int i = 0; i < m_docFonts.count(); ++i)
1324 	{
1325 		QString fontName = m_docFonts.at(i);
1326 		const ScFace fontFace = AllFonts[fontName];
1327 		if (!fontFace.subset() && (!fontFace.isOTF() || pdfVer.supportsEmbeddedOpenTypeFonts()))
1328 		{
1329 			QListWidgetItem* item = addFontItem(fontName, EmbedList);
1330 			if (m_annotationFonts.contains(item->text()))
1331 				item->setFlags(Qt::ItemIsEnabled);
1332 		}
1333 		else if (m_annotationFonts.contains(fontName))
1334 		{
1335 			QListWidgetItem* item = addFontItem(fontName, EmbedList);
1336 			item->setFlags(Qt::ItemIsEnabled);
1337 		}
1338 		else
1339 		{
1340 			addFontItem(fontName, SubsetList);
1341 		}
1342 	}
1343 }
1344 
SubsetAll()1345 void TabPDFOptions::SubsetAll()
1346 {
1347 	EmbedList->clear();
1348 	SubsetList->clear();
1349 	ToSubset->setEnabled(false);
1350 	FromSubset->setEnabled(false);
1351 	for (int a = 0; a < m_docFonts.count(); ++a)
1352 	{
1353 		QString fontName = m_docFonts.at(a);
1354 		if (m_annotationFonts.contains(fontName))
1355 		{
1356 			QListWidgetItem* item = addFontItem(fontName, EmbedList);
1357 			item->setFlags(Qt::ItemIsEnabled);
1358 		}
1359 		else
1360 		{
1361 			addFontItem(fontName, SubsetList);
1362 		}
1363 	}
1364 }
1365 
checkEmbeddableFonts()1366 void TabPDFOptions::checkEmbeddableFonts()
1367 {
1368 	PDFVersion pdfVer = PDFVersionCombo->version();
1369 
1370 	for (int i = 0; i < EmbedList->count(); ++i)
1371 	{
1372 		QListWidgetItem* item = EmbedList->item(i);
1373 		QString fontName = item->text();
1374 		if (m_annotationFonts.contains(fontName))
1375 			continue;
1376 		const ScFace fontFace = AllFonts[fontName];
1377 		if (fontFace.isOTF() && !pdfVer.supportsEmbeddedOpenTypeFonts())
1378 		{
1379 			delete EmbedList->takeItem(i);
1380 			addFontItem(fontName, SubsetList);
1381 			--i;
1382 		}
1383 	}
1384 }
1385 
addFontItem(const QString & fontName,QListWidget * fontList)1386 QListWidgetItem* TabPDFOptions::addFontItem(const QString& fontName, QListWidget* fontList)
1387 {
1388 	QListWidgetItem* item = nullptr;
1389 	if (!AllFonts.contains(fontName))
1390 		return nullptr;
1391 
1392 	const ScFace& face = AllFonts.value(fontName);
1393 	if (face.isReplacement())
1394 		item = new QListWidgetItem( IconManager::instance().loadIcon("font_subst16.png"), fontName, fontList );
1395 	else if (face.type() == ScFace::TYPE1)
1396 		item = new QListWidgetItem( IconManager::instance().loadIcon("font_type1_16.png"), fontName, fontList );
1397 	else if (face.type() == ScFace::TTF)
1398 		item = new QListWidgetItem( IconManager::instance().loadIcon("font_truetype16.png"), fontName, fontList );
1399 	else if (face.type() == ScFace::OTF)
1400 		item = new QListWidgetItem( IconManager::instance().loadIcon("font_otf16.png"), fontName, fontList );
1401 
1402 	return item;
1403 }
1404 
unitChange(int docUnitIndex)1405 void TabPDFOptions::unitChange(int docUnitIndex)
1406 {
1407 	BleedBottom->setNewUnit(docUnitIndex);
1408 	BleedTop->setNewUnit(docUnitIndex);
1409 	BleedRight->setNewUnit(docUnitIndex);
1410 	BleedLeft->setNewUnit(docUnitIndex);
1411 	markOffset->setNewUnit(docUnitIndex);
1412 }
1413 
createPageNumberRange()1414 void TabPDFOptions::createPageNumberRange( )
1415 {
1416 	CreateRange cr(PageNr->text(), m_Doc->DocPages.count(), this);
1417 	if (cr.exec())
1418 	{
1419 		CreateRangeData crData;
1420 		cr.getCreateRangeData(crData);
1421 		PageNr->setText(crData.pageRange);
1422 		return;
1423 	}
1424 
1425 	PageNr->setText(QString());
1426 }
1427