Subversion Repositories Scribus

Rev

Rev 21032 | Rev 21491 | 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
{
113
        return (PDFOptions::PDFFontEmbedding) fontEmbeddingCombo->currentIndex();
114
}
115
 
19828 jghali 116
QStringList Prefs_PDFExport::fontsToEmbed()
117
{
20122 jghali 118
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
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
{
20122 jghali 130
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
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
{
20122 jghali 142
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
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
 
306
        if (m_doc != 0 && exportingPDF)
307
        {
308
//      Build a list of all Fonts used in Annotations;
309
                PageItem *pgit;
310
                QList<PageItem*> allItems;
311
                for (QHash<int, PageItem*>::iterator it = m_doc->FrameItems.begin(); it != m_doc->FrameItems.end(); ++it)
312
                {
313
                        PageItem *currItem = it.value();
314
                        if (currItem->isGroup())
315
                                allItems = currItem->getItemList();
316
                        else
317
                                allItems.append(currItem);
318
                        for (int ii = 0; ii < allItems.count(); ii++)
319
                        {
320
                                pgit = allItems.at(ii);
321
                                if (((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) && (pgit->isAnnotation()) && (pgit->itemText.length() > 0))
322
                                        AnnotationFonts.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), "");
323
                        }
324
                        allItems.clear();
325
                }
326
                for (int a = 0; a < m_doc->MasterItems.count(); ++a)
327
                {
328
                        PageItem *currItem = m_doc->MasterItems.at(a);
329
                        if (currItem->isGroup())
330
                                allItems = currItem->getItemList();
331
                        else
332
                                allItems.append(currItem);
333
                        for (int ii = 0; ii < allItems.count(); ii++)
334
                        {
335
                                pgit = allItems.at(ii);
336
                                if (((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) && (pgit->isAnnotation()) && (pgit->itemText.length() > 0))
337
                                        AnnotationFonts.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), "");
338
                        }
339
                        allItems.clear();
340
                }
341
                for (int a = 0; a < m_doc->DocItems.count(); ++a)
342
                {
343
                        PageItem *currItem = m_doc->DocItems.at(a);
344
                        if (currItem->isGroup())
345
                                allItems = currItem->getItemList();
346
                        else
347
                                allItems.append(currItem);
348
                        for (int ii = 0; ii < allItems.count(); ii++)
349
                        {
350
                                pgit = allItems.at(ii);
351
                                if (((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) && (pgit->isAnnotation()) && (pgit->itemText.length() > 0))
352
                                        AnnotationFonts.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), "");
353
                        }
354
                        allItems.clear();
355
                }
20122 jghali 356
                toSubsetButton->setEnabled(false);
357
                fromSubsetButton->setEnabled(false);
20103 avox 358
 
20122 jghali 359
                if ((Opts.EmbedList.count() == 0) && (Opts.SubsetList.count() == 0) && (Opts.firstUse))
19828 jghali 360
                        EmbedAll();
361
                else
362
                {
20122 jghali 363
                        QStringList docFonts = m_doc->usedFonts().keys();
19828 jghali 364
                        embeddedFontsListWidget->clear();
20122 jghali 365
                        subsettedFontsListWidget->clear();
366
                        for (int fe = 0; fe < docFonts.count(); ++ fe)
19828 jghali 367
                        {
20122 jghali 368
                                QString fontName = docFonts.at(fe);
369
                                if (Opts.EmbedList.contains(fontName))
370
                                        addFontItem(fontName, embeddedFontsListWidget);
371
                                else
372
                                {
373
                                        addFontItem(fontName, subsettedFontsListWidget);
374
                                        if (!Opts.SubsetList.contains(fontName))
375
                                                Opts.SubsetList.append(fontName);
376
                                }
19828 jghali 377
                        }
378
                        QMap<QString, QString>::Iterator itAnn;
379
                        for (itAnn = AnnotationFonts.begin(); itAnn != AnnotationFonts.end(); ++itAnn)
380
                        {
381
                                QList<QListWidgetItem *> itEmbed = embeddedFontsListWidget->findItems(itAnn.key(), Qt::MatchExactly);
382
                                if (itEmbed.count() == 0)
383
                                {
20122 jghali 384
                                        QListWidgetItem* item = addFontItem(itAnn.key(), embeddedFontsListWidget);
385
                                        item->setFlags(Qt::ItemIsEnabled);
19828 jghali 386
                                }
20122 jghali 387
                                QList<QListWidgetItem *> itSubset = subsettedFontsListWidget->findItems(itAnn.key(), Qt::MatchExactly);
388
                                for (int itOut = 0; itOut < itSubset.count(); ++itOut)
19828 jghali 389
                                {
20122 jghali 390
                                        QListWidgetItem* item = itSubset[itOut];
391
                                        delete subsettedFontsListWidget->takeItem(subsettedFontsListWidget->row(item));
19828 jghali 392
                                }
393
                        }
394
                }
395
                enabledEffectsCheckBox->setChecked(Opts.PresentMode);
396
                showPagePreviewsCheckBox->setChecked(false);
397
                effectsPageListWidget->clear();
398
                QString tmp;
399
                for (int pg = 0; pg < m_doc->Pages->count(); ++pg)
400
                {
401
                        effectsPageListWidget->addItem( tr("Page")+" "+tmp.setNum(pg+1));
402
                        EffVal.append(m_doc->Pages->at(pg)->PresentVals);
403
                }
404
                displayDurationSpinBox->setValue(EffVal[0].pageViewDuration);
405
                effectDurationSpinBox->setValue(EffVal[0].pageEffectDuration);
406
                bool df = true;
407
                if ((Opts.displayBookmarks) || (Opts.displayFullscreen) || (Opts.displayLayers) || (Opts.displayThumbs))
408
                        df = false;
409
                if (df)
410
                        useViewerDefaultsRadioButton->setChecked(df);
411
                useFullScreenRadioButton->setChecked(Opts.displayFullscreen);
412
                useBookmarksRadioButton->setChecked(Opts.displayBookmarks);
413
                useThumbnailsRadioButton->setChecked(Opts.displayThumbs);
414
                useLayersRadioButton->setChecked(Opts.displayLayers);
415
                hideViewerToolBarCheckBox->setChecked(Opts.hideToolBar);
416
                hideViewerMenuBarCheckBox->setChecked(Opts.hideMenuBar);
417
                fitViewerWindowCheckBox->setChecked(Opts.fitWindow);
418
                QMap<QString,QString>::Iterator itja;
419
                startupJavascriptComboBox->clear();
420
                startupJavascriptComboBox->addItem( tr("No Script"));
421
                for (itja = m_doc->JavaScripts.begin(); itja != m_doc->JavaScripts.end(); ++itja)
422
                        startupJavascriptComboBox->addItem(itja.key());
423
                if (m_doc->JavaScripts.contains(Opts.openAction))
424
                        setCurrentComboItem(startupJavascriptComboBox, Opts.openAction);
425
                if (Opts.PageLayout == PDFOptions::SinglePage)
426
                        singlePageRadioButton->setChecked(true);
427
                else if (Opts.PageLayout == PDFOptions::OneColumn)
428
                        continuousPagesRadioButton->setChecked(true);
429
                else if (Opts.PageLayout == PDFOptions::TwoColumnLeft)
430
                        doublePageLeftRadioButton->setChecked(true);
431
                else if (Opts.PageLayout == PDFOptions::TwoColumnRight)
432
                        doublePageRightRadioButton->setChecked(true);
433
                if ((Opts.Version == PDFOptions::PDFVersion_15) || (Opts.Version == PDFOptions::PDFVersion_X4))
434
                        useLayersRadioButton->setEnabled(true);
435
                else
436
                        useLayersRadioButton->setEnabled(false);
437
        }
