r24985 by jghali - Enforce poppler version >= 0.86.0

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 2 22:48:30 UTC 2022


Author: jghali
Date: Wed Mar  2 22:48:29 2022
New Revision: 24985

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24985
Log:
Enforce poppler version >= 0.86.0

Modified:
    trunk/Scribus/cmake/modules/Findpoppler.cmake
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h

Modified: trunk/Scribus/cmake/modules/Findpoppler.cmake
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24985&path=/trunk/Scribus/cmake/modules/Findpoppler.cmake
==============================================================================
--- trunk/Scribus/cmake/modules/Findpoppler.cmake	(original)
+++ trunk/Scribus/cmake/modules/Findpoppler.cmake	Wed Mar  2 22:48:29 2022
@@ -1,8 +1,8 @@
 #include(FindPkgConfig)
 find_package(PkgConfig QUIET)
-pkg_search_module(poppler libpoppler>=0.62.0 poppler>=0.62.0)
+pkg_search_module(poppler libpoppler>=0.86.0 poppler>=0.86.0)
 if (poppler_FOUND)
-	pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.62.0 poppler-cpp>=0.62.0)
+	pkg_search_module(poppler_cpp REQUIRED libpoppler-cpp>=0.86.0 poppler-cpp>=0.86.0)
 endif(poppler_FOUND)
  
 find_path(poppler_INCLUDE_DIR

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24985&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	Wed Mar  2 22:48:29 2022
@@ -74,20 +74,15 @@
 
 QImage PdfPlug::readThumbnail(const QString& fName)
 {
+	globalParams.reset(new GlobalParams());
+	globalParams->setErrQuiet(gTrue);
+
 	QString pdfFile = QDir::toNativeSeparators(fName);
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
-	globalParams.reset(new GlobalParams());
-#else
-	std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());
-	globalParams = globalParamsPtr.get();
-#endif
-
-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
+#if defined(Q_OS_WIN32)
 	auto fname = new GooString(pdfFile.toUtf8().data());
 #else
 	auto fname = new GooString(QFile::encodeName(pdfFile).data());
 #endif
-	globalParams->setErrQuiet(gTrue);
 
 #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
 	PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
@@ -332,19 +327,15 @@
 		qApp->processEvents();
 	}
 
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
 	globalParams.reset(new GlobalParams());
-#else
-	std::unique_ptr<GlobalParams> globalParamsPtr(new GlobalParams());
-	globalParams = globalParamsPtr.get();
-#endif
-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
+	globalParams->setErrQuiet(gTrue);
+
+#if defined(Q_OS_WIN32)
 	auto fname = new GooString(fn.toUtf8().data());
 #else
 	auto fname = new GooString(QFile::encodeName(fn).data());
 #endif
-	globalParams->setErrQuiet(gTrue);
-//	globalParams->setPrintCommands(gTrue);
+
 	QList<OptionalContentGroup*> ocgGroups;
 #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
 	auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
@@ -364,7 +355,7 @@
 			QString text = QInputDialog::getText(mw, tr("Open PDF-File"), tr("Password"), QLineEdit::Normal, "", &ok);
 			if (ok && !text.isEmpty())
 			{
-#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
+#if defined(Q_OS_WIN32)
 				auto fname = new GooString(fn.toUtf8().data());
 #else
 				auto fname = new GooString(QFile::encodeName(fn).data());
@@ -382,9 +373,6 @@
 			{
 				if (m_progressDialog)
 					m_progressDialog->close();
-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 83, 0)
-				delete globalParams;
-#endif
 				return false;
 			}
 			if (m_progressDialog)
@@ -494,7 +482,6 @@
 							}
 							else
 							{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
 								const auto& ocgs = ocg->getOCGs ();
 								for (const auto& ocg : ocgs)
 								{
@@ -506,25 +493,11 @@
 										ocgNames.append(ocgName);
 									}
 								}
