framework/source/loadenv/loadenv.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 1115a60e6d825c049680e7f2caf318e36d481b12
Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
Date:   Tue Jun 19 11:47:08 2018 +0200

    tdf#118238 Only disable UI interaction when loading document as hidden
    
    The "quiet" interaction handler was used unconditionally
    when loading a document via the loadComponentFromURL API method.
    So no dialog was shown asking the user whether he wants to enable macros.
    
    With this patch, the "quiet" interaction handler is only used,
    when the document was loaded with the "Hidden" property set.
    
    Change-Id: Idd522d0bf605499b071390fb58312181b755dfca
    Reviewed-on: https://gerrit.libreoffice.org/56086
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/framework/source/loadenv/loadenv.cxx 
b/framework/source/loadenv/loadenv.cxx
index 4703d1cf5161..b527d0259e77 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -28,6 +28,7 @@
 #include <services.h>
 #include <comphelper/interaction.hxx>
 #include <comphelper/lok.hxx>
+#include <comphelper/namedvaluecollection.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <framework/interaction.hxx>
 #include <comphelper/processfactory.hxx>
@@ -152,11 +153,18 @@ css::uno::Reference< css::lang::XComponent > 
LoadEnv::loadComponentFromURL(const
     {
         LoadEnv aEnv(xContext);
 
+        LoadEnvFeatures loadEnvFeatures = LoadEnvFeatures::WorkWithUI;
+        comphelper::NamedValueCollection aDescriptor( lArgs );
+        // tdf#118238 Only disable UI interaction when loading as hidden
+        if (aDescriptor.get("Hidden") == uno::Any(true) || 
Application::IsHeadlessModeEnabled())
+            loadEnvFeatures = LoadEnvFeatures::NONE;
+
         aEnv.initializeLoading(sURL,
                                lArgs,
                                css::uno::Reference< css::frame::XFrame 
>(xLoader, css::uno::UNO_QUERY),
                                sTarget,
-                               nFlags);
+                               nFlags,
+                               loadEnvFeatures);
         aEnv.startLoading();
         aEnv.waitWhileLoading(); // wait for ever!
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to