438
 
439
        useEncryptionCheckBox->setChecked( prefsData->pdfPrefs.Encrypt );
440
        passwordOwnerLineEdit->setText(prefsData->pdfPrefs.PassOwner);
441
        passwordUserLineEdit->setText(prefsData->pdfPrefs.PassUser);
442
        allowPrintingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 4 );
443
        allowChangingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 8 );
444
        allowCopyingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 16 );
445
        allowAnnotatingCheckBox->setChecked( prefsData->pdfPrefs.Permissions & 32 );
446
        enableSecurityControls(prefsData->pdfPrefs.Encrypt);
447
 
448
        if (prefsData->pdfPrefs.UseRGB)
449
                outputIntentionComboBox->setCurrentIndex(0);
450
        else
451
        {
452
                if (prefsData->pdfPrefs.isGrayscale)
453
                        outputIntentionComboBox->setCurrentIndex(2);
454
                else
455
                        outputIntentionComboBox->setCurrentIndex(1);
456
        }
457
        convertSpotsToProcessCheckBox->setChecked(!prefsData->pdfPrefs.UseSpotColors);
458
 
20371 jghali 459
        bleedsWidget->setup(prefsData->pdfPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, NewMarginWidget::BleedWidgetFlags);
19828 jghali 460
        bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
461
        bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
462
        bleedsWidget->setPageSize(prefsData->docSetupPrefs.pageSize);
463
        bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
464
//
465
        useCustomRenderingCheckBox->setChecked(prefsData->pdfPrefs.UseLPI);
466
        QMap<QString,LPIData>::Iterator itlp;
467
        customRenderingColorComboBox->clear();
468
        for (itlp = prefsData->pdfPrefs.LPISettings.begin(); itlp != prefsData->pdfPrefs.LPISettings.end(); ++itlp)
469
                customRenderingColorComboBox->addItem( itlp.key() );
470
        customRenderingColorComboBox->setCurrentIndex(0);
471
 
472
        customRenderingFrequencySpinBox->setValue(prefsData->pdfPrefs.LPISettings[customRenderingColorComboBox->currentText()].Frequency);
473
        customRenderingAngleSpinBox->setValue(prefsData->pdfPrefs.LPISettings[customRenderingColorComboBox->currentText()].Angle);
474
        customRenderingSpotFunctionComboBox->setCurrentIndex(prefsData->pdfPrefs.LPISettings[customRenderingColorComboBox->currentText()].SpotFunc);
475
        useSolidColorProfileCheckBox->setChecked(prefsData->pdfPrefs.UseProfiles);
476
        useImageProfileCheckBox->setChecked(prefsData->pdfPrefs.UseProfiles2);
477
        doNotUseEmbeddedImageProfileCheckBox->setChecked(prefsData->pdfPrefs.EmbeddedI);
478
        if ((prefsData->pdfPrefs.UseRGB) || (prefsData->pdfPrefs.isGrayscale))
479
        {
480
                //enableSolidsImagesWidgets(false);
481
                enableProfiles(0);
482
        }
483
        else
484
                enableProfiles(1);
485
        enablePG();
486
        enablePGI();
487
        QString tp(prefsData->pdfPrefs.SolidProf);
488
        if (!ScCore->InputProfiles.contains(tp))
489
        {
490
                if (m_doc != 0 && exportingPDF)
491
                        tp = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
492
                else
493
                        tp = defaultSolidColorRGBProfile;
494
        }
495
        ProfilesL::Iterator itp;
496
        ProfilesL::Iterator itpend=ScCore->InputProfiles.end();
497
        solidColorProfileComboBox->clear();
498
        for (itp = ScCore->InputProfiles.begin(); itp != itpend; ++itp)
499
        {
500
                solidColorProfileComboBox->addItem(itp.key());
501
                if (itp.key() == tp)
502
                        solidColorProfileComboBox->setCurrentIndex(solidColorProfileComboBox->count()-1);
503
        }
504
        int solidIntent = Opts.Intent;
505
        if (Opts.Intent < 0)
506
                solidIntent = 1;
507
        solidColorRenderingIntentComboBox->setCurrentIndex(solidIntent);
508
        QString tp1 = Opts.ImageProf;
509
        if (!ScCore->InputProfiles.contains(tp1))
510
        {
511
                if (m_doc != 0 && exportingPDF)
512
                        tp1 = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
513
                else
514
                        tp1 = defaultSolidColorRGBProfile;
515
        }
516
        ProfilesL::Iterator itp2;
517
        ProfilesL::Iterator itp2end=ScCore->InputProfiles.end();
518
        imageProfileComboBox->clear();
519
        for (itp2 = ScCore->InputProfiles.begin(); itp2 != itp2end; ++itp2)
520
        {
521
                imageProfileComboBox->addItem(itp2.key());
522
                if (itp2.key() == tp1)
523
                        imageProfileComboBox->setCurrentIndex(imageProfileComboBox->count()-1);
524
        }
525
        int imageIntent = Opts.Intent2;
526
        if (imageIntent < 0)
527
                imageIntent = 0;
528
        imageRenderingIntentComboBox->setCurrentIndex(imageIntent);
529
        if (!cmsUse)
530
        {
531
                //Disabling vis hiding
532
                //setSolidsImagesWidgetsShown(false);
533
                enableSolidsImagesWidgets(false);
534
        }
535
 
536
        ProfilesL::const_iterator itp3;
537
        QString tp3(Opts.PrintProf);
538
        if (!PDFXProfiles.contains(tp3))
539
        {
540
                if (m_doc != 0 && exportingPDF)
541
                        tp3 = m_doc->cmsSettings().DefaultPrinterProfile;
542
                else
543
                        tp3 = defaultPrinterProfile;
544
        }
545
        pdfx3OutputProfileComboBox->clear();
546
        for (itp3 = PDFXProfiles.constBegin(); itp3 != PDFXProfiles.constEnd(); ++itp3)
547
        {
548
                pdfx3OutputProfileComboBox->addItem(itp3.key());
549
                if (itp3.key() == tp3)
550
                        pdfx3OutputProfileComboBox->setCurrentIndex(pdfx3OutputProfileComboBox->count()-1);
551
        }
552
 
553
        if (!Opts.Info.isEmpty())
554
                pdfx3InfoStringLineEdit->setText(Opts.Info);
555
        else
556
        {
557
                if (m_doc != 0 && exporting)
558
                {
559
                        QFileInfo fi(m_doc->DocName);
560
                        pdfx3InfoStringLineEdit->setText(fi.fileName());
561
                }
562
                else
563
                        pdfx3InfoStringLineEdit->setText( tr("InfoString"));
564
        }
565
 
566
        if (m_doc != 0 && exportingPDF)
567
        {
568
                useDocumentBleedsCheckBox->setChecked(Opts.useDocBleeds);
569
                doDocBleeds();
570
        }
571
        else
572
                useDocumentBleedsCheckBox->hide();
573
 
574
        markLengthSpinBox->setValue(prefsData->pdfPrefs.markLength*unitRatio);
575
        markOffsetSpinBox->setValue(prefsData->pdfPrefs.markOffset*unitRatio);
576
        printCropMarksCheckBox->setChecked(prefsData->pdfPrefs.cropMarks);
577
        printBleedMarksCheckBox->setChecked(prefsData->pdfPrefs.bleedMarks);
578
        printRegistrationMarksCheckBox->setChecked(prefsData->pdfPrefs.registrationMarks);
579
        printColorBarsCheckBox->setChecked(prefsData->pdfPrefs.colorMarks);
580
        printPageInfoCheckBox->setChecked(prefsData->pdfPrefs.docInfoMarks);
581
        if (!cmsUse)
582
                enablePDFXWidgets(false);
583
        if (cmsUse && (Opts.Version == PDFOptions::PDFVersion_X1a) && (!PDFXProfiles.isEmpty()))
584
                enablePDFX(3);
585
        else if (cmsUse && (Opts.Version == PDFOptions::PDFVersion_X3) && (!PDFXProfiles.isEmpty()))
586
                enablePDFX(4);
587
        else if (cmsUse && (Opts.Version == PDFOptions::PDFVersion_X4) && (!PDFXProfiles.isEmpty()))
588
                enablePDFX(5);
589
        else
590
                enablePDFXWidgets(false);
591
 
592
        if (m_doc != 0  && exportingPDF)
593
        {
594
                effectTypeComboBox->clear();
595
                effectTypeComboBox->addItem( tr("No Effect"));
596
                effectTypeComboBox->addItem( tr("Blinds"));
597
                effectTypeComboBox->addItem( tr("Box"));
598
                effectTypeComboBox->addItem( tr("Dissolve"));
599
                effectTypeComboBox->addItem( tr("Glitter"));
600
                effectTypeComboBox->addItem( tr("Split"));
601
                effectTypeComboBox->addItem( tr("Wipe"));
602
                if (Opts.Version == PDFOptions::PDFVersion_15)
603
                {
604
                        effectTypeComboBox->addItem( tr("Push"));
605
                        effectTypeComboBox->addItem( tr("Cover"));
606
                        effectTypeComboBox->addItem( tr("Uncover"));
607
                        effectTypeComboBox->addItem( tr("Fade"));
608
                }
609
                effectsPageListWidget->setCurrentRow(0);
610
                SetEffOpts(0);
611
                effectsPageListWidget->setEnabled(false);
612
                enableEffects(false);
613
                showPagePreviewsCheckBox->setEnabled(false);
614
                if (enabledEffectsCheckBox->isChecked())
615
                {
616
                        displayDurationSpinBox->setValue(EffVal[0].pageViewDuration);
617
                        effectDurationSpinBox->setValue(EffVal[0].pageEffectDuration);
618
                        effectTypeComboBox->setCurrentIndex(EffVal[0].effectType);
619
                        effectMovingDirectionComboBox->setCurrentIndex(EffVal[0].Dm);
620
                        effectInOutComboBox->setCurrentIndex(EffVal[0].M);
621
                        effectDirectionComboBox->setCurrentIndex(EffVal[0].Di);
622
                        SetEffOpts(effectTypeComboBox->currentIndex());
623
                }
624
                /* Using margin widget, is this necessary?
625
                if (m_doc->currentPageLayout != 0)
626
                {
627
                        BleedTxt3->setText( tr( "Inside:" ) );
628
                        BleedTxt4->setText( tr( "Outside:" ) );
629
                }
630
                */
631
        }
632
 
633
        if (m_doc != 0 && exportingPDF)
634
        {
20122 jghali 635
                connect(embedAllButton, SIGNAL(clicked()), this, SLOT(EmbedAll()));
636
                connect(embeddedFontsListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelEFont(QListWidgetItem*)));
637
                connect(subsetAllButton, SIGNAL(clicked()), this, SLOT(SubsetAll()));
638
                connect(subsettedFontsListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelSFont(QListWidgetItem*)));
639
                connect(toSubsetButton, SIGNAL(clicked()), this, SLOT(PutToSubset()));
640
                connect(fromSubsetButton, SIGNAL(clicked()), this, SLOT(RemoveSubset()));
19828 jghali 641
                connect(showPagePreviewsCheckBox, SIGNAL(clicked()), this, SLOT(PagePr()));
642
                connect(effectsPageListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(SetPgEff()));
643
                connect(effectTypeComboBox, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
644
                connect(effectDirectionComboBox, SIGNAL(activated(int)), this, SLOT(ValidDI(int)));
645
                connect(enabledEffectsCheckBox, SIGNAL(clicked()), this, SLOT(DoEffects()));
646
                connect(applyEffectToAllPagesPushButton, SIGNAL(clicked()), this, SLOT(EffectOnAll()));
647
//              connect(pdfx3InfoStringLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkInfo()));
648
//              connect(pdfx3InfoStringLineEdit, SIGNAL(editingFinished()), this, SLOT(checkInfo()));
649
                connect(useDocumentBleedsCheckBox, SIGNAL(clicked()), this, SLOT(doDocBleeds()));
650
 
20122 jghali 651
                embedAllButton->setToolTip( "<qt>" + tr( "Embed fonts into the PDF. Embedding the fonts will preserve the layout and appearance of your document." ) + "</qt>");
19828 jghali 652
                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>");
653
                showPagePreviewsCheckBox->setToolTip( "<qt>" + tr( "Show page previews of each page listed above." ) + "</qt>");
654
                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>" );
655
                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 656
                effectTypeComboBox->setToolTip( "<qt>" + tr( "Type of the display effect" ) + "</qt>" );
657
                effectMovingDirectionComboBox->setToolTip( "<qt>" + tr( "Direction of the effect of moving lines for the split and blind effects" ) + "</qt>" );
658
                effectInOutComboBox->setToolTip( "<qt>" + tr( "Starting position for the box and split effects" ) + "</qt>" );
659
                effectDirectionComboBox->setToolTip( "<qt>" + tr( "Direction of the glitter or wipe effects" ) + "</qt>" );
660
                applyEffectToAllPagesPushButton->setToolTip( "<qt>" + tr( "Apply the selected effect to all pages" ) + "</qt>" );
20286 craig 661
                subsetAllButton->setToolTip( "<qt>" + tr("Embed only subset fonts with glyphs used in the document into the PDF") + "</qt>");
19828 jghali 662
                singlePageRadioButton->setToolTip( "<qt>" + tr( "Show the document in single page mode" ) + "</qt>" );
663
                continuousPagesRadioButton->setToolTip( "<qt>" + tr( "Show the document in single page mode with the pages displayed continuously end to end like a scroll" ) + "</qt>" );
664
                doublePageLeftRadioButton->setToolTip( "<qt>" + tr( "Show the document with facing pages, starting with the first page displayed on the left" ) + "</qt>" );
665
                doublePageRightRadioButton->setToolTip( "<qt>" + tr( "Show the document with facing pages, starting with the first page displayed on the right" ) + "</qt>" );
666
                useViewerDefaultsRadioButton->setToolTip( "<qt>" + tr( "Use the viewer's defaults or the user's preferences if set differently from the viewer defaults" ) + "</qt>" );
667
                useFullScreenRadioButton->setToolTip( "<qt>" + tr( "Enables viewing the document in full screen" ) + "</qt>" );
668
                useBookmarksRadioButton->setToolTip( "<qt>" + tr( "Display the bookmarks upon opening" ) + "</qt>" );
669
                useThumbnailsRadioButton->setToolTip( "<qt>" + tr( "Display the page thumbnails upon opening" ) + "</qt>" );
670
                useLayersRadioButton->setToolTip( "<qt>" + tr( "Forces the displaying of layers. Useful only for PDF 1.5+." ) + "</qt>" );
671
                hideViewerToolBarCheckBox->setToolTip( "<qt>" + tr( "Hides the Tool Bar which has selection and other editing capabilities" ) + "</qt>" );
20272 craig 672
                hideViewerMenuBarCheckBox->setToolTip( "<qt>" + tr( "Hides the Menu Bar for the viewer, the PDF will display in a plain window" ) + "</qt>" );
673
                fitViewerWindowCheckBox->setToolTip( "<qt>" + tr( "Fit the document page or pages to the available space in the viewer window" ) + "</qt>" );
19828 jghali 674
        }
