diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-28 16:09:22 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-28 16:52:00 -0500 |
commit | 215ec266e11e1a45c24fe982cd28b4d360680d3c (patch) | |
tree | 4a2ff755cc0093da4d12f757cd8624f7c768fa2c | |
parent | 918fa06314554d70fbc227b4c6ccf1000a29bb22 (diff) |
Try to reduce direct access/manipulation of the flag value.
Change-Id: I252c1ad55099a821d3c1fec3c64255c4f26a0396
-rw-r--r-- | svtools/inc/svtools/viewdataentry.hxx | 1 | ||||
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 10 | ||||
-rw-r--r-- | svtools/source/contnr/viewdataentry.cxx | 8 |
3 files changed, 12 insertions, 7 deletions
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx index 35b9a5823c79..7f49f639b1a9 100644 --- a/svtools/inc/svtools/viewdataentry.hxx +++ b/svtools/inc/svtools/viewdataentry.hxx @@ -64,6 +64,7 @@ public: bool IsSelectable() const; void SetFocus( bool bFocus ); void SetCursored( bool bCursored ); + void SetSelected( bool bSelected ); sal_uInt16 GetFlags() const; void SetSelectable( bool bSelectable ); diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 9d752eff9349..9d4b6f909d4e 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -979,7 +979,7 @@ sal_Bool SvTreeList::Select( SvListView* pView, SvTreeListEntry* pEntry, sal_Boo return sal_False; else { - pViewData->nFlags |= SVLISTENTRYFLAG_SELECTED; + pViewData->SetSelected(true); pView->nSelectionCount++; } } @@ -989,7 +989,7 @@ sal_Bool SvTreeList::Select( SvListView* pView, SvTreeListEntry* pEntry, sal_Boo return sal_False; else { - pViewData->nFlags &= ~( SVLISTENTRYFLAG_SELECTED ); + pViewData->SetSelected(false); pView->nSelectionCount--; } } @@ -1054,11 +1054,7 @@ void SvTreeList::SelectAll( SvListView* pView, sal_Bool bSelect ) while ( pEntry ) { SvViewDataEntry* pViewData = pView->GetViewData( pEntry ); - if ( bSelect ) - pViewData->nFlags |= SVLISTENTRYFLAG_SELECTED; - else - pViewData->nFlags &= (~SVLISTENTRYFLAG_SELECTED); - + pViewData->SetSelected(bSelect); pEntry = Next( pEntry ); } if ( bSelect ) diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index 5288466f8d79..9c3d2d3b7889 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -86,6 +86,14 @@ void SvViewDataEntry::SetCursored( bool bCursored ) nFlags |= SVLISTENTRYFLAG_CURSORED; } +void SvViewDataEntry::SetSelected( bool bSelected ) +{ + if ( !bSelected ) + nFlags &= (~SVLISTENTRYFLAG_SELECTED); + else + nFlags |= SVLISTENTRYFLAG_SELECTED; +} + sal_uInt16 SvViewDataEntry::GetFlags() const { return nFlags; |