diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-27 16:01:34 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-28 12:47:07 +0200 |
commit | 173aa749d50f904887e4aa1ce425c6807668bff0 (patch) | |
tree | fc686ff759baf621029838d9a1d813a94443472c | |
parent | 79db3fc0ee41a6284eb2175a4780f4157cb708f6 (diff) |
convert INVERT flags to scoped enum
Change-Id: Iad8faee927de1ad646975157e36c3027c0ba8149
-rw-r--r-- | include/vcl/window.hxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/preview.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/scrbar.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/cursor.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 12 |
5 files changed, 24 insertions, 16 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 62f7a127db14..9654d340689d 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -273,8 +273,16 @@ namespace o3tl #define PARENTCLIPMODE_NOCLIP ((sal_uInt16)0x0002) // Flags for Invert() -#define INVERT_HIGHLIGHT ((sal_uInt16)0x0001) -#define INVERT_50 ((sal_uInt16)0x0002) +enum class InvertFlags +{ + NONE = 0x0000, + Highlight = 0x0001, + N50 = 0x0002, +}; +namespace o3tl +{ + template<> struct typed_flags<InvertFlags> : is_typed_flags<InvertFlags, 0x0003> {}; +} // Flags for ShowTracking() #define SHOWTRACK_SMALL ((sal_uInt16)0x0001) @@ -1239,8 +1247,8 @@ public: virtual void ShowFocus(const Rectangle& rRect); void HideFocus(); - void Invert( const Rectangle& rRect, sal_uInt16 nFlags = 0 ); - void Invert( const Polygon& rPoly, sal_uInt16 nFlags = 0 ); + void Invert( const Rectangle& rRect, InvertFlags nFlags = InvertFlags::NONE ); + void Invert( const Polygon& rPoly, InvertFlags nFlags = InvertFlags::NONE ); // transparent background for selected or checked items in toolboxes etc. void DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly ); diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 020f7400b267..43360991e46a 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -1567,12 +1567,12 @@ void ScPreview::DrawInvert( long nDragPos, PointerStyle nFlags ) if( nFlags == PointerStyle::HSizeBar || nFlags == PointerStyle::HSplit ) { Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1,(long)( ( nHeight * HMM_PER_TWIPS ) - aOffset.Y())); - Invert( aRect,INVERT_50 ); + Invert( aRect, InvertFlags::N50 ); } else if( nFlags == PointerStyle::VSizeBar ) { Rectangle aRect( -aOffset.X(), nDragPos,(long)( ( nWidth * HMM_PER_TWIPS ) - aOffset.X() ), nDragPos + 1 ); - Invert( aRect,INVERT_50 ); + Invert( aRect, InvertFlags::N50 ); } } diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 699f8e87fc2c..31986b9025e7 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -1160,7 +1160,7 @@ void ScrollBar::ImplInvert() aRect.Bottom() -= 2; } - Invert( aRect, 0 ); + Invert( aRect ); } void ScrollBar::GetFocus() diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index bd96802997a7..b665be75352d 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -46,11 +46,11 @@ static void ImplCursorInvert( ImplCursorData* pData ) vcl::Window* pWindow = pData->mpWindow; bool bMapMode = pWindow->IsMapModeEnabled(); pWindow->EnableMapMode( false ); - sal_uInt16 nInvertStyle; + InvertFlags nInvertStyle; if ( pData->mnStyle & CURSOR_SHADOW ) - nInvertStyle = INVERT_50; + nInvertStyle = InvertFlags::N50; else - nInvertStyle = 0; + nInvertStyle = InvertFlags::NONE; Rectangle aRect( pData->maPixPos, pData->maPixSize ); if ( pData->mnDirection != CursorDirection::NONE || pData->mnOrientation || pData->mnPixSlant ) diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index bed0306a541f..717f5d7cf136 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -127,7 +127,7 @@ void Window::HideFocus() mpWindowImpl->mbInHideFocus = false; } -void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags ) +void Window::Invert( const Rectangle& rRect, InvertFlags nFlags ) { if ( !IsDeviceOutputNecessary() ) return; @@ -153,14 +153,14 @@ void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags ) return; SalInvert nSalFlags = 0; - if ( nFlags & INVERT_HIGHLIGHT ) + if ( nFlags & InvertFlags::Highlight ) nSalFlags |= SAL_INVERT_HIGHLIGHT; - if ( nFlags & INVERT_50 ) + if ( nFlags & InvertFlags::N50 ) nSalFlags |= SAL_INVERT_50; mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags, this ); } -void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags ) +void Window::Invert( const Polygon& rPoly, InvertFlags nFlags ) { if ( !IsDeviceOutputNecessary() ) return; @@ -187,9 +187,9 @@ void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags ) return; SalInvert nSalFlags = 0; - if ( nFlags & INVERT_HIGHLIGHT ) + if ( nFlags & InvertFlags::Highlight ) nSalFlags |= SAL_INVERT_HIGHLIGHT; - if ( nFlags & INVERT_50 ) + if ( nFlags & InvertFlags::N50 ) nSalFlags |= SAL_INVERT_50; const SalPoint* pPtAry = reinterpret_cast<const SalPoint*>(aPoly.GetConstPointAry()); mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this ); |