diff options
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/ui/dlg/formula.cxx | 13 | ||||
-rw-r--r-- | formula/source/ui/dlg/funcpage.cxx | 9 |
2 files changed, 18 insertions, 4 deletions
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 0d0a6462ea0c..1cf839d12eb3 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -1041,7 +1041,16 @@ IMPL_LINK_TYPED( FormulaDlg_Impl, BtnHdl, Button*, pBtn, void ) } else if ( pBtn == m_pBtnForward ) { - const IFunctionDescription* pDesc =pFuncPage->GetFuncDesc( pFuncPage->GetFunction() ); + const IFunctionDescription* pDesc; + sal_Int32 nSelFunc = pFuncPage->GetFunction(); + if (nSelFunc != LISTBOX_ENTRY_NOTFOUND) + pDesc = pFuncPage->GetFuncDesc( nSelFunc ); + else + { + // Do not overwrite the selected formula expression, just edit the + // unlisted function. + pFuncDesc = pDesc = nullptr; + } if(pDesc==pFuncDesc || !pFuncPage->IsVisible()) EditNextFunc( true ); @@ -1963,7 +1972,7 @@ void FormEditData::Reset() nMode = 0; nFStart = 0; nCatSel = 1; //! oder 0 (zuletzt benutzte) - nFuncSel = 0; + nFuncSel = LISTBOX_ENTRY_NOTFOUND; nOffset = 0; nEdFocus = 0; bMatrix = false; diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx index 42a2b351a81d..7b83298fd658 100644 --- a/formula/source/ui/dlg/funcpage.cxx +++ b/formula/source/ui/dlg/funcpage.cxx @@ -155,7 +155,9 @@ void FuncPage::UpdateFunctionList() m_pLbFunction->SetUpdateMode( true ); - m_pLbFunction->SelectEntryPos(0); + // Ensure no function is selected so the Next button doesn't overwrite a + // function that is not in the list with an arbitrary selected one. + m_pLbFunction->SetNoSelection(); if(IsVisible()) SelHdl(*m_pLbFunction); } @@ -198,7 +200,10 @@ sal_Int32 FuncPage::GetFuncPos(const IFunctionDescription* _pDesc) void FuncPage::SetFunction(sal_Int32 nFunc) { - m_pLbFunction->SelectEntryPos(nFunc); + if (nFunc == LISTBOX_ENTRY_NOTFOUND) + m_pLbFunction->SetNoSelection(); + else + m_pLbFunction->SelectEntryPos(nFunc); } void FuncPage::SetFocus() |