675
}
676
 
677
 
678
void Prefs_PDFExport::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
679
{
680
        prefsData->pdfPrefs.Thumbnails = generateThumbnailsCheckBox->isChecked();
681
        prefsData->pdfPrefs.Compress = compressTextAndVectorGraphicsCheckBox->isChecked();
682
        prefsData->pdfPrefs.CompressMethod = (PDFOptions::PDFCompression) imageCompressionMethodComboBox->currentIndex();
683
        prefsData->pdfPrefs.Quality = imageCompressionQualityComboBox->currentIndex();
684
        prefsData->pdfPrefs.Resolution = epsExportResolutionSpinBox->value();
685
        prefsData->pdfPrefs.RecalcPic = maxResolutionLimitCheckBox->isChecked();
686
        prefsData->pdfPrefs.PicRes = maxExportResolutionSpinBox->value();
687
        prefsData->pdfPrefs.embedPDF = embedPDFAndEPSFilesCheckBox->isChecked();
688
        prefsData->pdfPrefs.Bookmarks = includeBookmarksCheckBox->isChecked();
689
        prefsData->pdfPrefs.Binding = pageBindingComboBox->currentIndex();
690
        prefsData->pdfPrefs.MirrorH = pageMirrorHorizontalToolButton->isChecked();
691
        prefsData->pdfPrefs.MirrorV = pageMirrorVerticalToolButton->isChecked();
692
        prefsData->pdfPrefs.RotateDeg = rotationComboBox->currentIndex() * 90;
693
        prefsData->pdfPrefs.Articles = saveLinkedTextFramesAsArticlesCheckBox->isChecked();
20122 jghali 694
        prefsData->pdfPrefs.FontEmbedding = (PDFOptions::PDFFontEmbedding) fontEmbeddingCombo->currentIndex();
19828 jghali 695
        prefsData->pdfPrefs.Encrypt = useEncryptionCheckBox->isChecked();
696
        prefsData->pdfPrefs.UseLPI = useCustomRenderingCheckBox->isChecked();
697
        prefsData->pdfPrefs.UseSpotColors = !convertSpotsToProcessCheckBox->isChecked();
698
        prefsData->pdfPrefs.doMultiFile = false;
699
        prefsData->pdfPrefs.cropMarks  = printCropMarksCheckBox->isChecked();
700
        prefsData->pdfPrefs.bleedMarks = printBleedMarksCheckBox->isChecked();
701
        prefsData->pdfPrefs.registrationMarks = printRegistrationMarksCheckBox->isChecked();
702
        prefsData->pdfPrefs.colorMarks = printColorBarsCheckBox->isChecked();
703
        prefsData->pdfPrefs.docInfoMarks = printPageInfoCheckBox->isChecked();
704
        prefsData->pdfPrefs.markLength   = markLengthSpinBox->value() / unitRatio;
705
        prefsData->pdfPrefs.markOffset   = markOffsetSpinBox->value() / unitRatio;
706
        prefsData->pdfPrefs.useDocBleeds = useDocumentBleedsCheckBox->isChecked();
707
        prefsData->pdfPrefs.bleeds = bleedsWidget->margins();
708
        prefsData->pdfPrefs.doClip = clipToPrinterMarginsCheckBox->isChecked();
709
        if (useEncryptionCheckBox->isChecked())
710
        {
711
                int Perm = -64;
712
                if (pdfVersionComboBox->currentIndex() == 1)
713
                        Perm &= ~0x00240000;
714
                if (allowPrintingCheckBox->isChecked())
715
                        Perm += 4;
716
                if (allowChangingCheckBox->isChecked())
717
                        Perm += 8;
718
                if (allowCopyingCheckBox->isChecked())
719
                        Perm += 16;
720
                if (allowAnnotatingCheckBox->isChecked())
721
                        Perm += 32;
722
                prefsData->pdfPrefs.Permissions = Perm;
723
                prefsData->pdfPrefs.PassOwner = passwordOwnerLineEdit->text();
724
                prefsData->pdfPrefs.PassUser = passwordUserLineEdit->text();
725
        }
726
        if (pdfVersionComboBox->currentIndex() == 0)
727
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_13;
728
        if (pdfVersionComboBox->currentIndex() == 1)
729
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_14;
730
        if (pdfVersionComboBox->currentIndex() == 2)
731
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_15;
732
        if (pdfVersionComboBox->currentIndex() == 3)
733
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_X1a;
734
        if (pdfVersionComboBox->currentIndex() == 4)
735
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_X3;
736
        if (pdfVersionComboBox->currentIndex() == 5)
737
                prefsData->pdfPrefs.Version = PDFOptions::PDFVersion_X4;
738
        if (outputIntentionComboBox->currentIndex() == 0)
739
        {
740
                prefsData->pdfPrefs.isGrayscale = false;
741
                prefsData->pdfPrefs.UseRGB = true;
742
                prefsData->pdfPrefs.UseProfiles = false;
743
                prefsData->pdfPrefs.UseProfiles2 = false;
744
        }
745
        else
746
        {
747
                if (outputIntentionComboBox->currentIndex() == 2)
748
                {
749
                        prefsData->pdfPrefs.isGrayscale = true;
750
                        prefsData->pdfPrefs.UseRGB = false;
751
                        prefsData->pdfPrefs.UseProfiles = false;
752
                        prefsData->pdfPrefs.UseProfiles2 = false;
753
                }
754
                else
755
                {
756
                        prefsData->pdfPrefs.isGrayscale = false;
757
                        prefsData->pdfPrefs.UseRGB = false;
758
                        if (/*CMSuse*/ ScCore->haveCMS())
759
                        {
760
                                prefsData->pdfPrefs.UseProfiles = useSolidColorProfileCheckBox->isChecked();
761
                                prefsData->pdfPrefs.UseProfiles2 = useImageProfileCheckBox->isChecked();
762
                                prefsData->pdfPrefs.Intent = solidColorRenderingIntentComboBox->currentIndex();
763
                                prefsData->pdfPrefs.Intent2 = imageRenderingIntentComboBox->currentIndex();
764
                                prefsData->pdfPrefs.EmbeddedI = doNotUseEmbeddedImageProfileCheckBox->isChecked();
765
                                prefsData->pdfPrefs.SolidProf = solidColorProfileComboBox->currentText();
766
                                prefsData->pdfPrefs.ImageProf = imageProfileComboBox->currentText();
767
                                prefsData->pdfPrefs.PrintProf = pdfx3OutputProfileComboBox->currentText();
768
                        }
769
                }
770
        }
771
}
772
 
773
 
