diff options
-rw-r--r-- | vcl/source/window/dialog.cxx | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index c1921d238c67..7f7fc3a9ef7d 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -752,23 +752,25 @@ void Dialog::StateChanged( StateChangedType nType ) { if (nType == StateChangedType::InitShow) { - if (comphelper::LibreOfficeKit::isActive() && !GetLOKNotifier()) + DoInitialLayout(); + + const bool bKitActive = comphelper::LibreOfficeKit::isActive(); + if (bKitActive) { - vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr); - if (pViewShell) + if (!GetLOKNotifier()) + SetLOKNotifier(mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr)); + + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) { - 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); + pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); } } - DoInitialLayout(); - if ( !HasChildPathFocus() || HasFocus() ) GrabFocusToFirstControl(); if ( !(GetStyle() & WB_CLOSEABLE) ) @@ -889,12 +891,7 @@ bool Dialog::ImplStartExecute() if (bModal) { if (bKitActive && !GetLOKNotifier()) - { - if (vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr)) - { - SetLOKNotifier(pViewShell); - } - } + SetLOKNotifier(mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr)); switch ( Application::GetDialogCancelMode() ) { @@ -925,19 +922,6 @@ bool Dialog::ImplStartExecute() std::abort(); } - if (bKitActive) - { - if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) - { - 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()); - pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); - } - } - #ifdef DBG_UTIL vcl::Window* pParent = GetParent(); if ( pParent ) |