convert FocusMoveDirection to scoped enum

and drop unused NONE enumerator

Change-Id: I793acf12ad25517a4d5fa6f886225b589d87176d
This commit is contained in:
Noel Grandin 2017-02-15 09:07:36 +02:00
parent 0ce9363dae
commit fdc970ef3a
3 changed files with 15 additions and 21 deletions

View File

@ -58,21 +58,17 @@ void FocusManager::MoveFocus (FocusMoveDirection eDirection)
const sal_Int32 nPageCount (mrSlideSorter.GetModel().GetPageCount()); const sal_Int32 nPageCount (mrSlideSorter.GetModel().GetPageCount());
switch (eDirection) switch (eDirection)
{ {
case FMD_NONE: case FocusMoveDirection::Left:
// Nothing to be done.
break;
case FMD_LEFT:
if (mnPageIndex > 0) if (mnPageIndex > 0)
mnPageIndex -= 1; mnPageIndex -= 1;
break; break;
case FMD_RIGHT: case FocusMoveDirection::Right:
if (mnPageIndex < nPageCount-1) if (mnPageIndex < nPageCount-1)
mnPageIndex += 1; mnPageIndex += 1;
break; break;
case FMD_UP: case FocusMoveDirection::Up:
{ {
const sal_Int32 nCandidate (mnPageIndex - nColumnCount); const sal_Int32 nCandidate (mnPageIndex - nColumnCount);
if (nCandidate >= 0) if (nCandidate >= 0)
@ -83,7 +79,7 @@ void FocusManager::MoveFocus (FocusMoveDirection eDirection)
} }
break; break;
case FMD_DOWN: case FocusMoveDirection::Down:
{ {
const sal_Int32 nCandidate (mnPageIndex + nColumnCount); const sal_Int32 nCandidate (mnPageIndex + nColumnCount);
if (nCandidate < nPageCount) if (nCandidate < nPageCount)

View File

@ -445,25 +445,25 @@ bool SelectionFunction::KeyInput (const KeyEvent& rEvent)
// Move the focus indicator left. // Move the focus indicator left.
case KEY_LEFT: case KEY_LEFT:
MoveFocus(FocusManager::FMD_LEFT, rCode.IsShift(), rCode.IsMod1()); MoveFocus(FocusManager::FocusMoveDirection::Left, rCode.IsShift(), rCode.IsMod1());
bResult = true; bResult = true;
break; break;
// Move the focus indicator right. // Move the focus indicator right.
case KEY_RIGHT: case KEY_RIGHT:
MoveFocus(FocusManager::FMD_RIGHT, rCode.IsShift(), rCode.IsMod1()); MoveFocus(FocusManager::FocusMoveDirection::Right, rCode.IsShift(), rCode.IsMod1());
bResult = true; bResult = true;
break; break;
// Move the focus indicator up. // Move the focus indicator up.
case KEY_UP: case KEY_UP:
MoveFocus(FocusManager::FMD_UP, rCode.IsShift(), rCode.IsMod1()); MoveFocus(FocusManager::FocusMoveDirection::Up, rCode.IsShift(), rCode.IsMod1());
bResult = true; bResult = true;
break; break;
// Move the focus indicator down. // Move the focus indicator down.
case KEY_DOWN: case KEY_DOWN:
MoveFocus(FocusManager::FMD_DOWN, rCode.IsShift(), rCode.IsMod1()); MoveFocus(FocusManager::FocusMoveDirection::Down, rCode.IsShift(), rCode.IsMod1());
bResult = true; bResult = true;
break; break;

View File

@ -49,13 +49,12 @@ public:
~FocusManager(); ~FocusManager();
enum FocusMoveDirection enum class FocusMoveDirection
{ {
FMD_NONE, Left,
FMD_LEFT, Right,
FMD_RIGHT, Up,
FMD_UP, Down
FMD_DOWN
}; };
/** Move the focus from the currently focused page to one that is /** Move the focus from the currently focused page to one that is
@ -66,10 +65,9 @@ public:
wrap around takes place in the same column, i.e. when you are wrap around takes place in the same column, i.e. when you are
in the top row and move up you come out in the bottom row in the in the top row and move up you come out in the bottom row in the
same column. Horizontal wrap around moves to the next same column. Horizontal wrap around moves to the next
(FMD_RIGHT) or previous (FMD_LEFT) page. Moving to the right (FocusMoveDirection::Right) or previous (FocusMoveDirection::Left) page. Moving to the right
from the last page goes to the first page and vice versa. from the last page goes to the first page and vice versa.
When FMD_NONE is given, the current page index is checked for The current page index is set to the nearest valid
being valid. If it is not, then it is set to the nearest valid
page index. page index.
*/ */
void MoveFocus (FocusMoveDirection eDirection); void MoveFocus (FocusMoveDirection eDirection);