[Libreoffice-commits] core.git: sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Oct 3 19:03:15 UTC 2018
sfx2/source/dialog/basedlgs.cxx | 52 ++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 25 deletions(-)
New commits:
commit 19ec881034dbabbdc72779eb9382d0deb17ac569
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 3 12:06:56 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 3 21:02:53 2018 +0200
Related: tdf#120277 extract common piece of SfxModalDialog LOK notification
Change-Id: Ie14cd80d5c33f58673823ee16fa8037efaa17773
Reviewed-on: https://gerrit.libreoffice.org/61303
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index bb944a05e89b..f40dbc910efe 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -152,30 +152,41 @@ void SfxModalDialog::CreateOutputItemSet( const SfxItemSet& rSet )
}
}
+namespace
+{
+ void InstallLOKNotifierCallback(Dialog& rDialog)
+ {
+ if (rDialog.GetLOKNotifier())
+ return;
+
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if (!pViewShell)
+ return;
+
+ // There are some dialogs, like Hyperlink dialog, which inherit from
+ // SfxModalDialog even though they are modeless, i.e., their Execute method
+ // isn't called.
+ rDialog.SetLOKNotifier(pViewShell);
+ std::vector<vcl::LOKPayloadItem> aItems;
+ aItems.emplace_back("type", "dialog");
+ aItems.emplace_back("size", rDialog.GetSizePixel().toString());
+ if (!rDialog.GetText().isEmpty())
+ aItems.emplace_back("title", rDialog.GetText().toUtf8());
+ pViewShell->notifyWindow(rDialog.GetLOKWindowId(), "created", aItems);
+ }
+}
void SfxModalDialog::StateChanged( StateChangedType nType )
{
if (comphelper::LibreOfficeKit::isActive())
{
- 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());
- 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());
- SfxViewShell::Current()->notifyWindow(GetLOKWindowId(), "created", aItems);
- }
+ if (nType == StateChangedType::InitShow)
+ InstallLOKNotifierCallback(*this);
}
ModalDialog::StateChanged(nType);
}
-
void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
{
if ( nStateChange == StateChangedType::InitShow )
@@ -215,17 +226,8 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
}
}
- SfxViewShell* pViewShell = SfxViewShell::Current();
- if (comphelper::LibreOfficeKit::isActive() && pViewShell && !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);
- }
+ if (comphelper::LibreOfficeKit::isActive())
+ InstallLOKNotifierCallback(*this);
pImpl->bConstructed = true;
}
More information about the Libreoffice-commits
mailing list