Kaydet (Commit) a48d8465 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#84938: convert SELENG_ #defines to 'enum class'

Change-Id: I200fc00958984577ced6d2df87c8e9647b43c809
üst 64cccf36
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
#include <vcl/timer.hxx> #include <vcl/timer.hxx>
#include <vcl/event.hxx> #include <vcl/event.hxx>
#include <o3tl/typed_flags_set.hxx>
namespace vcl { class Window; } namespace vcl { class Window; }
class CommandEvent; class CommandEvent;
...@@ -63,15 +64,20 @@ public: ...@@ -63,15 +64,20 @@ public:
// - SelectionEngine - // - SelectionEngine -
enum class SelectionEngineFlags {
#define SELENG_DRG_ENAB 0x0001 DRG_ENAB = 0x0001,
#define SELENG_IN_SEL 0x0002 IN_SEL = 0x0002,
#define SELENG_IN_ADD 0x0004 IN_ADD = 0x0004,
#define SELENG_ADD_ALW 0x0008 ADD_ALW = 0x0008,
#define SELENG_HAS_ANCH 0x0020 HAS_ANCH = 0x0020,
#define SELENG_CMDEVT 0x0040 CMDEVT = 0x0040,
#define SELENG_WAIT_UPEVT 0x0080 WAIT_UPEVT = 0x0080,
#define SELENG_EXPANDONMOVE 0x0100 EXPANDONMOVE = 0x0100,
};
namespace o3tl
{
template<> struct typed_flags<SelectionEngineFlags> : is_typed_flags<SelectionEngineFlags, 0x01ff> {};
}
class VCL_DLLPUBLIC SelectionEngine class VCL_DLLPUBLIC SelectionEngine
{ {
...@@ -84,7 +90,7 @@ private: ...@@ -84,7 +90,7 @@ private:
SelectionMode eSelMode; SelectionMode eSelMode;
sal_uLong nUpdateInterval; sal_uLong nUpdateInterval;
sal_uInt16 nLockedMods; sal_uInt16 nLockedMods;
sal_uInt16 nFlags; SelectionEngineFlags nFlags;
DECL_DLLPRIVATE_LINK( ImpWatchDog, void* ); DECL_DLLPRIVATE_LINK( ImpWatchDog, void* );
inline bool ShouldDeselect( bool bModifierKey1 ) const; inline bool ShouldDeselect( bool bModifierKey1 ) const;
...@@ -157,15 +163,15 @@ public: ...@@ -157,15 +163,15 @@ public:
void ExpandSelectionOnMouseMove( bool bExpand = true ) void ExpandSelectionOnMouseMove( bool bExpand = true )
{ {
if( bExpand ) if( bExpand )
nFlags |= SELENG_EXPANDONMOVE; nFlags |= SelectionEngineFlags::EXPANDONMOVE;
else else
nFlags &= ~SELENG_EXPANDONMOVE; nFlags &= ~SelectionEngineFlags::EXPANDONMOVE;
} }
}; };
inline bool SelectionEngine::IsAddMode() const inline bool SelectionEngine::IsAddMode() const
{ {
if ( nFlags & (SELENG_IN_ADD | SELENG_ADD_ALW) ) if ( nFlags & (SelectionEngineFlags::IN_ADD | SelectionEngineFlags::ADD_ALW) )
return true; return true;
else else
return false; return false;
...@@ -174,30 +180,30 @@ inline bool SelectionEngine::IsAddMode() const ...@@ -174,30 +180,30 @@ inline bool SelectionEngine::IsAddMode() const
inline void SelectionEngine::SetAddMode( bool bNewMode ) inline void SelectionEngine::SetAddMode( bool bNewMode )
{ {
if ( bNewMode ) if ( bNewMode )
nFlags |= SELENG_IN_ADD; nFlags |= SelectionEngineFlags::IN_ADD;
else else
nFlags &= (~SELENG_IN_ADD); nFlags &= (~SelectionEngineFlags::IN_ADD);
} }
inline void SelectionEngine::EnableDrag( bool bOn ) inline void SelectionEngine::EnableDrag( bool bOn )
{ {
if ( bOn ) if ( bOn )
nFlags |= SELENG_DRG_ENAB; nFlags |= SelectionEngineFlags::DRG_ENAB;
else else
nFlags &= (~SELENG_DRG_ENAB); nFlags &= (~SelectionEngineFlags::DRG_ENAB);
} }
inline void SelectionEngine::AddAlways( bool bOn ) inline void SelectionEngine::AddAlways( bool bOn )
{ {
if( bOn ) if( bOn )
nFlags |= SELENG_ADD_ALW; nFlags |= SelectionEngineFlags::ADD_ALW;
else else
nFlags &= (~SELENG_ADD_ALW); nFlags &= (~SelectionEngineFlags::ADD_ALW);
} }
inline bool SelectionEngine::IsAlwaysAdding() const inline bool SelectionEngine::IsAlwaysAdding() const
{ {
if ( nFlags & SELENG_ADD_ALW ) if ( nFlags & SelectionEngineFlags::ADD_ALW )
return true; return true;
else else
return false; return false;
...@@ -205,7 +211,7 @@ inline bool SelectionEngine::IsAlwaysAdding() const ...@@ -205,7 +211,7 @@ inline bool SelectionEngine::IsAlwaysAdding() const
inline bool SelectionEngine::IsInSelection() const inline bool SelectionEngine::IsInSelection() const
{ {
if ( nFlags & SELENG_IN_SEL ) if ( nFlags & SelectionEngineFlags::IN_SEL )
return true; return true;
else else
return false; return false;
...@@ -213,7 +219,7 @@ inline bool SelectionEngine::IsInSelection() const ...@@ -213,7 +219,7 @@ inline bool SelectionEngine::IsInSelection() const
inline bool SelectionEngine::HasAnchor() const inline bool SelectionEngine::HasAnchor() const
{ {
if ( nFlags & SELENG_HAS_ANCH ) if ( nFlags & SelectionEngineFlags::HAS_ANCH )
return true; return true;
else else
return false; return false;
...@@ -222,9 +228,9 @@ inline bool SelectionEngine::HasAnchor() const ...@@ -222,9 +228,9 @@ inline bool SelectionEngine::HasAnchor() const
inline void SelectionEngine::SetAnchor( bool bAnchor ) inline void SelectionEngine::SetAnchor( bool bAnchor )
{ {
if ( bAnchor ) if ( bAnchor )
nFlags |= SELENG_HAS_ANCH; nFlags |= SelectionEngineFlags::HAS_ANCH;
else else
nFlags &= (~SELENG_HAS_ANCH); nFlags &= (~SelectionEngineFlags::HAS_ANCH);
} }
#endif // INCLUDED_VCL_SELENG_HXX #endif // INCLUDED_VCL_SELENG_HXX
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment