20#include <svtools/strings.hrc>
21#include <com/sun/star/task/XInteractionContinuation.hpp>
22#include <com/sun/star/task/XInteractionAbort.hpp>
23#include <com/sun/star/task/XInteractionRetry.hpp>
24#include <com/sun/star/java/JavaNotFoundException.hpp>
25#include <com/sun/star/java/InvalidJavaSettingsException.hpp>
26#include <com/sun/star/java/JavaDisabledException.hpp>
27#include <com/sun/star/java/JavaVMCreationFailureException.hpp>
28#include <com/sun/star/java/RestartRequiredException.hpp>
32#include <jvmfwk/framework.hxx>
38#include <officecfg/Office/Common.hxx>
46 bool bDisabledHandled : 1;
47 bool bInvalidSettingsHandled : 1;
48 bool bNotFoundHandled : 1;
49 bool bVMCreationFailureHandled : 1;
50 bool bRestartRequiredHandled : 1;
51 sal_uInt16 nResult_JavaDisabled =
RET_NO;
53 : bDisabledHandled(false)
54 , bInvalidSettingsHandled(false)
55 , bNotFoundHandled(false)
56 , bVMCreationFailureHandled(false)
57 , bRestartRequiredHandled(false)
77 return Any(
static_cast<XInterface*
>(
this), aType);
96 Any anyExc = Request->getRequest();
102 for (
const auto& rCont : aSeqCont )
104 abort.set( rCont, UNO_QUERY );
109 for (
const auto& rCont : aSeqCont )
111 retry.set( rCont, UNO_QUERY );
116 css::java::JavaNotFoundException e1;
117 css::java::InvalidJavaSettingsException e2;
118 css::java::JavaDisabledException e3;
119 css::java::JavaVMCreationFailureException e4;
120 css::java::RestartRequiredException e5;
128 if( !g_JavaEvents.bNotFoundHandled )
132 OUString urlLink(officecfg::Office::Common::Menus::InstallJavaURL::get() +
134 g_JavaEvents.bNotFoundHandled =
true;
136 sPrimTex =
SvtResId(STR_WARNING_JAVANOTFOUND_MAC);
138 sPrimTex =
SvtResId(STR_WARNING_JAVANOTFOUND_WIN);
140 sPrimTex = sPrimTex.replaceAll(
"%BITNESS",
"64");
142 sPrimTex = sPrimTex.replaceAll(
"%BITNESS",
"32");
145 sPrimTex =
SvtResId(STR_WARNING_JAVANOTFOUND);
147 sPrimTex = sPrimTex.replaceAll(
"%FAQLINK", urlLink);
149 nullptr, VclMessageType::Warning, VclButtonsType::Ok, sPrimTex));
150 xWarningBox->set_title(
SvtResId(STR_WARNING_JAVANOTFOUND_TITLE));
151 nResult = xWarningBox->run();
158 else if ( anyExc >>= e2 )
161 if( !g_JavaEvents.bInvalidSettingsHandled )
164 g_JavaEvents.bInvalidSettingsHandled =
true;
166 OUString sWarning(
SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC));
168 OUString sWarning(
SvtResId(STR_WARNING_INVALIDJAVASETTINGS));
171 VclMessageType::Warning, VclButtonsType::Ok, sWarning));
172 xWarningBox->set_title(
SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE));
173 nResult = xWarningBox->run();
180 else if ( anyExc >>= e3 )
183 if( !g_JavaEvents.bDisabledHandled )
185 g_JavaEvents.bDisabledHandled =
true;
188 std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog(
"JavaDisabledDialog"));
189 nResult = xQueryBox->run();
195 g_JavaEvents.nResult_JavaDisabled = nResult;
200 nResult = g_JavaEvents.nResult_JavaDisabled;
203 else if ( anyExc >>= e4 )
206 if( !g_JavaEvents.bVMCreationFailureHandled )
209 g_JavaEvents.bVMCreationFailureHandled =
true;
211 OUString sWarning(
SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC));
213 OUString sWarning(
SvtResId(STR_ERROR_JVMCREATIONFAILED));
216 VclMessageType::Warning, VclButtonsType::Ok, sWarning));
217 xErrorBox->set_title(
SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE));
218 nResult = xErrorBox->run();
225 else if ( anyExc >>= e5 )
228 if( !g_JavaEvents.bRestartRequiredHandled )
232 g_JavaEvents.bRestartRequiredHandled =
true;
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
oslInterlockedCount m_aRefCount
virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest > &Request) override
virtual SVT_DLLPRIVATE ~JavaInteractionHandler()
static OUString getUILocale()
javaFrameworkError jfw_setEnabled(bool bEnabled)
Reference< XComponentContext > getProcessComponentContext()
OUString SvtResId(TranslateId aId)