774
void Prefs_PDFExport::SelLPIcol(int c)
775
{
776
        // XXX Optionen or Opts changed here
777
        Opts.LPISettings[SelLPIcolor].Frequency = customRenderingFrequencySpinBox->value();
778
        Opts.LPISettings[SelLPIcolor].Angle = customRenderingAngleSpinBox->value();
779
        Opts.LPISettings[SelLPIcolor].SpotFunc = customRenderingSpotFunctionComboBox->currentIndex();
780
        customRenderingFrequencySpinBox->setValue(Opts.LPISettings[customRenderingColorComboBox->itemText(c)].Frequency);
781
        customRenderingAngleSpinBox->setValue(Opts.LPISettings[customRenderingColorComboBox->itemText(c)].Angle);
782
        customRenderingSpotFunctionComboBox->setCurrentIndex(Opts.LPISettings[customRenderingColorComboBox->itemText(c)].SpotFunc);
783
        SelLPIcolor = customRenderingColorComboBox->itemText(c);
784
}
785
 
786
void Prefs_PDFExport::enableRangeControls(bool enabled)
787
{
788
        exportPageListLineEdit->setEnabled( enabled );
789
        exportRangeMorePushButton->setEnabled( enabled );
790
        if (enabled == false)
791
                includeBookmarksCheckBox->setChecked(false);
792
}
793
 
794
void Prefs_PDFExport::enableSecurityControls(bool enabled)
795
{
796
        passwordOwnerLineEdit->setEnabled(enabled);
797
        passwordUserLineEdit->setEnabled(enabled);
798
        allowPrintingCheckBox->setEnabled(enabled);
799
        allowChangingCheckBox->setEnabled(enabled);
800
        allowCopyingCheckBox->setEnabled(enabled);
801
        allowAnnotatingCheckBox->setEnabled(enabled);
802
}
803
 
804
 
805
void Prefs_PDFExport::enableCMS(bool enabled)
806
{
807
        cmsEnabled=enabled;
808
        addPDFVersions(enabled);
21147 jghali 809
        enableProfiles(outputIntentionComboBox->currentIndex());
19828 jghali 810
}
811
 
812
void Prefs_PDFExport::enablePDFExportTabs(bool enabled)
813
{
814
        if (!enabled)
815
        {
816
                tabWidget->removeTab(tabWidget->indexOf(tabFonts));//Fonts
817
                tabWidget->removeTab(tabWidget->indexOf(tabExtras));//Extras
818
                tabWidget->removeTab(tabWidget->indexOf(tabViewer));//Viewer
819
        }
820
}
821
 
822
void Prefs_PDFExport::createPageNumberRange()
823
{
824
        if (m_doc!=0)
825
        {
826
                CreateRange cr(exportPageListLineEdit->text(), m_doc->DocPages.count(), this);
827
                if (cr.exec())
828
                {
829
                        CreateRangeData crData;
830
                        cr.getCreateRangeData(crData);
831
                        exportPageListLineEdit->setText(crData.pageRange);
832
                        return;
833
                }
834
        }
835
        exportPageListLineEdit->setText(QString::null);
836
}
837
 
838
void Prefs_PDFExport::setMaximumResolution()
839
{
840
        if (maxResolutionLimitCheckBox->isChecked())
841
        {
842
                maxExportResolutionSpinBox->setEnabled(true);
843
                if (maxExportResolutionSpinBox->value() > epsExportResolutionSpinBox->value())
844
                        maxExportResolutionSpinBox->setValue(epsExportResolutionSpinBox->value());
845
        }
846
        else
847
                maxExportResolutionSpinBox->setEnabled(false);
848
}
849
 
850
void Prefs_PDFExport::enableProfiles(int i)
851
{
852
        enableLPI(i);
853
        bool setter = false;
854
        if (i == 1 && pdfVersionComboBox->currentIndex() != 3)
855
                setter = true;
856
        enableSolidsImagesWidgets(setter);
857
}
858
 
859
void Prefs_PDFExport::enableLPI(int i)
860
{
861
        if (i == 1)
862
        {
863
                QString tp(Opts.SolidProf);
864
                if (!ScCore->InputProfiles.contains(tp))
865
                {
866
                        if (m_doc != 0)
867
                                tp = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
868
                        else
869
                                tp = defaultSolidColorRGBProfile;
870
                }
871
                solidColorProfileComboBox->clear();
872
                ProfilesL::Iterator itp;
873
                ProfilesL::Iterator itpend=ScCore->InputProfiles.end();
874
                for (itp = ScCore->InputProfiles.begin(); itp != itpend; ++itp)
875
                {
876
                        solidColorProfileComboBox->addItem(itp.key());
877
                        if (itp.key() == tp)
878
                        {
879
                                if (cmsEnabled)
880
                                        solidColorProfileComboBox->setCurrentIndex(solidColorProfileComboBox->count()-1);
881
                        }
882
                }
883
                if (cmsEnabled)
884
                        solidColorRenderingIntentComboBox->setCurrentIndex(Opts.Intent);
885
                QString tp1 = Opts.ImageProf;
886
                if (!ScCore->InputProfiles.contains(tp1))
887
                {
888
                        if (m_doc != 0)
889
                                tp1 = m_doc->cmsSettings().DefaultSolidColorRGBProfile;
890
                        else
891
                                tp1 = defaultSolidColorRGBProfile;
892
                }
893
                imageProfileComboBox->clear();
894
                ProfilesL::Iterator itp2;
895
                ProfilesL::Iterator itp2end=ScCore->InputProfiles.end();
896
                for (itp2 = ScCore->InputProfiles.begin(); itp2 != itp2end; ++itp2)
897
                {
898
                        imageProfileComboBox->addItem(itp2.key());
899
                        if (itp2.key() == tp1)
900
                        {
901
                                if (cmsEnabled)
902
                                        imageProfileComboBox->setCurrentIndex(imageProfileComboBox->count()-1);
903
                        }
904
                }
905
                if (cmsEnabled)
906
                        imageRenderingIntentComboBox->setCurrentIndex(Opts.Intent2);
907
                //Disabling vs hiding
908
                enableSolidsImagesWidgets(cmsEnabled);
909
                convertSpotsToProcessCheckBox->setEnabled(true);
910
                if (m_doc!=0)
911
                {
912
                        useCustomRenderingCheckBox->setEnabled(true);
913
                        enableCustomRenderingWidgets(useCustomRenderingCheckBox->isChecked());
914
                }
915
        }
916
        else
917
        {
918
                convertSpotsToProcessCheckBox->setEnabled(false);
919
                useCustomRenderingCheckBox->setEnabled(false);
920
                enableCustomRenderingWidgets(false);
921
        }
922
}
923
 
924
 
925
void Prefs_PDFExport::enableLPI2()
926
{
927
        if (m_doc!=0)
928
                enableCustomRenderingWidgets(useCustomRenderingCheckBox->isChecked());
929
}
930
 
931
void Prefs_PDFExport::setCustomRenderingWidgetsShown(bool visible)
932
{
933
        useCustomRenderingCheckBox->setVisible(visible);
934
        customRenderingColorComboBox->setVisible(visible);
935
        customRenderingFrequencySpinBox->setVisible(visible);
936
        customRenderingAngleSpinBox->setVisible(visible);
937
        customRenderingSpotFunctionComboBox->setVisible(visible);
938
}
939
 
