diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 20:50:06 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 21:29:31 -0500 |
commit | dcfcf711b6631fd018aa755000d6b93040ae0382 (patch) | |
tree | 3ef2c48a392c2b46da84a879e98bb03533b50a0e /svtools | |
parent | f532752756c81a295116b0889fe4e9d31b7c3bb6 (diff) |
Use bitfield for better readability.
Change-Id: Iaa254703be5f798e749eaccfa3b7136e26054b65
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/viewdataentry.hxx | 6 | ||||
-rw-r--r-- | svtools/source/contnr/viewdataentry.cxx | 51 |
2 files changed, 27 insertions, 30 deletions
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx index 06860884dde7..abd1ead34a29 100644 --- a/svtools/inc/svtools/viewdataentry.hxx +++ b/svtools/inc/svtools/viewdataentry.hxx @@ -42,7 +42,11 @@ class SVT_DLLPUBLIC SvViewDataEntry std::vector<SvViewDataItem> maItems; sal_uLong nVisPos; - sal_uInt16 nFlags; + bool mbSelected:1; + bool mbExpanded:1; + bool mbFocused:1; + bool mbCursored:1; + bool mbSelectable:1; public: SvViewDataEntry(); diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index 897e0e9448bc..bcdcb110ae77 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -31,16 +31,25 @@ DBG_NAME(SvViewDataEntry); SvViewDataEntry::SvViewDataEntry() : - nVisPos(0), nFlags(0) + nVisPos(0), + mbSelected(false), + mbExpanded(false), + mbFocused(false), + mbCursored(false), + mbSelectable(true) { DBG_CTOR(SvViewDataEntry,0); } 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); - nFlags &= ~( SVLISTENTRYFLAG_SELECTED | SVLISTENTRYFLAG_FOCUSED ); } SvViewDataEntry::~SvViewDataEntry() @@ -48,73 +57,57 @@ SvViewDataEntry::~SvViewDataEntry() DBG_DTOR(SvViewDataEntry,0); #ifdef DBG_UTIL nVisPos = 0x12345678; - nFlags = 0x1234; #endif } bool SvViewDataEntry::IsSelected() const { - return (nFlags & SVLISTENTRYFLAG_SELECTED) != 0; + return mbSelected; } bool SvViewDataEntry::IsExpanded() const { - return (nFlags & SVLISTENTRYFLAG_EXPANDED) != 0; + return mbExpanded; } bool SvViewDataEntry::HasFocus() const { - return (nFlags & SVLISTENTRYFLAG_FOCUSED) != 0; + return mbFocused; } bool SvViewDataEntry::IsCursored() const { - return (nFlags & SVLISTENTRYFLAG_CURSORED) != 0; + return mbCursored; } bool SvViewDataEntry::IsSelectable() const { - return (nFlags & SVLISTENTRYFLAG_NOT_SELECTABLE) == 0; + return mbSelectable; } void SvViewDataEntry::SetFocus( bool bFocus ) { - if ( !bFocus ) - nFlags &= (~SVLISTENTRYFLAG_FOCUSED); - else - nFlags |= SVLISTENTRYFLAG_FOCUSED; + mbFocused = bFocus; } void SvViewDataEntry::SetCursored( bool bCursored ) { - if ( !bCursored ) - nFlags &= (~SVLISTENTRYFLAG_CURSORED); - else - nFlags |= SVLISTENTRYFLAG_CURSORED; + mbCursored = bCursored; } void SvViewDataEntry::SetSelected( bool bSelected ) { - if ( !bSelected ) - nFlags &= (~SVLISTENTRYFLAG_SELECTED); - else - nFlags |= SVLISTENTRYFLAG_SELECTED; + mbSelected = bSelected; } void SvViewDataEntry::SetExpanded( bool bExpanded ) { - if ( !bExpanded ) - nFlags &= (~SVLISTENTRYFLAG_EXPANDED); - else - nFlags |= SVLISTENTRYFLAG_EXPANDED; + mbExpanded = bExpanded; } void SvViewDataEntry::SetSelectable( bool bSelectable ) { - if( bSelectable ) - nFlags &= (~SVLISTENTRYFLAG_NOT_SELECTABLE); - else - nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE; + mbSelectable; } void SvViewDataEntry::Init(size_t nSize) |