diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-03 14:48:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-03 21:03:18 +0200 |
commit | 349d0e679a4ee296c703145afe73e65efc5d2bff (patch) | |
tree | 0366283ed5245f10315eae53e518bea7299d65b1 /sfx2 | |
parent | 19ec881034dbabbdc72779eb9382d0deb17ac569 (diff) |
Resolves: tdf#120277 special character dialog not appearing in Online
the magic smoke connecting the dialog to the viewshell was in
SfxModalDialog, so not inheriting from that drops the connection
add a SfxDialogController to enable setting up the connection
Change-Id: I29c45cd43e05295309fc647b039db0c6565ca0d1
Reviewed-on: https://gerrit.libreoffice.org/61304
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 64 |
1 files changed, 25 insertions, 39 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index f40dbc910efe..f8dfdc33123f 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -126,9 +126,15 @@ SfxModalDialog::SfxModalDialog(vcl::Window *pParent, const OUString& rID, const : ModalDialog(pParent, rID, rUIXMLDescription), pInputSet(nullptr) { + SetInstallLOKNotifierHdl(LINK(this, SfxModalDialog, InstallLOKNotifierHdl)); GetDialogData_Impl(); } +IMPL_LINK_NOARG(SfxModalDialog, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*) +{ + return SfxViewShell::Current(); +} + SfxModalDialog::~SfxModalDialog() { disposeOnce(); @@ -152,41 +158,6 @@ 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) - InstallLOKNotifierCallback(*this); - } - - ModalDialog::StateChanged(nType); -} - void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) { if ( nStateChange == StateChangedType::InitShow ) @@ -226,9 +197,6 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange ) } } - if (comphelper::LibreOfficeKit::isActive()) - InstallLOKNotifierCallback(*this); - pImpl->bConstructed = true; } @@ -302,9 +270,15 @@ SfxModelessDialog::SfxModelessDialog(SfxBindings* pBindinx, const OUString& rUIXMLDescription) : ModelessDialog(pParent, rID, rUIXMLDescription) { + SetInstallLOKNotifierHdl(LINK(this, SfxModelessDialog, InstallLOKNotifierHdl)); Init(pBindinx, pCW); } +IMPL_LINK_NOARG(SfxModelessDialog, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*) +{ + return SfxViewShell::Current(); +} + void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW) { pBindings = pBindinx; @@ -735,9 +709,21 @@ void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage) } } +SfxDialogController::SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, + const OString& rDialogId) + : GenericDialogController(pParent, rUIFile, rDialogId) +{ + m_xDialog->SetInstallLOKNotifierHdl(LINK(this, SfxDialogController, InstallLOKNotifierHdl)); +} + +IMPL_LINK_NOARG(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*) +{ + return SfxViewShell::Current(); +} + SfxSingleTabDialogController::SfxSingleTabDialogController(weld::Window *pParent, const SfxItemSet& rSet, const OUString& rUIXMLDescription, const OString& rID) - : GenericDialogController(pParent, rUIXMLDescription, rID) + : SfxDialogController(pParent, rUIXMLDescription, rID) , m_pInputSet(&rSet) , m_xContainer(m_xDialog->weld_content_area()) , m_xOKBtn(m_xBuilder->weld_button("ok")) |