From 00ac4d375922b96d94e42846c9555d22470fb2f6 Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Wed, 15 Feb 2023 23:52:53 +0100 Subject: lok: macro: VBA message dialogs was causing assertion failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get VBA MsgBox and VBA Runtime Script Error dialogs to be displayed correctly without causing an assertion failure. Provided a solution that allows VBA MsgBox to be executed in a not-async way so that the VBA script is paused until the message box is closed. Change-Id: Ica7d0d343a0ea4b6a163c1c43572f18a5779a0ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147243 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147321 Tested-by: Jenkins --- vcl/source/app/salvtables.cxx | 5 +++++ vcl/source/app/svapp.cxx | 1 + vcl/source/window/builder.cxx | 5 +++-- vcl/source/window/dialog.cxx | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index eb2697b61b03..f8dcfba0a16b 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1696,6 +1696,11 @@ weld::ScreenShotCollection SalInstanceWindow::collect_screenshot_data() return aRet; } +const vcl::ILibreOfficeKitNotifier* SalInstanceWindow::GetLOKNotifier() +{ + return m_xWindow ? m_xWindow->GetLOKNotifier() : nullptr; +} + SalInstanceWindow::~SalInstanceWindow() { // tdf#129745 only undo overriding child help for the normal case, not for diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index d2c6294917f0..a580a8215cdb 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -319,6 +319,7 @@ void Application::notifyWindow(vcl::LOKWindowId /*nLOKWindowId*/, const OUString& /*rAction*/, const std::vector& /*rPayload = std::vector()*/) const { + SAL_WARN("vcl", "Invoked not implemented method: Application::notifyWindow"); } void Application::libreOfficeKitViewCallback(int nType, const char* pPayload) const diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 2463c68182a6..047fd6e4ae9c 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -213,10 +213,11 @@ std::unique_ptr Application::CreateInterimBuilder(vcl::Window* pP } weld::MessageDialog* Application::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, - VclButtonsType eButtonType, const OUString& rPrimaryMessage) + VclButtonsType eButtonType, const OUString& rPrimaryMessage, + const ILibreOfficeKitNotifier* pNotifier) { if (comphelper::LibreOfficeKit::isActive()) - return JSInstanceBuilder::CreateMessageDialog(pParent, eMessageType, eButtonType, rPrimaryMessage); + return JSInstanceBuilder::CreateMessageDialog(pParent, eMessageType, eButtonType, rPrimaryMessage, pNotifier); else return ImplGetSVData()->mpDefInst->CreateMessageDialog(pParent, eMessageType, eButtonType, rPrimaryMessage); } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index b8d81a4b8130..a255ed4b9a47 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1131,7 +1131,8 @@ void Dialog::EndDialog( tools::Long nResult ) { if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) { - pNotifier->notifyWindow(GetLOKWindowId(), "close"); + if (mpDialogImpl->m_bLOKTunneling) + pNotifier->notifyWindow(GetLOKWindowId(), "close"); ReleaseLOKNotifier(); } } -- cgit