Kaydet (Commit) 8fd85527 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#58998 insert section applied twice

regression since 0157f0b1

my belief was that OK_Impl was only called in one
place, in sw/source/ui/fmtui/tmpdlg.cxx, so I
merged the use there into OK_Impl, but of course
there was another use in sfx2/source/dialog/tabdlg.cxx

Given that OK_Impl only called PrepareLeaveCurrentPage originally...

a) replace OK_Impl in sfx2/source/dialog/tabdlg.cxx
with PrepareLeaveCurrentPage, a no-op from the original state.
b) add an Apply method that does what I want, i.e.
call ok without closing the dialog, so we can retain
the fix of fdo#38606 to have "apply" immediately
apply the effect of pressing "ok" without closing
and reopening the dialog

Change-Id: I57e2e41c07ab9bf89ada98d1b9c3336db3493f19
üst 47d95d75
...@@ -219,13 +219,9 @@ public: ...@@ -219,13 +219,9 @@ public:
void SetApplyHandler(const Link& _rHdl); void SetApplyHandler(const Link& _rHdl);
SAL_DLLPRIVATE void Start_Impl(); SAL_DLLPRIVATE void Start_Impl();
bool OK_Impl()
{ //calls Ok without closing dialog
bool bRet = PrepareLeaveCurrentPage(); bool Apply();
if (bRet)
Ok();
return bRet;
}
}; };
namespace sfx { class ItemConnectionBase; } namespace sfx { class ItemConnectionBase; }
......
...@@ -1175,7 +1175,7 @@ IMPL_LINK_NOARG(SfxTabDialog, OkHdl) ...@@ -1175,7 +1175,7 @@ IMPL_LINK_NOARG(SfxTabDialog, OkHdl)
{ {
pImpl->bInOK = sal_True; pImpl->bInOK = sal_True;
if ( OK_Impl() ) if (PrepareLeaveCurrentPage())
{ {
if ( pImpl->bModal ) if ( pImpl->bModal )
EndDialog( Ok() ); EndDialog( Ok() );
...@@ -1188,6 +1188,14 @@ IMPL_LINK_NOARG(SfxTabDialog, OkHdl) ...@@ -1188,6 +1188,14 @@ IMPL_LINK_NOARG(SfxTabDialog, OkHdl)
return 0; return 0;
} }
bool SfxTabDialog::Apply()
{
bool bApplied = false;
if (PrepareLeaveCurrentPage())
bApplied = (Ok() == RET_OK);
return bApplied;
}
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
bool SfxTabDialog::PrepareLeaveCurrentPage() bool SfxTabDialog::PrepareLeaveCurrentPage()
......
...@@ -159,7 +159,7 @@ String AbstractTabDialog_Impl::GetText() const ...@@ -159,7 +159,7 @@ String AbstractTabDialog_Impl::GetText() const
IMPL_LINK_NOARG(AbstractApplyTabDialog_Impl, ApplyHdl) IMPL_LINK_NOARG(AbstractApplyTabDialog_Impl, ApplyHdl)
{ {
if (pDlg->OK_Impl()) if (pDlg->Apply())
m_aHandler.Call(NULL); m_aHandler.Call(NULL);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment