From 04a8ba2084950f998d791edad29739c124c8c4b8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 2 Sep 2016 14:57:18 +0200 Subject: convert ScrollType to scoped enum Change-Id: I6dd02d4f7df028dada6cfd5d767a6ec1b1c1efe1 --- .../source/standard/vclxaccessiblescrollbar.cxx | 10 ++-- dbaccess/source/ui/misc/WNameMatch.cxx | 4 +- desktop/source/deployment/gui/license_dialog.cxx | 2 +- extensions/source/propctrlr/browserlistbox.cxx | 2 +- extensions/source/propctrlr/taborder.cxx | 4 +- include/vcl/scrbar.hxx | 9 ++- reportdesign/source/ui/report/ViewsWindow.cxx | 2 +- reportdesign/source/ui/report/dlgedfunc.cxx | 10 ++-- sc/source/ui/view/tabview.cxx | 14 ++--- sfx2/source/dialog/dinfdlg.cxx | 2 +- sw/source/uibase/uiview/pview.cxx | 2 +- sw/source/uibase/uiview/viewport.cxx | 6 +- toolkit/source/awt/vclxwindows.cxx | 6 +- vcl/source/control/scrbar.cxx | 58 +++++++++---------- vcl/source/control/slider.cxx | 66 +++++++++++----------- vcl/source/edit/vclmedit.cxx | 12 ++-- 16 files changed, 107 insertions(+), 102 deletions(-) diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx index 516d41d5916c..6fdf4166a1d3 100644 --- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx +++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx @@ -138,11 +138,11 @@ sal_Bool VCLXAccessibleScrollBar::doAccessibleAction ( sal_Int32 nIndex ) throw ScrollType eScrollType; switch ( nIndex ) { - case 0: eScrollType = SCROLL_LINEUP; break; - case 1: eScrollType = SCROLL_LINEDOWN; break; - case 2: eScrollType = SCROLL_PAGEUP; break; - case 3: eScrollType = SCROLL_PAGEDOWN; break; - default: eScrollType = SCROLL_DONTKNOW; break; + case 0: eScrollType = ScrollType::LineUp; break; + case 1: eScrollType = ScrollType::LineDown; break; + case 2: eScrollType = ScrollType::PageUp; break; + case 3: eScrollType = ScrollType::PageDown; break; + default: eScrollType = ScrollType::DontKnow; break; } if ( pScrollBar->DoScrollAction( eScrollType ) ) bReturn = true; diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx index 75d9a789c380..42917c625cbf 100644 --- a/dbaccess/source/ui/misc/WNameMatch.cxx +++ b/dbaccess/source/ui/misc/WNameMatch.cxx @@ -220,7 +220,7 @@ IMPL_LINK_TYPED( OWizNameMatching, ButtonClickHdl, Button *, pButton, void ) if(pButton == m_pColumn_down && (nThumbPos+nVisibleSize+1) < nPos) { - m_pCTRL_LEFT->GetVScroll()->DoScrollAction(SCROLL_LINEDOWN); + m_pCTRL_LEFT->GetVScroll()->DoScrollAction(ScrollType::LineDown); } TableListClickHdl(m_pCTRL_LEFT); @@ -245,7 +245,7 @@ IMPL_LINK_TYPED( OWizNameMatching, RightButtonClickHdl, Button *, pButton, void long nVisibleSize = m_pCTRL_RIGHT->GetVScroll()->GetVisibleSize(); if(pButton == m_pColumn_down_right && (nThumbPos+nVisibleSize+1) < nPos) - m_pCTRL_RIGHT->GetVScroll()->DoScrollAction(SCROLL_LINEDOWN); + m_pCTRL_RIGHT->GetVScroll()->DoScrollAction(ScrollType::LineDown); TableListRightSelectHdl(m_pCTRL_RIGHT); } } diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index a5bf8026320a..212acccf4527 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -276,7 +276,7 @@ IMPL_LINK_NOARG_TYPED(LicenseDialogImpl, ScrolledHdl, LicenseView&, void) IMPL_LINK_NOARG_TYPED(LicenseDialogImpl, PageDownHdl, Button*, void) { - m_pLicense->ScrollDown( SCROLL_PAGEDOWN ); + m_pLicense->ScrollDown( ScrollType::PageDown ); } IMPL_LINK_NOARG_TYPED(LicenseDialogImpl, EndReachedHdl, LicenseView&, void) diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 5012c4938771..81d905084fbb 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -865,7 +865,7 @@ namespace pcr { PositionLine((sal_uInt16)nThumbPos); } - else if (nDelta!=0 || m_aVScroll->GetType() == SCROLL_DONTKNOW) + else if (nDelta!=0 || m_aVScroll->GetType() == ScrollType::DontKnow) { UpdatePlayGround(); } diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index 4d7ce611b304..0880464a2616 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -389,9 +389,9 @@ namespace pcr long nFirstVisible = GetModel()->GetAbsPos( FirstVisible()); if ( ( nThumbPos + nVisibleSize + 1 ) < (long)( nLastSelPos + 3 ) ) - GetVScroll()->DoScrollAction(SCROLL_LINEDOWN); + GetVScroll()->DoScrollAction(ScrollType::LineDown); else if((nThumbPos+nVisibleSize+1) >= (nFirstVisible)) - GetVScroll()->DoScrollAction(SCROLL_LINEUP); + GetVScroll()->DoScrollAction(ScrollType::LineUp); } } } diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx index 951fb874e0cc..126701518d64 100644 --- a/include/vcl/scrbar.hxx +++ b/include/vcl/scrbar.hxx @@ -27,8 +27,13 @@ class AutoTimer; -enum ScrollType { SCROLL_DONTKNOW, SCROLL_LINEUP, SCROLL_LINEDOWN, - SCROLL_PAGEUP, SCROLL_PAGEDOWN, SCROLL_DRAG, SCROLL_SET }; +enum class ScrollType +{ + DontKnow, + LineUp, LineDown, + PageUp, PageDown, + Drag, Set +}; struct ImplScrollBarData; diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index c4be7f78f477..16c94af43026 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1472,7 +1472,7 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode) OScrollWindowHelper* pScrollWindow = getView()->getScrollWindow(); ScrollBar& rScrollBar = ( nCode == KEY_LEFT || nCode == KEY_RIGHT ) ? pScrollWindow->GetHScroll() : pScrollWindow->GetVScroll(); if ( rScrollBar.IsVisible() ) - rScrollBar.DoScrollAction(( nCode == KEY_RIGHT || nCode == KEY_UP ) ? SCROLL_LINEUP : SCROLL_LINEDOWN ); + rScrollBar.DoScrollAction(( nCode == KEY_RIGHT || nCode == KEY_UP ) ? ScrollType::LineUp : ScrollType::LineDown ); return; } TSectionsMap::const_iterator aIter = m_aSections.begin(); diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx index d6603e299103..45cd2e78715a 100644 --- a/reportdesign/source/ui/report/dlgedfunc.cxx +++ b/reportdesign/source/ui/report/dlgedfunc.cxx @@ -92,16 +92,16 @@ void DlgEdFunc::ForceScroll( const Point& rPos ) { ScrollBar& rHScroll = pScrollWindow->GetHScroll(); ScrollBar& rVScroll = pScrollWindow->GetVScroll(); - ScrollType eH = SCROLL_LINEDOWN,eV = SCROLL_LINEDOWN; + ScrollType eH = ScrollType::LineDown,eV = ScrollType::LineDown; if( rPos.X() < aOutRect.Left() ) - eH = SCROLL_LINEUP; + eH = ScrollType::LineUp; else if( rPos.X() <= aOutRect.Right() ) - eH = SCROLL_DONTKNOW; + eH = ScrollType::DontKnow; if( rPos.Y() < aOutRect.Top() ) - eV = SCROLL_LINEUP; + eV = ScrollType::LineUp; else if( rPos.Y() <= aOutRect.Bottom() ) - eV = SCROLL_DONTKNOW; + eV = ScrollType::DontKnow; rHScroll.DoScrollAction(eH); rVScroll.DoScrollAction(eV); diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index aa81b31001f1..5ac34bd625a3 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1037,7 +1037,7 @@ IMPL_LINK_TYPED( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ); ScrollType eType = pScroll->GetType(); - if ( eType == SCROLL_DRAG ) + if ( eType == ScrollType::Drag ) { if (!bDragging) { @@ -1106,27 +1106,27 @@ IMPL_LINK_TYPED( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) long nDelta = pScroll->GetDelta(); switch ( eType ) { - case SCROLL_LINEUP: + case ScrollType::LineUp: nDelta = -1; break; - case SCROLL_LINEDOWN: + case ScrollType::LineDown: nDelta = 1; break; - case SCROLL_PAGEUP: + case ScrollType::PageUp: if ( pScroll == aHScrollLeft.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT ); if ( pScroll == aHScrollRight.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT ); if ( pScroll == aVScrollTop.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP ); if ( pScroll == aVScrollBottom.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM ); if (nDelta==0) nDelta=-1; break; - case SCROLL_PAGEDOWN: + case ScrollType::PageDown: if ( pScroll == aHScrollLeft.get() ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); if ( pScroll == aHScrollRight.get() ) nDelta = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); if ( pScroll == aVScrollTop.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_TOP ); if ( pScroll == aVScrollBottom.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); if (nDelta==0) nDelta=1; break; - case SCROLL_DRAG: + case ScrollType::Drag: { // only scroll in the correct direction, do not jitter around hidden ranges long nScrollMin = 0; // simulate RangeMin @@ -1158,7 +1158,7 @@ IMPL_LINK_TYPED( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) if (nDelta) { - bool bUpdate = ( eType != SCROLL_DRAG ); // don't alter the ranges while dragging + bool bUpdate = ( eType != ScrollType::Drag ); // don't alter the ranges while dragging if ( bHoriz ) ScrollX( nDelta, (pScroll == aHScrollLeft.get()) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT, bUpdate ); else diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 828e957f5ec7..017ef84dd18a 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -2161,7 +2161,7 @@ IMPL_LINK_NOARG_TYPED(CustomPropertiesControl, RemovedHdl, void*, void) long nLineCount = m_pPropertiesWin->GetVisibleLineCount(); m_pVertScroll->SetRangeMax(nLineCount + 1); if ( m_pPropertiesWin->GetOutputSizePixel().Height() < nLineCount * m_pPropertiesWin->GetLineHeight() ) - m_pVertScroll->DoScrollAction ( SCROLL_LINEUP ); + m_pVertScroll->DoScrollAction ( ScrollType::LineUp ); } void CustomPropertiesControl::AddLine( const OUString& sName, Any& rAny, bool bInteractive ) diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 24423f52d76a..fb869051b73e 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1426,7 +1426,7 @@ IMPL_LINK_TYPED( SwPagePreview, ScrollHdl, ScrollBar *, p, void ) if(!GetViewShell()) return; if( !pScrollbar->IsHoriScroll() && - pScrollbar->GetType() == SCROLL_DRAG && + pScrollbar->GetType() == ScrollType::Drag && Help::IsQuickHelpEnabled() && GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow()) { diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 7be971df4bf0..89b3e1478e04 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -686,11 +686,11 @@ IMPL_LINK_TYPED( SwView, ScrollHdl, ScrollBar *, p, void ) if ( GetWrtShell().ActionPend() ) return; - if ( pScrollbar->GetType() == SCROLL_DRAG ) + if ( pScrollbar->GetType() == ScrollType::Drag ) m_pWrtShell->EnableSmooth( false ); if(!m_pWrtShell->GetViewOptions()->getBrowseMode() && - pScrollbar->GetType() == SCROLL_DRAG) + pScrollbar->GetType() == ScrollType::Drag) { // Here comment out again if it is not desired to scroll together: // The end scrollhandler invalidate the FN_STAT_PAGE, @@ -746,7 +746,7 @@ IMPL_LINK_TYPED( SwView, ScrollHdl, ScrollBar *, p, void ) else EndScrollHdl(pScrollbar); - if ( pScrollbar->GetType() == SCROLL_DRAG ) + if ( pScrollbar->GetType() == ScrollType::Drag ) m_pWrtShell->EnableSmooth( true ); } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 83c2c562225b..d3b655616d6f 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -3699,15 +3699,15 @@ void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) // set adjustment type ScrollType aType = pScrollBar->GetType(); - if ( aType == SCROLL_LINEUP || aType == SCROLL_LINEDOWN ) + if ( aType == ScrollType::LineUp || aType == ScrollType::LineDown ) { aEvent.Type = css::awt::AdjustmentType_ADJUST_LINE; } - else if ( aType == SCROLL_PAGEUP || aType == SCROLL_PAGEDOWN ) + else if ( aType == ScrollType::PageUp || aType == ScrollType::PageDown ) { aEvent.Type = css::awt::AdjustmentType_ADJUST_PAGE; } - else if ( aType == SCROLL_DRAG ) + else if ( aType == ScrollType::Drag ) { aEvent.Type = css::awt::AdjustmentType_ADJUST_ABS; } diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index b4abe08a4de9..5ac987e5dd8b 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -89,7 +89,7 @@ void ScrollBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) mnDelta = 0; mnDragDraw = 0; mnStateFlags = 0; - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; mbCalcSize = true; mbFullDrag = false; @@ -724,19 +724,19 @@ long ScrollBar::ImplDoAction( bool bCallEndScroll ) switch ( meScrollType ) { - case SCROLL_LINEUP: + case ScrollType::LineUp: nDelta = ImplScroll( mnThumbPos-mnLineSize, bCallEndScroll ); break; - case SCROLL_LINEDOWN: + case ScrollType::LineDown: nDelta = ImplScroll( mnThumbPos+mnLineSize, bCallEndScroll ); break; - case SCROLL_PAGEUP: + case ScrollType::PageUp: nDelta = ImplScroll( mnThumbPos-mnPageSize, bCallEndScroll ); break; - case SCROLL_PAGEDOWN: + case ScrollType::PageDown: nDelta = ImplScroll( mnThumbPos+mnPageSize, bCallEndScroll ); break; default: @@ -758,7 +758,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) switch ( meScrollType ) { - case SCROLL_LINEUP: + case ScrollType::LineUp: if ( HitTestNativeControl( ControlType::Scrollbar, bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rMousePos, bIsInside )? bIsInside: @@ -771,7 +771,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) mnStateFlags &= ~SCRBAR_STATE_BTN1_DOWN; break; - case SCROLL_LINEDOWN: + case ScrollType::LineDown: if ( HitTestNativeControl( ControlType::Scrollbar, bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rMousePos, bIsInside )? bIsInside: @@ -784,7 +784,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) mnStateFlags &= ~SCRBAR_STATE_BTN2_DOWN; break; - case SCROLL_PAGEUP: + case ScrollType::PageUp: // HitTestNativeControl, see remark at top of file if ( HitTestNativeControl( ControlType::Scrollbar, bHorizontal? ControlPart::TrackHorzLeft: ControlPart::TrackVertUpper, maPage1Rect, rMousePos, bIsInside )? @@ -798,7 +798,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) mnStateFlags &= ~SCRBAR_STATE_PAGE1_DOWN; break; - case SCROLL_PAGEDOWN: + case ScrollType::PageDown: // HitTestNativeControl, see remark at top of file if ( HitTestNativeControl( ControlType::Scrollbar, bHorizontal? ControlPart::TrackHorzRight: ControlPart::TrackVertLower, maPage2Rect, rMousePos, bIsInside )? @@ -892,7 +892,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) ) { nTrackFlags = StartTrackingFlags::ButtonRepeat; - meScrollType = SCROLL_LINEUP; + meScrollType = ScrollType::LineUp; mnDragDraw = SCRBAR_DRAW_BTN1; } } @@ -904,7 +904,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) ) { nTrackFlags = StartTrackingFlags::ButtonRepeat; - meScrollType = SCROLL_LINEDOWN; + meScrollType = ScrollType::LineDown; mnDragDraw = SCRBAR_DRAW_BTN2; } } @@ -932,7 +932,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( mnVisibleSize < mnMaxRange-mnMinRange ) { nTrackFlags = StartTrackingFlags::NONE; - meScrollType = SCROLL_DRAG; + meScrollType = ScrollType::Drag; mnDragDraw = SCRBAR_DRAW_THUMB; // calculate mouse offset @@ -968,19 +968,19 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) bIsInside: maPage1Rect.IsInside( rMousePos ) ) { - meScrollType = SCROLL_PAGEUP; + meScrollType = ScrollType::PageUp; mnDragDraw = SCRBAR_DRAW_PAGE1; } else { - meScrollType = SCROLL_PAGEDOWN; + meScrollType = ScrollType::PageDown; mnDragDraw = SCRBAR_DRAW_PAGE2; } } } // Should we start Tracking? - if ( meScrollType != SCROLL_DONTKNOW ) + if ( meScrollType != ScrollType::DontKnow ) { // store original position for cancel and EndScroll delta mnStartPos = mnThumbPos; @@ -1018,7 +1018,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) Scroll(); } - if ( meScrollType == SCROLL_DRAG ) + if ( meScrollType == ScrollType::Drag ) { // On a SCROLLDRAG we recalculate the Thumb, so that it's back to a // rounded ThumbPosition @@ -1035,7 +1035,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) mnDelta = mnThumbPos-mnStartPos; EndScroll(); mnDelta = 0; - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; if( mpData ) mpData->mbHide = false; // re-enable focus blinking @@ -1057,7 +1057,7 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) const Point rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel); // Dragging is treated in a special way - if ( meScrollType == SCROLL_DRAG ) + if ( meScrollType == ScrollType::Drag ) ImplDragThumb( rMousePos ); else ImplDoMouseAction( rMousePos, rTEvt.IsTrackingRepeat() ); @@ -1085,20 +1085,20 @@ void ScrollBar::KeyInput( const KeyEvent& rKEvt ) case KEY_LEFT: case KEY_UP: - DoScrollAction( SCROLL_LINEUP ); + DoScrollAction( ScrollType::LineUp ); break; case KEY_RIGHT: case KEY_DOWN: - DoScrollAction( SCROLL_LINEDOWN ); + DoScrollAction( ScrollType::LineDown ); break; case KEY_PAGEUP: - DoScrollAction( SCROLL_PAGEUP ); + DoScrollAction( ScrollType::PageUp ); break; case KEY_PAGEDOWN: - DoScrollAction( SCROLL_PAGEDOWN ); + DoScrollAction( ScrollType::PageDown ); break; default: @@ -1323,26 +1323,26 @@ void ScrollBar::EndScroll() long ScrollBar::DoScroll( long nNewPos ) { - if ( meScrollType != SCROLL_DONTKNOW ) + if ( meScrollType != ScrollType::DontKnow ) return 0; SAL_INFO("vcl.scrollbar", "DoScroll(" << nNewPos << ")"); - meScrollType = SCROLL_DRAG; + meScrollType = ScrollType::Drag; long nDelta = ImplScroll( nNewPos, true ); - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; return nDelta; } long ScrollBar::DoScrollAction( ScrollType eScrollType ) { - if ( (meScrollType != SCROLL_DONTKNOW) || - (eScrollType == SCROLL_DONTKNOW) || - (eScrollType == SCROLL_DRAG) ) + if ( (meScrollType != ScrollType::DontKnow) || + (eScrollType == ScrollType::DontKnow) || + (eScrollType == ScrollType::Drag) ) return 0; meScrollType = eScrollType; long nDelta = ImplDoAction( true ); - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; return nDelta; } diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index a59eb77bc4e4..1c38fbe65e3a 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -56,7 +56,7 @@ void Slider::ImplInit( vcl::Window* pParent, WinBits nStyle ) mnPageSize = 1; mnDelta = 0; mnStateFlags = 0; - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; mbCalcSize = true; mbFullDrag = true; @@ -505,23 +505,23 @@ long Slider::ImplDoAction( bool bCallEndSlide ) switch ( meScrollType ) { - case SCROLL_LINEUP: + case ScrollType::LineUp: nDelta = ImplSlide( mnThumbPos-mnLineSize, bCallEndSlide ); break; - case SCROLL_LINEDOWN: + case ScrollType::LineDown: nDelta = ImplSlide( mnThumbPos+mnLineSize, bCallEndSlide ); break; - case SCROLL_PAGEUP: + case ScrollType::PageUp: nDelta = ImplSlide( mnThumbPos-mnPageSize, bCallEndSlide ); break; - case SCROLL_PAGEDOWN: + case ScrollType::PageDown: nDelta = ImplSlide( mnThumbPos+mnPageSize, bCallEndSlide ); break; - case SCROLL_SET: + case ScrollType::Set: nDelta = ImplSlide( ImplCalcThumbPos( GetPointerPosPixel().X() ), bCallEndSlide ); break; default: @@ -538,7 +538,7 @@ void Slider::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) switch ( meScrollType ) { - case SCROLL_SET: + case ScrollType::Set: { const bool bUp = ImplIsPageUp( rMousePos ), bDown = ImplIsPageDown( rMousePos ); @@ -552,7 +552,7 @@ void Slider::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) break; } - case SCROLL_PAGEUP: + case ScrollType::PageUp: if ( ImplIsPageUp( rMousePos ) ) { bAction = bCallAction; @@ -562,7 +562,7 @@ void Slider::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) mnStateFlags &= ~SLIDER_STATE_CHANNEL1_DOWN; break; - case SCROLL_PAGEDOWN: + case ScrollType::PageDown: if ( ImplIsPageDown( rMousePos ) ) { bAction = bCallAction; @@ -591,24 +591,24 @@ void Slider::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) void Slider::ImplDoSlide( long nNewPos ) { - if ( meScrollType != SCROLL_DONTKNOW ) + if ( meScrollType != ScrollType::DontKnow ) return; - meScrollType = SCROLL_DRAG; + meScrollType = ScrollType::Drag; ImplSlide( nNewPos, true ); - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; } void Slider::ImplDoSlideAction( ScrollType eScrollType ) { - if ( (meScrollType != SCROLL_DONTKNOW) || - (eScrollType == SCROLL_DONTKNOW) || - (eScrollType == SCROLL_DRAG) ) + if ( (meScrollType != ScrollType::DontKnow) || + (eScrollType == ScrollType::DontKnow) || + (eScrollType == ScrollType::Drag) ) return; meScrollType = eScrollType; ImplDoAction( true ); - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; } void Slider::MouseButtonDown( const MouseEvent& rMEvt ) @@ -620,7 +620,7 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) if ( maThumbRect.IsInside( rMousePos ) ) { - meScrollType = SCROLL_DRAG; + meScrollType = ScrollType::Drag; // calculate additional values Point aCenterPos = maThumbRect.Center(); @@ -632,33 +632,33 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) else if ( ImplIsPageUp( rMousePos ) ) { if( GetStyle() & WB_SLIDERSET ) - meScrollType = SCROLL_SET; + meScrollType = ScrollType::Set; else { nTrackFlags = StartTrackingFlags::ButtonRepeat; - meScrollType = SCROLL_PAGEUP; + meScrollType = ScrollType::PageUp; } } else if ( ImplIsPageDown( rMousePos ) ) { if( GetStyle() & WB_SLIDERSET ) - meScrollType = SCROLL_SET; + meScrollType = ScrollType::Set; else { nTrackFlags = StartTrackingFlags::ButtonRepeat; - meScrollType = SCROLL_PAGEDOWN; + meScrollType = ScrollType::PageDown; } } // Shall we start Tracking? - if( meScrollType != SCROLL_DONTKNOW ) + if( meScrollType != ScrollType::DontKnow ) { // store Start position for cancel and EndScroll delta mnStartPos = mnThumbPos; - ImplDoMouseAction( rMousePos, meScrollType != SCROLL_SET ); + ImplDoMouseAction( rMousePos, meScrollType != ScrollType::Set ); Update(); - if( meScrollType != SCROLL_SET ) + if( meScrollType != ScrollType::Set ) StartTracking( nTrackFlags ); } } @@ -666,7 +666,7 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) void Slider::MouseButtonUp( const MouseEvent& ) { - if( SCROLL_SET == meScrollType ) + if( ScrollType::Set == meScrollType ) { // reset Button and PageRect state const sal_uInt16 nOldStateFlags = mnStateFlags; @@ -678,7 +678,7 @@ void Slider::MouseButtonUp( const MouseEvent& ) Invalidate(InvalidateFlags::NoChildren | InvalidateFlags::NoErase); } ImplDoAction( true ); - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; } } @@ -704,7 +704,7 @@ void Slider::Tracking( const TrackingEvent& rTEvt ) Slide(); } - if ( meScrollType == SCROLL_DRAG ) + if ( meScrollType == ScrollType::Drag ) { // after dragging, recalculate to a rounded Thumb position ImplCalc(); @@ -721,14 +721,14 @@ void Slider::Tracking( const TrackingEvent& rTEvt ) mnDelta = mnThumbPos-mnStartPos; EndSlide(); mnDelta = 0; - meScrollType = SCROLL_DONTKNOW; + meScrollType = ScrollType::DontKnow; } else { const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel(); // special handling for dragging - if ( meScrollType == SCROLL_DRAG ) + if ( meScrollType == ScrollType::Drag ) { long nMovePix; Point aCenterPos = maThumbRect.Center(); @@ -784,20 +784,20 @@ void Slider::KeyInput( const KeyEvent& rKEvt ) case KEY_LEFT: case KEY_UP: - ImplDoSlideAction( SCROLL_LINEUP ); + ImplDoSlideAction( ScrollType::LineUp ); break; case KEY_RIGHT: case KEY_DOWN: - ImplDoSlideAction( SCROLL_LINEDOWN ); + ImplDoSlideAction( ScrollType::LineDown ); break; case KEY_PAGEUP: - ImplDoSlideAction( SCROLL_PAGEUP ); + ImplDoSlideAction( ScrollType::PageUp ); break; case KEY_PAGEDOWN: - ImplDoSlideAction( SCROLL_PAGEDOWN ); + ImplDoSlideAction( ScrollType::PageDown ); break; default: diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 3079dbd33c70..97ab7557c04b 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -1467,37 +1467,37 @@ bool VclMultiLineEdit::PreNotify( NotifyEvent& rNEvt ) case KEY_UP: { if ( pImpVclMEdit->GetVScrollBar() ) - pImpVclMEdit->GetVScrollBar()->DoScrollAction( SCROLL_LINEUP ); + pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::LineUp ); } break; case KEY_DOWN: { if ( pImpVclMEdit->GetVScrollBar() ) - pImpVclMEdit->GetVScrollBar()->DoScrollAction( SCROLL_LINEDOWN ); + pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::LineDown ); } break; case KEY_PAGEUP : { if ( pImpVclMEdit->GetVScrollBar() ) - pImpVclMEdit->GetVScrollBar()->DoScrollAction( SCROLL_PAGEUP ); + pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::PageUp ); } break; case KEY_PAGEDOWN: { if ( pImpVclMEdit->GetVScrollBar() ) - pImpVclMEdit->GetVScrollBar()->DoScrollAction( SCROLL_PAGEDOWN ); + pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::PageDown ); } break; case KEY_LEFT: { if ( pImpVclMEdit->GetHScrollBar() ) - pImpVclMEdit->GetHScrollBar()->DoScrollAction( SCROLL_LINEUP ); + pImpVclMEdit->GetHScrollBar()->DoScrollAction( ScrollType::LineUp ); } break; case KEY_RIGHT: { if ( pImpVclMEdit->GetHScrollBar() ) - pImpVclMEdit->GetHScrollBar()->DoScrollAction( SCROLL_LINEDOWN ); + pImpVclMEdit->GetHScrollBar()->DoScrollAction( ScrollType::LineDown ); } break; case KEY_HOME: -- cgit