sc/source/ui/dbgui/dbnamdlg.cxx | 8 ++++++-- sc/source/ui/inc/dbnamdlg.hxx | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
New commits: commit b74376687e1927d89b00838d384816ae970ea25b Author: Tünde Tóth <[email protected]> AuthorDate: Thu Jul 29 10:00:06 2021 +0200 Commit: Tünde Tóth <[email protected]> CommitDate: Thu Oct 21 10:53:25 2021 +0200 tdf#115520 sc UI: Define Database Range dialog disappeared if the name of the database range was invalid. Change-Id: If0eb08d35b2187f04ef93136acd6f7eafa3b588a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119652 Tested-by: Jenkins Reviewed-by: Eike Rathke <[email protected]> (cherry picked from commit a07351e8181353c0c0b6df5d2ccbad4615c6706b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123861 Tested-by: Tünde Tóth <[email protected]> Reviewed-by: Tünde Tóth <[email protected]> diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 361a4bae505e..73c924c638df 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -249,6 +249,7 @@ void ScDbNameDlg::Init() bSaved = true; xSaveObj->Save(); NameModifyHdl( *m_xEdName ); + bInvalid = false; } void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData ) @@ -376,17 +377,18 @@ bool ScDbNameDlg::IsRefInputMode() const IMPL_LINK_NOARG(ScDbNameDlg, OkBtnHdl, weld::Button&, void) { + bInvalid = false; AddBtnHdl(*m_xBtnAdd); // Pass the changes and the remove list to the view: both are // transferred as a reference only, so that no dead memory can // be created at this point: + if (!bInvalid) { ScDBDocFunc aFunc(*m_rViewData.GetDocShell()); aFunc.ModifyAllDBData(aLocalDbCol, aRemoveList); + response(RET_OK); } - - response(RET_OK); } IMPL_LINK_NOARG(ScDbNameDlg, CancelBtnHdl, weld::Button&, void) @@ -468,6 +470,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void) ERRORBOX(m_xDialog.get(), aStrInvalid); m_xEdAssign->SelectAll(); m_xEdAssign->GrabFocus(); + bInvalid = true; } } else @@ -475,6 +478,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void) ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDNAME)); m_xEdName->select_entry_region(0, -1); m_xEdName->grab_focus(); + bInvalid = true; } } diff --git a/sc/source/ui/inc/dbnamdlg.hxx b/sc/source/ui/inc/dbnamdlg.hxx index fa7cc13dad4f..f179f783f177 100644 --- a/sc/source/ui/inc/dbnamdlg.hxx +++ b/sc/source/ui/inc/dbnamdlg.hxx @@ -42,6 +42,7 @@ public: private: bool bSaved; + bool bInvalid; OUString aStrAdd; OUString aStrModify;
