diff options
author | Jan Holesovsky <kendy@collabora.com> | 2018-01-12 11:57:22 +0000 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-01-15 17:44:42 +0100 |
commit | c40dfabd56ade10fe35690dc9810955c2e99e2c0 (patch) | |
tree | 0ae297ec41e2a1a5e4e078180c18320a83823a89 /include | |
parent | 5942140c5149065ffb5adf9d33b21aeceeabf957 (diff) |
lokdialog: Allow closing the Format Cell dialogs in any order.
Includes also lots of infrastructural changes, making the
conversion of the rest of the dialogs much easier.
StartExecuteAsync should be used in-place of StartExecuteModal
and the latter removed from the code-base incrementally. More
common code from Dialog::Execute should be moved to
ImplStartExecuteModal in a next step, as this is used more widely.
Change-Id: Idb2c1ec790e38f582438471a0419a56cdcf1439d
Reviewed-on: https://gerrit.libreoffice.org/47722
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/tabdlg.hxx | 1 | ||||
-rw-r--r-- | include/vcl/abstdlg.hxx | 18 | ||||
-rw-r--r-- | include/vcl/dialog.hxx | 17 |
3 files changed, 36 insertions, 0 deletions
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 06f99318c3c0..409b15196307 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -190,6 +190,7 @@ public: short Execute() override; void StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) override; + bool StartExecuteAsync( VclAbstractDialog::AsyncContext &rCtx ) override; void Start(); const SfxItemSet* GetExampleSet() const { return m_pExampleSet; } diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 40f75ed293b6..87336e0d5a5f 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -25,6 +25,7 @@ #include <vcl/vclptr.hxx> #include <vcl/vclreferencebase.hxx> #include <vector> +#include <functional> namespace vcl { class Window; } class Dialog; @@ -42,6 +43,23 @@ protected: public: virtual short Execute() = 0; + struct AsyncContext { + VclPtr<VclReferenceBase> mxOwner; + std::function<void(sal_Int32)> maEndDialogFn; + bool isSet() { return !!maEndDialogFn; } + }; + + bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn, VclPtr<VclReferenceBase> xOwner) + { + AsyncContext aCtx; + aCtx.mxOwner = xOwner; + aCtx.maEndDialogFn = rEndDialogFn; + return StartExecuteAsync(aCtx); + } + + /// Commence execution of a modal dialog. + virtual bool StartExecuteAsync(AsyncContext &); + // Screenshot interface virtual std::vector<OString> getAllPageUIXMLDescriptions() const; virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription); diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 3da4ec0cb59a..6dea53f47058 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -26,6 +26,7 @@ #include <vcl/syswin.hxx> #include <vcl/vclptr.hxx> #include <vcl/IDialogRenderable.hxx> +#include <vcl/abstdlg.hxx> struct DialogImpl; class VclBox; @@ -45,6 +46,7 @@ public: private: VclPtr<Dialog> mpPrevExecuteDlg; + VclPtr<Dialog> mpNextExecuteDlg; std::unique_ptr<DialogImpl> mpDialogImpl; long mnMousePositioned; bool mbInExecute; @@ -57,6 +59,7 @@ private: VclPtr<VclButtonBox> mpActionArea; VclPtr<VclBox> mpContentArea; + SAL_DLLPRIVATE void RemoveFromDlgList(); SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); SAL_DLLPRIVATE VclPtr<vcl::Window> AddBorderWindow(vcl::Window* pParent, WinBits nBits); @@ -138,6 +141,20 @@ private: void ImplSetModalInputMode(bool bModal); public: + // FIXME: Need to remove old StartExecuteModal in favour of this one. + /// Returns true of the dialog successfully starts + bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn, + VclPtr<VclReferenceBase> xOwner = VclPtr<VclReferenceBase>()) + { + VclAbstractDialog::AsyncContext aCtx; + aCtx.mxOwner = xOwner; + aCtx.maEndDialogFn = rEndDialogFn; + return StartExecuteAsync(aCtx); + } + + /// Commence execution of a modal dialog, disposes owner on failure + virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx); + // Dialog::Execute replacement API |