Subversion Repositories Scribus

Rev

Rev 20337 | Rev 21018 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
19828 jghali 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
#include <QStandardItem>
9
#include <QAbstractItemView>
10
 
20185 craig 11
#include "iconmanager.h"
19828 jghali 12
#include "prefsstructs.h"
13
#include "scribuscore.h"
14
#include "scribusdoc.h"
15
#include "scribusview.h"
20185 craig 16
#include "ui/createrange.h"
17
#include "ui/prefs_pdfexport.h"
19828 jghali 18
#include "ui/scrspinbox.h"
19
#include "units.h"
20
#include "util.h"
21
 
22
Prefs_PDFExport::Prefs_PDFExport(QWidget* parent, ScribusDoc* doc)
23
        : Prefs_Pane(parent),
24
        cmsEnabled(false),
25
        m_doc(doc),
26
        exportingPDF(false)
27
{
28
        setupUi(this);
20185 craig 29
        pageMirrorHorizontalToolButton->setIcon(IconManager::instance()->loadIcon("16/flip-object-horizontal.png"));
30
        pageMirrorVerticalToolButton->setIcon(IconManager::instance()->loadIcon("16/flip-object-vertical.png"));
19828 jghali 31
        unitChange(0);
32
        languageChange();
20122 jghali 33
 
34
        connect(fontEmbeddingCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(EmbeddingModeChange()));
19828 jghali 35
        connect(exportChosenPagesRadioButton, SIGNAL(toggled(bool)), this, SLOT(enableRangeControls(bool)));
36
        connect(exportRangeMorePushButton, SIGNAL(clicked()), this, SLOT(createPageNumberRange()));
37
        connect(maxResolutionLimitCheckBox, SIGNAL(clicked()), this, SLOT(setMaximumResolution()));
38
        connect(outputIntentionComboBox, SIGNAL(activated(int)), this, SLOT(enableProfiles(int)));
39
        connect(useSolidColorProfileCheckBox, SIGNAL(clicked()), this, SLOT(enablePG()));
40
        connect(useImageProfileCheckBox, SIGNAL(clicked()), this, SLOT(enablePGI()));
41
        connect(doNotUseEmbeddedImageProfileCheckBox, SIGNAL(clicked()), this, SLOT(enablePGI2()));
42
        connect(pdfVersionComboBox, SIGNAL(activated(int)), this, SLOT(enablePDFX(int)));
43
        connect(useEncryptionCheckBox, SIGNAL(clicked(bool)), this, SLOT(enableSecurityControls(bool)));
44
        connect(useCustomRenderingCheckBox, SIGNAL(clicked()), this, SLOT(enableLPI2()));
45
        connect(customRenderingColorComboBox, SIGNAL(activated(int)), this, SLOT(SelLPIcol(int)));
46
 
47
        rotationComboBox->setToolTip( "<qt>" + tr( "Automatically rotate the exported pages" ) + "</qt>" );
48
        exportAllPagesRadioButton->setToolTip( "<qt>" + tr( "Export all pages to PDF" ) + "</qt>" );
49
        exportChosenPagesRadioButton->setToolTip( "<qt>" + tr( "Export a range of pages to PDF" ) );
50
        exportPageListLineEdit->setToolTip( "<qt>" + tr( "Insert a comma separated list of tokens where "
51
                                                                                        "a token can be * for all the pages, 1-5 for "
20267 craig 52
                                                                                        "a range of pages or a single page number") + "</qt>" );
19828 jghali 53
        exportRangeMorePushButton->setToolTip( "<qt>" + tr( "Create a range of pages" ) + "</qt>");
54
 
55
        pdfVersionComboBox->setToolTip( "<qt>" + tr( "Determines the PDF compatibility.<br/>The default is <b>PDF 1.3</b> which gives the widest compatibility.<br/>Choose <b>PDF 1.4</b> if your file uses features such as transparency or you require 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-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-1a</b> is for blind exchange with colors strictly specified in CMYK or spot colors.<br/><b>PDF/X-4</b> is an extension of PDF/X-3 to support transparancy and layering." ) + "</qt>");
56
        pageBindingComboBox->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>" );
57
        generateThumbnailsCheckBox->setToolTip( "<qt>" + tr( "Generates thumbnails of each page in the PDF. Some viewers can use the thumbnails for navigation." ) + "</qt>" );
20267 craig 58
        saveLinkedTextFramesAsArticlesCheckBox->setToolTip( "<qt>" + tr( "Generate PDF Articles, which is useful for navigating linked articles in a PDF" ) + "</qt>" );
20270 craig 59
        includeLayersCheckBox->setToolTip( "<qt>" + tr( "Layers in your document are exported to the PDF. Only available if PDF 1.5 is chosen." ) + "</qt>" );
19828 jghali 60
        includeBookmarksCheckBox->setToolTip( "<qt>" + tr( "Embed the bookmarks you created in your document. These are useful for navigating long PDF documents." ) + "</qt>" );
61
        epsExportResolutionSpinBox->setToolTip( "<qt>" + tr( "Export resolution of text and vector graphics. This does not affect the resolution of bitmap images like photos." ) + "</qt>" );
62
        embedPDFAndEPSFilesCheckBox->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>" );
63
        compressTextAndVectorGraphicsCheckBox->setToolTip( "<qt>" + tr( "Enables lossless compression of text and graphics. Unless you have a reason, leave this checked. This reduces PDF file size." ) + "</qt>" );
64
        imageCompressionMethodComboBox->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>");
65
        imageCompressionQualityComboBox->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>");
66
        maxResolutionLimitCheckBox->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>" );
20267 craig 67
        maxExportResolutionSpinBox->setToolTip( "<qt>" + tr( "DPI (Dots Per Inch) for image export") + "</qt>" );
19828 jghali 68
        useEncryptionCheckBox->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>" );
69
        passwordOwnerLineEdit->setToolTip( "<qt>" + tr( "Choose an owner password which enables or disables all the security features in your exported PDF" ) + "</qt>" );
20267 craig 70
        passwordUserLineEdit->setToolTip( "<qt>" + tr( "Choose a password for users to be able to read your PDF" ) + "</qt>" );
20337 craig 71
        allowPrintingCheckBox->setToolTip( "<qt>" + tr( "Allow printing of the PDF. If unchecked, printing is prevented." ) + "</qt>" );
20267 craig 72
        allowChangingCheckBox->setToolTip( "<qt>" + tr( "Allow modifying of the PDF. If unchecked, modifying the PDF is prevented." ) + "</qt>" );
19828 jghali 73
        allowCopyingCheckBox->setToolTip( "<qt>" + tr( "Allow copying of text or graphics from the PDF. If unchecked, text and graphics cannot be copied." ) + "</qt>" );
74
        allowAnnotatingCheckBox->setToolTip( "<qt>" + tr( "Allow adding annotations and fields to the PDF. If unchecked, editing annotations and fields is prevented." ) + "</qt>" );
75
        outputIntentionComboBox->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>" );
76
        useCustomRenderingCheckBox->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>" );
77
        useSolidColorProfileCheckBox->setToolTip( "<qt>" + tr( "Embed a color profile for solid colors" ) + "</qt>" );
78
        solidColorProfileComboBox->setToolTip( "<qt>" + tr( "Color profile for solid colors" ) + "</qt>" );
79
        solidColorRenderingIntentComboBox->setToolTip( "<qt>" + tr( "Rendering intent for solid colors" ) + "</qt>" );
80
        useImageProfileCheckBox->setToolTip( "<qt>" + tr( "Embed a color profile for images" ) + "</qt>" );
81
        doNotUseEmbeddedImageProfileCheckBox->setToolTip( "<qt>" + tr( "Do not use color profiles that are embedded in source images" ) + "</qt>" );
82
        imageProfileComboBox->setToolTip( "<qt>" + tr( "Color profile for images" ) + "</qt>" );
83
        imageRenderingIntentComboBox->setToolTip( "<qt>" + tr( "Rendering intent for images" ) + "</qt>" );
84
        pageMirrorHorizontalToolButton->setToolTip( "<qt>" + tr( "Mirror Page(s) horizontally" ) + "</qt>" );
85
        pageMirrorVerticalToolButton->setToolTip( "<qt>" + tr( "Mirror Page(s) vertically" ) + "</qt>" );
86
        convertSpotsToProcessCheckBox->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>");
87
        clipToPrinterMarginsCheckBox->setToolTip( "<qt>" + tr( "Do not show objects outside the margins in the exported file" ) + "</qt>" );
88
        //PrePress tab
89
        printCropMarksCheckBox->setToolTip( "<qt>" + tr( "Creates crop marks in the PDF indicating where the paper should be cut or trimmed after printing" ) + "</qt>" );
90
        printBleedMarksCheckBox->setToolTip( "<qt>" + tr( "This creates bleed marks which are indicated by  _ . _ and show the bleed limit" ) + "</qt>" );
91
        printRegistrationMarksCheckBox->setToolTip( "<qt>" + tr( "Add registration marks to each separation" ) + "</qt>" );
92
        printColorBarsCheckBox->setToolTip( "<qt>" + tr( "Add color calibration bars" ) + "</qt>" );
93
        printPageInfoCheckBox->setToolTip( "<qt>" + tr( "Add document information which includes the document title and page numbers" ) + "</qt>" );
94
        markLengthSpinBox->setToolTip( "<qt>" + tr( "Length of crop marks" ) + "</qt>" );
95
        markOffsetSpinBox->setToolTip( "<qt>" + tr( "Indicate the distance offset for the registration marks" ) + "</qt>" );
96
//      BleedTop->setToolTip( "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
97
//      BleedBottom->setToolTip( "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
98
//      BleedLeft->setToolTip( "<qt>" + tr( "Distance for bleed from the left of the physical page" ) + "</qt>" );
99
//      BleedRight->setToolTip( "<qt>" + tr( "Distance for bleed from the right of the physical page" )  + "</qt>");
100
        useDocumentBleedsCheckBox->setToolTip( "<qt>" + tr( "Use the existing bleed settings from the document preferences" ) + "</qt>" );
101
        pdfx3OutputProfileComboBox->setToolTip( "<qt>" + tr( "Output profile for printing. If possible, get some guidance from your printer on profile selection." ) + "</qt>" );
102
        pdfx3InfoStringLineEdit->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>" );
103
 
104
}
105
 
