diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-14 13:11:00 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-12-14 13:42:51 +0100 |
commit | b5b0ac92512ead854066f7e5c908109c848e7327 (patch) | |
tree | cdb5236132abd3bd2ed4fa189613e6de67b76e3e /sfx2 | |
parent | ad9ac5cf73808d4e71bb4cf6b8df9c3ded0adbe3 (diff) |
lokdialog: Send close callback when dialog dissappears too
Change-Id: I88bea3dc1ae938d31462e85ca1a8f48dd13e8e89
(cherry picked from commit 76de866e162502518acbc0ab020c257b80946c2d)
Reviewed-on: https://gerrit.libreoffice.org/46439
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 8bbf8bd3dee6..77486632c91d 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -167,10 +167,9 @@ void SfxModalDialog::dispose() SetDialogData_Impl(); delete pOutputSet; - SfxViewShell* pViewShell = SfxViewShell::Current(); - if (comphelper::LibreOfficeKit::isActive() && pViewShell) + if (comphelper::LibreOfficeKit::isActive() && GetLOKNotifier()) { - pViewShell->notifyWindow(GetLOKWindowId(), "close"); + SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "close"); ReleaseLOKNotifier(); } @@ -214,13 +213,13 @@ void SfxModalDialog::CreateOutputItemSet( const SfxItemSet& rSet ) void SfxModalDialog::StateChanged( StateChangedType nType ) { - if (comphelper::LibreOfficeKit::isActive() && nType == StateChangedType::InitShow) + if (comphelper::LibreOfficeKit::isActive()) { - // There are some dialogs, like Hyperlink dialog, which inherit from - // SfxModalDialog even though they are modeless, i.e., their Execute method - // isn't called. - if (!GetLOKNotifier()) + if (nType == StateChangedType::InitShow && !GetLOKNotifier()) { + // There are some dialogs, like Hyperlink dialog, which inherit from + // SfxModalDialog even though they are modeless, i.e., their Execute method + // isn't called. SetLOKNotifier(SfxViewShell::Current()); const Size aSize = GetOptimalSize(); std::vector<vcl::LOKPayloadItem> aItems; @@ -228,6 +227,13 @@ void SfxModalDialog::StateChanged( StateChangedType nType ) aItems.emplace_back(std::make_pair("size", aSize.toString())); SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "created", aItems); } + else if (nType == StateChangedType::Visible && + !IsVisible() && + GetLOKNotifier()) + { + SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "close"); + ReleaseLOKNotifier(); + } } ModalDialog::StateChanged(nType); |