[Libreoffice-commits] core.git: config_host/config_features.h.in config_host.mk.in configure.ac RepositoryExternal.mk Repository.mk sd/CppunitTest_sd_activex_controls_tests.mk sd/CppunitTest_sd_import_tests.mk sdext/Module_sdext.mk sdext/source sfx2/source xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk xmlsecurity/CppunitTest_xmlsecurity_signing.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Mar 7 10:43:59 UTC 2019


 Repository.mk                                     |    4 -
 RepositoryExternal.mk                             |    4 +
 config_host.mk.in                                 |    1 
 config_host/config_features.h.in                  |    5 ++
 configure.ac                                      |   51 +++++++++++++++-------
 sd/CppunitTest_sd_activex_controls_tests.mk       |    2 
 sd/CppunitTest_sd_import_tests.mk                 |    4 -
 sdext/Module_sdext.mk                             |    7 ++-
 sdext/source/pdfimport/test/tests.cxx             |   13 +++++
 sfx2/source/doc/objstor.cxx                       |   16 +++++-
 xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk |    2 
 xmlsecurity/CppunitTest_xmlsecurity_signing.mk    |    2 
 12 files changed, 85 insertions(+), 26 deletions(-)

New commits:
commit 0d8c670797f6becc584cf2eca4f414df7a3d0d85
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Mar 6 22:06:35 2019 -0500
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Mar 7 11:43:25 2019 +0100

    build: support disabling poppler
    
    This adds --enable-poppler configure option.
    Poppler can be enabled/disabled by setting this
    parameter to yes or no.
    
    Change-Id: I42ba2d27de7b5014d28523394310616d20073b71
    Reviewed-on: https://gerrit.libreoffice.org/68602
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/68842
    Tested-by: Jenkins

diff --git a/Repository.mk b/Repository.mk
index 59c93c206466..e6e02c00aa8e 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -231,7 +231,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,gnome, \
 ))
 endif
 
-ifneq ($(ENABLE_PDFIMPORT),)
+ifneq ($(ENABLE_POPPLER),)
 $(eval $(call gb_Helper_register_executables_for_install,OOO,pdfimport, \
 	xpdfimport \
 ))
@@ -1004,7 +1004,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ogltrans,\
 	slideshow_opengl_shader \
 ))
 
-ifneq ($(ENABLE_PDFIMPORT),)
+ifneq ($(ENABLE_POPPLER),)
 $(eval $(call gb_Helper_register_packages_for_install,pdfimport, \
 	sdext_pdfimport_pdf \
 ))
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 3c9be8755848..b039484338a8 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2780,6 +2780,8 @@ endef
 
 endif # ENABLE_VALGRIND
 
+ifeq ($(ENABLE_POPPLER),TRUE)
+
 ifneq ($(SYSTEM_POPPLER),)
 
 define gb_LinkTarget__use_poppler
@@ -2829,6 +2831,8 @@ endef
 
 endif # SYSTEM_POPPLER
 
+endif # ENABLE_POPPLER
+
 
 ifneq ($(SYSTEM_CLUCENE),)
 
diff --git a/config_host.mk.in b/config_host.mk.in
index 5413c78dd6ab..5b4a54a8e3ed 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -164,6 +164,7 @@ export ENABLE_OPTIMIZED=@ENABLE_OPTIMIZED@
 export ENABLE_PCH=@ENABLE_PCH@
 export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@
 export ENABLE_PDFIUM=@ENABLE_PDFIUM@
+export ENABLE_POPPLER=@ENABLE_POPPLER@
 export ENABLE_QT5=@ENABLE_QT5@
 export ENABLE_KDE5=@ENABLE_KDE5@
 export ENABLE_GTK3_KDE5=@ENABLE_GTK3_KDE5@
diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 97c2a4f797db..a68050111457 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -159,6 +159,11 @@
 #define HAVE_FEATURE_PDFIUM 0
 
 /*
+ * Whether poppler is available
+ */
+#define HAVE_FEATURE_POPPLER 0
+
+/*
  * Whether extra fonts are available
  */
 #define HAVE_MORE_FONTS 0
diff --git a/configure.ac b/configure.ac
index c4d789140362..974eab39c7ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1725,6 +1725,11 @@ AC_ARG_WITH(system-openldap,
         [Use the OpenLDAP LDAP SDK already on system.]),,
     [with_system_openldap="$with_system_libs"])
 