106
Prefs_PDFExport::~Prefs_PDFExport()
107
{
108
}
109
 
20122 jghali 110
PDFOptions::PDFFontEmbedding Prefs_PDFExport::fontEmbeddingMode()
111
{
112
        return (PDFOptions::PDFFontEmbedding) fontEmbeddingCombo->currentIndex();
113
}
114
 
19828 jghali 115
QStringList Prefs_PDFExport::fontsToEmbed()
116
{
20122 jghali 117
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
118
        if (embeddingMode != PDFOptions::EmbedFonts)
119
                return QStringList();
120
 
19828 jghali 121
        QStringList fonts;
20122 jghali 122
        for (int i = 0; i < embeddedFontsListWidget->count(); ++i)
123
                fonts.append(embeddedFontsListWidget->item(i)->text());
19828 jghali 124
        return fonts;
125
}
126
 
20103 avox 127
QStringList Prefs_PDFExport::fontsToSubset()
19828 jghali 128
{
20122 jghali 129
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
130
        if (embeddingMode != PDFOptions::EmbedFonts)
131
                return QStringList();
132
 
19828 jghali 133
        QStringList fonts;
20122 jghali 134
        for (int i = 0; i < subsettedFontsListWidget->count(); ++i)
135
                fonts.append(subsettedFontsListWidget->item(i)->text());
19828 jghali 136
        return fonts;
137
}
138
 
20103 avox 139
QStringList Prefs_PDFExport::fontsToOutline()
140
{
20122 jghali 141
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
142
        if (embeddingMode != PDFOptions::OutlineFonts)
143
                return QStringList();
144
 
145
        if (m_doc)
146
                return m_doc->usedFonts().keys();
147
        return QStringList();
20103 avox 148
}
149
 
20122 jghali 150
QListWidgetItem* Prefs_PDFExport::addFontItem(QString fontName, QListWidget* fontList)
151
{
152
        QListWidgetItem* item = 0;
153
        if (!AllFonts.contains(fontName))
154
                return 0;
155
 
156
        const ScFace face = AllFonts.value(fontName);
157
        if (face.isReplacement())
20185 craig 158
                item = new QListWidgetItem( IconManager::instance()->loadIcon("font_subst16.png"), fontName, fontList );
20122 jghali 159
        else if (face.type() == ScFace::TYPE1)
20185 craig 160
                item = new QListWidgetItem( IconManager::instance()->loadIcon("font_type1_16.png"), fontName, fontList );
20122 jghali 161
        else if (face.type() == ScFace::TTF)
20185 craig 162
                item = new QListWidgetItem( IconManager::instance()->loadIcon("font_truetype16.png"), fontName, fontList );
20122 jghali 163
        else if (face.type() == ScFace::OTF)
20185 craig 164
                item = new QListWidgetItem( IconManager::instance()->loadIcon("font_otf16.png"), fontName, fontList );
20122 jghali 165
 
166
        return item;
167
}
168
 
19828 jghali 169
void Prefs_PDFExport::unitChange(int unitIndex)
170
{
171
        unitRatio = unitGetRatioFromIndex(unitIndex);
172
 
173
        markLengthSpinBox->setNewUnit(unitIndex);
174
        markLengthSpinBox->setMinimum(0);
175
        markLengthSpinBox->setMaximum(3000 * unitRatio);
176
 
177
        markOffsetSpinBox->setNewUnit(unitIndex);
178
        markOffsetSpinBox->setMinimum(0);
179
        markOffsetSpinBox->setMaximum(3000 * unitRatio);
180
 
181
        bleedsWidget->setNewUnit(unitIndex);
182
}
183
 
184
void Prefs_PDFExport::languageChange()
185
{
186
        int i=0;
187
        i = rotationComboBox->currentIndex();
188
        rotationComboBox->clear();
189
        rotationComboBox->addItem(QString::fromUtf8("0 °"));
190
        rotationComboBox->addItem(QString::fromUtf8("90 °"));
191
        rotationComboBox->addItem(QString::fromUtf8("180 °"));
192
        rotationComboBox->addItem(QString::fromUtf8("270 °"));
193
        rotationComboBox->setCurrentIndex(i);
194
 
195
        i = imageCompressionMethodComboBox->currentIndex();
196
        imageCompressionMethodComboBox->clear();
197
        imageCompressionMethodComboBox->addItem( tr( "Automatic" ) );
198
        imageCompressionMethodComboBox->addItem( tr( "Lossy - JPEG" ) );
199
        imageCompressionMethodComboBox->addItem( tr( "Lossless - Zip" ) );
200
        imageCompressionMethodComboBox->addItem( tr( "None" ) );
201
        imageCompressionMethodComboBox->setCurrentIndex(i);
202
 
203
        i = imageCompressionQualityComboBox->currentIndex();
204
        imageCompressionQualityComboBox->clear();
205
        imageCompressionQualityComboBox->addItem( tr( "Maximum" ) );
206
        imageCompressionQualityComboBox->addItem( tr( "High" ) );
207
        imageCompressionQualityComboBox->addItem( tr( "Medium" ) );
208
        imageCompressionQualityComboBox->addItem( tr( "Low" ) );
209
        imageCompressionQualityComboBox->addItem( tr( "Minimum" ) );
210
        imageCompressionQualityComboBox->setCurrentIndex(i);
211
 
212
        addPDFVersions(true);//if (cmsEnabled)// && (!PDFXProfiles.isEmpty()))
213
 
214
        i = pageBindingComboBox->currentIndex();
215
        pageBindingComboBox->clear();
216
        pageBindingComboBox->addItem( tr("Left Margin"));
217
        pageBindingComboBox->addItem( tr("Right Margin"));
218
        pageBindingComboBox->setCurrentIndex(i);
219
 
220
        i = outputIntentionComboBox->currentIndex();
221
        outputIntentionComboBox->clear();
222
        outputIntentionComboBox->addItem( tr( "Screen / Web" ) );
223
        outputIntentionComboBox->addItem( tr( "Printer" ) );
224
        outputIntentionComboBox->addItem( tr( "Grayscale" ) );
225
        outputIntentionComboBox->setCurrentIndex(i);
226
 
227
        i = customRenderingSpotFunctionComboBox->currentIndex();
228
        customRenderingSpotFunctionComboBox->clear();
229
        customRenderingSpotFunctionComboBox->addItem( tr( "Simple Dot" ) );
230
        customRenderingSpotFunctionComboBox->addItem( tr( "Line" ) );
231
        customRenderingSpotFunctionComboBox->addItem( tr( "Round" ) );
232
        customRenderingSpotFunctionComboBox->addItem( tr( "Ellipse" ) );
233
        customRenderingSpotFunctionComboBox->setCurrentIndex(i);
234
        SelLPIcolor = customRenderingColorComboBox->currentText();
235
 
236
        i = solidColorRenderingIntentComboBox->currentIndex();
237
        int j=imageRenderingIntentComboBox->currentIndex();
238
        solidColorRenderingIntentComboBox->clear();
239
        imageRenderingIntentComboBox->clear();
240
        QString tmp_ip[] = { tr("Perceptual"), tr("Relative Colorimetric"), tr("Saturation"), tr("Absolute Colorimetric")};
241
        size_t ar_ip = sizeof(tmp_ip) / sizeof(*tmp_ip);
242
        for (uint a = 0; a < ar_ip; ++a)
243
                solidColorRenderingIntentComboBox->addItem(tmp_ip[a]);
244
        for (uint a = 0; a < ar_ip; ++a)
245
                imageRenderingIntentComboBox->addItem(tmp_ip[a]);
246
        solidColorRenderingIntentComboBox->setCurrentIndex(i);
247
        imageRenderingIntentComboBox->setCurrentIndex(j);
248
}
249
 
250
void Prefs_PDFExport::restoreDefaults(struct ApplicationPrefs *prefsData)
251
{
252
}
253
 
254
void Prefs_PDFExport::restoreDefaults(struct ApplicationPrefs *prefsData, const ProfilesL & PDFXProfiles, bool exporting)
255
{
256
        exportingPDF=exporting;
257
        enablePDFExportTabs(exportingPDF);
258
        AllFonts=prefsData->fontPrefs.AvailFonts;
259
        int unitIndex = prefsData->docSetupPrefs.docUnitIndex;
260
        unitRatio = unitGetRatioFromIndex(unitIndex);
261
        unitChange(unitIndex);
262
        Opts=prefsData->pdfPrefs;
263
        defaultSolidColorRGBProfile=prefsData->colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
264
        defaultPrinterProfile=prefsData->colorPrefs.DCMSset.DefaultPrinterProfile;
265
        exportAllPagesRadioButton->setChecked(true);
266
        enableRangeControls(false);
267
        rotationComboBox->setCurrentIndex(prefsData->pdfPrefs.RotateDeg / 90);
268
        pageMirrorHorizontalToolButton->setChecked(prefsData->pdfPrefs.MirrorH);
269
        pageMirrorVerticalToolButton->setChecked(prefsData->pdfPrefs.MirrorV);
270
        clipToPrinterMarginsCheckBox->setChecked(prefsData->pdfPrefs.doClip);
271
        bool cmsUse = m_doc ? (ScCore->haveCMS() && m_doc->HasCMS) : false;
272
        int newCMSIndex=0;
273
        if (cmsUse)
274
        {
275
                if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X1a)
276
                        newCMSIndex=3;
277
                if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X3)
278
                        newCMSIndex=4;
279
                if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X4)
280
                        newCMSIndex=5;
