diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-11-23 08:22:02 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-11-23 09:01:40 +0100 |
commit | 6a56210854bc6600f559589531617fb65e250870 (patch) | |
tree | b9000a4b1b0d4fadfc26577be6ee3c11cb4fb5bb /sc/source | |
parent | 717438333eaa48898728ddc1f6b1394651dab48c (diff) |
ManageNames: disable some elements if table is empty
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/inc/namedlg.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index 6a9523f787bf..ed72e6576ae5 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -109,6 +109,7 @@ private: bool IsNameValid(); bool IsFormulaValid(); + void CheckForEmptyTable(); ScRangeName* GetRangeName(const rtl::OUString& rScope); diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 1f2060b21e89..f0c3b3fc9686 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -178,8 +178,12 @@ void ScNameDlg::Init() SelectionChanged(); } + CheckForEmptyTable(); + //TODO: fix the Add Button maBtnAdd.Disable(); + //TODO: discuss the Select Range button with UX + maBtnSelect.Disable(); } sal_Bool ScNameDlg::IsRefInputMode() const @@ -213,6 +217,35 @@ sal_Bool ScNameDlg::Close() return DoClose( ScNameDlgWrapper::GetChildWindowId() ); } +void ScNameDlg::CheckForEmptyTable() +{ + if (!mpRangeManagerTable->GetEntryCount()) + { + maBtnDelete.Disable(); + maEdAssign.Disable(); + maEdName.Disable(); + maLbScope.Disable(); + + maBtnCriteria.Disable(); + maBtnPrintArea.Disable(); + maBtnColHeader.Disable(); + maBtnRowHeader.Disable(); + } + else + { + maBtnDelete.Enable(); + maEdAssign.Enable(); + maEdName.Enable(); + maLbScope.Enable(); + + + maBtnCriteria.Enable(); + maBtnPrintArea.Enable(); + maBtnColHeader.Enable(); + maBtnRowHeader.Enable(); + } +} + void ScNameDlg::CancelPushed() { DoClose( ScNameDlgWrapper::GetChildWindowId() ); @@ -343,6 +376,7 @@ void ScNameDlg::RemovePushed() if (pData) pRangeName->erase(*pData); } + CheckForEmptyTable(); } void ScNameDlg::NameModified() @@ -400,6 +434,8 @@ void ScNameDlg::NameModified() void ScNameDlg::SelectionChanged() { + + //don't update if we have just modified due to user input if (!mbNeedUpdate) { |