diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-10-18 21:34:11 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-10-19 08:51:11 +0200 |
commit | ad18bb24d51e4f735085d50c496d28bd637dbb0b (patch) | |
tree | 026cff2345d0d7531debbba3bab9137d4a9a9151 | |
parent | 95ed72a4cda2826f56d6ef08267ddc89b0422c04 (diff) |
Turn ScGridWin::AutoFilterMode into scoped enum
...to avoid -Werror,-Wshadow from Clang trunk with
<https://reviews.llvm.org/D52400> "Improve -Wshadow warnings with enumerators",
warning about shadowing of SortAscending/Descending in enum SvSortMode in
include/svtools/treelist.hxx
Change-Id: I7022d3c6338c5ff50edf6362577f89f6609cd3e9
Reviewed-on: https://gerrit.libreoffice.org/61960
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 30 |
2 files changed, 16 insertions, 16 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 487559143a0c..06a01df9feae 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -300,7 +300,7 @@ protected: virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override; public: - enum AutoFilterMode { Normal, Top10, Custom, Empty, NonEmpty, SortAscending, SortDescending }; + enum class AutoFilterMode { Normal, Top10, Custom, Empty, NonEmpty, SortAscending, SortDescending }; ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ); virtual ~ScGridWindow() override; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index f3e7b40327a0..4ac3bc07b241 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -645,7 +645,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) mpAutoFilterPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, pDoc)); if (comphelper::LibreOfficeKit::isActive()) mpAutoFilterPopup->SetLOKNotifier(SfxViewShell::Current()); - mpAutoFilterPopup->setOKAction(new AutoFilterAction(this, Normal)); + mpAutoFilterPopup->setOKAction(new AutoFilterAction(this, AutoFilterMode::Normal)); mpAutoFilterPopup->setPopupEndAction( new AutoFilterPopupEndAction(this, ScAddress(nCol, nRow, nTab))); std::unique_ptr<AutoFilterData> pData(new AutoFilterData); @@ -700,20 +700,20 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) // Populate the menu. mpAutoFilterPopup->addMenuItem( ScResId(STR_MENU_SORT_ASC), - new AutoFilterAction(this, SortAscending)); + new AutoFilterAction(this, AutoFilterMode::SortAscending)); mpAutoFilterPopup->addMenuItem( ScResId(STR_MENU_SORT_DESC), - new AutoFilterAction(this, SortDescending)); + new AutoFilterAction(this, AutoFilterMode::SortDescending)); mpAutoFilterPopup->addSeparator(); mpAutoFilterPopup->addMenuItem( - ScResId(SCSTR_TOP10FILTER), new AutoFilterAction(this, Top10)); + ScResId(SCSTR_TOP10FILTER), new AutoFilterAction(this, AutoFilterMode::Top10)); mpAutoFilterPopup->addMenuItem( - ScResId(SCSTR_FILTER_EMPTY), new AutoFilterAction(this, Empty)); + ScResId(SCSTR_FILTER_EMPTY), new AutoFilterAction(this, AutoFilterMode::Empty)); mpAutoFilterPopup->addMenuItem( - ScResId(SCSTR_FILTER_NOTEMPTY), new AutoFilterAction(this, NonEmpty)); + ScResId(SCSTR_FILTER_NOTEMPTY), new AutoFilterAction(this, AutoFilterMode::NonEmpty)); mpAutoFilterPopup->addSeparator(); mpAutoFilterPopup->addMenuItem( - ScResId(SCSTR_STDFILTER), new AutoFilterAction(this, Custom)); + ScResId(SCSTR_STDFILTER), new AutoFilterAction(this, AutoFilterMode::Custom)); ScCheckListMenuWindow::Config aConfig; aConfig.mbAllowEmptySet = false; @@ -752,8 +752,8 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) svl::SharedStringPool& rPool = pDoc->GetSharedStringPool(); switch (eMode) { - case SortAscending: - case SortDescending: + case AutoFilterMode::SortAscending: + case AutoFilterMode::SortDescending: { SCCOL nCol = rPos.Col(); ScSortParam aSortParam; @@ -774,7 +774,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) aSortParam.bInplace = true; aSortParam.maKeyState[0].bDoSort = true; aSortParam.maKeyState[0].nField = nCol; - aSortParam.maKeyState[0].bAscending = (eMode == SortAscending); + aSortParam.maKeyState[0].bAscending = (eMode == AutoFilterMode::SortAscending); for (size_t i = 1; i < aSortParam.GetSortKeyCount(); ++i) aSortParam.maKeyState[i].bDoSort = false; @@ -786,7 +786,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) ; } - if (eMode == Custom) + if (eMode == AutoFilterMode::Custom) { ScRange aRange; pDBData->GetArea(aRange); @@ -819,7 +819,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) switch (eMode) { - case Normal: + case AutoFilterMode::Normal: { pEntry->eOp = SC_EQUAL; @@ -844,15 +844,15 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) } } break; - case Top10: + case AutoFilterMode::Top10: pEntry->eOp = SC_TOPVAL; pEntry->GetQueryItem().meType = ScQueryEntry::ByString; pEntry->GetQueryItem().maString = rPool.intern("10"); break; - case Empty: + case AutoFilterMode::Empty: pEntry->SetQueryByEmpty(); break; - case NonEmpty: + case AutoFilterMode::NonEmpty: pEntry->SetQueryByNonEmpty(); break; default: |