940
void Prefs_PDFExport::enableCustomRenderingWidgets(bool enabled)
941
{
942
        customRenderingColorComboBox->setEnabled(enabled);
943
        customRenderingFrequencySpinBox->setEnabled(enabled);
944
        customRenderingAngleSpinBox->setEnabled(enabled);
945
        customRenderingSpotFunctionComboBox->setEnabled(enabled);
946
}
947
 
948
void Prefs_PDFExport::setSolidsImagesWidgetsShown(bool visible)
949
{
950
        solidColorsLabel->setVisible(visible);
951
        solidColorsLine->setVisible(visible);
952
        useSolidColorProfileCheckBox->setVisible(visible);
953
        solidColorProfileComboBox->setVisible(visible);
954
        solidColorRenderingIntentComboBox->setVisible(visible);
955
        imagesLabel->setVisible(visible);
956
        imagesLine->setVisible(visible);
957
        useImageProfileCheckBox->setVisible(visible);
958
        doNotUseEmbeddedImageProfileCheckBox->setVisible(visible);
959
        imageProfileComboBox->setVisible(visible);
960
        imageRenderingIntentComboBox->setVisible(visible);
961
}
962
 
963
void Prefs_PDFExport::enableSolidsImagesWidgets(bool enabled)
964
{
965
        //if we want to show/hide instead
966
        //setSolidsImagesWidgetsShown(enabled);
21147 jghali 967
        bool enableSolidWidgets = false;
19828 jghali 968
        useSolidColorProfileCheckBox->setEnabled(enabled);
21147 jghali 969
        if (enabled)
970
                enableSolidWidgets = useSolidColorProfileCheckBox->isChecked();
971
        solidColorProfileComboBox->setEnabled(enableSolidWidgets);
972
        solidColorRenderingIntentComboBox->setEnabled(enableSolidWidgets);
973
 
974
        bool enableImageWidgets = false;
19828 jghali 975
        useImageProfileCheckBox->setEnabled(enabled);
21147 jghali 976
        if (enabled)
977
                enableImageWidgets = useImageProfileCheckBox->isChecked();
978
        doNotUseEmbeddedImageProfileCheckBox->setEnabled(enableImageWidgets);
979
        if (enableImageWidgets)
980
                enableImageWidgets = doNotUseEmbeddedImageProfileCheckBox->isChecked();
981
        imageProfileComboBox->setEnabled(enableImageWidgets);
982
        imageRenderingIntentComboBox->setEnabled(enableImageWidgets);
19828 jghali 983
}
984
 
985
void Prefs_PDFExport::enablePDFXWidgets(bool enabled)
986
{
987
        pdfx3OutputProfileComboBox->setEnabled(enabled);
988
        pdfx3InfoStringLineEdit->setEnabled(enabled);
989
}
990
 
991
 
992
void Prefs_PDFExport::enablePGI()
993
{
994
        bool setter=false;
995
        if (useImageProfileCheckBox->isChecked())
996
                setter = doNotUseEmbeddedImageProfileCheckBox->isChecked() ? true : false;
997
        imageProfileComboBox->setEnabled(setter);
998
        imageRenderingIntentComboBox->setEnabled(setter);
999
        doNotUseEmbeddedImageProfileCheckBox->setEnabled(useImageProfileCheckBox->isChecked());
1000
}
1001
 
1002
void Prefs_PDFExport::enablePGI2()
1003
{
1004
        bool setter = doNotUseEmbeddedImageProfileCheckBox->isChecked() ? true : false;
1005
        imageProfileComboBox->setEnabled(setter);
1006
        imageRenderingIntentComboBox->setEnabled(setter);
1007
}
1008
 
1009
void Prefs_PDFExport::enablePG()
1010
{
1011
        bool setter = useSolidColorProfileCheckBox->isChecked() ? true : false;
1012
 
1013
        solidColorProfileComboBox->setEnabled(setter);
1014
        solidColorRenderingIntentComboBox->setEnabled(setter);
1015
}
1016
 
