summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/swabstdlg.hxx1
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx8
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx6
-rw-r--r--sw/source/uibase/inc/insfnote.hxx10
-rw-r--r--sw/source/uibase/shells/textsh1.cxx30
-rw-r--r--sw/source/uibase/uiview/viewdlg2.cxx11
6 files changed, 40 insertions, 26 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 4ea4085f387e..621ac8cd666f 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -113,6 +113,7 @@ class AbstractInsFootNoteDlg : public VclAbstractDialog
protected:
virtual ~AbstractInsFootNoteDlg() override = default;
public:
+ virtual void Apply() = 0;
virtual OUString GetFontName() = 0;
virtual bool IsEndNote() = 0;
virtual OUString GetStr() = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 5b26dcd38c59..66a77db67b4b 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -298,7 +298,13 @@ short AbstractFieldInputDlg_Impl::Execute()
short AbstractInsFootNoteDlg_Impl::Execute()
{
- return m_xDlg->run();
+ assert(false);
+ return -1;
+}
+
+bool AbstractInsFootNoteDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+ return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
}
short AbstractJavaEditDialog_Impl::Execute()
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 92e565f5bfcf..5ebcbdd7509e 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -550,13 +550,15 @@ public:
class SwInsFootNoteDlg;
class AbstractInsFootNoteDlg_Impl : public AbstractInsFootNoteDlg
{
- std::unique_ptr<SwInsFootNoteDlg> m_xDlg;
+ std::shared_ptr<SwInsFootNoteDlg> m_xDlg;
public:
- explicit AbstractInsFootNoteDlg_Impl(std::unique_ptr<SwInsFootNoteDlg> p)
+ explicit AbstractInsFootNoteDlg_Impl(std::shared_ptr<SwInsFootNoteDlg> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
+ virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
+ virtual void Apply() override { m_xDlg->Apply(); }
virtual OUString GetFontName() override;
virtual bool IsEndNote() override;
virtual OUString GetStr() override;
diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx
index 396e87404644..7e9bb2649029 100644
--- a/sw/source/uibase/inc/insfnote.hxx
+++ b/sw/source/uibase/inc/insfnote.hxx
@@ -54,8 +54,6 @@ class SwInsFootNoteDlg final : public weld::GenericDialogController
DECL_LINK(NumberExtCharHdl, weld::Button&, void);
DECL_LINK(NextPrevHdl, weld::Button&, void);
- void Apply();
-
void Init();
public:
@@ -70,13 +68,7 @@ public:
return m_xNumberCharEdit->get_text();
return OUString();
}
- virtual short run() override
- {
- short nRet = GenericDialogController::run();
- if (nRet == RET_OK)
- Apply();
- return nRet;
- }
+ void Apply();
};
#endif
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 23fd3e4804d4..1a70f027fdef 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -990,20 +990,26 @@ void SwTextShell::Execute(SfxRequest &rReq)
case FN_INSERT_FOOTNOTE_DLG:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg(
+ VclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg(
GetView().GetFrameWeld(), rWrtSh));
pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
- if ( pDlg->Execute() == RET_OK )
- {
- const sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
- SfxRequest aReq(GetView().GetViewFrame(), nId);
- if ( !pDlg->GetStr().isEmpty() )
- aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
- if ( !pDlg->GetFontName().isEmpty() )
- aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
- ExecuteSlot( aReq );
- }
-
+ pDlg->StartExecuteAsync(
+ [this, pDlg] (sal_Int32 nResult)->void
+ {
+ if ( nResult == RET_OK )
+ {
+ pDlg->Apply();
+ const sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
+ SfxRequest aReq(GetView().GetViewFrame(), nId);
+ if ( !pDlg->GetStr().isEmpty() )
+ aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
+ if ( !pDlg->GetFontName().isEmpty() )
+ aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
+ ExecuteSlot( aReq );
+ }
+ pDlg->disposeOnce();
+ }
+ );
rReq.Ignore();
}
break;
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx
index bd2b9509e6d9..7d78b693dfaa 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -130,12 +130,19 @@ void SwView::ExecDlgExt(SfxRequest& rReq)
case FN_EDIT_FOOTNOTE:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg(
+ VclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg(
GetFrameWeld(), *m_pWrtShell, true));
pDlg->SetHelpId(GetStaticInterface()->GetSlot(FN_EDIT_FOOTNOTE)->GetCommand());
pDlg->SetText( SwResId(STR_EDIT_FOOTNOTE) );
- pDlg->Execute();
+ pDlg->StartExecuteAsync(
+ [pDlg] (sal_Int32 nResult)->void
+ {
+ if (nResult == RET_OK)
+ pDlg->Apply();
+ pDlg->disposeOnce();
+ }
+ );
break;
}
}