diff options
-rw-r--r-- | vcl/source/window/window2.cxx | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 838809530cd6..98d7559fde43 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1197,26 +1197,19 @@ sal_Bool Window::HandleScrollCommand( const CommandEvent& rCmd, // ----------------------------------------------------------------------- -// Not that when called for COMMAND_WHEEL above, despite its name, -// pVScrl isn't necessarily the vertical scroll bar. Depending on -// whether the scroll is horizontal or vertical, it is either the -// horizontal or vertical scroll bar. nY is correspondingly either -// the horizontal or vertical scroll amount. - -void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX, - ScrollBar* pVScrl, long nY ) +static void lcl_HandleScrollHelper( ScrollBar* pScrl, long nN ) { - if ( pHScrl && nX && pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() ) + if ( pScrl && nN && pScrl->IsEnabled() && pScrl->IsInputEnabled() && ! pScrl->IsInModalMode() ) { - long nNewPos = pHScrl->GetThumbPos(); + long nNewPos = pScrl->GetThumbPos(); - if ( nX == -LONG_MAX ) - nNewPos += pHScrl->GetPageSize(); - else if ( nX == LONG_MAX ) - nNewPos -= pHScrl->GetPageSize(); + if ( nN == -LONG_MAX ) + nNewPos += pScrl->GetPageSize(); + else if ( nN == LONG_MAX ) + nNewPos -= pScrl->GetPageSize(); else { - const double fVal = (double)nNewPos - ((double)nX * pHScrl->GetLineSize()); + const double fVal = (double)nNewPos - ((double)nN * pScrl->GetLineSize()); if ( fVal < LONG_MIN ) nNewPos = LONG_MIN; @@ -1226,31 +1219,22 @@ void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX, nNewPos = (long)fVal; } - pHScrl->DoScroll( nNewPos ); + pScrl->DoScroll( nNewPos ); } - if ( pVScrl && nY && pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() ) - { - long nNewPos = pVScrl->GetThumbPos(); - - if ( nY == -LONG_MAX ) - nNewPos += pVScrl->GetPageSize(); - else if ( nY == LONG_MAX ) - nNewPos -= pVScrl->GetPageSize(); - else - { - const double fVal = (double)nNewPos - ((double)nY * pVScrl->GetLineSize()); +} - if ( fVal < LONG_MIN ) - nNewPos = LONG_MIN; - else if ( fVal > LONG_MAX ) - nNewPos = LONG_MAX; - else - nNewPos = (long)fVal; - } +// Note that when called for COMMAND_WHEEL above, despite its name, +// pVScrl isn't necessarily the vertical scroll bar. Depending on +// whether the scroll is horizontal or vertical, it is either the +// horizontal or vertical scroll bar. nY is correspondingly either +// the horizontal or vertical scroll amount. - pVScrl->DoScroll( nNewPos ); - } +void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX, + ScrollBar* pVScrl, long nY ) +{ + lcl_HandleScrollHelper( pHScrl, nX ); + lcl_HandleScrollHelper( pVScrl, nY ); } DockingManager* Window::GetDockingManager() |