diff options
author | Jan Holesovsky <kendy@collabora.com> | 2018-01-13 12:10:43 +0000 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-01-15 17:40:11 +0100 |
commit | d0f4f27465da113748ca63103692c45da64af6f5 (patch) | |
tree | 7f0d3c2038b080dd98127e298402ae0144b21758 /include | |
parent | aceaaaa85fd824611349e637f37b9644b6fe62cb (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/47817
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 efed3fff4d35..a758d4544291 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 c173326706c8..55260f51aef3 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -24,6 +24,7 @@ #include <vcl/dllapi.h> #include <vcl/vclreferencebase.hxx> #include <vector> +#include <functional> namespace vcl { class Window; } class Dialog; @@ -41,6 +42,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 706cd762db94..aa837f741c2c 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -25,6 +25,7 @@ #include <vcl/syswin.hxx> #include <vcl/vclptr.hxx> #include <vcl/IDialogRenderable.hxx> +#include <vcl/abstdlg.hxx> struct DialogImpl; class VclBox; @@ -37,6 +38,7 @@ public: private: VclPtr<Dialog> mpPrevExecuteDlg; + VclPtr<Dialog> mpNextExecuteDlg; std::unique_ptr<DialogImpl> mpDialogImpl; long mnMousePositioned; bool mbInExecute; @@ -48,6 +50,7 @@ private: VclPtr<VclButtonBox> mpActionArea; VclPtr<VclBox> mpContentArea; + SAL_DLLPRIVATE void RemoveFromDlgList(); SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); @@ -124,6 +127,20 @@ private: static void ImplEndExecuteModal(); 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 |