281
        }
282
        if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_13)
283
                newCMSIndex=0;
284
        if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_14)
285
                newCMSIndex=1;
286
        if (prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_15)
287
                newCMSIndex=2;
288
        pdfVersionComboBox->setCurrentIndex(newCMSIndex);
289
        pageBindingComboBox->setCurrentIndex(prefsData->pdfPrefs.Binding);
290
        generateThumbnailsCheckBox->setChecked(prefsData->pdfPrefs.Thumbnails);
291
        saveLinkedTextFramesAsArticlesCheckBox->setChecked(prefsData->pdfPrefs.Articles);
292
        includeBookmarksCheckBox->setChecked(prefsData->pdfPrefs.Bookmarks);
293
        includeLayersCheckBox->setChecked(prefsData->pdfPrefs.useLayers);
294
        includeLayersCheckBox->setEnabled(prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_15 || prefsData->pdfPrefs.Version == PDFOptions::PDFVersion_X4);
295
 
296
        epsExportResolutionSpinBox->setValue(prefsData->pdfPrefs.Resolution);
297
        embedPDFAndEPSFilesCheckBox->setChecked(prefsData->pdfPrefs.embedPDF);
298
        compressTextAndVectorGraphicsCheckBox->setChecked( prefsData->pdfPrefs.Compress );
299
        imageCompressionMethodComboBox->setCurrentIndex(prefsData->pdfPrefs.CompressMethod);
300
        imageCompressionQualityComboBox->setCurrentIndex(prefsData->pdfPrefs.Quality);
301
        maxResolutionLimitCheckBox->setChecked(prefsData->pdfPrefs.RecalcPic);
302
        maxExportResolutionSpinBox->setValue(prefsData->pdfPrefs.PicRes);
303
        maxExportResolutionSpinBox->setEnabled(prefsData->pdfPrefs.RecalcPic);
304
 
305
        if (m_doc != 0 && exportingPDF)
306
        {
307
//      Build a list of all Fonts used in Annotations;
308
                PageItem *pgit;
309
                QList<PageItem*> allItems;
310
                for (QHash<int, PageItem*>::iterator it = m_doc->FrameItems.begin(); it != m_doc->FrameItems.end(); ++it)
311
                {
312
                        PageItem *currItem = it.value();
313
                        if (currItem->isGroup())
314
                                allItems = currItem->getItemList();
315
                        else
316
                                allItems.append(currItem);
317
                        for (int ii = 0; ii < allItems.count(); ii++)
318
                        {
319
                                pgit = allItems.at(ii);
320
                                if (((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) && (pgit->isAnnotation()) && (pgit->itemText.length() > 0))
321
                                        AnnotationFonts.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), "");
322
                        }
323
                        allItems.clear();
324
                }
325
                for (int a = 0; a < m_doc->MasterItems.count(); ++a)
326
                {
327
                        PageItem *currItem = m_doc->MasterItems.at(a);
328
                        if (currItem->isGroup())
329
                                allItems = currItem->getItemList();
330
                        else
331
                                allItems.append(currItem);
332
                        for (int ii = 0; ii < allItems.count(); ii++)
333
                        {
334
                                pgit = allItems.at(ii);
335
                                if (((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) && (pgit->isAnnotation()) && (pgit->itemText.length() > 0))
336
                                        AnnotationFonts.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), "");
337
                        }
338
                        allItems.clear();
339
                }
340
                for (int a = 0; a < m_doc->DocItems.count(); ++a)
341
                {
342
                        PageItem *currItem = m_doc->DocItems.at(a);
343
                        if (currItem->isGroup())
344
                                allItems = currItem->getItemList();
345
                        else
346
                                allItems.append(currItem);
347
                        for (int ii = 0; ii < allItems.count(); ii++)
348
                        {
349
                                pgit = allItems.at(ii);
350
                                if (((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) && (pgit->isAnnotation()) && (pgit->itemText.length() > 0))
351
                                        AnnotationFonts.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), "");
352
                        }
353
                        allItems.clear();
354
                }
20122 jghali 355
                toSubsetButton->setEnabled(false);
356
                fromSubsetButton->setEnabled(false);
20103 avox 357
 
20122 jghali 358
                if ((Opts.EmbedList.count() == 0) && (Opts.SubsetList.count() == 0) && (Opts.firstUse))
19828 jghali 359
                        EmbedAll();
360
                else
361
                {
20122 jghali 362
                        QStringList docFonts = m_doc->usedFonts().keys();
19828 jghali 363
                        embeddedFontsListWidget->clear();
20122 jghali 364
                        subsettedFontsListWidget->clear();
365
                        for (int fe = 0; fe < docFonts.count(); ++ fe)
19828 jghali 366
                        {
20122 jghali 367
                                QString fontName = docFonts.at(fe);
368
                                if (Opts.EmbedList.contains(fontName))
369
                                        addFontItem(fontName, embeddedFontsListWidget);
370
                                else
371
                                {
372
                                        addFontItem(fontName, subsettedFontsListWidget);
373
                                        if (!Opts.SubsetList.contains(fontName))
374
                                                Opts.SubsetList.append(fontName);
375
                                }
19828 jghali 376
                        }
377
                        QMap<QString, QString>::Iterator itAnn;
378
                        for (itAnn = AnnotationFonts.begin(); itAnn != AnnotationFonts.end(); ++itAnn)
379
                        {
380
                                QList<QListWidgetItem *> itEmbed = embeddedFontsListWidget->findItems(itAnn.key(), Qt::MatchExactly);
381
                                if (itEmbed.count() == 0)
382
                                {
20122 jghali 383
                                        QListWidgetItem* item = addFontItem(itAnn.key(), embeddedFontsListWidget);
384
                                        item->setFlags(Qt::ItemIsEnabled);
19828 jghali 385
                                }
20122 jghali 386
                                QList<QListWidgetItem *> itSubset = subsettedFontsListWidget->findItems(itAnn.key(), Qt::MatchExactly);
387
                                for (int itOut = 0; itOut < itSubset.count(); ++itOut)
19828 jghali 388
                                {
20122 jghali 389
                                        QListWidgetItem* item = itSubset[itOut];
390
                                        delete subsettedFontsListWidget->takeItem(subsettedFontsListWidget->row(item));
19828 jghali 391
                                }
392
                        }
393
                }
394
                enabledEffectsCheckBox->setChecked(Opts.PresentMode);
395
                showPagePreviewsCheckBox->setChecked(false);
396
                effectsPageListWidget->clear();
397
                QString tmp;
398
                for (int pg = 0; pg < m_doc->Pages->count(); ++pg)
399
                {
400
                        effectsPageListWidget->addItem( tr("Page")+" "+tmp.setNum(pg+1));
401
                        EffVal.append(m_doc->Pages->at(pg)->PresentVals);
402
                }
403
                displayDurationSpinBox->setValue(EffVal[0].pageViewDuration);
404
                effectDurationSpinBox->setValue(EffVal[0].pageEffectDuration);
405
                bool df = true;
406
                if ((Opts.displayBookmarks) || (Opts.displayFullscreen) || (Opts.displayLayers) || (Opts.displayThumbs))
407
                        df = false;
408
                if (df)
409
                        useViewerDefaultsRadioButton->setChecked(df);
410
                useFullScreenRadioButton->setChecked(Opts.displayFullscreen);
411
                useBookmarksRadioButton->setChecked(Opts.displayBookmarks);
412
                useThumbnailsRadioButton->setChecked(Opts.displayThumbs);
413
                useLayersRadioButton->setChecked(Opts.displayLayers);
414
                hideViewerToolBarCheckBox->setChecked(Opts.hideToolBar);
415
                hideViewerMenuBarCheckBox->setChecked(Opts.hideMenuBar);
416
                fitViewerWindowCheckBox->setChecked(Opts.fitWindow);
417
                QMap<QString,QString>::Iterator itja;
418
                startupJavascriptComboBox->clear();
419
                startupJavascriptComboBox->addItem( tr("No Script"));
420
                for (itja = m_doc->JavaScripts.begin(); itja != m_doc->JavaScripts.end(); ++itja)
421
                        startupJavascriptComboBox->addItem(itja.key());
422
                if (m_doc->JavaScripts.contains(Opts.openAction))
423
                        setCurrentComboItem(startupJavascriptComboBox, Opts.openAction);
424
                if (Opts.PageLayout == PDFOptions::SinglePage)
425
                        singlePageRadioButton->setChecked(true);
426
                else if (Opts.PageLayout == PDFOptions::OneColumn)
427
                        continuousPagesRadioButton->setChecked(true);
428
                else if (Opts.PageLayout == PDFOptions::TwoColumnLeft)
429
                        doublePageLeftRadioButton->setChecked(true);
430
                else if (Opts.PageLayout == PDFOptions::TwoColumnRight)
431
                        doublePageRightRadioButton->setChecked(true);
432
                if ((Opts.Version == PDFOptions::PDFVersion_15) || (Opts.Version == PDFOptions::PDFVersion_X4))
433
                        useLayersRadioButton->setEnabled(true);
434
                else
435
                        useLayersRadioButton->setEnabled(false);
436
        }
437
 
438
        useEncryptionCheckBox->setChecked( prefsData->pdfPrefs.Encrypt );
439
        passwordOwnerLineEdit->setText(prefsData->pdfPrefs.PassOwner);
440
        passwordUserLineEdit->setText(prefsData->pdfPrefs.PassUser);
441
        allowPrintingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 4 );
442
        allowChangingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 8 );
443
        allowCopyingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 16 );
444
        allowAnnotatingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 32 );
445
        enableSecurityControls(prefsData->pdfPrefs.Encrypt);
446
 
447
        if (prefsData->pdfPrefs.UseRGB)
448
                outputIntentionComboBox->setCurrentIndex(0);
449
        else
450
        {
451
                if (prefsData->pdfPrefs.isGrayscale)
452
                        outputIntentionComboBox->setCurrentIndex(2);
453
                else
454
                        outputIntentionComboBox->setCurrentIndex(1);
455
        }
