summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-12-14 13:11:00 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-12-14 14:15:31 +0530
commit76de866e162502518acbc0ab020c257b80946c2d (patch)
tree21d3f67869f5f356734e81e90b4e035cfedde08a /sfx2
parent53f8f28c53391ef1cadefaf16c3a9e81e04ac7f5 (diff)
lokdialog: Send close callback when dialog dissappears too
Change-Id: I88bea3dc1ae938d31462e85ca1a8f48dd13e8e89
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/basedlgs.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index f44ed4c15446..a11ddad63f02 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -161,10 +161,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();
}
@@ -208,13 +207,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;
@@ -222,6 +221,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);