Subversion Repositories Scribus

Rev

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