456
        convertSpotsToProcessCheckBox->setChecked(!prefsData->pdfPrefs.UseSpotColors);
457
 
20371 jghali 458
        bleedsWidget->setup(prefsData->pdfPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
19828 jghali 459
        bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
460
        bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
461
        bleedsWidget->setPageSize(prefsData->docSetupPrefs.pageSize);
462
        bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
463
//
464
        useCustomRenderingCheckBox->setChecked(prefsData->pdfPrefs.UseLPI);
465
        QMap<QString,LPIData>::Iterator itlp;
466
        customRenderingColorComboBox->clear();
467
        for (itlp = prefsData->pdfPrefs.LPISettings.begin(); itlp != prefsData->pdfPrefs.LPISettings.end(); ++itlp)
468
                customRenderingColorComboBox->addItem( itlp.key() );
469
        customRenderingColorComboBox->setCurrentIndex(0);
470
 
471
        customRenderingFrequencySpinBox->setValue(prefsData->pdfPrefs.LPISettings[customRenderingColorComboBox->currentText()].Frequency);
472
        customRenderingAngleSpinBox->setValue(prefsData->pdfPrefs.LPISettings[customRenderingColorComboBox->currentText()].Angle);
473
        customRenderingSpotFunctionComboBox->setCurrentIndex(prefsData->pdfPrefs.LPISettings[customRenderingColorComboBox->currentText()].SpotFunc);
474
        useSolidColorProfileCheckBox->setChecked(prefsData->pdfPrefs.UseProfiles);
475
        useImageProfileCheckBox->setChecked(prefsData->pdfPrefs.UseProfiles2);
476
        doNotUseEmbeddedImageProfileCheckBox->setChecked(prefsData->pdfPrefs.EmbeddedI);
477
        if ((prefsData->pdfPrefs.UseRGB) || (prefsData->pdfPrefs.isGrayscale))
478
        {
479
                //enableSolidsImagesWidgets(false);
480
                enableProfiles(0);
481
        }
482
        else
483
                enableProfiles(1);
484
        enablePG();
485
        enablePGI();
486
        QString tp(prefsData->pdfPrefs.SolidProf);
487
        if (!ScCore->InputProfiles.contains(tp))
488
        {
489
                if (m_doc != 0 && exportingPDF)
490
                        tp = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
491
                else
492
                        tp = defaultSolidColorRGBProfile;
493
        }
494
        ProfilesL::Iterator itp;
495
        ProfilesL::Iterator itpend=ScCore->InputProfiles.end();
496
        solidColorProfileComboBox->clear();
497
        for (itp = ScCore->InputProfiles.begin(); itp != itpend; ++itp)
498
        {
499
                solidColorProfileComboBox->addItem(itp.key());
500
                if (itp.key() == tp)
501
                        solidColorProfileComboBox->setCurrentIndex(solidColorProfileComboBox->count()-1);
502
        }
503
        int solidIntent = Opts.Intent;
504
        if (Opts.Intent < 0)
505
                solidIntent = 1;
506
        solidColorRenderingIntentComboBox->setCurrentIndex(solidIntent);
507
        QString tp1 = Opts.ImageProf;
508
        if (!ScCore->InputProfiles.contains(tp1))
509
        {
510
                if (m_doc != 0 && exportingPDF)
511
                        tp1 = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
512
                else
513
                        tp1 = defaultSolidColorRGBProfile;
514
        }
515
        ProfilesL::Iterator itp2;
516
        ProfilesL::Iterator itp2end=ScCore->InputProfiles.end();
517
        imageProfileComboBox->clear();
518
        for (itp2 = ScCore->InputProfiles.begin(); itp2 != itp2end; ++itp2)
519
        {
520
                imageProfileComboBox->addItem(itp2.key());
521
                if (itp2.key() == tp1)
522
                        imageProfileComboBox->setCurrentIndex(imageProfileComboBox->count()-1);
523
        }
524
        int imageIntent = Opts.Intent2;
525
        if (imageIntent < 0)
526
                imageIntent = 0;
527
        imageRenderingIntentComboBox->setCurrentIndex(imageIntent);
528
        if (!cmsUse)
529
        {
530
                //Disabling vis hiding
531
                //setSolidsImagesWidgetsShown(false);
532
                enableSolidsImagesWidgets(false);
533
        }
534
 
535
        ProfilesL::const_iterator itp3;
536
        QString tp3(Opts.PrintProf);
537
        if (!PDFXProfiles.contains(tp3))
538
        {
539
                if (m_doc != 0 && exportingPDF)
540
                        tp3 = m_doc->cmsSettings().DefaultPrinterProfile;
541
                else
542
                        tp3 = defaultPrinterProfile;
543
        }
544
        pdfx3OutputProfileComboBox->clear();
545
        for (itp3 = PDFXProfiles.constBegin(); itp3 != PDFXProfiles.constEnd(); ++itp3)
546
        {
547
                pdfx3OutputProfileComboBox->addItem(itp3.key());
548
                if (itp3.key() == tp3)
549
                        pdfx3OutputProfileComboBox->setCurrentIndex(pdfx3OutputProfileComboBox->count()-1);
550
        }
551
 
552
        if (!Opts.Info.isEmpty())
553
                pdfx3InfoStringLineEdit->setText(Opts.Info);
554
        else
555
        {
556
                if (m_doc != 0 && exporting)
557
                {
558
                        QFileInfo fi(m_doc->DocName);
559
                        pdfx3InfoStringLineEdit->setText(fi.fileName());
560
                }
561
                else
562
                        pdfx3InfoStringLineEdit->setText( tr("InfoString"));
563
        }
564
 
565
        if (m_doc != 0 && exportingPDF)
566
        {
567
                useDocumentBleedsCheckBox->setChecked(Opts.useDocBleeds);
568
                doDocBleeds();
569
        }
570
        else
571
                useDocumentBleedsCheckBox->hide();
572
 
573
        markLengthSpinBox->setValue(prefsData->pdfPrefs.markLength*unitRatio);
574
        markOffsetSpinBox->setValue(prefsData->pdfPrefs.markOffset*unitRatio);
575
        printCropMarksCheckBox->setChecked(prefsData->pdfPrefs.cropMarks);
576
        printBleedMarksCheckBox->setChecked(prefsData->pdfPrefs.bleedMarks);
577
        printRegistrationMarksCheckBox->setChecked(prefsData->pdfPrefs.registrationMarks);
578
        printColorBarsCheckBox->setChecked(prefsData->pdfPrefs.colorMarks);
579
        printPageInfoCheckBox->setChecked(prefsData->pdfPrefs.docInfoMarks);
580
        if (!cmsUse)
581
                enablePDFXWidgets(false);
582
        if (cmsUse && (Opts.Version == PDFOptions::PDFVersion_X1a) && (!PDFXProfiles.isEmpty()))
583
                enablePDFX(3);
584
        else if (cmsUse && (Opts.Version == PDFOptions::PDFVersion_X3) && (!PDFXProfiles.isEmpty()))
585
                enablePDFX(4);
586
        else if (cmsUse && (Opts.Version == PDFOptions::PDFVersion_X4) && (!PDFXProfiles.isEmpty()))
587
                enablePDFX(5);
588
        else
589
                enablePDFXWidgets(false);
590
 
591
        if (m_doc != 0  && exportingPDF)
592
        {
593
                effectTypeComboBox->clear();
594
                effectTypeComboBox->addItem( tr("No Effect"));
595
                effectTypeComboBox->addItem( tr("Blinds"));
596
                effectTypeComboBox->addItem( tr("Box"));
597
                effectTypeComboBox->addItem( tr("Dissolve"));
598
                effectTypeComboBox->addItem( tr("Glitter"));
599
                effectTypeComboBox->addItem( tr("Split"));
600
                effectTypeComboBox->addItem( tr("Wipe"));
601
                if (Opts.Version == PDFOptions::PDFVersion_15)
602
                {
603
                        effectTypeComboBox->addItem( tr("Push"));
604
                        effectTypeComboBox->addItem( tr("Cover"));
605
                        effectTypeComboBox->addItem( tr("Uncover"));
606
                        effectTypeComboBox->addItem( tr("Fade"));
607
                }
608
                effectsPageListWidget->setCurrentRow(0);
609
                SetEffOpts(0);
610
                effectsPageListWidget->setEnabled(false);
611
                enableEffects(false);
612
                showPagePreviewsCheckBox->setEnabled(false);
613
                if (enabledEffectsCheckBox->isChecked())
614
                {
615
                        displayDurationSpinBox->setValue(EffVal[0].pageViewDuration);
616
                        effectDurationSpinBox->setValue(EffVal[0].pageEffectDuration);
617
                        effectTypeComboBox->setCurrentIndex(EffVal[0].effectType);
618
                        effectMovingDirectionComboBox->setCurrentIndex(EffVal[0].Dm);
619
                        effectInOutComboBox->setCurrentIndex(EffVal[0].M);
620
                        effectDirectionComboBox->setCurrentIndex(EffVal[0].Di);
621
                        SetEffOpts(effectTypeComboBox->currentIndex());
622
                }
623
                /* Using margin widget, is this necessary?
624
                if (m_doc->currentPageLayout != 0)
625
                {
626
                        BleedTxt3->setText( tr( "Inside:" ) );
627
                        BleedTxt4->setText( tr( "Outside:" ) );
628
                }
629
                */
630
        }
631
 
632
        if (m_doc != 0 && exportingPDF)
633
        {
20122 jghali 634
                connect(embedAllButton, SIGNAL(clicked()), this, SLOT(EmbedAll()));
635
                connect(embeddedFontsListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelEFont(QListWidgetItem*)));
636
                connect(subsetAllButton, SIGNAL(clicked()), this, SLOT(SubsetAll()));
637
                connect(subsettedFontsListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelSFont(QListWidgetItem*)));
638
                connect(toSubsetButton, SIGNAL(clicked()), this, SLOT(PutToSubset()));
639
                connect(fromSubsetButton, SIGNAL(clicked()), this, SLOT(RemoveSubset()));
19828 jghali 640
                connect(showPagePreviewsCheckBox, SIGNAL(clicked()), this, SLOT(PagePr()));
641
                connect(effectsPageListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(SetPgEff()));
642
                connect(effectTypeComboBox, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
643
                connect(effectDirectionComboBox, SIGNAL(activated(int)), this, SLOT(ValidDI(int)));
644
                connect(enabledEffectsCheckBox, SIGNAL(clicked()), this, SLOT(DoEffects()));
645
                connect(applyEffectToAllPagesPushButton, SIGNAL(clicked()), this, SLOT(EffectOnAll()));
646
//              connect(pdfx3InfoStringLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkInfo()));
647
//              connect(pdfx3InfoStringLineEdit, SIGNAL(editingFinished()), this, SLOT(checkInfo()));
648
                connect(useDocumentBleedsCheckBox, SIGNAL(clicked()), this, SLOT(doDocBleeds()));
649
 
20122 jghali 650
                embedAllButton->setToolTip( "<qt>" + tr( "Embed fonts into the PDF. Embedding the fonts will preserve the layout and appearance of your document." ) + "</qt>");
19828 jghali 651
                enabledEffectsCheckBox->setToolTip( "<qt>" + tr( "Enables presentation effects when using Adobe&#174; Reader&#174; and other PDF viewers which support this in full screen mode." ) + "</qt>");
652
                showPagePreviewsCheckBox->setToolTip( "<qt>" + tr( "Show page previews of each page listed above." ) + "</qt>");
653
                effectDurationSpinBox->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>" );
654
                effectDurationSpinBox->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>" );
20272 craig 655
                effectTypeComboBox->setToolTip( "<qt>" + tr( "Type of the display effect" ) + "</qt>" );
656
                effectMovingDirectionComboBox->setToolTip( "<qt>" + tr( "Direction of the effect of moving lines for the split and blind effects" ) + "</qt>" );
657
                effectInOutComboBox->setToolTip( "<qt>" + tr( "Starting position for the box and split effects" ) + "</qt>" );
658
                effectDirectionComboBox->setToolTip( "<qt>" + tr( "Direction of the glitter or wipe effects" ) + "</qt>" );
659
                applyEffectToAllPagesPushButton->setToolTip( "<qt>" + tr( "Apply the selected effect to all pages" ) + "</qt>" );
20286 craig 660
                subsetAllButton->setToolTip( "<qt>" + tr("Embed only subset fonts with glyphs used in the document into the PDF") + "</qt>");
19828 jghali 661
                singlePageRadioButton->setToolTip( "<qt>" + tr( "Show the document in single page mode" ) + "</qt>" );
662
                continuousPagesRadioButton->setToolTip( "<qt>" + tr( "Show the document in single page mode with the pages displayed continuously end to end like a scroll" ) + "</qt>" );
663
                doublePageLeftRadioButton->setToolTip( "<qt>" + tr( "Show the document with facing pages, starting with the first page displayed on the left" ) + "</qt>" );
664
                doublePageRightRadioButton->setToolTip( "<qt>" + tr( "Show the document with facing pages, starting with the first page displayed on the right" ) + "</qt>" );
665
                useViewerDefaultsRadioButton->setToolTip( "<qt>" + tr( "Use the viewer's defaults or the user's preferences if set differently from the viewer defaults" ) + "</qt>" );
666
                useFullScreenRadioButton->setToolTip( "<qt>" + tr( "Enables viewing the document in full screen" ) + "</qt>" );
667
                useBookmarksRadioButton->setToolTip( "<qt>" + tr( "Display the bookmarks upon opening" ) + "</qt>" );
668
                useThumbnailsRadioButton->setToolTip( "<qt>" + tr( "Display the page thumbnails upon opening" ) + "</qt>" );
669
                useLayersRadioButton->setToolTip( "<qt>" + tr( "Forces the displaying of layers. Useful only for PDF 1.5+." ) + "</qt>" );
670
                hideViewerToolBarCheckBox->setToolTip( "<qt>" + tr( "Hides the Tool Bar which has selection and other editing capabilities" ) + "</qt>" );
20272 craig 671
                hideViewerMenuBarCheckBox->setToolTip( "<qt>" + tr( "Hides the Menu Bar for the viewer, the PDF will display in a plain window" ) + "</qt>" );
672
                fitViewerWindowCheckBox->setToolTip( "<qt>" + tr( "Fit the document page or pages to the available space in the viewer window" ) + "</qt>" );
19828 jghali 673
        }
674
}
675
 
676
 
677
void Prefs_PDFExport::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
678
{
679
        prefsData->pdfPrefs.Thumbnails = generateThumbnailsCheckBox->isChecked();
680
        prefsData->pdfPrefs.Compress = compressTextAndVectorGraphicsCheckBox->isChecked();
681
        prefsData->pdfPrefs.CompressMethod = (PDFOptions::PDFCompression) imageCompressionMethodComboBox->currentIndex();
682
        prefsData->pdfPrefs.Quality = imageCompressionQualityComboBox->currentIndex();
683
        prefsData->pdfPrefs.Resolution = epsExportResolutionSpinBox->value();
684
        prefsData->pdfPrefs.RecalcPic = maxResolutionLimitCheckBox->isChecked();
685
        prefsData->pdfPrefs.PicRes = maxExportResolutionSpinBox->value();
686
        prefsData->pdfPrefs.embedPDF = embedPDFAndEPSFilesCheckBox->isChecked();
687
        prefsData->pdfPrefs.Bookmarks = includeBookmarksCheckBox->isChecked();
688
        prefsData->pdfPrefs.Binding = pageBindingComboBox->currentIndex();
689
        prefsData->pdfPrefs.MirrorH = pageMirrorHorizontalToolButton->isChecked();
690
        prefsData->pdfPrefs.MirrorV = pageMirrorVerticalToolButton->isChecked();
691
        prefsData->pdfPrefs.RotateDeg = rotationComboBox->currentIndex() * 90;
692
        prefsData->pdfPrefs.Articles = saveLinkedTextFramesAsArticlesCheckBox->isChecked();
20122 jghali 693
        prefsData->pdfPrefs.FontEmbedding = (PDFOptions::PDFFontEmbedding) fontEmbeddingCombo->currentIndex();
19828 jghali 694
        prefsData->pdfPrefs.Encrypt = useEncryptionCheckBox->isChecked();
695
        prefsData->pdfPrefs.UseLPI = useCustomRenderingCheckBox->isChecked();
696
        prefsData->pdfPrefs.UseSpotColors = !convertSpotsToProcessCheckBox->isChecked();
697
        prefsData->pdfPrefs.doMultiFile = false;
698
        prefsData->pdfPrefs.cropMarks  = printCropMarksCheckBox->isChecked();
699
        prefsData->pdfPrefs.bleedMarks = printBleedMarksCheckBox->isChecked();
700
        prefsData->pdfPrefs.registrationMarks = printRegistrationMarksCheckBox->isChecked();
701
        prefsData->pdfPrefs.colorMarks = printColorBarsCheckBox->isChecked();
702
        prefsData->pdfPrefs.docInfoMarks = printPageInfoCheckBox->isChecked();
703
        prefsData->pdfPrefs.markLength   = markLengthSpinBox->value() / unitRatio;
704
        prefsData->pdfPrefs.markOffset   = markOffsetSpinBox->value() / unitRatio;
705
        prefsData->pdfPrefs.useDocBleeds = useDocumentBleedsCheckBox->isChecked();
706
        prefsData->pdfPrefs.bleeds = bleedsWidget->margins();
707
        prefsData->pdfPrefs.doClip = clipToPrinterMarginsCheckBox->isChecked();
708
        if (useEncryptionCheckBox->isChecked())
709
        {
710
                int Perm = -64;
711
                if (pdfVersionComboBox->currentIndex() == 1)
712
                        Perm &= ~0x00240000;
713
                if (allowPrintingCheckBox->isChecked())
714
                        Perm += 4;
715
                if (allowChangingCheckBox->isChecked())
716
                        Perm += 8;
717
                if (allowCopyingCheckBox->isChecked())
718
                        Perm += 16;
719
                if (allowAnnotatingCheckBox->isChecked())
720
                        Perm += 32;
721
                prefsData->pdfPrefs.Permissions = Perm;
722
                prefsData->pdfPrefs.PassOwner = passwordOwnerLineEdit->text();
723
                prefsData->pdfPrefs.PassUser = passwordUserLineEdit->text();
724
        }
725
        if (pdfVersionComboBox->currentIndex() == 0)
726
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_13;
727
        if (pdfVersionComboBox->currentIndex() == 1)
728
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_14;
729
        if (pdfVersionComboBox->currentIndex() == 2)
730
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_15;
731
        if (pdfVersionComboBox->currentIndex() == 3)
732
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_X1a;
733
        if (pdfVersionComboBox->currentIndex() == 4)
734
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_X3;
735
        if (pdfVersionComboBox->currentIndex() == 5)
736
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_X4;
737
        if (outputIntentionComboBox->currentIndex() == 0)
738
        {
739
                prefsData->pdfPrefs.isGrayscale = false;
740
                prefsData->pdfPrefs.UseRGB = true;
741
                prefsData->pdfPrefs.UseProfiles = false;
742
                prefsData->pdfPrefs.UseProfiles2 = false;
743
        }
744
        else
745
        {
746
                if (outputIntentionComboBox->currentIndex() == 2)
747
                {
748
                        prefsData->pdfPrefs.isGrayscale = true;
749
                        prefsData->pdfPrefs.UseRGB = false;
750
                        prefsData->pdfPrefs.UseProfiles = false;
751
                        prefsData->pdfPrefs.UseProfiles2 = false;
752
                }
753
                else
754
                {
755
                        prefsData->pdfPrefs.isGrayscale = false;
756
                        prefsData->pdfPrefs.UseRGB = false;
757
                        if (/*CMSuse*/ ScCore->haveCMS())
758
                        {
759
                                prefsData->pdfPrefs.UseProfiles = useSolidColorProfileCheckBox->isChecked();
760
                                prefsData->pdfPrefs.UseProfiles2 = useImageProfileCheckBox->isChecked();
761
                                prefsData->pdfPrefs.Intent = solidColorRenderingIntentComboBox->currentIndex();
762
                                prefsData->pdfPrefs.Intent2 = imageRenderingIntentComboBox->currentIndex();
763
                                prefsData->pdfPrefs.EmbeddedI = doNotUseEmbeddedImageProfileCheckBox->isChecked();
764
                                prefsData->pdfPrefs.SolidProf = solidColorProfileComboBox->currentText();
765
                                prefsData->pdfPrefs.ImageProf = imageProfileComboBox->currentText();
766
                                prefsData->pdfPrefs.PrintProf = pdfx3OutputProfileComboBox->currentText();
767
                        }
768
                }
769
        }
770
}
771
 
