svx/qa/unit/xoutdev.cxx | 11 +++++++---- svx/source/inc/svdpdf.hxx | 7 +------ svx/source/svdraw/svdedtv2.cxx | 14 ++++++++------ svx/source/svdraw/svdpdf.cxx | 8 -------- 4 files changed, 16 insertions(+), 24 deletions(-)
New commits: commit c792cbf4f2d0d44279f273c4c6cba650601f1468 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Mar 10 21:18:45 2021 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Mar 11 11:29:08 2021 +0100 svx: rework to avoid pdfium ifdefs Return early in case pdfium is not available, to avoid the ifdef forest. Change-Id: If0e12f9dd937b308b6c3b121801269b2ce68ae60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112284 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx index f422b5141705..4e0cc5ff0b48 100644 --- a/svx/qa/unit/xoutdev.cxx +++ b/svx/qa/unit/xoutdev.cxx @@ -7,8 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <config_features.h> - #include <cppunit/TestAssert.h> #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> @@ -22,6 +20,7 @@ #include <vcl/graph.hxx> #include <vcl/graphicfilter.hxx> #include <svx/xoutbmp.hxx> +#include <vcl/filter/PDFiumLibrary.hxx> class XOutdevTest : public CppUnit::TestFixture { @@ -35,7 +34,12 @@ public: CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport) { -#if HAVE_FEATURE_PDFIUM + auto pPdfium = vcl::pdf::PDFiumLibrary::get(); + if (!pPdfium) + { + return; + } + // Import the graphic. Graphic aGraphic; test::Directories aDirectories; @@ -62,7 +66,6 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport) CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('D'), sFirstBytes[2]); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('F'), sFirstBytes[3]); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>('-'), sFirstBytes[4]); -#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svdpdf.hxx b/svx/source/inc/svdpdf.hxx index 271eb1fd6dee..f8736a7bc891 100644 --- a/svx/source/inc/svdpdf.hxx +++ b/svx/source/inc/svdpdf.hxx @@ -20,9 +20,6 @@ #ifndef INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX #define INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX -#include <config_features.h> - -#if HAVE_FEATURE_PDFIUM #include <sal/config.h> #include <memory> @@ -140,8 +137,6 @@ public: SvdProgressInfo* pProgrInfo = nullptr); }; -#endif // HAVE_FEATURE_PDFIUM - -#endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDFMTF_HXX +#endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 17ced3685bff..ef1a1c43e89b 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -2108,14 +2108,16 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) if (pVectorGraphicData && pVectorGraphicData->getType() == VectorGraphicDataType::Pdf) { -#if HAVE_FEATURE_PDFIUM - aLogicRect = pGraf->GetLogicRect(); - ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect, aGraphic); - if (aGraphic.getPageNumber() < aFilter.GetPageCount()) + auto pPdfium = vcl::pdf::PDFiumLibrary::get(); + if (pPdfium) { - nInsCnt = aFilter.DoImport(*pOL, nInsPos, aGraphic.getPageNumber(), pProgrInfo); + aLogicRect = pGraf->GetLogicRect(); + ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect, aGraphic); + if (aGraphic.getPageNumber() < aFilter.GetPageCount()) + { + nInsCnt = aFilter.DoImport(*pOL, nInsPos, aGraphic.getPageNumber(), pProgrInfo); + } } -#endif // HAVE_FEATURE_PDFIUM } else if (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedVectorGraphicData() ) { diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 75f079540935..714e90da7c52 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -19,12 +19,6 @@ #include <svdpdf.hxx> -#include <config_features.h> - -#if HAVE_FEATURE_PDFIUM -#include <fpdfview.h> -#include <fpdf_edit.h> - #include <tools/UnitConversion.hxx> #include <vcl/graph.hxx> #include <vcl/vectorgraphicdata.hxx> @@ -1060,6 +1054,4 @@ tools::Rectangle ImpSdrPdfImport::PointsToLogic(double left, double right, doubl return tools::Rectangle(aPos, aSize); } -#endif // HAVE_FEATURE_PDFIUM - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits