diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-12-01 14:23:18 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-12-01 14:24:31 +0000 |
commit | 462df89dbb89b4f32aefde092830806002145e86 (patch) | |
tree | 5ec33785a86c6963509605c415acf14b8eb82b4d /extensions | |
parent | 559127c7c61a886ef4a5712eda4819af3b780da5 (diff) |
WaE: -Werror=switch
Change-Id: I2cd8ef48620bdd70554658b7468183e902ed8b45
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/propctrlr/browserlistbox.cxx | 92 |
1 files changed, 44 insertions, 48 deletions
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index c43a058f4fb8..12cfcd65b65b 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -1205,65 +1205,64 @@ namespace pcr { switch ( _rNEvt.GetType() ) { - case MouseNotifyEvent::KEYINPUT: - { - const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); - if ( ( pKeyEvent->GetKeyCode().GetModifier() != 0 ) - || ( ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEUP ) - && ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEDOWN ) + case MouseNotifyEvent::KEYINPUT: + { + const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); + if ( ( pKeyEvent->GetKeyCode().GetModifier() != 0 ) + || ( ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEUP ) + && ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEDOWN ) + ) ) - ) - break; + break; - long nScrollOffset = 0; - if ( m_aVScroll.IsVisible() ) - { - if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP ) - nScrollOffset = -m_aVScroll.GetPageSize(); - else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN ) - nScrollOffset = m_aVScroll.GetPageSize(); - } + long nScrollOffset = 0; + if ( m_aVScroll.IsVisible() ) + { + if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP ) + nScrollOffset = -m_aVScroll.GetPageSize(); + else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN ) + nScrollOffset = m_aVScroll.GetPageSize(); + } - if ( nScrollOffset ) - { - long nNewThumbPos = m_aVScroll.GetThumbPos() + nScrollOffset; - nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll.GetRangeMin() ); - nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll.GetRangeMax() ); - m_aVScroll.DoScroll( nNewThumbPos ); - nNewThumbPos = m_aVScroll.GetThumbPos(); - - sal_uInt16 nFocusControlPos = 0; - sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl ); - if ( nActiveControlPos < nNewThumbPos ) - nFocusControlPos = (sal_uInt16)nNewThumbPos; - else if ( nActiveControlPos >= nNewThumbPos + CalcVisibleLines() ) - nFocusControlPos = (sal_uInt16)nNewThumbPos + CalcVisibleLines() - 1; - if ( nFocusControlPos ) + if ( nScrollOffset ) { - if ( nFocusControlPos < m_aLines.size() ) + long nNewThumbPos = m_aVScroll.GetThumbPos() + nScrollOffset; + nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll.GetRangeMin() ); + nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll.GetRangeMax() ); + m_aVScroll.DoScroll( nNewThumbPos ); + nNewThumbPos = m_aVScroll.GetThumbPos(); + + sal_uInt16 nFocusControlPos = 0; + sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl ); + if ( nActiveControlPos < nNewThumbPos ) + nFocusControlPos = (sal_uInt16)nNewThumbPos; + else if ( nActiveControlPos >= nNewThumbPos + CalcVisibleLines() ) + nFocusControlPos = (sal_uInt16)nNewThumbPos + CalcVisibleLines() - 1; + if ( nFocusControlPos ) { - m_aLines[ nFocusControlPos ].pLine->GrabFocus(); + if ( nFocusControlPos < m_aLines.size() ) + { + m_aLines[ nFocusControlPos ].pLine->GrabFocus(); + } + else + OSL_FAIL( "OBrowserListBox::PreNotify: internal error, invalid focus control position!" ); } - else - OSL_FAIL( "OBrowserListBox::PreNotify: internal error, invalid focus control position!" ); } - } - return true; - // handled this. In particular, we also consume PageUp/Down events if we do not use them for scrolling, - // otherwise they would be used to scroll the document view, which does not sound like it is desired by - // the user. - } + return true; + // handled this. In particular, we also consume PageUp/Down events if we do not use them for scrolling, + // otherwise they would be used to scroll the document view, which does not sound like it is desired by + // the user. + } + default: + break; } return Control::PreNotify( _rNEvt ); } - bool OBrowserListBox::Notify( NotifyEvent& _rNEvt ) { - switch ( _rNEvt.GetType() ) - { - case MouseNotifyEvent::COMMAND: + if ( _rNEvt.GetType() == MouseNotifyEvent::COMMAND) { const CommandEvent* pCommand = _rNEvt.GetCommandEvent(); if ( ( COMMAND_WHEEL == pCommand->GetCommand() ) @@ -1278,9 +1277,6 @@ namespace pcr } } } - break; - } - return Control::Notify( _rNEvt ); } |