diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-31 18:39:32 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-01-07 11:20:43 +0200 |
commit | 079590c9097a9491b31f1ef1b30d67d42bd0139a (patch) | |
tree | e77fb91fbc3b4b7312bcd29875434b1d1344e3e7 | |
parent | e197bcc6285b69179463b5847fe8ce459806455a (diff) |
fdo#84938: convert INDICATOR_ #defines to 'enum class'
and replace SalIndicatorState, it serves the same purpose
Change-Id: I618b8946b8e2527883eecb13060b2256abc505b6
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 2 | ||||
-rw-r--r-- | include/vcl/keycodes.hxx | 14 | ||||
-rw-r--r-- | include/vcl/window.hxx | 8 | ||||
-rw-r--r-- | vcl/headless/svpframe.cxx | 6 | ||||
-rw-r--r-- | vcl/inc/headless/svpframe.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/osx/salframe.h | 2 | ||||
-rw-r--r-- | vcl/inc/salframe.hxx | 7 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/saldisp.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/salframe.h | 2 | ||||
-rw-r--r-- | vcl/inc/win/salframe.h | 2 | ||||
-rw-r--r-- | vcl/osx/salframe.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 8 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 10 |
17 files changed, 44 insertions, 49 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index a2754c48c7d1..0f2467cec268 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1387,7 +1387,7 @@ SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, ; else { - bool bLockKeyOn = pFrameWin && (pFrameWin->GetIndicatorState() & INDICATOR_CAPSLOCK); + bool bLockKeyOn = pFrameWin && (pFrameWin->GetIndicatorState() & KeyIndicatorState::CAPSLOCK); bool bUnsupported = lcl_IsUnsupportedUnicodeChar( rCC, rTxt, nCapLttrPos, nInsPos ); nRet = 0; diff --git a/include/vcl/keycodes.hxx b/include/vcl/keycodes.hxx index 271ff61ec7a2..45adac1f6d24 100644 --- a/include/vcl/keycodes.hxx +++ b/include/vcl/keycodes.hxx @@ -24,6 +24,7 @@ #undef DELETE #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/awt/KeyGroup.hpp> +#include <o3tl/typed_flags_set.hxx> // Key-Gruppen #define KEYGROUP_NUM ((sal_uInt16)::com::sun::star::awt::KeyGroup::NUM) @@ -169,9 +170,16 @@ #define MOUSE_MIDDLE ((sal_uInt16)0x0002) #define MOUSE_RIGHT ((sal_uInt16)0x0004) -#define INDICATOR_CAPSLOCK 0x0001 -#define INDICATOR_NUMLOCK 0x0002 -#define INDICATOR_SCROLLLOCK 0x0004 +enum class KeyIndicatorState { + NONE = 0x0000, + CAPSLOCK = 0x0001, + NUMLOCK = 0x0002, + SCROLLLOCK = 0x0004 +}; +namespace o3tl +{ + template<> struct typed_flags<KeyIndicatorState> : is_typed_flags<KeyIndicatorState, 0x0007> {}; +} #endif // INCLUDED_VCL_KEYCODES_HXX diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 3b0c0e93864c..eefc0051169a 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1437,11 +1437,11 @@ public: Scroll Lock. Use the following mask to retrieve the state of each indicator: - INDICATOR_CAPS_LOCK - INDICATOR_NUM_LOCK - INDICATOR_SCROLL_LOCK + KeyIndicatorState::CAPS_LOCK + KeyIndicatorState::NUM_LOCK + KeyIndicatorState::SCROLL_LOCK */ - sal_uInt16 GetIndicatorState() const; + KeyIndicatorState GetIndicatorState() const; void SimulateKeyPress( sal_uInt16 nKeyCode ) const; diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 4df65242fe24..86915bfd6a18 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -460,11 +460,9 @@ SalFrame::SalPointerState SvpSalFrame::GetPointerState() return aState; } -SalFrame::SalIndicatorState SvpSalFrame::GetIndicatorState() +KeyIndicatorState SvpSalFrame::GetIndicatorState() { - SalIndicatorState aState; - aState.mnState = 0; - return aState; + return KeyIndicatorState::NONE; } void SvpSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ ) diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 4154252ac3b0..d2a786c6bd2d 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -117,7 +117,7 @@ public: virtual void Beep() SAL_OVERRIDE; virtual const SystemEnvData* GetSystemData() const SAL_OVERRIDE; virtual SalPointerState GetPointerState() SAL_OVERRIDE; - virtual SalIndicatorState GetIndicatorState() SAL_OVERRIDE; + virtual KeyIndicatorState GetIndicatorState() SAL_OVERRIDE; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) SAL_OVERRIDE; virtual void SetParent( SalFrame* pNewParent ) SAL_OVERRIDE; virtual bool SetPluginParent( SystemParentData* pNewParent ) SAL_OVERRIDE; diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h index 7611b6d7aa08..8bb0acf982c3 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -142,7 +142,7 @@ public: virtual void Beep() SAL_OVERRIDE; virtual const SystemEnvData* GetSystemData() const SAL_OVERRIDE; virtual SalPointerState GetPointerState() SAL_OVERRIDE; - virtual SalIndicatorState GetIndicatorState() SAL_OVERRIDE; + virtual KeyIndicatorState GetIndicatorState() SAL_OVERRIDE; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) SAL_OVERRIDE; virtual void SetParent( SalFrame* pNewParent ) SAL_OVERRIDE; virtual bool SetPluginParent( SystemParentData* pNewParent ) SAL_OVERRIDE; diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index 73c4e745737a..95e8bf2391af 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -200,12 +200,7 @@ public: virtual SalPointerState GetPointerState() = 0; - struct SalIndicatorState - { - sal_uInt16 mnState; - }; - - virtual SalIndicatorState GetIndicatorState() = 0; + virtual KeyIndicatorState GetIndicatorState() = 0; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) = 0; diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index c10f0b5687f9..ad4a5f0c7e85 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -419,7 +419,7 @@ public: // get current modifier and button mask virtual SalPointerState GetPointerState() SAL_OVERRIDE; - virtual SalIndicatorState GetIndicatorState() SAL_OVERRIDE; + virtual KeyIndicatorState GetIndicatorState() SAL_OVERRIDE; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) SAL_OVERRIDE; diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index acaa1fd7065a..2eca3a3c269f 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -307,7 +307,7 @@ public: void ModifierMapping(); void SimulateKeyPress( sal_uInt16 nKeyCode ); - sal_uInt16 GetIndicatorState() const; + KeyIndicatorState GetIndicatorState() const; OUString GetKeyNameFromKeySym( KeySym keysym ) const; OUString GetKeyName( sal_uInt16 nKeyCode ) const; sal_uInt16 GetKeyCode( KeySym keysym, char*pcPrintable ) const; diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index 9b737f9aeca1..d7ce0c29d9be 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -253,7 +253,7 @@ public: virtual void Beep() SAL_OVERRIDE; virtual const SystemEnvData* GetSystemData() const SAL_OVERRIDE; virtual SalPointerState GetPointerState() SAL_OVERRIDE; - virtual SalIndicatorState GetIndicatorState() SAL_OVERRIDE; + virtual KeyIndicatorState GetIndicatorState() SAL_OVERRIDE; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) SAL_OVERRIDE; virtual void SetParent( SalFrame* pNewParent ) SAL_OVERRIDE; virtual bool SetPluginParent( SystemParentData* pNewParent ) SAL_OVERRIDE; diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index a94cca5afbcb..f548965313c5 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -123,7 +123,7 @@ public: virtual void Beep(); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); - virtual SalIndicatorState GetIndicatorState(); + virtual KeyIndicatorState GetIndicatorState(); virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 2dead3748219..226f5396995f 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -1425,11 +1425,9 @@ SalPointerState AquaSalFrame::GetPointerState() return state; } -SalFrame::SalIndicatorState AquaSalFrame::GetIndicatorState() +KeyIndicatorState AquaSalFrame::GetIndicatorState() { - SalIndicatorState aState; - aState.mnState = 0; - return aState; + return KeyIndicatorState::NONE; } void AquaSalFrame::SimulateKeyPress( sal_uInt16 /*nKeyCode*/ ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index f3c597026987..3b8cde253f4d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1863,9 +1863,9 @@ void Window::doLazyDelete() vcl::LazyDeletor<vcl::Window>::Delete( this ); } -sal_uInt16 Window::GetIndicatorState() const +KeyIndicatorState Window::GetIndicatorState() const { - return mpWindowImpl->mpFrame->GetIndicatorState().mnState; + return mpWindowImpl->mpFrame->GetIndicatorState(); } void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 908d8cefc027..ee922853686c 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -707,18 +707,18 @@ void SalDisplay::SimulateKeyPress( sal_uInt16 nKeyCode ) } } -sal_uInt16 SalDisplay::GetIndicatorState() const +KeyIndicatorState SalDisplay::GetIndicatorState() const { unsigned int _state = 0; - sal_uInt16 nState = 0; + KeyIndicatorState nState = KeyIndicatorState::NONE; XkbGetIndicatorState(pDisp_, XkbUseCoreKbd, &_state); if ((_state & 0x00000001)) - nState |= INDICATOR_CAPSLOCK; + nState |= KeyIndicatorState::CAPSLOCK; if ((_state & 0x00000002)) - nState |= INDICATOR_NUMLOCK; + nState |= KeyIndicatorState::NUMLOCK; if ((_state & 0x00000004)) - nState |= INDICATOR_SCROLLLOCK; + nState |= KeyIndicatorState::SCROLLLOCK; return nState; } diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 77370f71eb2f..52e10567b298 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2708,11 +2708,9 @@ SalFrame::SalPointerState X11SalFrame::GetPointerState() return aState; } -SalFrame::SalIndicatorState X11SalFrame::GetIndicatorState() +KeyIndicatorState X11SalFrame::GetIndicatorState() { - SalIndicatorState aState; - aState.mnState = vcl_sal::getSalDisplay(GetGenericData())->GetIndicatorState(); - return aState; + return vcl_sal::getSalDisplay(GetGenericData())->GetIndicatorState(); } void X11SalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 7341071b9cd2..313386741e99 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -2819,16 +2819,14 @@ SalFrame::SalPointerState GtkSalFrame::GetPointerState() return aState; } -SalFrame::SalIndicatorState GtkSalFrame::GetIndicatorState() +KeyIndicatorState GtkSalFrame::GetIndicatorState() { - SalIndicatorState aState; #if !GTK_CHECK_VERSION(3,0,0) - aState.mnState = GetGtkSalData()->GetGtkDisplay()->GetIndicatorState(); + return GetGtkSalData()->GetGtkDisplay()->GetIndicatorState(); #else g_warning ("missing get indicator state"); - aState.mnState = 0; + return KeyIndicatorState::NONE; #endif - return aState; } void GtkSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 571064574f4c..e900213bae3e 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2884,18 +2884,18 @@ SalFrame::SalPointerState WinSalFrame::GetPointerState() return aState; } -SalFrame::SalIndicatorState WinSalFrame::GetIndicatorState() +KeyIndicatorState WinSalFrame::GetIndicatorState() { - SalIndicatorState aState; + KeyIndicatorState aState = KeyIndicatorState::NONE; aState.mnState = 0; if (::GetKeyState(VK_CAPITAL)) - aState.mnState |= INDICATOR_CAPSLOCK; + aState |= KeyIndicatorState::CAPSLOCK; if (::GetKeyState(VK_NUMLOCK)) - aState.mnState |= INDICATOR_NUMLOCK; + aState |= KeyIndicatorState::NUMLOCK; if (::GetKeyState(VK_SCROLL)) - aState.mnState |= INDICATOR_SCROLLLOCK; + aState |= KeyIndicatorState::SCROLLLOCK; return aState; } |