772
 
773
void Prefs_PDFExport::SelLPIcol(int c)
774
{
775
        // XXX Optionen or Opts changed here
776
        Opts.LPISettings[SelLPIcolor].Frequency = customRenderingFrequencySpinBox->value();
777
        Opts.LPISettings[SelLPIcolor].Angle = customRenderingAngleSpinBox->value();
778
        Opts.LPISettings[SelLPIcolor].SpotFunc = customRenderingSpotFunctionComboBox->currentIndex();
779
        customRenderingFrequencySpinBox->setValue(Opts.LPISettings[customRenderingColorComboBox->itemText(c)].Frequency);
780
        customRenderingAngleSpinBox->setValue(Opts.LPISettings[customRenderingColorComboBox->itemText(c)].Angle);
781
        customRenderingSpotFunctionComboBox->setCurrentIndex(Opts.LPISettings[customRenderingColorComboBox->itemText(c)].SpotFunc);
782
        SelLPIcolor = customRenderingColorComboBox->itemText(c);
783
}
784
 
785
void Prefs_PDFExport::enableRangeControls(bool enabled)
786
{
787
        exportPageListLineEdit->setEnabled( enabled );
788
        exportRangeMorePushButton->setEnabled( enabled );
789
        if (enabled == false)
790
                includeBookmarksCheckBox->setChecked(false);
791
}
792
 
793
void Prefs_PDFExport::enableSecurityControls(bool enabled)
794
{
795
        passwordOwnerLineEdit->setEnabled(enabled);
796
        passwordUserLineEdit->setEnabled(enabled);
797
        allowPrintingCheckBox->setEnabled(enabled);
798
        allowChangingCheckBox->setEnabled(enabled);
799
        allowCopyingCheckBox->setEnabled(enabled);
800
        allowAnnotatingCheckBox->setEnabled(enabled);
801
}
802
 
803
 
804
void Prefs_PDFExport::enableCMS(bool enabled)
805
{
806
        cmsEnabled=enabled;
807
        addPDFVersions(enabled);
808
        enableProfiles(enabled);
809
}
810
 
811
void Prefs_PDFExport::enablePDFExportTabs(bool enabled)
812
{
813
        if (!enabled)
814
        {
815
                tabWidget->removeTab(tabWidget->indexOf(tabFonts));//Fonts
816
                tabWidget->removeTab(tabWidget->indexOf(tabExtras));//Extras
817
                tabWidget->removeTab(tabWidget->indexOf(tabViewer));//Viewer
818
        }
819
}
820
 
821
void Prefs_PDFExport::createPageNumberRange()
822
{
823
        if (m_doc!=0)
824
        {
825
                CreateRange cr(exportPageListLineEdit->text(), m_doc->DocPages.count(), this);
826
                if (cr.exec())
827
                {
828
                        CreateRangeData crData;
829
                        cr.getCreateRangeData(crData);
830
                        exportPageListLineEdit->setText(crData.pageRange);
831
                        return;
832
                }
833
        }
834
        exportPageListLineEdit->setText(QString::null);
835
}
836
 
837
void Prefs_PDFExport::setMaximumResolution()
838
{
839
        if (maxResolutionLimitCheckBox->isChecked())
840
        {
841
                maxExportResolutionSpinBox->setEnabled(true);
842
                if (maxExportResolutionSpinBox->value() > epsExportResolutionSpinBox->value())
843
                        maxExportResolutionSpinBox->setValue(epsExportResolutionSpinBox->value());
844
        }
845
        else
846
                maxExportResolutionSpinBox->setEnabled(false);
847
}
848
 
849
void Prefs_PDFExport::enableProfiles(int i)
850
{
851
        enableLPI(i);
852
        bool setter = false;
853
        if (i == 1 && pdfVersionComboBox->currentIndex() != 3)
854
                setter = true;
855
        enableSolidsImagesWidgets(setter);
856
}
857
 
858
void Prefs_PDFExport::enableLPI(int i)
859
{
860
        if (i == 1)
861
        {
862
                QString tp(Opts.SolidProf);
863
                if (!ScCore->InputProfiles.contains(tp))
864
                {
865
                        if (m_doc != 0)
866
                                tp = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
867
                        else
868
                                tp = defaultSolidColorRGBProfile;
869
                }
870
                solidColorProfileComboBox->clear();
871
                ProfilesL::Iterator itp;
872
                ProfilesL::Iterator itpend=ScCore->InputProfiles.end();
873
                for (itp = ScCore->InputProfiles.begin(); itp != itpend; ++itp)
874
                {
875
                        solidColorProfileComboBox->addItem(itp.key());
876
                        if (itp.key() == tp)
877
                        {
878
                                if (cmsEnabled)
879
                                        solidColorProfileComboBox->setCurrentIndex(solidColorProfileComboBox->count()-1);
880
                        }
881
                }
882
                if (cmsEnabled)
883
                        solidColorRenderingIntentComboBox->setCurrentIndex(Opts.Intent);
884
                QString tp1 = Opts.ImageProf;
885
                if (!ScCore->InputProfiles.contains(tp1))
886
                {
887
                        if (m_doc != 0)
888
                                tp1 = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
889
                        else
890
                                tp1 = defaultSolidColorRGBProfile;
891
                }
892
                imageProfileComboBox->clear();
893
                ProfilesL::Iterator itp2;
894
                ProfilesL::Iterator itp2end=ScCore->InputProfiles.end();
895
                for (itp2 = ScCore->InputProfiles.begin(); itp2 != itp2end; ++itp2)
896
                {
897
                        imageProfileComboBox->addItem(itp2.key());
898
                        if (itp2.key() == tp1)
899
                        {
900
                                if (cmsEnabled)
901
                                        imageProfileComboBox->setCurrentIndex(imageProfileComboBox->count()-1);
902
                        }
903
                }
904
                if (cmsEnabled)
905
                        imageRenderingIntentComboBox->setCurrentIndex(Opts.Intent2);
906
                //Disabling vs hiding
907
                enableSolidsImagesWidgets(cmsEnabled);
908
                convertSpotsToProcessCheckBox->setEnabled(true);
909
                if (m_doc!=0)
910
                {
911
                        useCustomRenderingCheckBox->setEnabled(true);
912
                        enableCustomRenderingWidgets(useCustomRenderingCheckBox->isChecked());
913
                }
914
        }
915
        else
916
        {
917
                convertSpotsToProcessCheckBox->setEnabled(false);
918
                useCustomRenderingCheckBox->setEnabled(false);
919
                enableCustomRenderingWidgets(false);
920
        }
921
}
922
 
923
 
924
void Prefs_PDFExport::enableLPI2()
925
{
926
        if (m_doc!=0)
927
                enableCustomRenderingWidgets(useCustomRenderingCheckBox->isChecked());
928
}
929
 
930
void Prefs_PDFExport::setCustomRenderingWidgetsShown(bool visible)
931
{
932
        useCustomRenderingCheckBox->setVisible(visible);
933
        customRenderingColorComboBox->setVisible(visible);
934
        customRenderingFrequencySpinBox->setVisible(visible);
935
        customRenderingAngleSpinBox->setVisible(visible);
936
        customRenderingSpotFunctionComboBox->setVisible(visible);
937
}
938
 
939
void Prefs_PDFExport::enableCustomRenderingWidgets(bool enabled)
940
{
941
        customRenderingColorComboBox->setEnabled(enabled);
942
        customRenderingFrequencySpinBox->setEnabled(enabled);
943
        customRenderingAngleSpinBox->setEnabled(enabled);
944
        customRenderingSpotFunctionComboBox->setEnabled(enabled);
945
}
946
 
947
void Prefs_PDFExport::setSolidsImagesWidgetsShown(bool visible)
948
{
949
        solidColorsLabel->setVisible(visible);
950
        solidColorsLine->setVisible(visible);
951
        useSolidColorProfileCheckBox->setVisible(visible);
952
        solidColorProfileComboBox->setVisible(visible);
953
        solidColorRenderingIntentComboBox->setVisible(visible);
954
        imagesLabel->setVisible(visible);
955
        imagesLine->setVisible(visible);
956
        useImageProfileCheckBox->setVisible(visible);
957
        doNotUseEmbeddedImageProfileCheckBox->setVisible(visible);
958
        imageProfileComboBox->setVisible(visible);
959
        imageRenderingIntentComboBox->setVisible(visible);
960
}
961
 