-#else
-								GooList *ocgs = ocg->getOCGs ();
-								for (int i = 0; i < ocgs->getLength (); ++i)
-								{
-									OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);
-									QString ocgName = UnicodeParsedString(oc->getName());
-									if (!ocgNames.contains(ocgName))
-									{
-										ocgGroups.prepend(oc);
-										ocgNames.append(ocgName);
-									}
-								}
-#endif
 							}
 						}
 					}
 					else
 					{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
 						const auto& ocgs = ocg->getOCGs ();
 						for (const auto& ocg : ocgs)
 						{
@@ -536,19 +509,6 @@
 								ocgNames.append(ocgName);
 							}
 						}
-#else
-						GooList *ocgs = ocg->getOCGs ();
-						for (int i = 0; i < ocgs->getLength (); ++i)
-						{
-							OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);
-							QString ocgName = UnicodeParsedString(oc->getName());
-							if (!ocgNames.contains(ocgName))
-							{
-								ocgGroups.prepend(oc);
-								ocgNames.append(ocgName);
-							}
-						}
-#endif
 					}
 				}
 
@@ -787,13 +747,8 @@
 							names = catDict.dictLookup("OpenAction");
 							if (names.isDict())
 							{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 								std::unique_ptr<LinkAction> linkActionUPtr = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());
 								LinkAction *linkAction = linkActionUPtr.get();
-#else
-								LinkAction *linkAction = nullptr;
-								linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());
-#endif
 								if (linkAction && (linkAction->getKind() == actionJavaScript))
 								{
 									LinkJavaScript *jsa = (LinkJavaScript*) linkAction;
@@ -861,11 +816,7 @@
 		}
 		pdfDoc.reset();
 	}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 83, 0)
 	globalParams.reset();
-#else
-	globalParams = nullptr;
-#endif
 
 //	qDebug() << "converting finished";
 //	qDebug() << "Imported" << m_elements.count() << "Elements";

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24985&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp	Wed Mar  2 22:48:29 2022
@@ -332,15 +332,9 @@
 }
 
 /* Replacement for the crippled Poppler function LinkAction* AnnotWidget::getAdditionalAction(AdditionalActionsType type) */
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)
 {
 	std::unique_ptr<LinkAction> linkAction;
-#else
-LinkAction* SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *ano)
-{
-	LinkAction *linkAction = nullptr;
-#endif
 	Object obj;
 	Ref refa = ano->getRef();
 
@@ -467,11 +461,7 @@
 				if (dst->isPageRef())
 				{
 					Ref dstr = dst->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
 					pagNum = pdfDoc->findPage(dstr);
-#else
-					pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
-#endif
 				}
 				else
 					pagNum = dst->getPageNum();
@@ -485,11 +475,7 @@
 			POPPLER_CONST GooString *ndst = gto->getNamedDest();
 			if (ndst)
 			{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 				std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
-#else
-				LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
 				if (dstn)
 				{
 					if (dstn->getKind() == destXYZ)
@@ -497,11 +483,7 @@
 						if (dstn->isPageRef())
 						{
 							Ref dstr = dstn->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
 							pagNum = pdfDoc->findPage(dstr);
-#else
-							pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
-#endif
 						}
 						else
 							pagNum = dstn->getPageNum();
@@ -533,11 +515,7 @@
 			POPPLER_CONST GooString *ndst = gto->getNamedDest();
 			if (ndst)
 			{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 				std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
-#else
-				LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
 				if (dstn)
 				{
 					if (dstn->getKind() == destXYZ)
@@ -985,11 +963,7 @@
 					if (dst->isPageRef())
 					{
 						Ref dstr = dst->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
 						pagNum = pdfDoc->findPage(dstr);
-#else
-						pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
-#endif
 					}
 					else
 						pagNum = dst->getPageNum();
@@ -1005,11 +979,7 @@
 				POPPLER_CONST GooString *ndst = gto->getNamedDest();
 				if (ndst)
 				{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 					std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
-#else
-					LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
 					if (dstn)
 					{
 						if (dstn->getKind() == destXYZ)
@@ -1017,11 +987,7 @@
 							if (dstn->isPageRef())
 							{
 								Ref dstr = dstn->getPageRef();
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 76, 0)
 								pagNum = pdfDoc->findPage(dstr);
-#else
-								pagNum = pdfDoc->findPage(dstr.num, dstr.gen);
-#endif
 							}
 							else
 								pagNum = dstn->getPageNum();
@@ -1061,11 +1027,7 @@
 				POPPLER_CONST GooString *ndst = gto->getNamedDest();
 				if (ndst)
 				{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 					std::unique_ptr<LinkDest> dstn = pdfDoc->findDest(ndst);
-#else
-					LinkDest *dstn = pdfDoc->findDest(ndst);
-#endif
 					if (dstn)
 					{
 						if (dstn->getKind() == destXYZ)
@@ -1139,143 +1101,91 @@
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setD_act(UnicodeParsedString(jsa->getScript()));
 				ite->annotation().setAAact(true);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("E", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setE_act(UnicodeParsedString(jsa->getScript()));
 				ite->annotation().setAAact(true);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("X", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setX_act(UnicodeParsedString(jsa->getScript()));
 				ite->annotation().setAAact(true);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("Fo", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setFo_act(UnicodeParsedString(jsa->getScript()));
 				ite->annotation().setAAact(true);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("Bl", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setBl_act(UnicodeParsedString(jsa->getScript()));
 				ite->annotation().setAAact(true);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("C", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setC_act(UnicodeParsedString(jsa->getScript()));
 				ite->annotation().setAAact(true);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("F", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setF_act(UnicodeParsedString(jsa->getScript()));
@@ -1283,22 +1193,14 @@
 				ite->annotation().setFormat(5);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("K", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setK_act(UnicodeParsedString(jsa->getScript()));
@@ -1306,33 +1208,21 @@
 				ite->annotation().setFormat(5);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 	Aact = SC_getAdditionalAction("V", ano);
 	if (Aact)
 	{
 		if (Aact->getKind() == actionJavaScript)
 		{
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 			LinkJavaScript *jsa = (LinkJavaScript*) Aact.get();
-#else
-			LinkJavaScript *jsa = (LinkJavaScript*) Aact;
-#endif
 			if (jsa->isOk())
 			{
 				ite->annotation().setV_act(UnicodeParsedString(jsa->getScript()));
 				ite->annotation().setAAact(true);
 			}
 		}
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 		Aact.reset();
-#else
-		Aact = nullptr;
-#endif
 	}
 }
 
@@ -1342,11 +1232,7 @@
 	catalog = catA;
 	pdfDoc = doc;
 	updateGUICounter = 0;
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 84, 0)
 	m_fontEngine = new SplashFontEngine(true, false, false, true);
-#else
-	m_fontEngine = new SplashFontEngine(globalParams->getEnableFreeType(), false, false, true);
-#endif
 }
 
 void SlaOutputDev::startPage(int pageNum, GfxState *, XRef *)

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24985&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h	Wed Mar  2 22:48:29 2022
@@ -30,9 +30,6 @@
 #include "selection.h"
 #include "vgradient.h"
 
-#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 73, 0)
-#include <poppler/goo/gtypes.h>
-#endif
 #include <poppler/Object.h>
 #include <poppler/OutputDev.h>
 #include <poppler/Gfx.h>
@@ -163,11 +160,7 @@
 	virtual ~SlaOutputDev();
 
 	LinkAction* SC_getAction(AnnotWidget *ano);
-#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 86, 0)
 	std::unique_ptr<LinkAction> SC_getAdditionalAction(const char *key, AnnotWidget *ano);
-#else
-	LinkAction* SC_getAdditionalAction(const char *key, AnnotWidget *ano);
-#endif
 	static GBool annotations_callback(Annot *annota, void *user_data);
 	bool handleTextAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);
 	bool handleLinkAnnot(Annot* annota, double xCoor, double yCoor, double width, double height);




More information about the scribus-commit mailing list