summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-06-19 11:47:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-06-19 14:13:33 +0200
commit1115a60e6d825c049680e7f2caf318e36d481b12 (patch)
tree8e7922b4eb40961c61cb6822b50c3ce427b53098
parent3b6905e37a6baac08eaff00e6e42aced7d6896df (diff)
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 <sbergman@redhat.com>
-rw-r--r--framework/source/loadenv/loadenv.cxx10
1 files changed, 9 insertions, 1 deletions
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!