summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-10-06 17:08:57 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-10-08 16:12:20 +0200
commitf3ce30ec75a4d7116b9cd4d7b21d9aaa0e237eeb (patch)
tree63796907e0ec423d41d06fc15e9ceba0da567624 /cui
parent078a81d5ba9f44b642e3e8b838fc4fe48a91810a (diff)
tdf#120363: try to avoid asking user to enable JVM when looking ...
... for a provider for an operation. When another provider actually handles an operation, it's useless to ask user to enable disabled JVM just to learn that it doesn't handle the request. So, this patch does the MasterScriptProvider operations in two steps: first with "Enable JVM" interaction disabled, and if failed, again with the interaction enabled to try disabled providers. This shouldn't typically give performance penalties in case when JVM is enabled, and when it's disabled and the operation is addressed to another provider. A context class designed to disable "Enable JVM" interaction is moved from cui/source/customize/cfgutil.cxx to a new comphelper header, which is supposed to hold similar helper context classes in needed. Change-Id: I21be922bfd80a276d9c8f1215d62a47bb3c225f5 Reviewed-on: https://gerrit.libreoffice.org/61468 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/cfgutil.cxx34
1 files changed, 2 insertions, 32 deletions
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 56d91c1eaf82..fbc07d50f41a 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -47,6 +47,7 @@
#include <bitmaps.hlst>
#include <sfx2/app.hxx>
#include <sfx2/minfitem.hxx>
+#include <comphelper/DisableInteractionHelper.hxx>
#include <comphelper/documentinfo.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequenceashashmap.hxx>
@@ -65,7 +66,6 @@
#include <vcl/help.hxx>
#include <vcl/vclmedit.hxx>
#include <o3tl/make_unique.hxx>
-#include <uno/current_context.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -542,36 +542,6 @@ namespace
}
}
-namespace
-{
-class NoEnableJavaInteractionContext : public cppu::WeakImplHelper<css::uno::XCurrentContext>
-{
-public:
- explicit NoEnableJavaInteractionContext(
- css::uno::Reference<css::uno::XCurrentContext> const& xContext)
- : mxContext(xContext)
- {
- }
- NoEnableJavaInteractionContext(const NoEnableJavaInteractionContext&) = delete;
- NoEnableJavaInteractionContext& operator=(const NoEnableJavaInteractionContext&) = delete;
-
-private:
- virtual ~NoEnableJavaInteractionContext() override {}
-
- virtual css::uno::Any SAL_CALL getValueByName(OUString const& Name) override
- {
- if (Name == "DontEnableJava")
- return css::uno::Any(true);
- else if (mxContext.is())
- return mxContext->getValueByName(Name);
- else
- return css::uno::Any();
- }
-
- css::uno::Reference<css::uno::XCurrentContext> mxContext;
-};
-
-} // namespace
void SfxConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
SvTreeListEntry* pParentEntry, bool bCheapChildrenOnDemand)
@@ -581,7 +551,7 @@ void SfxConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
{
// tdf#120362: Don't ask to enable disabled Java when filling script list
css::uno::ContextLayer layer(
- new NoEnableJavaInteractionContext(css::uno::getCurrentContext()));
+ new comphelper::NoEnableJavaInteractionContext(css::uno::getCurrentContext()));
Sequence< Reference< browse::XBrowseNode > > children =
xRootNode->getChildNodes();