From f003eba0e30f41d036bed6fe417520fe66a3335f Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Fri, 24 Nov 2017 02:27:09 +0530 Subject: lokdialog: Let all modal dialogs notify about creation, disposal Change-Id: I8ec0ad81abcf1adf628906b02f7f94ab74a550b5 --- include/sfx2/basedlgs.hxx | 2 ++ sfx2/source/dialog/basedlgs.cxx | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index 6e1ef1256d01..30ad2fb0a2d5 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -71,6 +71,8 @@ protected: public: virtual ~SfxModalDialog() override; virtual void dispose() override; + + virtual short Execute() override; const SfxItemSet* GetOutputItemSet() const { return pOutputSet; } const SfxItemSet* GetInputItemSet() const { return pInputSet; } }; diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index a80c43c906d0..1a20dcf2576e 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -166,9 +166,33 @@ void SfxModalDialog::dispose() { SetDialogData_Impl(); delete pOutputSet; + + SfxViewShell* pViewShell = SfxViewShell::Current(); + if (comphelper::LibreOfficeKit::isActive() && pViewShell) + { + pViewShell->notifyDialog(maID, "close"); + pViewShell->UnregisterDlg(maID); + } + ModalDialog::dispose(); } +short SfxModalDialog::Execute() +{ + SfxViewShell* pViewShell = SfxViewShell::Current(); + if (comphelper::LibreOfficeKit::isActive() && pViewShell) + { + pViewShell->RegisterDlg(maID, this); + registerDialogNotifier(static_cast(pViewShell)); + const Size aSize = GetOptimalSize(); + std::vector aItems; + aItems.emplace_back(std::make_pair("size", aSize.toString())); + pViewShell->notifyDialog(maID, "created", aItems); + } + + return ModalDialog::Execute(); +} + void SfxModalDialog::CreateOutputItemSet( SfxItemPool& rPool ) { DBG_ASSERT( !pOutputSet, "Double creation of OutputSet!" ); -- cgit v1.2.3