From 45e8b302bce1d318f310ea13599d7ce84acc477e Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sun, 5 Oct 2025 14:21:49 +0200 Subject: [PATCH] Bump poppler to 25.02.0 --- CMakeLists.txt | 2 +- filters/karbon/pdf/Pdf2OdgImport.cpp | 18 +++++------------- filters/karbon/pdf/PdfImport.cpp | 27 +++++++++------------------ filters/karbon/pdf/SvgOutputDev.cpp | 18 ++++++++++++------ 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 237308baa5d..878caf74af4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -618,7 +618,7 @@ set_package_properties(LibEtonyek PROPERTIES ## ## Test for qt-poppler ## -macro_optional_find_package(Poppler "22.02.0" COMPONENTS Qt6) +macro_optional_find_package(Poppler "25.02.0" COMPONENTS Qt6) set_package_properties(Poppler PROPERTIES PURPOSE "Required by the Karbon PDF import filter and CSTester PDF feature" TYPE RECOMMENDED diff --git a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp index 22124b5bc03..be9db2db942 100644 --- a/filters/karbon/pdf/Pdf2OdgImport.cpp +++ b/filters/karbon/pdf/Pdf2OdgImport.cpp @@ -31,8 +31,6 @@ #include -#include - // Don't show this warning: it's an issue in poppler #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-parameter" @@ -42,8 +40,6 @@ #include #include -#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO)) - K_PLUGIN_FACTORY_WITH_JSON(Pdf2OdgImportFactory, "calligra_filter_pdf2odg.json", registerPlugin();) Pdf2OdgImport::Pdf2OdgImport(QObject *parent, const QVariantList &) @@ -70,17 +66,13 @@ KoFilter::ConversionStatus Pdf2OdgImport::convert(const QByteArray &from, const Q_ASSERT(m_document->pages().isEmpty()); // read config file - globalParams = std::unique_ptr(new GlobalParams); - if (!globalParams) + globalParams = std::make_unique(); + if (!globalParams) { return KoFilter::NotImplemented; + } -#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0) - GooString *fname = new GooString(QFile::encodeName(m_chain->inputFile()).data()); - PDFDoc *pdfDoc = new PDFDoc(fname, 0, 0, 0); -#else std::unique_ptr fname = std::make_unique(QFile::encodeName(m_chain->inputFile()).data()); - PDFDoc *pdfDoc = new PDFDoc(std::move(fname)); -#endif + auto pdfDoc = new PDFDoc(std::move(fname)); if (!pdfDoc) { globalParams.reset(); return KoFilter::StupidError; @@ -109,7 +101,7 @@ KoFilter::ConversionStatus Pdf2OdgImport::convert(const QByteArray &from, const } tmpFile.close(); debugPdf << "tmpFile:" << tmpFile.fileName(); - SvgOutputDev *dev = new SvgOutputDev(tmpFile.fileName()); + auto dev = new SvgOutputDev(tmpFile.fileName()); if (dev->isOk()) { int rotate = 0; bool useMediaBox = true; diff --git a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp index d41eb163250..511962cc0b6 100644 --- a/filters/karbon/pdf/PdfImport.cpp +++ b/filters/karbon/pdf/PdfImport.cpp @@ -17,10 +17,6 @@ #include -#include - -#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO)) - // Don't show this warning: it's an issue in poppler #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-parameter" @@ -51,17 +47,13 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray &from, const QByt } // read config file - globalParams = std::unique_ptr(new GlobalParams); - if (!globalParams) + globalParams = std::make_unique(); + if (!globalParams) { return KoFilter::NotImplemented; + } -#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0) - GooString *fname = new GooString(QFile::encodeName(m_chain->inputFile()).data()); - PDFDoc *pdfDoc = new PDFDoc(fname, 0, 0, 0); -#else - std::unique_ptr fname = std::make_unique(QFile::encodeName(m_chain->inputFile()).data()); - PDFDoc *pdfDoc = new PDFDoc(std::move(fname)); -#endif + auto fname = std::make_unique(QFile::encodeName(m_chain->inputFile()).data()); + auto pdfDoc = new PDFDoc(std::move(fname)); if (!pdfDoc) { globalParams.reset(); return KoFilter::StupidError; @@ -81,19 +73,18 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray &from, const QByt debugPdf << "converting pages" << firstPage << "-" << lastPage; - SvgOutputDev *dev = new SvgOutputDev(m_chain->outputFile()); - if (dev->isOk()) { + SvgOutputDev dev(m_chain->outputFile()); + if (dev.isOk()) { int rotate = 0; bool useMediaBox = true; bool crop = false; bool printing = false; - pdfDoc->displayPages(dev, firstPage, lastPage, hDPI, vDPI, rotate, useMediaBox, crop, printing); - dev->dumpContent(); + pdfDoc->displayPages(&dev, firstPage, lastPage, hDPI, vDPI, rotate, useMediaBox, crop, printing); + dev.dumpContent(); } debugPdf << "wrote file to" << m_chain->outputFile(); - delete dev; delete pdfDoc; globalParams.reset(); diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp index 1e553ab391e..436243da7bd 100644 --- a/filters/karbon/pdf/SvgOutputDev.cpp +++ b/filters/karbon/pdf/SvgOutputDev.cpp @@ -386,23 +386,29 @@ void SvgOutputDev::drawString(GfxState *state, const GooString *s) { int render = state->getRender(); // check for invisible text -- this is used by Acrobat Capture - if (render == 3) + if (render == 3) { return; + } // ignore empty strings - if (s->getLength() == 0) +#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(25, 10, 0) + if (s->getLength() == 0) { +#else + if (s->size() == 0) { +#endif return; + } -#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 04, 0) - GfxFont *font = state->getFont(); -#else std::shared_ptr font = state->getFont(); -#endif QString str; const char *p = s->c_str(); +#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(25, 10, 0) int len = s->getLength(); +#else + int len = s->size(); +#endif CharCode code; const Unicode *u = nullptr; int uLen; -- GitLab