Kaydet (Commit) 83a597af authored tarafından Caolán McNamara's avatar Caolán McNamara

WaE: -Werror=switch

Change-Id: Ic5b7f1da92ac5a936857fe122cb8db0441b6d291
üst 2dc8ed69
...@@ -52,37 +52,29 @@ namespace svt ...@@ -52,37 +52,29 @@ namespace svt
bool ComboBoxControl::PreNotify( NotifyEvent& rNEvt ) bool ComboBoxControl::PreNotify( NotifyEvent& rNEvt )
{ {
switch (rNEvt.GetType()) if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT && !IsInDropDown())
{ {
case MouseNotifyEvent::KEYINPUT: const KeyEvent *pEvt = rNEvt.GetKeyEvent();
if (!IsInDropDown()) const vcl::KeyCode rKey = pEvt->GetKeyCode();
if ((rKey.GetCode() == KEY_UP || rKey.GetCode() == KEY_DOWN) &&
(!pEvt->GetKeyCode().IsShift() && pEvt->GetKeyCode().IsMod1()))
{
// select next resp. previous entry
sal_Int32 nPos = GetEntryPos(GetText());
int nDir = (rKey.GetCode() == KEY_DOWN ? 1 : -1);
if (!((nPos == 0 && nDir == -1) || (nPos >= GetEntryCount() && nDir == 1)))
{ {
const KeyEvent *pEvt = rNEvt.GetKeyEvent(); nPos += nDir;
const vcl::KeyCode rKey = pEvt->GetKeyCode(); SetText(GetEntry(nPos));
if ((rKey.GetCode() == KEY_UP || rKey.GetCode() == KEY_DOWN) &&
(!pEvt->GetKeyCode().IsShift() && pEvt->GetKeyCode().IsMod1()))
{
// select next resp. previous entry
sal_Int32 nPos = GetEntryPos(GetText());
int nDir = (rKey.GetCode() == KEY_DOWN ? 1 : -1);
if (!((nPos == 0 && nDir == -1) || (nPos >= GetEntryCount() && nDir == 1)))
{
nPos += nDir;
SetText(GetEntry(nPos));
}
return true;
}
} }
break; return true;
}
} }
return ComboBox::PreNotify(rNEvt); return ComboBox::PreNotify(rNEvt);
} }
//= ComboBoxCellController //= ComboBoxCellController
ComboBoxCellController::ComboBoxCellController(ComboBoxControl* pWin) ComboBoxCellController::ComboBoxCellController(ComboBoxControl* pWin)
:CellController(pWin) :CellController(pWin)
{ {
...@@ -133,22 +125,17 @@ namespace svt ...@@ -133,22 +125,17 @@ namespace svt
return GetComboBox().IsValueChangedFromSaved(); return GetComboBox().IsValueChangedFromSaved();
} }
void ComboBoxCellController::ClearModified() void ComboBoxCellController::ClearModified()
{ {
GetComboBox().SaveValue(); GetComboBox().SaveValue();
} }
void ComboBoxCellController::SetModifyHdl(const Link& rLink) void ComboBoxCellController::SetModifyHdl(const Link& rLink)
{ {
GetComboBox().SetModifyHdl(rLink); GetComboBox().SetModifyHdl(rLink);
} }
//= ListBoxControl //= ListBoxControl
ListBoxControl::ListBoxControl(vcl::Window* pParent, WinBits nWinStyle) ListBoxControl::ListBoxControl(vcl::Window* pParent, WinBits nWinStyle)
:ListBox(pParent, nWinStyle|WB_DROPDOWN|WB_NOBORDER) :ListBox(pParent, nWinStyle|WB_DROPDOWN|WB_NOBORDER)
{ {
...@@ -157,43 +144,34 @@ namespace svt ...@@ -157,43 +144,34 @@ namespace svt
SetDropDownLineCount(20); SetDropDownLineCount(20);
} }
bool ListBoxControl::PreNotify( NotifyEvent& rNEvt ) bool ListBoxControl::PreNotify( NotifyEvent& rNEvt )
{ {
switch (rNEvt.GetType()) switch (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT && !IsInDropDown())
{ {
case MouseNotifyEvent::KEYINPUT: const KeyEvent *pEvt = rNEvt.GetKeyEvent();
if (!IsInDropDown()) const vcl::KeyCode rKey = pEvt->GetKeyCode();
if ((rKey.GetCode() == KEY_UP || rKey.GetCode() == KEY_DOWN) &&
(!pEvt->GetKeyCode().IsShift() && pEvt->GetKeyCode().IsMod1()))
{
// select next resp. previous entry
sal_Int32 nPos = GetSelectEntryPos();
int nDir = (rKey.GetCode() == KEY_DOWN ? 1 : -1);
if (!((nPos == 0 && nDir == -1) || (nPos >= GetEntryCount() && nDir == 1)))
{ {
const KeyEvent *pEvt = rNEvt.GetKeyEvent(); nPos += nDir;
const vcl::KeyCode rKey = pEvt->GetKeyCode(); SelectEntryPos(nPos);
if ((rKey.GetCode() == KEY_UP || rKey.GetCode() == KEY_DOWN) &&
(!pEvt->GetKeyCode().IsShift() && pEvt->GetKeyCode().IsMod1()))
{
// select next resp. previous entry
sal_Int32 nPos = GetSelectEntryPos();
int nDir = (rKey.GetCode() == KEY_DOWN ? 1 : -1);
if (!((nPos == 0 && nDir == -1) || (nPos >= GetEntryCount() && nDir == 1)))
{
nPos += nDir;
SelectEntryPos(nPos);
}
Select(); // for calling Modify
return true;
}
else if (GetParent()->PreNotify(rNEvt))
return true;
} }
break; Select(); // for calling Modify
return true;
}
else if (GetParent()->PreNotify(rNEvt))
return true;
} }
return ListBox::PreNotify(rNEvt); return ListBox::PreNotify(rNEvt);
} }
//= ListBoxCellController //= ListBoxCellController
ListBoxCellController::ListBoxCellController(ListBoxControl* pWin) ListBoxCellController::ListBoxCellController(ListBoxControl* pWin)
:CellController(pWin) :CellController(pWin)
{ {
...@@ -333,6 +311,9 @@ namespace svt ...@@ -333,6 +311,9 @@ namespace svt
break; break;
case MouseNotifyEvent::LOSEFOCUS: case MouseNotifyEvent::LOSEFOCUS:
HideFocus(); HideFocus();
break;
default:
break;
} }
return Control::PreNotify(rEvt); return Control::PreNotify(rEvt);
} }
......
...@@ -68,17 +68,18 @@ namespace svt ...@@ -68,17 +68,18 @@ namespace svt
if ( IsWindowOrChild( _rNEvt.GetWindow() ) ) if ( IsWindowOrChild( _rNEvt.GetWindow() ) )
DisplayURL( GetText() ); DisplayURL( GetText() );
break; break;
default:
break;
} }
return SvtURLBox::PreNotify(_rNEvt); return SvtURLBox::PreNotify(_rNEvt);
} }
bool FileURLBox::Notify( NotifyEvent& _rNEvt ) bool FileURLBox::Notify( NotifyEvent& _rNEvt )
{ {
switch ( _rNEvt.GetType() ) switch (_rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
{ {
case MouseNotifyEvent::KEYINPUT:
if ( ( GetSubEdit() == _rNEvt.GetWindow() ) if ( ( GetSubEdit() == _rNEvt.GetWindow() )
&& ( KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode() ) && ( KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode() )
&& ( IsInDropDown() ) && ( IsInDropDown() )
...@@ -88,13 +89,11 @@ namespace svt ...@@ -88,13 +89,11 @@ namespace svt
DisplayURL( m_sPreservedText ); DisplayURL( m_sPreservedText );
return nReturn; return nReturn;
} }
break;
} }
return SvtURLBox::Notify(_rNEvt); return SvtURLBox::Notify(_rNEvt);
} }
} // namespace svt } // namespace svt
......
...@@ -1225,58 +1225,53 @@ void AssignmentPersistentData::Commit() ...@@ -1225,58 +1225,53 @@ void AssignmentPersistentData::Commit()
return 0L; return 0L;
} }
bool AddressBookSourceDialog::PreNotify( NotifyEvent& _rNEvt ) bool AddressBookSourceDialog::PreNotify( NotifyEvent& _rNEvt )
{ {
switch (_rNEvt.GetType()) switch (_rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
{ {
case MouseNotifyEvent::KEYINPUT: const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
{ sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode();
const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); bool bShift = pKeyEvent->GetKeyCode().IsShift();
sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); bool bCtrl = pKeyEvent->GetKeyCode().IsMod1();
bool bShift = pKeyEvent->GetKeyCode().IsShift(); bool bAlt = pKeyEvent->GetKeyCode().IsMod2();
bool bCtrl = pKeyEvent->GetKeyCode().IsMod1();
bool bAlt = pKeyEvent->GetKeyCode().IsMod2(); if (KEY_TAB == nCode)
{ // somebody pressed the tab key
if (KEY_TAB == nCode) if (!bAlt && !bCtrl && !bShift)
{ // somebody pressed the tab key { // it's really the only the key (no modifiers)
if (!bAlt && !bCtrl && !bShift) if (m_pImpl->pFields[m_pImpl->nLastVisibleListIndex]->HasChildPathFocus())
{ // it's really the only the key (no modifiers) // the last of our visible list boxes has the focus
if (m_pImpl->pFields[m_pImpl->nLastVisibleListIndex]->HasChildPathFocus()) if (m_pImpl->nFieldScrollPos < m_pFieldScroller->GetRangeMax())
// the last of our visible list boxes has the focus { // we can still scroll down
if (m_pImpl->nFieldScrollPos < m_pFieldScroller->GetRangeMax()) sal_Int32 nNextFocusList = m_pImpl->nLastVisibleListIndex + 1 - 2;
{ // we can still scroll down // -> scroll down
sal_Int32 nNextFocusList = m_pImpl->nLastVisibleListIndex + 1 - 2; implScrollFields(m_pImpl->nFieldScrollPos + 1, false, true);
// -> scroll down // give the left control in the "next" line the focus
implScrollFields(m_pImpl->nFieldScrollPos + 1, false, true); m_pImpl->pFields[nNextFocusList]->GrabFocus();
// give the left control in the "next" line the focus // return saying "have handled this"
m_pImpl->pFields[nNextFocusList]->GrabFocus(); return true;
// return saying "have handled this" }
return true; }
} else if (!bAlt && !bCtrl && bShift)
} { // it's shift-tab
else if (!bAlt && !bCtrl && bShift) if (m_pImpl->pFields[0]->HasChildPathFocus())
{ // it's shift-tab // our first list box has the focus
if (m_pImpl->pFields[0]->HasChildPathFocus()) if (m_pImpl->nFieldScrollPos > 0)
// our first list box has the focus { // we can still scroll up
if (m_pImpl->nFieldScrollPos > 0) // -> scroll up
{ // we can still scroll up implScrollFields(m_pImpl->nFieldScrollPos - 1, false, true);
// -> scroll up // give the right control in the "prebious" line the focus
implScrollFields(m_pImpl->nFieldScrollPos - 1, false, true); m_pImpl->pFields[0 - 1 + 2]->GrabFocus();
// give the right control in the "prebious" line the focus // return saying "have handled this"
m_pImpl->pFields[0 - 1 + 2]->GrabFocus(); return true;
// return saying "have handled this" }
return true;
}
}
} }
} }
break;
} }
return ModalDialog::PreNotify(_rNEvt); return ModalDialog::PreNotify(_rNEvt);
} }
} // namespace svt } // namespace svt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment