diff options
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")) |