+libo_FUZZ_ARG_ENABLE(poppler,
+    AS_HELP_STRING([--disable-poppler],
+        [Disable building Poppler.])
+)
+
 AC_ARG_WITH(system-poppler,
     AS_HELP_STRING([--with-system-poppler],
         [Use system poppler (only needed for PDF import).]),,
@@ -10644,6 +10649,33 @@ AC_SUBST([DCONF_CFLAGS])
 AC_SUBST([DCONF_LIBS])
 AC_SUBST([ENABLE_DCONF])
 
+# Pdfium?
+AC_MSG_CHECKING([whether to build PDFium])
+ENABLE_PDFIUM=
+if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
+    AC_MSG_RESULT([yes])
+    ENABLE_PDFIUM=TRUE
+    AC_DEFINE(HAVE_FEATURE_PDFIUM)
+    BUILD_TYPE="$BUILD_TYPE PDFIUM"
+else
+    AC_MSG_RESULT([no])
+fi
+AC_SUBST(ENABLE_PDFIUM)
+
+dnl ===================================================================
+dnl Check for poppler
+dnl ===================================================================
+ENABLE_POPPLER=
+AC_MSG_CHECKING([enable poppler])
+if test -z "$enable_poppler" -o "$enable_poppler" = yes; then
+    AC_MSG_RESULT([yes])
+    ENABLE_POPPLER=TRUE
+    AC_DEFINE(HAVE_FEATURE_POPPLER)
+else
+    AC_MSG_RESULT([no])
+fi
+AC_SUBST(ENABLE_POPPLER)
+
 # pdf import?
 AC_MSG_CHECKING([whether to build the PDF import feature])
 ENABLE_PDFIMPORT=
@@ -10651,7 +10683,11 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_
     AC_MSG_RESULT([yes])
     ENABLE_PDFIMPORT=TRUE
     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
+else
+    AC_MSG_RESULT([no])
+fi
 
+if test $ENABLE_PDFIMPORT == TRUE -a $ENABLE_POPPLER == TRUE; then
     dnl ===================================================================
     dnl Check for system poppler
     dnl ===================================================================
@@ -10682,27 +10718,12 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_
         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
     fi
     AC_DEFINE([ENABLE_PDFIMPORT],1)
-else
-    AC_MSG_RESULT([no])
 fi
 AC_SUBST(ENABLE_PDFIMPORT)
 AC_SUBST(SYSTEM_POPPLER)
 AC_SUBST(POPPLER_CFLAGS)
 AC_SUBST(POPPLER_LIBS)
 
-# pdf import?
-AC_MSG_CHECKING([whether to build PDFium])
-ENABLE_PDFIUM=
-if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
-    AC_MSG_RESULT([yes])
-    ENABLE_PDFIUM=TRUE
-    AC_DEFINE(HAVE_FEATURE_PDFIUM)
-    BUILD_TYPE="$BUILD_TYPE PDFIUM"
-else
-    AC_MSG_RESULT([no])
-fi
-AC_SUBST(ENABLE_PDFIUM)
-
 SYSTEM_GPGMEPP=
 
 if test "$build_for_ios" = "YES"; then
diff --git a/sd/CppunitTest_sd_activex_controls_tests.mk b/sd/CppunitTest_sd_activex_controls_tests.mk
index 0f8faf14c0c7..3a50ba709049 100644
--- a/sd/CppunitTest_sd_activex_controls_tests.mk
+++ b/sd/CppunitTest_sd_activex_controls_tests.mk
@@ -89,7 +89,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_activex_controls_tests,\
     sd/util/sd \
     sd/util/sdfilt \
     sd/util/sdd \
-    $(if $(ENABLE_PDFIMPORT),sdext/source/pdfimport/pdfimport) \
+    $(if $(ENABLE_POPPLER),sdext/source/pdfimport/pdfimport) \
     sfx2/util/sfx \
     sot/util/sot \
     svl/source/fsstor/fsstorage \
diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk
index ca5fa508bf06..20828e3bf380 100644
--- a/sd/CppunitTest_sd_import_tests.mk
+++ b/sd/CppunitTest_sd_import_tests.mk
@@ -93,7 +93,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\
     sd/util/sd \
     sd/util/sdfilt \
     sd/util/sdd \
-    $(if $(ENABLE_PDFIMPORT),sdext/source/pdfimport/pdfimport) \
+    $(if $(ENABLE_POPPLER),sdext/source/pdfimport/pdfimport) \
     sfx2/util/sfx \
     sot/util/sot \
     svl/source/fsstor/fsstorage \
@@ -122,7 +122,7 @@ $(eval $(call gb_CppunitTest_use_packages,sd_import_tests,\
 	oox_customshapes \
 ))
 
-ifneq ($(ENABLE_PDFIMPORT),)
+ifneq ($(ENABLE_POPPLER),)
 $(eval $(call gb_CppunitTest_use_executable,sd_import_tests,xpdfimport))
 endif
 
diff --git a/sdext/Module_sdext.mk b/sdext/Module_sdext.mk
index 44ccba59a754..fd1d191b4939 100644
--- a/sdext/Module_sdext.mk
+++ b/sdext/Module_sdext.mk
@@ -20,10 +20,15 @@ $(eval $(call gb_Module_add_targets,sdext,\
 ifeq ($(ENABLE_PDFIMPORT),TRUE)
 $(eval $(call gb_Module_add_targets,sdext,\
     CustomTarget_pdfimport \
-    Executable_xpdfimport \
     Library_pdfimport \
+))
+
+ifeq ($(ENABLE_POPPLER),TRUE)
+$(eval $(call gb_Module_add_targets,sdext,\
+    Executable_xpdfimport \
     Package_pdfimport_xpdfimport \
 ))
+endif
 
 $(eval $(call gb_Module_add_check_targets,sdext,\
     CppunitTest_sdext_pdfimport \
diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx
index 8596859f791f..4cbf870dc28a 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
 #include <zlib.h>
 
 #include "outputwrap.hxx"
@@ -453,6 +454,7 @@ namespace
     public:
         void testXPDFParser()
         {
+#if HAVE_FEATURE_POPPLER
             std::shared_ptr<TestSink> pSink( new TestSink() );
             CPPUNIT_ASSERT(
                 pdfi::xpdf_ImportFromFile(
@@ -462,10 +464,12 @@ namespace
                     OUString(),
                     getComponentContext(), "" ) );
             pSink->check();
+#endif
         }
 
         void testOdfDrawExport()
         {
+#if HAVE_FEATURE_POPPLER
             rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
             xAdaptor->setTreeVisitorFactory( createDrawTreeVisitorFactory() );
 
@@ -477,10 +481,12 @@ namespace
                                                         new OutputWrap(tempFileURL),
                                                         nullptr ));
             osl::File::remove( tempFileURL );
+#endif
         }
 
         void testOdfWriterExport()
         {
+#if HAVE_FEATURE_POPPLER
             rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
             xAdaptor->setTreeVisitorFactory( createWriterTreeVisitorFactory() );
 
@@ -492,10 +498,12 @@ namespace
                                                         new OutputWrap(tempFileURL),
                                                         nullptr ));
             osl::File::remove( tempFileURL );
+#endif
         }
 
         void testTdf96993()
         {
+#if HAVE_FEATURE_POPPLER
             rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
             xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
@@ -506,10 +514,12 @@ namespace
                 nullptr));
             // This ensures that the imported image arrives properly flipped
             CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"matrix(18520.8333333333 0 0 26281.9444444444 0 0)\"") != -1);
+#endif
         }
 
         void testTdf98421()
         {
+#if HAVE_FEATURE_POPPLER
             rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
             xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
 
@@ -521,10 +531,12 @@ namespace
             // This ensures that the imported image arrives properly flipped
             CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"scale( 1.0 -1.0 ) translate( 0mm 0mm )\"") != -1);
             CPPUNIT_ASSERT(aOutput.indexOf("svg:height=\"-262.82mm\"") != -1);
+#endif
         }
 
         void testTdf105536()
         {
+#if HAVE_FEATURE_POPPLER
             rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
             xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
@@ -535,6 +547,7 @@ namespace
                 nullptr));
             // This ensures that the imported image arrives properly flipped
             CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"matrix(-21488.4 0 0 -27978.1 21488.4 27978.1)\"") != -1);
+#endif
         }
 
         CPPUNIT_TEST_SUITE(PDFITest);
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 44364d26092c..3df35e09f1aa 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -721,11 +721,21 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
         {
             // Experimental PDF importing using PDFium. This is currently enabled for LOK only and
             // we handle it not via XmlFilterAdaptor but a new SdPdfFiler.
-            const bool bPdfiumImport = (comphelper::LibreOfficeKit::isActive() || getenv("LO_IMPORT_USE_PDFIUM")) && pMedium->GetFilter() &&
-                                       (pMedium->GetFilter()->GetFilterName() == "draw_pdf_import");
+#if !HAVE_FEATURE_POPPLER
+            constexpr bool bUsePdfium = true;
+#else
+            const bool bUsePdfium
+                = comphelper::LibreOfficeKit::isActive() || getenv("LO_IMPORT_USE_PDFIUM");
+#endif
+            const bool bPdfiumImport
+                = bUsePdfium && pMedium->GetFilter()
+                  && (pMedium->GetFilter()->GetFilterName() == "draw_pdf_import");
+
             pImpl->nLoadedFlags = SfxLoadedFlags::NONE;
             pImpl->bModelInitialized = false;
-            if ( pMedium->GetFilter() && ( pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER ) && !bPdfiumImport )
+            if (pMedium->GetFilter()
+                && (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER)
+                && !bPdfiumImport)
             {
                 uno::Reference < beans::XPropertySet > xSet( GetModel(), uno::UNO_QUERY );
                 const OUString sLockUpdates("LockUpdates");
diff --git a/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk b/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk
index 021ab8dbe99f..f2500b5d3100 100644
--- a/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk
+++ b/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk
@@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_pdfsigning,services))
 
 $(eval $(call gb_CppunitTest_use_configuration,xmlsecurity_pdfsigning))
 
-ifeq ($(ENABLE_PDFIMPORT),TRUE)
+ifeq ($(ENABLE_POPPLER),TRUE)
 $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_pdfsigning,xpdfimport))
 endif
 
diff --git a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
index 6a3cbcab2a58..418aa21a27c9 100644
--- a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
+++ b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk
@@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_signing,services))
 
 $(eval $(call gb_CppunitTest_use_configuration,xmlsecurity_signing))
 
-ifeq ($(ENABLE_PDFIMPORT),TRUE)
+ifeq ($(ENABLE_POPPLER),TRUE)
 $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_signing,xpdfimport))
 endif
 


More information about the Libreoffice-commits mailing list