From 0b0e2574e5693b7ea252e0a75520811c0863146e Mon Sep 17 00:00:00 2001
From: Heiko Becker <mail@heiko-becker.de>
Date: Tue, 5 Mar 2024 00:43:12 +0100
Subject: [PATCH] Fix build with poppler >= 24.03.0

---
 scribus/plugins/import/pdf/slaoutput.cpp | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index da824a1a2..04f9c05f0 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -14,6 +14,7 @@ for which a new license (GPL+exception) is in place.
 
 #include <poppler/GlobalParams.h>
 #include <poppler/poppler-config.h>
+#include <poppler/glib/poppler-features.h>
 #include <poppler/FileSpec.h>
 #include <poppler/fofi/FoFiTrueType.h>
 
@@ -1845,7 +1846,11 @@ GBool SlaOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, d
 	VGradient FillGradient = VGradient(VGradient::linear);
 	FillGradient.clearStops();
 	GfxColorSpace *color_space = shading->getColorSpace();
+#if POPPLER_CHECK_VERSION(24, 3, 0)
+	if (func->getType() == Function::Type::Stitching)
+#else
 	if (func->getType() == 3)
+#endif
 	{
 		StitchingFunction *stitchingFunc = (StitchingFunction*)func;
 		const double *bounds = stitchingFunc->getBounds();
@@ -1867,7 +1872,11 @@ GBool SlaOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, d
 			FillGradient.addStop( ScColorEngine::getShadeColor(m_doc->PageColors[stopColor], m_doc, shade), stopPoint, 0.5, 1.0, stopColor, shade );
 		}
 	}
+#if POPPLER_CHECK_VERSION(24, 3, 0)
+	else if ((func->getType() == Function::Type::Exponential) || (func->getType() == Function::Type::Sampled))
+#else
 	else if ((func->getType() == 2) || (func->getType() == 0))
+#endif
 	{
 		GfxColor stop1;
 		shading->getColor(0.0, &stop1);
@@ -1979,7 +1988,11 @@ GBool SlaOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading,
 	VGradient FillGradient = VGradient(VGradient::linear);
 	FillGradient.clearStops();
 	GfxColorSpace *color_space = shading->getColorSpace();
-	if (func->getType() == 3)
+#if POPPLER_CHECK_VERSION(24, 3, 0)
+	if (func->getType() == Function::Type::Stitching)
+#else
+    if (func->getType() == 3)
+#endif
 	{
 		StitchingFunction *stitchingFunc = (StitchingFunction*)func;
 		const double *bounds = stitchingFunc->getBounds();
@@ -2001,7 +2014,11 @@ GBool SlaOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading,
 			FillGradient.addStop( ScColorEngine::getShadeColor(m_doc->PageColors[stopColor], m_doc, shade), stopPoint, 0.5, 1.0, stopColor, shade );
 		}
 	}
+#if POPPLER_CHECK_VERSION(24, 3, 0)
+	else if ((func->getType() == Function::Type::Exponential) || (func->getType() == Function::Type::Sampled))
+#else
 	else if ((func->getType() == 2) || (func->getType() == 0))
+#endif
 	{
 		GfxColor stop1;
 		shading->getColor(0.0, &stop1);
-- 
2.44.0

