diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-27 15:09:52 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-28 12:47:07 +0200 |
commit | 79db3fc0ee41a6284eb2175a4780f4157cb708f6 (patch) | |
tree | 5a9fd718cd188bc3491f2f80758bbcd83fa2b342 | |
parent | a086ca18987a91543a65a3965b2bbc4c022400f8 (diff) |
convert STARTTRACK constants to scoped enum
Change-Id: I9b441688eb59ffd3540b014716a9abe7969c9be4
-rw-r--r-- | include/vcl/window.hxx | 24 | ||||
-rw-r--r-- | sc/source/ui/dbgui/csvgrid.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dbgui/csvruler.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl1.cxx | 4 | ||||
-rw-r--r-- | svtools/source/control/calendar.cxx | 2 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 2 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 6 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/scrbar.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/slider.cxx | 9 | ||||
-rw-r--r-- | vcl/source/window/dockmgr.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/dockwin.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/mouse.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 8 |
18 files changed, 54 insertions, 47 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index f3f3b4da1ca0..62f7a127db14 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -286,13 +286,21 @@ namespace o3tl #define SHOWTRACK_STYLE ((sal_uInt16)0x000F) // Flags for StartTracking() -#define STARTTRACK_KEYINPUT ((sal_uInt16)0x0001) -#define STARTTRACK_KEYMOD ((sal_uInt16)0x0002) -#define STARTTRACK_NOKEYCANCEL ((sal_uInt16)0x0004) -#define STARTTRACK_SCROLLREPEAT ((sal_uInt16)0x0008) -#define STARTTRACK_BUTTONREPEAT ((sal_uInt16)0x0010) -#define STARTTRACK_MOUSEBUTTONDOWN ((sal_uInt16)0x0020) -#define STARTTRACK_FOCUSCANCEL ((sal_uInt16)0x0040) +enum class StartTrackingFlags +{ + NONE = 0x0000, + KeyInput = 0x0001, + KeyMod = 0x0002, + NoKeyCancel = 0x0004, + ScrollRepeat = 0x0008, + ButtonRepeat = 0x0010, + MouseButtonDown = 0x0020, + FocusCancel = 0x0040, +}; +namespace o3tl +{ + template<> struct typed_flags<StartTrackingFlags> : is_typed_flags<StartTrackingFlags, 0x007f> {}; +} // Flags for StartAutoScroll() enum class StartAutoScrollFlags @@ -1248,7 +1256,7 @@ public: sal_uInt16 nFlags = SHOWTRACK_SMALL ); void InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags = 0 ); - void StartTracking( sal_uInt16 nFlags = 0 ); + void StartTracking( StartTrackingFlags nFlags = StartTrackingFlags::NONE ); void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE ); bool IsTracking() const; diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 7d6172496294..069edcf44f5a 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -863,7 +863,7 @@ void ScCsvGrid::MouseButtonDown( const MouseEvent& rMEvt ) DoSelectAction( nColIx, rMEvt.GetModifier() ); mnMTCurrCol = nColIx; mbMTSelecting = IsSelected( nColIx ); - StartTracking( STARTTRACK_BUTTONREPEAT ); + StartTracking( StartTrackingFlags::ButtonRepeat ); } } EnableRepaint(); diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index aab46e9d2e5c..d6ad878320b8 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -476,7 +476,7 @@ void ScCsvRuler::StartMouseTracking( sal_Int32 nPos ) maOldSplits = maSplits; Execute( CSVCMD_INSERTSPLIT, nPos ); if( HasSplit( nPos ) ) - StartTracking( STARTTRACK_BUTTONREPEAT ); + StartTracking( StartTrackingFlags::ButtonRepeat ); } void ScCsvRuler::MoveMouseTracking( sal_Int32 nPos ) diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 118008cd0da5..ca994b6956a9 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -776,7 +776,7 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) } if( !pEntry && !(nWinBits & WB_NODRAGSELECTION)) - pView->StartTracking( STARTTRACK_SCROLLREPEAT ); + pView->StartTracking( StartTrackingFlags::ScrollRepeat ); return true; } else @@ -796,7 +796,7 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) else nFlags |= F_ADD_MODE; aCurSelectionRect.SetPos( aDocPos ); - pView->StartTracking( STARTTRACK_SCROLLREPEAT ); + pView->StartTracking( StartTrackingFlags::ScrollRepeat ); } else bHandled = false; diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index e560bcd67dcc..e9d60b306e0d 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -1398,7 +1398,7 @@ void Calendar::MouseButtonDown( const MouseEvent& rMEvt ) // it should really read BUTTONREPEAT, therefore do not // change it to SCROLLREPEAT, check with TH, // why it could be different (71775) - StartTracking( STARTTRACK_BUTTONREPEAT ); + StartTracking( StartTrackingFlags::ButtonRepeat ); } else { diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 218034695a13..4866dc3ef59b 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1216,7 +1216,7 @@ void ValueSet::MouseButtonDown( const MouseEvent& rMouseEvent ) mbHighlight = true; mnHighItemId = mnSelItemId; ImplHighlightItem( pItem->mnId ); - StartTracking( STARTTRACK_SCROLLREPEAT ); + StartTracking( StartTrackingFlags::ScrollRepeat ); } else if ( rMouseEvent.GetClicks() == 2 ) DoubleClick(); diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 59306f2f6328..595812abdb66 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -195,7 +195,7 @@ struct ImplSVWinData AutoTimer* mpTrackTimer; // tracking timer ImageList* mpMsgBoxImgList; // ImageList for MessageBox VclPtr<vcl::Window> mpAutoScrollWin; // window, that is in AutoScrollMode mode - sal_uInt16 mnTrackFlags; // tracking flags + StartTrackingFlags mnTrackFlags; // tracking flags StartAutoScrollFlags mnAutoScrollFlags; // auto scroll flags bool mbNoDeactivate; // true: do not execute Deactivate bool mbNoSaveFocus; // true: menus must not save/restore focus diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 9998c2292e03..b13ac6fd669f 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1200,17 +1200,17 @@ void PushButton::MouseButtonDown( const MouseEvent& rMEvt ) if ( rMEvt.IsLeft() && ImplHitTestPushButton( this, rMEvt.GetPosPixel() ) ) { - sal_uInt16 nTrackFlags = 0; + StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; if ( ( GetStyle() & WB_REPEAT ) && ! ( GetStyle() & WB_TOGGLE ) ) - nTrackFlags |= STARTTRACK_BUTTONREPEAT; + nTrackFlags |= StartTrackingFlags::ButtonRepeat; ImplGetButtonState() |= DrawButtonFlags::Pressed; Invalidate(); StartTracking( nTrackFlags ); - if ( nTrackFlags & STARTTRACK_BUTTONREPEAT ) + if ( nTrackFlags & StartTrackingFlags::ButtonRepeat ) Click(); } } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index e83ae507aa7d..9ff20ba8b47e 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1375,7 +1375,7 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt ) ImplSetCursorPos( nCharPos, rMEvt.IsShift() ); if ( !mbClickedInSelection && rMEvt.IsLeft() && ( rMEvt.GetClicks() == 1 ) ) - StartTracking( STARTTRACK_SCROLLREPEAT ); + StartTracking( StartTrackingFlags::ScrollRepeat ); } mbInMBDown = true; // then do not select all in GetFocus diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index f7d4592b7d4b..2cf7dfb9407a 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -859,7 +859,7 @@ void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt ) if ( mbGrabFocus ) GrabFocus(); - StartTracking( STARTTRACK_SCROLLREPEAT ); + StartTracking( StartTrackingFlags::ScrollRepeat ); } } if( rMEvt.GetClicks() == 2 ) @@ -946,7 +946,7 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) if ( mbStackMode && ( mpEntryList->GetSelectionAnchor() == LISTBOX_ENTRY_NOTFOUND ) ) mpEntryList->SetSelectionAnchor( 0 ); - StartTracking( STARTTRACK_SCROLLREPEAT ); + StartTracking( StartTrackingFlags::ScrollRepeat ); } } } diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 2d7fdc3adb3e..699f8e87fc2c 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -898,7 +898,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if (rMEvt.IsLeft() || rMEvt.IsMiddle() || rMEvt.IsRight()) { const Point& rMousePos = rMEvt.GetPosPixel(); - sal_uInt16 nTrackFlags = 0; + StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0; bool bIsInside = false; bool bDragToMouse = false; @@ -913,7 +913,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) { if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) ) { - nTrackFlags = STARTTRACK_BUTTONREPEAT; + nTrackFlags = StartTrackingFlags::ButtonRepeat; meScrollType = SCROLL_LINEUP; mnDragDraw = SCRBAR_DRAW_BTN1; } @@ -925,7 +925,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) { if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) ) { - nTrackFlags = STARTTRACK_BUTTONREPEAT; + nTrackFlags = StartTrackingFlags::ButtonRepeat; meScrollType = SCROLL_LINEDOWN; mnDragDraw = SCRBAR_DRAW_BTN2; } @@ -953,7 +953,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( mnVisibleSize < mnMaxRange-mnMinRange ) { - nTrackFlags = 0; + nTrackFlags = StartTrackingFlags::NONE; meScrollType = SCROLL_DRAG; mnDragDraw = SCRBAR_DRAW_THUMB; @@ -982,7 +982,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) aControlRegion, rMousePos, bIsInside ) || bIsInside) ) { - nTrackFlags = STARTTRACK_BUTTONREPEAT; + nTrackFlags = StartTrackingFlags::ButtonRepeat; // HitTestNativeControl, see remark at top of file if ( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_LEFT : PART_TRACK_VERT_UPPER, diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index f30e0c030244..db264ee6b703 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -658,12 +658,11 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() ) { - const Point& rMousePos = rMEvt.GetPosPixel(); - sal_uInt16 nTrackFlags = 0; + const Point& rMousePos = rMEvt.GetPosPixel(); + StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; if ( maThumbRect.IsInside( rMousePos ) ) { - nTrackFlags = 0; meScrollType = SCROLL_DRAG; mnDragDraw = SLIDER_DRAW_THUMB; @@ -680,7 +679,7 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) meScrollType = SCROLL_SET; else { - nTrackFlags = STARTTRACK_BUTTONREPEAT; + nTrackFlags = StartTrackingFlags::ButtonRepeat; meScrollType = SCROLL_PAGEUP; } @@ -692,7 +691,7 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) meScrollType = SCROLL_SET; else { - nTrackFlags = STARTTRACK_BUTTONREPEAT; + nTrackFlags = StartTrackingFlags::ButtonRepeat; meScrollType = SCROLL_PAGEDOWN; } diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 84a083436445..a1cd73420418 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -730,7 +730,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) { // start window move mbMoving = true; - StartTracking( STARTTRACK_NOKEYCANCEL ); + StartTracking( StartTrackingFlags::NoKeyCancel ); return; } if( !mbHighlight && GetDragRect().IsInside( aMousePos ) ) @@ -891,7 +891,7 @@ bool ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos ) GetWindow()->ImplUpdateAll(); GetWindow()->ImplGetFrameWindow()->ImplUpdateAll(); - GetWindow()->StartTracking( STARTTRACK_KEYMOD ); + GetWindow()->StartTracking( StartTrackingFlags::KeyMod ); return true; } diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 348af892b773..658e8dbc4fcb 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -299,7 +299,7 @@ bool DockingWindow::ImplStartDocking( const Point& rPos ) ImplGetFrameWindow()->ImplUpdateAll(); } - StartTracking( STARTTRACK_KEYMOD ); + StartTracking( StartTrackingFlags::KeyMod ); return true; } diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 9114ac093ab1..3582ed62a3cd 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -352,7 +352,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags ) if ( pOldFocusWindow && ! aOldFocusDel.IsDead() ) { if ( pOldFocusWindow->IsTracking() && - (pSVData->maWinData.mnTrackFlags & STARTTRACK_FOCUSCANCEL) ) + (pSVData->maWinData.mnTrackFlags & StartTrackingFlags::FocusCancel) ) pOldFocusWindow->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Focus ); NotifyEvent aNEvt( MouseNotifyEvent::LOSEFOCUS, pOldFocusWindow ); if ( !ImplCallPreNotify( aNEvt ) ) diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 53ef7fa7494f..a98380008563 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -3871,14 +3871,14 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) } // update actual data - sal_uInt16 nTrackFlags = 0; + StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; mnCurPos = i; mnCurItemId = it->mnId; mnDownItemId = mnCurItemId; mnMouseClicks = rMEvt.GetClicks(); mnMouseModifier = rMEvt.GetModifier(); if ( it->mnBits & ToolBoxItemBits::REPEAT ) - nTrackFlags |= STARTTRACK_BUTTONREPEAT; + nTrackFlags |= StartTrackingFlags::ButtonRepeat; if ( mbSelection ) { @@ -3939,7 +3939,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) Click(); // also call Select handler at repeat - if ( nTrackFlags & STARTTRACK_BUTTONREPEAT ) + if ( nTrackFlags & StartTrackingFlags::ButtonRepeat ) Select(); // if the actions was not aborted in Click handler diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index a177383fa782..bed0306a541f 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -350,7 +350,7 @@ IMPL_LINK_TYPED( Window, ImplTrackTimerHdl, Timer*, pTimer, void ) ImplSVData* pSVData = ImplGetSVData(); // Bei Button-Repeat muessen wir den Timeout umsetzen - if ( pSVData->maWinData.mnTrackFlags & STARTTRACK_BUTTONREPEAT ) + if ( pSVData->maWinData.mnTrackFlags & StartTrackingFlags::ButtonRepeat ) pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() ); // Tracking-Event erzeugen @@ -369,7 +369,7 @@ IMPL_LINK_TYPED( Window, ImplTrackTimerHdl, Timer*, pTimer, void ) Tracking( aTEvt ); } -void Window::StartTracking( sal_uInt16 nFlags ) +void Window::StartTracking( StartTrackingFlags nFlags ) { ImplSVData* pSVData = ImplGetSVData(); @@ -379,11 +379,11 @@ void Window::StartTracking( sal_uInt16 nFlags ) pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel ); } - if ( nFlags & (STARTTRACK_SCROLLREPEAT | STARTTRACK_BUTTONREPEAT) ) + if ( nFlags & (StartTrackingFlags::ScrollRepeat | StartTrackingFlags::ButtonRepeat) ) { pSVData->maWinData.mpTrackTimer = new AutoTimer; - if ( nFlags & STARTTRACK_SCROLLREPEAT ) + if ( nFlags & StartTrackingFlags::ScrollRepeat ) pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() ); else pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() ); @@ -413,7 +413,7 @@ void Window::EndTracking( TrackingEventFlags nFlags ) } pSVData->maWinData.mpTrackWin = NULL; - pSVData->maWinData.mnTrackFlags = 0; + pSVData->maWinData.mnTrackFlags = StartTrackingFlags::NONE; ReleaseMouse(); } diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index a56f94df7164..9278c2b53d0f 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -687,7 +687,7 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool { // When ScrollRepeat, we restart the timer if ( pSVData->maWinData.mpTrackTimer && - (pSVData->maWinData.mnTrackFlags & STARTTRACK_SCROLLREPEAT) ) + (pSVData->maWinData.mnTrackFlags & StartTrackingFlags::ScrollRepeat) ) pSVData->maWinData.mpTrackTimer->Start(); } bCallHelpRequest = false; @@ -717,7 +717,7 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool else if ( nSVEvent == MouseNotifyEvent::MOUSEBUTTONDOWN ) { if ( pSVData->maWinData.mpTrackWin && - !(pSVData->maWinData.mnTrackFlags & STARTTRACK_MOUSEBUTTONDOWN) ) + !(pSVData->maWinData.mnTrackFlags & StartTrackingFlags::MouseButtonDown) ) bRet = true; else { @@ -947,7 +947,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, { sal_uInt16 nOrigCode = aKeyCode.GetCode(); - if ( (nOrigCode == KEY_ESCAPE) && !(pSVData->maWinData.mnTrackFlags & STARTTRACK_NOKEYCANCEL) ) + if ( (nOrigCode == KEY_ESCAPE) && !(pSVData->maWinData.mnTrackFlags & StartTrackingFlags::NoKeyCancel) ) { pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel | TrackingEventFlags::Key ); if ( pSVData->maWinData.mpFirstFloat ) @@ -968,7 +968,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Key ); return true; } - else if ( !(pSVData->maWinData.mnTrackFlags & STARTTRACK_KEYINPUT) ) + else if ( !(pSVData->maWinData.mnTrackFlags & StartTrackingFlags::KeyInput) ) return true; } |