Changeset View
Changeset View
Standalone View
Standalone View
generators/poppler/generator_pdf.cpp
Show All 38 Lines | |||||
39 | #include <KLocalizedString> | 39 | #include <KLocalizedString> | ||
40 | #include <kmessagebox.h> | 40 | #include <kmessagebox.h> | ||
41 | 41 | | |||
42 | #include <core/action.h> | 42 | #include <core/action.h> | ||
43 | #include <core/page.h> | 43 | #include <core/page.h> | ||
44 | #include <core/annotations.h> | 44 | #include <core/annotations.h> | ||
45 | #include <core/movie.h> | 45 | #include <core/movie.h> | ||
46 | #include <core/pagetransition.h> | 46 | #include <core/pagetransition.h> | ||
47 | #include <core/printoptionswidget.h> | ||||
47 | #include <core/sound.h> | 48 | #include <core/sound.h> | ||
48 | #include <core/sourcereference.h> | 49 | #include <core/sourcereference.h> | ||
49 | #include <core/textpage.h> | 50 | #include <core/textpage.h> | ||
50 | #include <core/fileprinter.h> | 51 | #include <core/fileprinter.h> | ||
51 | #include <core/utils.h> | 52 | #include <core/utils.h> | ||
52 | 53 | | |||
53 | #include "ui_pdfsettingswidget.h" | 54 | #include "ui_pdfsettingswidget.h" | ||
54 | #include "pdfsettings.h" | 55 | #include "pdfsettings.h" | ||
Show All 16 Lines | |||||
71 | Q_DECLARE_METATYPE(const Poppler::LinkRendition*) | 72 | Q_DECLARE_METATYPE(const Poppler::LinkRendition*) | ||
72 | #ifdef HAVE_POPPLER_0_50 | 73 | #ifdef HAVE_POPPLER_0_50 | ||
73 | Q_DECLARE_METATYPE(const Poppler::LinkOCGState*) | 74 | Q_DECLARE_METATYPE(const Poppler::LinkOCGState*) | ||
74 | #endif | 75 | #endif | ||
75 | 76 | | |||
76 | static const int defaultPageWidth = 595; | 77 | static const int defaultPageWidth = 595; | ||
77 | static const int defaultPageHeight = 842; | 78 | static const int defaultPageHeight = 842; | ||
78 | 79 | | |||
79 | class PDFOptionsPage : public QWidget | 80 | class PDFOptionsPage : public Okular::PrintOptionsWidget | ||
80 | { | 81 | { | ||
81 | Q_OBJECT | 82 | Q_OBJECT | ||
82 | public slots: | 83 | public slots: | ||
83 | void enableOrDisableScaleMode() | 84 | void enableOrDisableScaleMode() | ||
84 | { | 85 | { | ||
85 | m_scaleMode->setEnabled ( m_forceRaster->isChecked() ); | 86 | m_scaleMode->setEnabled ( m_forceRaster->isChecked() ); | ||
86 | 87 | | |||
87 | if ( m_forceRaster->isChecked() ) { | 88 | if ( m_forceRaster->isChecked() ) { | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 104 | { | |||
132 | connect( m_forceRaster, &QCheckBox::stateChanged, this, &PDFOptionsPage::enableOrDisableScaleMode ); | 133 | connect( m_forceRaster, &QCheckBox::stateChanged, this, &PDFOptionsPage::enableOrDisableScaleMode ); | ||
133 | 134 | | |||
134 | #if defined(Q_OS_WIN) && !defined HAVE_POPPLER_0_60 | 135 | #if defined(Q_OS_WIN) && !defined HAVE_POPPLER_0_60 | ||
135 | m_printAnnots->setVisible( false ); | 136 | m_printAnnots->setVisible( false ); | ||
136 | #endif | 137 | #endif | ||
137 | setPrintAnnots( true ); // Default value | 138 | setPrintAnnots( true ); // Default value | ||
138 | } | 139 | } | ||
139 | 140 | | |||
141 | bool ignorePrintMargins() const override { | ||||
aacid: remove the virtual | |||||
142 | return scaleMode() == FitToPage; | ||||
143 | } | ||||
144 | | ||||
140 | bool printAnnots() | 145 | bool printAnnots() | ||
141 | { | 146 | { | ||
142 | return m_printAnnots->isChecked(); | 147 | return m_printAnnots->isChecked(); | ||
143 | } | 148 | } | ||
144 | 149 | | |||
145 | void setPrintAnnots( bool printAnnots ) | 150 | void setPrintAnnots( bool printAnnots ) | ||
146 | { | 151 | { | ||
147 | m_printAnnots->setChecked( printAnnots ); | 152 | m_printAnnots->setChecked( printAnnots ); | ||
▲ Show 20 Lines • Show All 1213 Lines • ▼ Show 20 Line(s) | 1364 | #ifdef HAVE_POPPLER_0_60 | |||
1361 | { | 1366 | { | ||
1362 | pdfdoc->setRenderHint(Poppler::Document::HideAnnotations, !printAnnots); | 1367 | pdfdoc->setRenderHint(Poppler::Document::HideAnnotations, !printAnnots); | ||
1363 | #else | 1368 | #else | ||
1364 | if ( forceRasterize && printAnnots) | 1369 | if ( forceRasterize && printAnnots) | ||
1365 | { | 1370 | { | ||
1366 | #endif | 1371 | #endif | ||
1367 | 1372 | | |||
1368 | // If requested, scale to full page instead of the printable area | 1373 | // If requested, scale to full page instead of the printable area | ||
1369 | if ( scaleMode == PDFOptionsPage::FitToPage ) | 1374 | printer.setFullPage( pdfOptionsPage->ignorePrintMargins() ); | ||
1370 | printer.setFullPage( true ); | | |||
1371 | 1375 | | |||
1372 | QPainter painter; | 1376 | QPainter painter; | ||
1373 | painter.begin(&printer); | 1377 | painter.begin(&printer); | ||
1374 | 1378 | | |||
1375 | QList<int> pageList = Okular::FilePrinter::pageList( printer, pdfdoc->numPages(), | 1379 | QList<int> pageList = Okular::FilePrinter::pageList( printer, pdfdoc->numPages(), | ||
1376 | document()->currentPage() + 1, | 1380 | document()->currentPage() + 1, | ||
1377 | document()->bookmarkedPageList() ); | 1381 | document()->bookmarkedPageList() ); | ||
1378 | for ( int i = 0; i < pageList.count(); ++i ) | 1382 | for ( int i = 0; i < pageList.count(); ++i ) | ||
▲ Show 20 Lines • Show All 609 Lines • ▼ Show 20 Line(s) | 1991 | if ( !okularFormFields.isEmpty() ) | |||
1988 | page->setFormFields( okularFormFields ); | 1992 | page->setFormFields( okularFormFields ); | ||
1989 | } | 1993 | } | ||
1990 | 1994 | | |||
1991 | PDFGenerator::PrintError PDFGenerator::printError() const | 1995 | PDFGenerator::PrintError PDFGenerator::printError() const | ||
1992 | { | 1996 | { | ||
1993 | return lastPrintError; | 1997 | return lastPrintError; | ||
1994 | } | 1998 | } | ||
1995 | 1999 | | |||
1996 | QWidget* PDFGenerator::printConfigurationWidget() const | 2000 | Okular::PrintOptionsWidget* PDFGenerator::printConfigurationWidget() const | ||
1997 | { | 2001 | { | ||
1998 | if ( !pdfOptionsPage ) | 2002 | if ( !pdfOptionsPage ) | ||
1999 | { | 2003 | { | ||
2000 | const_cast<PDFGenerator*>(this)->pdfOptionsPage = new PDFOptionsPage(); | 2004 | const_cast<PDFGenerator*>(this)->pdfOptionsPage = new PDFOptionsPage(); | ||
2001 | } | 2005 | } | ||
2002 | return pdfOptionsPage; | 2006 | return pdfOptionsPage; | ||
2003 | } | 2007 | } | ||
2004 | 2008 | | |||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |
remove the virtual