[Libreoffice-commits] core.git: vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 8 08:09:24 UTC 2021


 vcl/source/graphic/VectorGraphicSearch.cxx |   56 +++++------------------------
 1 file changed, 10 insertions(+), 46 deletions(-)

New commits:
commit faf3f18bdc89cc5e04abdefcb12d63e6ef796396
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Apr 7 20:47:00 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Apr 8 10:08:42 2021 +0200

    vcl VectorGraphicSearch: clean up not needed HAVE_FEATURE_PDFIUM ifdefs
    
    Towards completely avoiding the HAVE_FEATURE_PDFIUM ifdef forest.
    
    Change-Id: I38f138d7b7602cd0bd676d2e4f859b0bb5f051e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113772
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 14e67e0b7138..710c6e5f52e6 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -10,18 +10,11 @@
 
 #include <vcl/VectorGraphicSearch.hxx>
 
-#include <config_features.h>
-
-#if HAVE_FEATURE_PDFIUM
-
 #include <vcl/filter/PDFiumLibrary.hxx>
 #include <tools/UnitConversion.hxx>
 
 #include <sal/config.h>
 
-#include <fpdf_doc.h>
-#include <fpdf_text.h>
-
 namespace
 {
 class SearchContext
@@ -209,6 +202,11 @@ VectorGraphicSearch::~VectorGraphicSearch() { mpImplementation.reset(); }
 bool VectorGraphicSearch::search(OUString const& rSearchString,
                                  VectorGraphicSearchOptions const& rOptions)
 {
+    if (!mpImplementation->mpPDFium)
+    {
+        return false;
+    }
+
     if (!mpImplementation->mpSearchContext)
     {
         auto pData = maGraphic.getVectorGraphicData();
@@ -227,6 +225,11 @@ bool VectorGraphicSearch::search(OUString const& rSearchString,
 
 bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rData)
 {
+    if (!mpImplementation->mpPDFium)
+    {
+        return false;
+    }
+
     mpImplementation->mpPdfDocument = mpImplementation->mpPDFium->openDocument(
         rData->getBinaryDataContainer().getData(), rData->getBinaryDataContainer().getSize());
 
@@ -299,43 +302,4 @@ std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
     return std::vector<basegfx::B2DRectangle>();
 }
 
-#else // !HAVE_FEATURE_PDFIUM
-
-class VectorGraphicSearch::Implementation
-{
-};
-
-VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
-    : maGraphic(rGraphic)
-{
-}
-
-VectorGraphicSearch::~VectorGraphicSearch() {}
-
-bool VectorGraphicSearch::search(OUString const& /*rSearchString*/,
-                                 VectorGraphicSearchOptions const& /*rOptions*/)
-{
-    return false;
-}
-
-bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& /*rData*/)
-{
-    return false;
-}
-
-basegfx::B2DSize VectorGraphicSearch::pageSize() { return basegfx::B2DSize(); }
-
-bool VectorGraphicSearch::next() { return false; }
-
-bool VectorGraphicSearch::previous() { return false; }
-
-int VectorGraphicSearch::index() { return -1; }
-
-std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
-{
-    return std::vector<basegfx::B2DRectangle>();
-}
-
-#endif // HAVE_FEATURE_PDFIUM
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list