diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/salvtables.cxx | 5 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 32 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 5 |
3 files changed, 40 insertions, 2 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index b89ad836136c..baf21c15532c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -676,6 +676,11 @@ public: return m_xDialog->StartExecuteAsync(aCtx); } + virtual void SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink) override + { + m_xDialog->SetInstallLOKNotifierHdl(rLink); + } + virtual int run() override { VclButtonBox* pActionArea = m_xDialog->get_action_area(); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index c29227d86b25..2d34490b523b 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -343,6 +343,7 @@ struct DialogImpl long mnResult; bool mbStartedModal; VclAbstractDialog::AsyncContext maEndCtx; + Link<void*, vcl::ILibreOfficeKitNotifier*> m_aInstallLOKNotifierHdl; DialogImpl() : mnResult( -1 ), mbStartedModal( false ) {} @@ -717,10 +718,30 @@ Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize) std::max<long>(h, 480 - 50)); } +void Dialog::SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink) +{ + mpDialogImpl->m_aInstallLOKNotifierHdl = rLink; +} + void Dialog::StateChanged( StateChangedType nType ) { if (nType == StateChangedType::InitShow) { + if (comphelper::LibreOfficeKit::isActive() && !GetLOKNotifier()) + { + vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr); + if (pViewShell) + { + SetLOKNotifier(pViewShell); + std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back("type", "dialog"); + aItems.emplace_back("size", GetSizePixel().toString()); + if (!GetText().isEmpty()) + aItems.emplace_back("title", GetText().toUtf8()); + pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems); + } + } + DoInitialLayout(); if ( !HasChildPathFocus() || HasFocus() ) @@ -826,6 +847,13 @@ bool Dialog::ImplStartExecuteModal() ImplSVData* pSVData = ImplGetSVData(); + const bool bKitActive = comphelper::LibreOfficeKit::isActive(); + if (bKitActive && !GetLOKNotifier()) + { + if (vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr)) + SetLOKNotifier(pViewShell); + } + switch ( Application::GetDialogCancelMode() ) { case Application::DialogCancelMode::Off: @@ -887,7 +915,7 @@ bool Dialog::ImplStartExecuteModal() } mbInExecute = true; // no real modality in LibreOfficeKit - if (!comphelper::LibreOfficeKit::isActive()) + if (!bKitActive) SetModalInputMode(true); // FIXME: no layouting, workaround some clipping issues @@ -907,7 +935,7 @@ bool Dialog::ImplStartExecuteModal() xEventBroadcaster->documentEventOccured(aObject); UITestLogger::getInstance().log("DialogExecute"); - if (comphelper::LibreOfficeKit::isActive()) + if (bKitActive) { if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) { diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 0b855ebd4822..ee3dc615243a 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2152,6 +2152,11 @@ public: return new GtkInstanceContainer(GTK_CONTAINER(gtk_dialog_get_content_area(m_pDialog)), false); } + virtual void SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>&) override + { + //not implemented for the gtk variant + } + virtual ~GtkInstanceDialog() override { g_signal_handler_disconnect(m_pDialog, m_nCloseSignalId); |