sc/inc/strings.hrc | 1 + sc/qa/uitest/autofilter/autofilter.py | 2 ++ sc/qa/uitest/autofilter2/tdf126306.py | 4 ++-- sc/qa/uitest/autofilter2/tdf141559.py | 3 ++- sc/qa/uitest/autofilter2/tdf46184.py | 1 + sc/qa/uitest/autofilter2/tdf68113.py | 2 -- sc/source/ui/inc/gridwin.hxx | 5 +++-- sc/source/ui/view/gridwin.cxx | 11 +++++++++-- 8 files changed, 20 insertions(+), 9 deletions(-)
New commits: commit d8aae8057d76743cfc1591cbffda2f54c338a213 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Dec 9 16:27:43 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Dec 10 10:56:18 2021 +0100 Related: tdf#146018 move Top10 below empty/not-empty add add Bottom10 Change-Id: I3333c44b84dea8f8b1e61872606b50e9a384d8c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126621 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index ed39473c4637..96f4e8c3e0b2 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -33,6 +33,7 @@ #define SCSTR_STDFILTER NC_("SCSTR_STDFILTER", "Standard Filter...") #define SCSTR_CLEAR_FILTER NC_("SCSTR_CLEAR_FILTER", "Clear Filter") #define SCSTR_TOP10FILTER NC_("SCSTR_TOP10FILTER", "Top 10") +#define SCSTR_BOTTOM10FILTER NC_("SCSTR_BOTTOM10FILTER", "Bottom 10") #define SCSTR_FILTER_EMPTY NC_("SCSTR_FILTER_EMPTY", "Empty") #define SCSTR_FILTER_NOTEMPTY NC_("SCSTR_FILTER_NOTEMPTY", "Not Empty") #define SCSTR_FILTER_COLOR NC_("SCSTR_FILTER_COLOR", "Filter by Color") diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 21e6e4eed20b..bbfbbaab7118 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -431,6 +431,8 @@ class AutofilterTest(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) self.assertFalse(is_row_hidden(doc, 0)) diff --git a/sc/qa/uitest/autofilter2/tdf126306.py b/sc/qa/uitest/autofilter2/tdf126306.py index cf8dcd1f3f0a..51c099a3f3c2 100644 --- a/sc/qa/uitest/autofilter2/tdf126306.py +++ b/sc/qa/uitest/autofilter2/tdf126306.py @@ -84,6 +84,8 @@ class tdf126306(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) top10_hidden_values = [True, True, True, False, True, False, True, @@ -108,7 +110,6 @@ class tdf126306(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") - xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) empty_values = [False] * 14 @@ -132,7 +133,6 @@ class tdf126306(UITestCase): xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) #Nothing should change diff --git a/sc/qa/uitest/autofilter2/tdf141559.py b/sc/qa/uitest/autofilter2/tdf141559.py index 5f027a10ed43..e4eba12056b0 100644 --- a/sc/qa/uitest/autofilter2/tdf141559.py +++ b/sc/qa/uitest/autofilter2/tdf141559.py @@ -43,7 +43,7 @@ class tdf141559(UITestCase): xSubMenu = xSubFloatWindow.getChild("menu") nLastIdx = int(get_state_as_dict(xSubMenu)['Children']) - 1 - self.assertEqual(4, nLastIdx) + self.assertEqual(5, nLastIdx) # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional) self.assertEqual('Standard Filter...', get_state_as_dict(xSubMenu.getChild(str(nLastIdx)))['Text']) @@ -51,6 +51,7 @@ class tdf141559(UITestCase): xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) self.assertEqual("Standard Filter...", get_state_as_dict(xSubMenu)['SelectEntryText']) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) diff --git a/sc/qa/uitest/autofilter2/tdf46184.py b/sc/qa/uitest/autofilter2/tdf46184.py index 6f1edcaa781f..87908b833507 100755 --- a/sc/qa/uitest/autofilter2/tdf46184.py +++ b/sc/qa/uitest/autofilter2/tdf46184.py @@ -42,6 +42,7 @@ class tdf46184(UITestCase): xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) self.assertEqual("Standard Filter...", get_state_as_dict(xSubMenu)['SelectEntryText']) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) diff --git a/sc/qa/uitest/autofilter2/tdf68113.py b/sc/qa/uitest/autofilter2/tdf68113.py index 9c34ab5c9e85..74c35d65b665 100644 --- a/sc/qa/uitest/autofilter2/tdf68113.py +++ b/sc/qa/uitest/autofilter2/tdf68113.py @@ -39,7 +39,6 @@ class tdf68113(UITestCase): xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") - xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) # Checkbox elements @@ -65,7 +64,6 @@ class tdf68113(UITestCase): xSubFloatWindow = self.xUITest.getFloatWindow() xSubMenu = xSubFloatWindow.getChild("menu") xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) # Checkbox elements diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 2f8ac0deacfc..183705db2326 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -331,10 +331,11 @@ public: enum class AutoFilterMode { Normal, - Top10, - Custom, Empty, NonEmpty, + Top10, + Bottom10, + Custom, TextColor, BackgroundColor, SortAscending, diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 9e0328ba7991..6d832990f271 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -980,12 +980,14 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) pSubMenu->setPopupStartAction(new AutoFilterColorPopupStartAction(this, pSubMenu)); if (ScListSubMenuControl* pSubMenu = mpAutoFilterPopup->addSubMenuItem(ScResId(SCSTR_FILTER_CONDITION), true, false)) { - pSubMenu->addMenuItem( - ScResId(SCSTR_TOP10FILTER), new AutoFilterAction(this, AutoFilterMode::Top10)); pSubMenu->addMenuItem( ScResId(SCSTR_FILTER_EMPTY), new AutoFilterAction(this, AutoFilterMode::Empty)); pSubMenu->addMenuItem( ScResId(SCSTR_FILTER_NOTEMPTY), new AutoFilterAction(this, AutoFilterMode::NonEmpty)); + pSubMenu->addMenuItem( + ScResId(SCSTR_TOP10FILTER), new AutoFilterAction(this, AutoFilterMode::Top10)); + pSubMenu->addMenuItem( + ScResId(SCSTR_BOTTOM10FILTER), new AutoFilterAction(this, AutoFilterMode::Bottom10)); pSubMenu->addSeparator(); pSubMenu->addMenuItem( ScResId(SCSTR_STDFILTER), new AutoFilterAction(this, AutoFilterMode::Custom)); @@ -1163,6 +1165,11 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) pEntry->GetQueryItem().meType = ScQueryEntry::ByString; pEntry->GetQueryItem().maString = rPool.intern("10"); break; + case AutoFilterMode::Bottom10: + pEntry->eOp = SC_BOTVAL; + pEntry->GetQueryItem().meType = ScQueryEntry::ByString; + pEntry->GetQueryItem().maString = rPool.intern("10"); + break; case AutoFilterMode::Empty: pEntry->SetQueryByEmpty(); break;