00001
00002
00003
00004
00005
00006
00007 #include "ImportCroppingUtilPdf.h"
00008 #include "poppler-qt5.h"
00009 #include <QApplication>
00010
00011 using namespace Poppler;
00012
00013 ImportCroppingUtilPdf::ImportCroppingUtilPdf()
00014 {
00015 }
00016
00017 bool ImportCroppingUtilPdf::applyImportCropping (bool isErrorReportRegressionTest,
00018 const QString &fileName,
00019 ImportCropping importCropping,
00020 Document *&document) const
00021 {
00022 document = 0;
00023
00024 bool cropping = false;
00025
00026 if (!isErrorReportRegressionTest) {
00027
00028
00029 if (fileName.right (4).toLower () == ".pdf") {
00030
00031
00032 QApplication::setOverrideCursor (Qt::BusyCursor);
00033 document = Document::load (fileName);
00034 QApplication::restoreOverrideCursor();
00035 if (document != 0) {
00036 if (!document->isLocked ()) {
00037
00038 cropping = (importCropping == IMPORT_CROPPING_ALWAYS ||
00039 (importCropping == IMPORT_CROPPING_MULTIPAGE_PDFS && document->numPages () > 1));
00040 }
00041 }
00042 }
00043 }
00044
00045 return cropping;
00046 }