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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed Mar 21 00:57:51 UTC 2018


 sdext/source/pdfimport/wrapper/wrapper.cxx |   21 +++++++++++++++++++++
 vcl/source/filter/ipdf/pdfread.cxx         |    2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit ac6e6753bd3b94df1780b011efae829964262587
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Mar 3 13:10:49 2018 -0500

    pdf: refactor poppler importer
    
    This paves the way to add pdf
    parsing via pdfium.
    
    Change-Id: I384687bcdce3011682ebeec18ee3de44759feb1a
    Reviewed-on: https://gerrit.libreoffice.org/51254
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index d79ffc3c99fb..7d3d68901e37 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -1001,6 +1001,14 @@ public:
     }
 };
 
+bool xpdf_ImportFromFile_Poppler(const OUString& aSysUPath,
+                                 const ContentSinkSharedPtr& rSink,
+                                 const uno::Reference<task::XInteractionHandler>& xIHdl,
+                                 const bool bIsEncrypted,
+                                 const OUString& aPwd,
+                                 const uno::Reference<uno::XComponentContext>& xContext,
+                                 const OUString& rFilterOptions);
+
 bool xpdf_ImportFromFile( const OUString&                             rURL,
                           const ContentSinkSharedPtr&                        rSink,
                           const uno::Reference< task::XInteractionHandler >& xIHdl,
@@ -1031,6 +1039,19 @@ bool xpdf_ImportFromFile( const OUString&                             rURL,
         return false;
     }
 
+    return xpdf_ImportFromFile_Poppler(aSysUPath, rSink, xIHdl, bIsEncrypted, aPwd, xContext, rFilterOptions);
+}
+
+/// Parse PDf file using libpoppler, which is quite limited
+/// to be phased out in favor of pdfium.
+bool xpdf_ImportFromFile_Poppler(const OUString& aSysUPath,
+                                 const ContentSinkSharedPtr& rSink,
+                                 const uno::Reference<task::XInteractionHandler>& /*xIHdl*/,
+                                 const bool bIsEncrypted,
+                                 const OUString& aPwd,
+                                 const uno::Reference<uno::XComponentContext>& xContext,
+                                 const OUString& rFilterOptions)
+{
     // Determine xpdfimport executable URL:
     OUString converterURL("$BRAND_BASE_DIR/" LIBO_BIN_FOLDER "/xpdfimport");
     rtl::Bootstrap::expandMacros(converterURL); //TODO: detect failure
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 5597e851c6ea..4bdca2f02783 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -228,7 +228,7 @@ bool ImportPDF(SvStream& rStream, Graphic& rGraphic)
 {
     uno::Sequence<sal_Int8> aPdfData;
     Bitmap aBitmap;
-    bool bRet = ImportPDF(rStream, aBitmap, aPdfData);
+    const bool bRet = ImportPDF(rStream, aBitmap, aPdfData);
     rGraphic = aBitmap;
     rGraphic.setPdfData(aPdfData);
     return bRet;


More information about the Libreoffice-commits mailing list