1017
void Prefs_PDFExport::enablePDFX(int i)
1018
{
1019
        includeLayersCheckBox->setEnabled((i == 2) || (i == 5));
1020
        if (useLayersRadioButton)
1021
                useLayersRadioButton->setEnabled((i == 2) || (i == 5));
1022
        if (m_doc != 0 && exportingPDF)
1023
        {
1024
                int currentEff = effectTypeComboBox->currentIndex();
1025
                disconnect(effectTypeComboBox, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
1026
                effectTypeComboBox->clear();
1027
                effectTypeComboBox->addItem( tr("No Effect"));
1028
                effectTypeComboBox->addItem( tr("Blinds"));
1029
                effectTypeComboBox->addItem( tr("Box"));
1030
                effectTypeComboBox->addItem( tr("Dissolve"));
1031
                effectTypeComboBox->addItem( tr("Glitter"));
1032
                effectTypeComboBox->addItem( tr("Split"));
1033
                effectTypeComboBox->addItem( tr("Wipe"));
1034
                if (i == 2)
1035
                {
1036
                        effectTypeComboBox->addItem( tr("Push"));
1037
                        effectTypeComboBox->addItem( tr("Cover"));
1038
                        effectTypeComboBox->addItem( tr("Uncover"));
1039
                        effectTypeComboBox->addItem( tr("Fade"));
1040
                        effectTypeComboBox->setCurrentIndex(currentEff);
1041
                }
1042
                else
1043
                {
1044
                        if (currentEff > 6)
1045
                        {
1046
                                currentEff = 0;
1047
                                effectTypeComboBox->setCurrentIndex(0);
1048
                                SetEffOpts(0);
1049
                                for (int pg = 0; pg<m_doc->Pages->count(); ++pg)
1050
                                {
1051
                                        if (EffVal[pg].effectType > 6)
1052
                                                EffVal[pg].effectType = 0;
1053
                                }
1054
                        }
1055
                        else
1056
                                effectTypeComboBox->setCurrentIndex(currentEff);
1057
                }
1058
                connect(effectTypeComboBox, SIGNAL(activated(int)), this, SLOT(SetEffOpts(int)));
1059
        }
1060
 
1061
        if (i < 3)  // not PDF/X
1062
        {
20122 jghali 1063
                fontEmbeddingCombo->setEnabled(true);
19828 jghali 1064
                enablePDFXWidgets(false);
1065
                tabWidget->setTabEnabled(2, true);
1066
                outputIntentionComboBox->setEnabled(true);
1067
                useImageProfileCheckBox->setEnabled(true);
1068
                emit hasInfo();
1069
                if (m_doc != 0 && exportingPDF)
1070
                {
1071
                        enabledEffectsCheckBox->setEnabled(true);
20122 jghali 1072
                        embedAllButton->setEnabled(true);
19828 jghali 1073
                }
1074
 
1075
                return;
1076
        }
1077
        // PDF/X is selected
1078
        disconnect(outputIntentionComboBox, SIGNAL(activated(int)), this, SLOT(enableProfiles(int)));
1079
        outputIntentionComboBox->setCurrentIndex(1);
1080
        outputIntentionComboBox->setEnabled(false);
1081
        enableProfiles(1);
1082
        if ((i == 4) || (i == 5)) // X3 or X4, enforcing color profiles on images
1083
        {
1084
                useImageProfileCheckBox->setChecked(true);
1085
                useImageProfileCheckBox->setEnabled(false);
1086
        }
1087
        if (m_doc != 0 && exportingPDF)
1088
        {
1089
//              EmbedFonts->setChecked(true);
1090
                EmbedAll();
1091
                enabledEffectsCheckBox->setChecked(false);
1092
                enabledEffectsCheckBox->setEnabled(false);
1093
//              EmbedFonts->setEnabled(false);
1094
                if (pdfx3InfoStringLineEdit->text().isEmpty())
1095
                        emit noInfo();
1096
                else
1097
                        emit hasInfo();
1098
        }
20122 jghali 1099
 
1100
        fontEmbeddingCombo->setCurrentIndex(0);
1101
        fontEmbeddingCombo->setEnabled(false);
1102
 
1103
        embeddedFontsListWidget->setEnabled(true);
1104
        embedAllButton->setEnabled(true);
1105
        subsettedFontsListWidget->setEnabled(true);
1106
        subsetAllButton->setEnabled(true);
1107
        toSubsetButton->setEnabled(true);
1108
        fromSubsetButton->setEnabled(true);
1109
 
19828 jghali 1110
        enablePGI();
1111
        pdfx3OutputProfileComboBox->setEnabled(true);
1112
        pdfx3InfoStringLineEdit->setEnabled(true);
1113
        tabWidget->setTabEnabled(2, false);
1114
        connect(outputIntentionComboBox, SIGNAL(activated(int)), this, SLOT(enableProfiles(int)));
1115
}
1116
 
1117
void Prefs_PDFExport::addPDFVersions(bool addPDFXStrings)
1118
{
1119
        disconnect(pdfVersionComboBox, SIGNAL(activated(int)), this, SLOT(enablePDFX(int)));
1120
        int i = pdfVersionComboBox->currentIndex();
1121
        pdfVersionComboBox->clear();
1122
        pdfVersionComboBox->addItem("PDF 1.3 (Acrobat 4)");
1123
        pdfVersionComboBox->addItem("PDF 1.4 (Acrobat 5)");
1124
        pdfVersionComboBox->addItem("PDF 1.5 (Acrobat 6)");
1125
        if (addPDFXStrings)
1126
        {
1127
                pdfVersionComboBox->addItem("PDF/X-1a");
1128
                pdfVersionComboBox->addItem("PDF/X-3");
1129
                pdfVersionComboBox->addItem("PDF/X-4");
1130
        }
1131
        else
1132
                i=qMin(i,2);
1133
        pdfVersionComboBox->setCurrentIndex(i);
1134
        connect(pdfVersionComboBox, SIGNAL(activated(int)), this, SLOT(enablePDFX(int)));
1135
}
1136
 
1137
 
1138
void Prefs_PDFExport::enableEffects(bool enabled)
1139
{
1140
        effectsPageListWidget->setEnabled(enabled);
1141
        showPagePreviewsCheckBox->setEnabled(enabled);
1142
        displayDurationSpinBox->setEnabled(enabled);
1143
        effectDurationSpinBox->setEnabled(enabled);
1144
        effectTypeComboBox->setEnabled(enabled);
1145
        if (enabled)
1146
                SetEffOpts(effectTypeComboBox->currentIndex());
1147
        else
1148
        {
1149
                effectMovingDirectionComboBox->setEnabled(false);
1150
                effectInOutComboBox->setEnabled(false);
1151
                effectDirectionComboBox->setEnabled(false);
1152
                applyEffectToAllPagesPushButton->setEnabled(false);
1153
        }
1154
}
1155
 
20122 jghali 1156
void Prefs_PDFExport::EmbedAll()
20103 avox 1157
{
20122 jghali 1158
        embeddedFontsListWidget->clear();
1159
        subsettedFontsListWidget->clear();
1160
        toSubsetButton->setEnabled(false);
1161
        fromSubsetButton->setEnabled(false);
20103 avox 1162
 
20122 jghali 1163
        QStringList docFonts;
1164
        if (m_doc)
1165
                docFonts = m_doc->usedFonts().keys();
1166
 
1167
        for (int a=0; a < docFonts.count(); ++a)
19828 jghali 1168
        {
20122 jghali 1169
                QString fontName = docFonts.at(a);
1170
                if (!AllFonts[fontName].subset())
19828 jghali 1171
                {
20122 jghali 1172
                        QListWidgetItem* item = addFontItem(fontName, embeddedFontsListWidget);
19828 jghali 1173
                        if (AnnotationFonts.contains(item->text()))
20122 jghali 1174
                                item->setFlags(Qt::ItemIsEnabled);
19828 jghali 1175
                }
20122 jghali 1176
                else if (AnnotationFonts.contains(fontName))
1177
                {
1178
                        QListWidgetItem* item = addFontItem(fontName, embeddedFontsListWidget);
1179
                        item->setFlags(Qt::ItemIsEnabled);
1180
                }
19828 jghali 1181
                else
1182
                {
20122 jghali 1183
                        addFontItem(fontName, subsettedFontsListWidget);
19828 jghali 1184
                }
1185
        }
1186
}
1187
 
20122 jghali 1188
void Prefs_PDFExport::SubsetAll()
19828 jghali 1189
{
1190
        embeddedFontsListWidget->clear();
20122 jghali 1191
        subsettedFontsListWidget->clear();
1192
        toSubsetButton->setEnabled(false);
1193
        fromSubsetButton->setEnabled(false);
1194
 
1195
        QStringList docFonts;
1196
        if (m_doc)
1197
                docFonts = m_doc->usedFonts().keys();
1198
 
1199
        for (int a = 0; a < docFonts.count(); ++a)
19828 jghali 1200
        {
20122 jghali 1201
                QString fontName = docFonts.at(a);
1202
                if (AnnotationFonts.contains(fontName))
19828 jghali 1203
                {
20122 jghali 1204
                        QListWidgetItem* item = addFontItem(fontName, embeddedFontsListWidget);
1205
                        item->setFlags(Qt::ItemIsEnabled);
19828 jghali 1206
                }
1207
                else
1208
                {
20122 jghali 1209
                        addFontItem(fontName, subsettedFontsListWidget);
19828 jghali 1210
                }
1211
        }
1212
}
1213
 
20122 jghali 1214
void Prefs_PDFExport::OutlineAll()
1215
{
1216
        // Nothing to do at this point
1217
}
1218
 
19828 jghali 1219
void Prefs_PDFExport::doDocBleeds()
1220
{
1221
        if (useDocumentBleedsCheckBox->isChecked())
1222
        {
1223
                Opts.bleeds=bleedsWidget->margins();
1224
                bleedsWidget->setNewValues(m_doc->bleedsVal());
1225
                bleedsWidget->setEnabled(false);
1226
        }
1227
        else
1228
        {
1229
                bleedsWidget->setNewValues(Opts.bleeds);
1230
                bleedsWidget->setEnabled(true);
1231
        }
1232
}
1233
 
1234
 
1235
void Prefs_PDFExport::SetEffOpts(int nr)
1236
{
1237
        QStandardItem* si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(2));
1238
        if (si) si->setSelectable(false);
1239
        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(3));
1240
        if (si) si->setSelectable(false);
1241
        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(4));
1242
        if (si) si->setSelectable(false);
1243
        switch (nr)
1244
        {
1245
        case 0:
1246
        case 3:
1247
        case 10:
1248
                effectMovingDirectionComboBox->setEnabled(false);
1249
                effectInOutComboBox->setEnabled(false);
1250
                effectDirectionComboBox->setEnabled(false);
1251
                break;
1252
        case 1:
1253
                effectMovingDirectionComboBox->setEnabled(true);
1254
                effectInOutComboBox->setEnabled(false);
1255
                effectDirectionComboBox->setEnabled(false);
1256
                break;
1257
        case 2:
1258
                effectMovingDirectionComboBox->setEnabled(false);
1259
                effectInOutComboBox->setEnabled(true);
1260
                effectDirectionComboBox->setEnabled(false);
1261
                break;
1262
        case 4:
1263
        case 6:
1264
        case 7:
1265
        case 8:
1266
        case 9:
1267
                effectMovingDirectionComboBox->setEnabled(false);
1268
                effectInOutComboBox->setEnabled(false);
1269
                effectDirectionComboBox->setEnabled(true);
1270
                if (nr == 6)
1271
                {
1272
                        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(2));
1273
                        if (si) si->setSelectable(true);
1274
                        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(3));
1275
                        if (si) si->setSelectable(true);
1276
                }
1277
                else
1278
                {
1279
                        si = dynamic_cast<QStandardItem*>(effectDirectionComboBox->view()->children().at(4));
1280
                        if (si) si->setSelectable(true);
1281
                }
1282
                break;
1283
        case 5:
1284
                effectMovingDirectionComboBox->setEnabled(true);
1285
                effectInOutComboBox->setEnabled(true);
1286
                effectDirectionComboBox->setEnabled(false);
1287
                break;
1288
        }
1289
}
1290
 
1291
void Prefs_PDFExport::SelEFont(QListWidgetItem *c)
1292
{
1293
        if (c != NULL)
1294
        {
1295
                if (c->flags() & Qt::ItemIsSelectable)
20122 jghali 1296
                        toSubsetButton->setEnabled(true);
1297
                fromSubsetButton->setEnabled(false);
1298
                subsettedFontsListWidget->clearSelection();
19828 jghali 1299
        }
1300
}
1301
 
1302
void Prefs_PDFExport::SelSFont(QListWidgetItem *c)
1303
{
1304
        if (c != NULL)
1305
        {
1306
                if (pdfVersionComboBox->currentIndex() == 4)
1307
                {
1308
                        if ((AllFonts[c->text()].type() == ScFace::OTF) || (AllFonts[c->text()].subset()))
20122 jghali 1309
                                fromSubsetButton->setEnabled(false);
19828 jghali 1310
                        else
20122 jghali 1311
                                fromSubsetButton->setEnabled(true);
19828 jghali 1312
                }
1313
                else
20122 jghali 1314
                        fromSubsetButton->setEnabled(true);
1315
                toSubsetButton->setEnabled(false);
19828 jghali 1316
                embeddedFontsListWidget->clearSelection();
1317
        }
1318
}
1319
 
1320
void Prefs_PDFExport::PagePr()
1321
{
1322
        disconnect(effectsPageListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(SetPgEff()));
1323
        QString tmp;
1324
        QPixmap pm;
1325
        int ci = effectsPageListWidget->currentRow();
1326
        int pgMaxX = 0;
1327
        int pgMaxY = 0;
1328
        effectsPageListWidget->clear();
1329
        if (showPagePreviewsCheckBox->isChecked())
1330
        {
1331
                for (int pg = 0; pg < m_doc->Pages->count(); ++pg)
1332
                {
1333
                        pm=QPixmap::fromImage(m_doc->view()->PageToPixmap(pg, 70));
1334
                        pgMaxX = qMax(pgMaxX, pm.width());
1335
                        pgMaxY = qMax(pgMaxY, pm.height());
1336
                        new QListWidgetItem( pm, tr("Page")+" "+tmp.setNum(pg+1), effectsPageListWidget);
1337
                }
1338
                effectsPageListWidget->setIconSize(QSize(pgMaxX, pgMaxY));
1339
        }
1340
        else
1341
        {
1342
                for (int pg = 0; pg < m_doc->Pages->count(); ++pg)
1343
                {
1344
                        new QListWidgetItem( tr("Page")+" "+tmp.setNum(pg+1), effectsPageListWidget);
1345
                }
1346
        }
1347
        if (ci != -1)
1348
                effectsPageListWidget->setCurrentRow(ci);
1349
        else
1350
                effectsPageListWidget->clearSelection();
1351
        connect(effectsPageListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(SetPgEff()));
1352
}
1353
 
1354
void Prefs_PDFExport::DoDownsample()
1355
{
1356
        if (maxResolutionLimitCheckBox->isChecked())
1357
        {
1358
                maxExportResolutionSpinBox->setEnabled(true);
1359
                if (maxExportResolutionSpinBox->value() > epsExportResolutionSpinBox->value())
1360
                        maxExportResolutionSpinBox->setValue(epsExportResolutionSpinBox->value());
1361
        }
1362
        else
1363
                maxExportResolutionSpinBox->setEnabled(false);
1364
}
1365
 
20122 jghali 1366
void Prefs_PDFExport::EmbeddingModeChange()
19828 jghali 1367
{
20122 jghali 1368
        PDFOptions::PDFFontEmbedding embeddingMode = fontEmbeddingMode();
1369
 
1370
        embeddedFontsListWidget->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1371
        embedAllButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1372
        subsettedFontsListWidget->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1373
        subsetAllButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1374
        toSubsetButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
1375
        fromSubsetButton->setEnabled(embeddingMode == PDFOptions::EmbedFonts);
19828 jghali 1376
}
1377
 
20122 jghali 1378
void Prefs_PDFExport::RemoveSubset()
19828 jghali 1379
{
20122 jghali 1380
        QString currentFont = subsettedFontsListWidget->currentItem()->text();
1381
        const ScFace fontFace = AllFonts[currentFont];
1382
        if ((fontFace.type() != ScFace::OTF) && (!fontFace.subset()))
19828 jghali 1383
        {
20122 jghali 1384
                embeddedFontsListWidget->addItem(currentFont);
1385
                delete subsettedFontsListWidget->takeItem(subsettedFontsListWidget->currentRow());
19828 jghali 1386
        }
20122 jghali 1387
        subsettedFontsListWidget->clearSelection();
1388
        if (subsettedFontsListWidget->count() == 0)
1389
                fromSubsetButton->setEnabled(false);
19828 jghali 1390
}
1391
 
20122 jghali 1392
void Prefs_PDFExport::PutToSubset()
19828 jghali 1393
{
1394
        QString currentFont = embeddedFontsListWidget->currentItem()->text();
20122 jghali 1395
        if (subsettedFontsListWidget->count() != 0)
19828 jghali 1396
        {
20122 jghali 1397
                if (subsettedFontsListWidget->findItems(currentFont, Qt::MatchExactly).count() == 0)
1398
                        addFontItem(currentFont, subsettedFontsListWidget);
19828 jghali 1399
        }
1400
        else
1401
        {
20122 jghali 1402
                addFontItem(currentFont, subsettedFontsListWidget);
19828 jghali 1403
        }
1404
        delete embeddedFontsListWidget->takeItem(embeddedFontsListWidget->currentRow());
1405
        embeddedFontsListWidget->clearSelection();
1406
        if (embeddedFontsListWidget->count() == 0)
1407
        {
20122 jghali 1408
                toSubsetButton->setEnabled(false);
19828 jghali 1409
        }
20122 jghali 1410
        else if (!(embeddedFontsListWidget->currentItem()->flags() & Qt::ItemIsSelectable))
19828 jghali 1411
        {
20122 jghali 1412
                toSubsetButton->setEnabled(false);
19828 jghali 1413
        }
1414
}