summaryrefslogtreecommitdiffstats
path: root/cui
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-08-02 07:08:04 +1000
committerCaolán McNamara <caolanm@redhat.com>2019-08-03 20:15:58 +0200
commit60b6288bc1aec17d04b45f62ba6f117fc43f8ab4 (patch)
treeeeef88f244b04572775d77dc9ea90efbcaf93b04 /cui
parentUpdate git submodules (diff)
downloadcore-60b6288bc1aec17d04b45f62ba6f117fc43f8ab4.tar.gz
core-60b6288bc1aec17d04b45f62ba6f117fc43f8ab4.zip
tdf#126643: avoid unnecessary asking for JRE in script organizer dialog
Use two-pass search for the needed language node; if it fails with Java interaction disabled, only then repeat the search with it enabled, like in commit f3ce30ec75a4d7116b9cd4d7b21d9aaa0e237eeb. Change-Id: Icde5dbeb552a6837af02182f7b8cbbc90765c5a5 Reviewed-on: https://gerrit.libreoffice.org/76831 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 1a1f4e73b7ab9e5b071aab74c8d7e27ba2b2d29c) Reviewed-on: https://gerrit.libreoffice.org/76878 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/scriptdlg.cxx26
1 files changed, 19 insertions, 7 deletions
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 11ef3a8820e2..99ac608b17af 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -24,6 +24,7 @@
#include <sfx2/objsh.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
+#include <uno/current_context.hxx>
#include <strings.hrc>
#include <bitmaps.hlst>
@@ -47,6 +48,7 @@
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <comphelper/DisableInteractionHelper.hxx>
#include <comphelper/documentinfo.hxx>
#include <comphelper/processfactory.hxx>
@@ -247,14 +249,24 @@ SvxScriptOrgDialog::getLangNodeFromRootNode( Reference< browse::XBrowseNode > co
try
{
- Sequence < Reference< browse::XBrowseNode > > children = rootNode->getChildNodes();
- for ( sal_Int32 n = 0; n < children.getLength(); n++ )
+ auto tryFind = [&] {
+ const Sequence<Reference<browse::XBrowseNode>> children = rootNode->getChildNodes();
+ const auto it = std::find_if(children.begin(), children.end(),
+ [&](const Reference<browse::XBrowseNode>& child) {
+ return child->getName() == language;
+ });
+ return (it != children.end()) ? *it : nullptr;
+ };
{
- if ( children[ n ]->getName() == language )
- {
- langNode = children[ n ];
- break;
- }
+ // First try without Java interaction, to avoid warnings for non-JRE-dependent providers
+ css::uno::ContextLayer layer(
+ new comphelper::NoEnableJavaInteractionContext(css::uno::getCurrentContext()));
+ langNode = tryFind();
+ }
+ if (!langNode)
+ {
+ // Now try with Java interaction enabled
+ langNode = tryFind();
}
}
catch ( Exception& )