Kaydet (Commit) dcfcf711 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Use bitfield for better readability.

Change-Id: Iaa254703be5f798e749eaccfa3b7136e26054b65
üst f5327527
...@@ -42,7 +42,11 @@ class SVT_DLLPUBLIC SvViewDataEntry ...@@ -42,7 +42,11 @@ class SVT_DLLPUBLIC SvViewDataEntry
std::vector<SvViewDataItem> maItems; std::vector<SvViewDataItem> maItems;
sal_uLong nVisPos; sal_uLong nVisPos;
sal_uInt16 nFlags; bool mbSelected:1;
bool mbExpanded:1;
bool mbFocused:1;
bool mbCursored:1;
bool mbSelectable:1;
public: public:
SvViewDataEntry(); SvViewDataEntry();
......
...@@ -31,16 +31,25 @@ ...@@ -31,16 +31,25 @@
DBG_NAME(SvViewDataEntry); DBG_NAME(SvViewDataEntry);
SvViewDataEntry::SvViewDataEntry() : SvViewDataEntry::SvViewDataEntry() :
nVisPos(0), nFlags(0) nVisPos(0),
mbSelected(false),
mbExpanded(false),
mbFocused(false),
mbCursored(false),
mbSelectable(true)
{ {
DBG_CTOR(SvViewDataEntry,0); DBG_CTOR(SvViewDataEntry,0);
} }
SvViewDataEntry::SvViewDataEntry( const SvViewDataEntry& rData ) : SvViewDataEntry::SvViewDataEntry( const SvViewDataEntry& rData ) :
nVisPos(rData.nVisPos), nFlags(rData.nFlags) nVisPos(rData.nVisPos),
mbSelected(false),
mbExpanded(rData.mbExpanded),
mbFocused(false),
mbCursored(rData.mbCursored),
mbSelectable(rData.mbSelectable)
{ {
DBG_CTOR(SvViewDataEntry,0); DBG_CTOR(SvViewDataEntry,0);
nFlags &= ~( SVLISTENTRYFLAG_SELECTED | SVLISTENTRYFLAG_FOCUSED );
} }
SvViewDataEntry::~SvViewDataEntry() SvViewDataEntry::~SvViewDataEntry()
...@@ -48,73 +57,57 @@ SvViewDataEntry::~SvViewDataEntry() ...@@ -48,73 +57,57 @@ SvViewDataEntry::~SvViewDataEntry()
DBG_DTOR(SvViewDataEntry,0); DBG_DTOR(SvViewDataEntry,0);
#ifdef DBG_UTIL #ifdef DBG_UTIL
nVisPos = 0x12345678; nVisPos = 0x12345678;
nFlags = 0x1234;
#endif #endif
} }
bool SvViewDataEntry::IsSelected() const bool SvViewDataEntry::IsSelected() const
{ {
return (nFlags & SVLISTENTRYFLAG_SELECTED) != 0; return mbSelected;
} }
bool SvViewDataEntry::IsExpanded() const bool SvViewDataEntry::IsExpanded() const
{ {
return (nFlags & SVLISTENTRYFLAG_EXPANDED) != 0; return mbExpanded;
} }
bool SvViewDataEntry::HasFocus() const bool SvViewDataEntry::HasFocus() const
{ {
return (nFlags & SVLISTENTRYFLAG_FOCUSED) != 0; return mbFocused;
} }
bool SvViewDataEntry::IsCursored() const bool SvViewDataEntry::IsCursored() const
{ {
return (nFlags & SVLISTENTRYFLAG_CURSORED) != 0; return mbCursored;
} }
bool SvViewDataEntry::IsSelectable() const bool SvViewDataEntry::IsSelectable() const
{ {
return (nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0; return mbSelectable;
} }
void SvViewDataEntry::SetFocus( bool bFocus ) void SvViewDataEntry::SetFocus( bool bFocus )
{ {
if ( !bFocus ) mbFocused = bFocus;
nFlags &= (~SVLISTENTRYFLAG_FOCUSED);
else
nFlags |= SVLISTENTRYFLAG_FOCUSED;
} }
void SvViewDataEntry::SetCursored( bool bCursored ) void SvViewDataEntry::SetCursored( bool bCursored )
{ {
if ( !bCursored ) mbCursored = bCursored;
nFlags &= (~SVLISTENTRYFLAG_CURSORED);
else
nFlags |= SVLISTENTRYFLAG_CURSORED;
} }
void SvViewDataEntry::SetSelected( bool bSelected ) void SvViewDataEntry::SetSelected( bool bSelected )
{ {
if ( !bSelected ) mbSelected = bSelected;
nFlags &= (~SVLISTENTRYFLAG_SELECTED);
else
nFlags |= SVLISTENTRYFLAG_SELECTED;
} }
void SvViewDataEntry::SetExpanded( bool bExpanded ) void SvViewDataEntry::SetExpanded( bool bExpanded )
{ {
if ( !bExpanded ) mbExpanded = bExpanded;
nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
else
nFlags |= SVLISTENTRYFLAG_EXPANDED;
} }
void SvViewDataEntry::SetSelectable( bool bSelectable ) void SvViewDataEntry::SetSelectable( bool bSelectable )
{ {
if( bSelectable ) mbSelectable;
nFlags &= (~SVLISTENTRYFLAG_NOT_SELECTABLE);
else
nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
} }
void SvViewDataEntry::Init(size_t nSize) void SvViewDataEntry::Init(size_t nSize)
......
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