1 /* 2 For general Scribus (>=1.3.2) copyright and licensing information please refer 3 to the COPYING file provided with the program. Following this notice may exist 4 a copyright and/or license notice that predates the release of Scribus 1.3.2 5 for which a new license (GPL+exception) is in place. 6 */ 7 #ifndef OUTPUTPREVIEW_PDF_H 8 #define OUTPUTPREVIEW_PDF_H 9 10 #include <QMap> 11 12 #include "pdfoptions.h" 13 #include "pdfversion.h" 14 #include "outputpreviewbase.h" 15 16 class QCheckBox; 17 18 class PrefsManager; 19 class ScribusDoc; 20 namespace Ui { class OutputPreview_PDF; } 21 22 class OutputPreview_PDF : public OutputPreviewBase 23 { 24 Q_OBJECT 25 26 public: 27 OutputPreview_PDF(QWidget* parent, ScribusDoc* doc); 28 ~OutputPreview_PDF(); 29 30 /** 31 * @brief Delete temporary files generated during execution of the dialog 32 */ 33 void cleanupTemporaryFiles() override; 34 35 /** 36 * @brief Creates the Preview of the Actual Page 37 * @param pageIndex int page number 38 * @param res int resolution 39 * @retval pixmap QPixmap print preview 40 */ 41 QPixmap createPreview(int pageIndex, int res) override; 42 43 bool isCMYKPreviewEnabled() const ; 44 bool isAntialiasingEnabled() const; 45 bool isTransparencyEnabled() const; 46 bool isInkChannelVisible(const QString& ink); 47 bool isInkCoverageEnabled() const; 48 double inkCoverageThreshold() const; 49 50 protected: 51 bool m_havePngAlpha { false }; 52 bool m_haveTiffSep { false }; 53 int m_gsVersion { 0 }; 54 55 // PDF export options 56 PDFVersion m_pdfVersion; 57 int m_pdfOutputMode { 0 }; 58 bool m_cmykPreviewMode { false }; 59 bool m_mirrorH { false }; 60 bool m_mirrorV { false }; 61 bool m_clipToMargins { false }; 62 bool m_convertSpots { false }; 63 64 bool m_fontEmbeddingWasSet { false }; 65 PDFOptions m_pdfOptions; 66 67 // Preview display options 68 int m_scaleMode { 1 }; 69 int m_inkMax { 1020 }; // 4 * 255 70 bool m_useAntialiasing { false }; 71 bool m_showTransparency { false }; 72 73 Ui::OutputPreview_PDF* m_optionsUi { nullptr }; 74 QMap<QString, int> m_sepsToFileNum; 75 QMap<QString, QCheckBox*> m_inkVisibilities; 76 QString m_tempBaseName; // Base name for temporary files 77 78 PrefsManager& m_prefsManager; 79 80 int renderPreview(int pageIndex, int res); 81 int renderPreviewSep(int pageIndex, int res); 82 83 bool createPreviewFile(int pageIndex); 84 void setupFontEmbedding(PDFOptions& options); 85 86 bool optionsHaveChanged(int pageIndex) const; 87 bool pdfOptionsHaveChanged(int pageIndex) const; 88 void setPDFOptionsToOptions(PDFOptions& options); 89 void setPDFOptionsToUi(PDFOptions& options); 90 void setUiOptionsToPDFOptions(PDFOptions& options); 91 void updateOptionsFromUI(); 92 93 void imageLoadError(QPixmap &pixmap); 94 95 protected slots: 96 void onPdfVersionChanged(int index); 97 void onPdfOutputModeChanged(int index); 98 void onInkTableCellDoubleClicked(int row); 99 void toggleAllFromHeader(); 100 void toggleCMYK(); 101 void toggleCMYK_Colour(); 102 }; 103 104 #endif 105