diff options
Diffstat (limited to 'sw/source/ui/fldui/fldtdlg.cxx')
-rw-r--r-- | sw/source/ui/fldui/fldtdlg.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index 8c1bb998fb85..084c4d66c8c7 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -110,9 +110,16 @@ void SwFieldDlg::Close() { if (m_bClosing) return; - m_pBindings->GetDispatcher()-> + const SfxPoolItem* pResult = m_pBindings->GetDispatcher()-> Execute(m_bDataBaseMode ? FN_INSERT_FIELD_DATA_ONLY : FN_INSERT_FIELD, SfxCallMode::SYNCHRON|SfxCallMode::RECORD); + if (!pResult) + { + // If Execute action did fail for whatever reason, this means that request + // to close did fail or wasn't delivered to SwTextShell::ExecField(). + // Just explicitly close dialog in this case. + SfxTabDialogController::EndDialog(); + } } void SwFieldDlg::Initialize(SfxChildWinInfo const *pInfo) @@ -179,8 +186,9 @@ void SwFieldDlg::ReInitDlg() if(!pActiveView) return; const SwWrtShell& rSh = pActiveView->GetWrtShell(); - GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() || - !rSh.HasReadonlySel()); + GetOKButton().set_sensitive(( !rSh.IsReadOnlyAvailable() + || !rSh.HasReadonlySel()) + && !SwCursorShell::PosInsideInputField(*rSh.GetCursor()->GetPoint())); ReInitTabPage("document"); ReInitTabPage("variables"); @@ -212,8 +220,10 @@ void SwFieldDlg::Activate() { bool bHtmlMode = (::GetHtmlMode(static_cast<SwDocShell*>(SfxObjectShell::Current())) & HTMLMODE_ON) != 0; const SwWrtShell& rSh = pView->GetWrtShell(); - GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() || - !rSh.HasReadonlySel()); + GetOKButton().set_sensitive(( !rSh.IsReadOnlyAvailable() + || !rSh.HasReadonlySel()) + && !SwCursorShell::PosInsideInputField(*rSh.GetCursor()->GetPoint())); + ReInitTabPage("variables", true); @@ -233,9 +243,12 @@ void SwFieldDlg::EnableInsert(bool bEnable) OSL_ENSURE(pView, "no view found"); if( !pView || (pView->GetWrtShell().IsReadOnlyAvailable() && - pView->GetWrtShell().HasReadonlySel()) ) + pView->GetWrtShell().HasReadonlySel()) + || SwCursorShell::PosInsideInputField(*pView->GetWrtShell().GetCursor()->GetPoint())) + { bEnable = false; } + } GetOKButton().set_sensitive(bEnable); } |