962
void Prefs_PDFExport::enableSolidsImagesWidgets(bool enabled)
963
{
964
        //if we want to show/hide instead
965
        //setSolidsImagesWidgetsShown(enabled);
966
        useSolidColorProfileCheckBox->setEnabled(enabled);
967
        solidColorProfileComboBox->setEnabled(enabled);
968
        solidColorRenderingIntentComboBox->setEnabled(enabled);
969
        useImageProfileCheckBox->setEnabled(enabled);
970
        doNotUseEmbeddedImageProfileCheckBox->setEnabled(enabled);
971
        imageProfileComboBox->setEnabled(enabled);
972
        imageRenderingIntentComboBox->setEnabled(enabled);
973
}
974
 
975
void Prefs_PDFExport::enablePDFXWidgets(bool enabled)
976
{
977
        pdfx3OutputProfileComboBox->setEnabled(enabled);
978
        pdfx3InfoStringLineEdit->setEnabled(enabled);
979
}
980
 
981
 
982
void Prefs_PDFExport::enablePGI()
983
{
984
        bool setter=false;
985
        if (useImageProfileCheckBox->isChecked())
986
                setter = doNotUseEmbeddedImageProfileCheckBox->isChecked() ? true : false;
987
        imageProfileComboBox->setEnabled(setter);
988
        imageRenderingIntentComboBox->setEnabled(setter);
989
        doNotUseEmbeddedImageProfileCheckBox->setEnabled(useImageProfileCheckBox->isChecked());
990
}
991
 
992
void Prefs_PDFExport::enablePGI2()
993
{
994
        bool setter = doNotUseEmbeddedImageProfileCheckBox->isChecked() ? true : false;
995
        imageProfileComboBox->setEnabled(setter);
996
        imageRenderingIntentComboBox->setEnabled(setter);
997
}
998
 
999
void Prefs_PDFExport::enablePG()
1000
{
1001
        bool setter = useSolidColorProfileCheckBox->isChecked() ? true : false;
1002
 
1003
        solidColorProfileComboBox->setEnabled(setter);
1004
        solidColorRenderingIntentComboBox->setEnabled(setter);
1005
}
1006
 
1007
void Prefs_PDFExport::enablePDFX(int i)
1008
{
1009
        includeLayersCheckBox->setEnabled((i == 2) || (i == 5));
1010
        if (useLayersRadioButton)
1011
                useLayersRadioButton->setEnabled((i == 2) || (i == 5));
1012
        if (m_doc != 0 && exportingPDF)
1013
        {
1014
                int currentEff = effectTypeComboBox->currentIndex();
1015
                disconnect(effectTypeComboBox, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
1016
                effectTypeComboBox->clear();
1017
                effectTypeComboBox->addItem( tr("No Effect"));
1018
                effectTypeComboBox->addItem( tr("Blinds"));
1019
                effectTypeComboBox->addItem( tr("Box"));
1020
                effectTypeComboBox->addItem( tr("Dissolve"));
1021
                effectTypeComboBox->addItem( tr("Glitter"));
1022
                effectTypeComboBox->addItem( tr("Split"));
1023
                effectTypeComboBox->addItem( tr("Wipe"));
1024
                if (i == 2)
1025
                {
1026
                        effectTypeComboBox->addItem( tr("Push"));
1027
                        effectTypeComboBox->addItem( tr("Cover"));
1028
                        effectTypeComboBox->addItem( tr("Uncover"));
1029
                        effectTypeComboBox->addItem( tr("Fade"));
1030
                        effectTypeComboBox->setCurrentIndex(currentEff);
1031
                }
1032
                else
1033
                {
1034
                        if (currentEff > 6)
1035
                        {
1036
                                currentEff = 0;
1037
                                effectTypeComboBox->setCurrentIndex(0);
1038
                                SetEffOpts(0);
1039
                                for (int pg = 0; pg<m_doc->Pages->count(); ++pg)
1040
                                {
1041
                                        if (EffVal[pg].effectType > 6)
1042
                                                EffVal[pg].effectType = 0;
1043
                                }
1044
                        }
1045
                        else
1046
                                effectTypeComboBox->setCurrentIndex(currentEff);
1047
                }
1048
                connect(effectTypeComboBox, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
1049
        }
1050
 
1051
        if (i < 3)  // not PDF/X
1052
        {
20122 jghali 1053
                fontEmbeddingCombo->setEnabled(true);
19828 jghali 1054
                enablePDFXWidgets(false);
1055
                tabWidget->setTabEnabled(2, true);
1056
                outputIntentionComboBox->setEnabled(true);
1057
                useImageProfileCheckBox->setEnabled(true);
1058
                emit hasInfo();
1059
                if (m_doc != 0 && exportingPDF)
1060
                {
1061
                        enabledEffectsCheckBox->setEnabled(true);
20122 jghali 1062
                        embedAllButton->setEnabled(true);
19828 jghali 1063
                }
1064
 
1065
                return;
1066
        }
1067
        // PDF/X is selected
1068
        disconnect(outputIntentionComboBox, SIGNAL(activated(int)), this, SLOT(enableProfiles(int)));
1069
        outputIntentionComboBox->setCurrentIndex(1);
1070
        outputIntentionComboBox->setEnabled(false);
1071
        enableProfiles(1);
1072
        if ((i == 4) || (i == 5)) // X3 or X4, enforcing color profiles on images
1073
        {
1074
                useImageProfileCheckBox->setChecked(true);
1075
                useImageProfileCheckBox->setEnabled(false);
1076
        }
1077
        if (m_doc != 0 && exportingPDF)
1078
        {
1079
//              EmbedFonts->setChecked(true);
1080
                EmbedAll();
1081
                enabledEffectsCheckBox->setChecked(false);
1082
                enabledEffectsCheckBox->setEnabled(false);
1083
//              EmbedFonts->setEnabled(false);
1084
                if (pdfx3InfoStringLineEdit->text().isEmpty())
1085
                        emit noInfo();
1086
                else
1087
                        emit hasInfo();
1088
        }
20122 jghali 1089
 
1090
        fontEmbeddingCombo->setCurrentIndex(0);
1091
        fontEmbeddingCombo->setEnabled(false);
1092
 
1093
        embeddedFontsListWidget->setEnabled(true);
1094
        embedAllButton->setEnabled(true);
1095
        subsettedFontsListWidget->setEnabled(true);
1096
        subsetAllButton->setEnabled(true);
1097
        toSubsetButton->setEnabled(true);
1098
        fromSubsetButton->setEnabled(true);
1099
 
19828 jghali 1100
        enablePGI();
1101
        pdfx3OutputProfileComboBox->setEnabled(true);
1102
        pdfx3InfoStringLineEdit->setEnabled(true);
1103
        tabWidget->setTabEnabled(2, false);
1104
        connect(outputIntentionComboBox, SIGNAL(activated(int)), this, SLOT(enableProfiles(int)));
1105
}
1106
 
1107
void Prefs_PDFExport::addPDFVersions(bool addPDFXStrings)
1108
{
1109
        disconnect(pdfVersionComboBox, SIGNAL(activated(int)), this, SLOT(enablePDFX(int)));
1110
        int i = pdfVersionComboBox->currentIndex();
1111
        pdfVersionComboBox->clear();
1112
        pdfVersionComboBox->addItem("PDF 1.3 (Acrobat 4)");
1113
        pdfVersionComboBox->addItem("PDF 1.4 (Acrobat 5)");
1114
        pdfVersionComboBox->addItem("PDF 1.5 (Acrobat 6)");
1115
        if (addPDFXStrings)
1116
        {
1117
                pdfVersionComboBox->addItem("PDF/X-1a");
1118
                pdfVersionComboBox->addItem("PDF/X-3");
1119
                pdfVersionComboBox->addItem("PDF/X-4");
1120
        }
1121
        else
1122
                i=qMin(i,2);
1123
        pdfVersionComboBox->setCurrentIndex(i);
1124
        connect(pdfVersionComboBox, SIGNAL(activated(int)), this, SLOT(enablePDFX(int)));
1125
}
1126
 
1127
 
1128
void Prefs_PDFExport::enableEffects(bool enabled)
1129
{
1130
        effectsPageListWidget->setEnabled(enabled);
1131
        showPagePreviewsCheckBox->setEnabled(enabled);
1132
        displayDurationSpinBox->setEnabled(enabled);
1133
        effectDurationSpinBox->setEnabled(enabled);
1134
        effectTypeComboBox->setEnabled(enabled);
1135
        if (enabled)
1136
                SetEffOpts(effectTypeComboBox->currentIndex());
1137
        else
1138
        {
1139
                effectMovingDirectionComboBox->setEnabled(false);
1140
                effectInOutComboBox->setEnabled(false);
1141
                effectDirectionComboBox->setEnabled(false);
1142
                applyEffectToAllPagesPushButton->setEnabled(false);
1143
        }
1144
}
1145
 
20122 jghali 1146
void Prefs_PDFExport::EmbedAll()
20103 avox 1147
{
20122 jghali 1148
        embeddedFontsListWidget->clear();
1149
        subsettedFontsListWidget->clear();
1150
        toSubsetButton->setEnabled(false);
1151
        fromSubsetButton->setEnabled(false);
20103 avox 1152
 
20122 jghali 1153
        QStringList docFonts;
1154
        if (m_doc)
1155
                docFonts = m_doc->usedFonts().keys();
1156
 
1157
        for (int a=0; a < docFonts.count(); ++a)
19828 jghali 1158
        {
20122 jghali 1159
                QString fontName = docFonts.at(a);
1160
                if (!AllFonts[fontName].subset())
19828 jghali 1161
                {
20122 jghali 1162
                        QListWidgetItem* item = addFontItem(fontName, embeddedFontsListWidget);
19828 jghali 1163
                        if (AnnotationFonts.contains(item->text()))
20122 jghali 1164
                                item->setFlags(Qt::ItemIsEnabled);
19828 jghali 1165
                }
20122 jghali 1166
                else if (AnnotationFonts.contains(fontName))
1167
                {
1168
                        QListWidgetItem* item = addFontItem(fontName, embeddedFontsListWidget);
1169
                        item->setFlags(Qt::ItemIsEnabled);
1170
                }
19828 jghali 1171
                else
1172
                {
20122 jghali 1173
                        addFontItem(fontName, subsettedFontsListWidget);
19828 jghali 1174
                }
1175
        }
1176
}
1177
 
20122 jghali 1178
void Prefs_PDFExport::SubsetAll()
19828 jghali 1179
{
1180
        embeddedFontsListWidget->clear();
20122 jghali 1181
        subsettedFontsListWidget->clear();
1182
        toSubsetButton->setEnabled(false);
1183
        fromSubsetButton->setEnabled(false);
1184
 
1185
        QStringList docFonts;
1186
        if (m_doc)
1187
                docFonts = m_doc->usedFonts().keys();
1188
 
1189
        for (int a = 0; a < docFonts.count(); ++a)
19828 jghali 1190
        {
20122 jghali 1191
                QString fontName = docFonts.at(a);
1192
                if (AnnotationFonts.contains(fontName))
19828 jghali 1193
                {
20122 jghali 1194
                        QListWidgetItem* item = addFontItem(fontName, embeddedFontsListWidget);
1195
                        item->setFlags(Qt::ItemIsEnabled);
19828 jghali 1196
                }
1197
                else
1198
                {
20122 jghali 1199
                        addFontItem(fontName, subsettedFontsListWidget);
19828 jghali 1200
                }
1201
        }
1202
}
1203
 
20122 jghali 1204
void Prefs_PDFExport::OutlineAll()
1205
{
1206
        // Nothing to do at this point
1207
}
1208
 
19828 jghali 1209
void Prefs_PDFExport::doDocBleeds()
1210
{
1211
        if (useDocumentBleedsCheckBox->isChecked())
1212
        {
1213
                Opts.bleeds=bleedsWidget->margins();
1214
                bleedsWidget->setNewValues(m_doc->bleedsVal());
1215
                bleedsWidget->setEnabled(false);
1216
        }
1217
        else
1218
        {
1219
                bleedsWidget->setNewValues(Opts.bleeds);
1220
                bleedsWidget->setEnabled(true);
1221
        }
1222
}
1223
 
1224
 
1225
void Prefs_PDFExport::SetEffOpts(int nr)
1226
{
1227
        QStandardItem* si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(2));
1228
        if (si) si->setSelectable(false);
1229
        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(3));
1230
        if (si) si->setSelectable(false);
1231
        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(4));
1232
        if (si) si->setSelectable(false);
1233
        switch (nr)
1234
        {
1235
        case 0:
1236
        case 3:
1237
        case 10:
1238
                effectMovingDirectionComboBox->setEnabled(false);
1239
                effectInOutComboBox->setEnabled(false);
1240
                effectDirectionComboBox->setEnabled(false);
1241
                break;
1242
        case 1:
1243
                effectMovingDirectionComboBox->setEnabled(true);
1244
                effectInOutComboBox->setEnabled(false);
1245
                effectDirectionComboBox->setEnabled(false);
1246
                break;
1247
        case 2:
1248
                effectMovingDirectionComboBox->setEnabled(false);
1249
                effectInOutComboBox->setEnabled(true);
1250
                effectDirectionComboBox->setEnabled(false);
1251
                break;
1252
        case 4:
1253
        case 6:
1254
        case 7:
1255
        case 8:
1256
        case 9:
1257
                effectMovingDirectionComboBox->setEnabled(false);
1258
                effectInOutComboBox->setEnabled(false);
1259
                effectDirectionComboBox->setEnabled(true);
1260
                if (nr == 6)
1261
                {
1262
                        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(2));
1263
                        if (si) si->setSelectable(true);
1264
                        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(3));
1265
                        if (si) si->setSelectable(true);
1266
                }
1267
                else
1268
                {
1269
                        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(4));
1270
                        if (si) si->setSelectable(true);
1271
                }
1272
                break;
1273
        case 5:
1274
                effectMovingDirectionComboBox->setEnabled(true);
1275
                effectInOutComboBox->setEnabled(true);
1276
                effectDirectionComboBox->setEnabled(false);
1277
                break;
1278
        }
1279
}
1280
 
1281
void Prefs_PDFExport::SelEFont(QListWidgetItem *c)
1282
{
1283
        if (c != NULL)
1284
        {
1285
                if (c->flags() & Qt::ItemIsSelectable)
20122 jghali 1286
                        toSubsetButton->setEnabled(true);
1287
                fromSubsetButton->setEnabled(false);
1288
                subsettedFontsListWidget->clearSelection();
19828 jghali 1289
        }
1290
}
1291
 
1292
void Prefs_PDFExport::SelSFont(QListWidgetItem *c)
1293
{
1294
        if (c != NULL)
1295
        {
1296
                if (pdfVersionComboBox->currentIndex() == 4)
1297
                {
1298
                        if ((AllFonts[c->text()].type() == ScFace::OTF) || (AllFonts[c->text()].subset()))
20122 jghali 1299
                                fromSubsetButton->setEnabled(false);
19828 jghali 1300
                        else
20122 jghali 1301
                                fromSubsetButton->setEnabled(true);
19828 jghali 1302
                }
1303
                else
20122 jghali 1304
                        fromSubsetButton->setEnabled(true);
1305
                toSubsetButton->setEnabled(false);
19828 jghali 1306
                embeddedFontsListWidget->clearSelection();
1307
        }
1308
}
1309
 
1310
void Prefs_PDFExport::PagePr()
1311
{
1312
        disconnect(effectsPageListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(SetPgEff()));
1313
        QString tmp;
1314
        QPixmap pm;
1315
        int ci = effectsPageListWidget->currentRow();
1316
        int pgMaxX = 0;
1317
        int pgMaxY = 0;
1318
        effectsPageListWidget->clear();
1319
        if (showPagePreviewsCheckBox->isChecked())
1320
        {
1321
                for (int pg = 0; pg < m_doc->Pages->count(); ++pg)
1322
                {
1323
                        pm=QPixmap::fromImage(m_doc->view()->PageToPixmap(pg, 70));
1324
                        pgMaxX = qMax(pgMaxX, pm.width());
1325
                        pgMaxY = qMax(pgMaxY, pm.height());
1326
                        new QListWidgetItem( pm, tr("Page")+" "+tmp.setNum(pg+1), effectsPageListWidget);
1327
                }
1328
                effectsPageListWidget->setIconSize(QSize(pgMaxX, pgMaxY));
1329
        }
1330
        else
1331
        {
1332
                for (int pg = 0; pg < m_doc->Pages->count(); ++pg)
1333
                {
1334
                        new QListWidgetItem( tr("Page")+" "+tmp.setNum(pg+1), effectsPageListWidget);
1335
                }
1336
        }
1337
        if (ci != -1)
1338
                effectsPageListWidget->setCurrentRow(ci);
1339
        else
1340
                effectsPageListWidget->clearSelection();
1341
        connect(effectsPageListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(SetPgEff()));
1342
}
1343
 
1344
void Prefs_PDFExport::DoDownsample()
1345
{
1346
        if (maxResolutionLimitCheckBox->isChecked())
1347
        {
1348
                maxExportResolutionSpinBox->setEnabled(true);
1349
                if (maxExportResolutionSpinBox->value() > epsExportResolutionSpinBox->value())
1350
                        maxExportResolutionSpinBox->setValue(epsExportResolutionSpinBox->value());
1351
        }
1352
        else
1353
                maxExportResolutionSpinBox->setEnabled(false);
1354
}
1355
 
20122 jghali 1356
void Prefs_PDFExport::EmbeddingModeChange()
19828 jghali 1357
{
20122 jghali 1358
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
1359
 
1360
        embeddedFontsListWidget->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1361
        embedAllButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1362
        subsettedFontsListWidget->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1363
        subsetAllButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1364
        toSubsetButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1365
        fromSubsetButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
19828 jghali 1366
}
1367
 
20122 jghali 1368
void Prefs_PDFExport::RemoveSubset()
19828 jghali 1369
{
20122 jghali 1370
        QString currentFont = subsettedFontsListWidget->currentItem()->text();
1371
        const ScFace fontFace = AllFonts[currentFont];
1372
        if ((fontFace.type() != ScFace::OTF) && (!fontFace.subset()))
19828 jghali 1373
        {
20122 jghali 1374
                embeddedFontsListWidget->addItem(currentFont);
1375
                delete subsettedFontsListWidget->takeItem(subsettedFontsListWidget->currentRow());
19828 jghali 1376
        }
20122 jghali 1377
        subsettedFontsListWidget->clearSelection();
1378
        if (subsettedFontsListWidget->count() == 0)
1379
                fromSubsetButton->setEnabled(false);
19828 jghali 1380
}
1381
 
20122 jghali 1382
void Prefs_PDFExport::PutToSubset()
19828 jghali 1383
{
1384
        QString currentFont = embeddedFontsListWidget->currentItem()->text();
20122 jghali 1385
        if (subsettedFontsListWidget->count() != 0)
19828 jghali 1386
        {
20122 jghali 1387
                if (subsettedFontsListWidget->findItems(currentFont, Qt::MatchExactly).count() == 0)
1388
                        addFontItem(currentFont, subsettedFontsListWidget);
19828 jghali 1389
        }
1390
        else
1391
        {
20122 jghali 1392
                addFontItem(currentFont, subsettedFontsListWidget);
19828 jghali 1393
        }
1394
        delete embeddedFontsListWidget->takeItem(embeddedFontsListWidget->currentRow());
1395
        embeddedFontsListWidget->clearSelection();
1396
        if (embeddedFontsListWidget->count() == 0)
1397
        {
20122 jghali 1398
                toSubsetButton->setEnabled(false);
19828 jghali 1399
        }
20122 jghali 1400
        else if (!(embeddedFontsListWidget->currentItem()->flags() & Qt::ItemIsSelectable))
19828 jghali 1401
        {
20122 jghali 1402
                toSubsetButton->setEnabled(false);
19828 jghali 1403
        }
1404
}