diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 17:44:52 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 19:13:18 -0500 |
commit | 74a16a90ff3befd7fc336cf203a9b797df9fc5b6 (patch) | |
tree | 5c9fbd990c777ffed4cc1248688d57043a0c9dc2 /svtools | |
parent | 1ea411fb15930d734fb31c28dde01d919bd22f38 (diff) |
Avoid direct use of flag value.
Change-Id: I4279c352a990b2ffda482e9c69b63b18b3c13dc9
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/viewdataentry.hxx | 1 | ||||
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 12 | ||||
-rw-r--r-- | svtools/source/contnr/viewdataentry.cxx | 8 |
3 files changed, 15 insertions, 6 deletions
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx index 7f49f639b1a9..8f1c21f91b50 100644 --- a/svtools/inc/svtools/viewdataentry.hxx +++ b/svtools/inc/svtools/viewdataentry.hxx @@ -65,6 +65,7 @@ public: void SetFocus( bool bFocus ); void SetCursored( bool bCursored ); void SetSelected( bool bSelected ); + void SetExpanded( bool bExpanded ); sal_uInt16 GetFlags() const; void SetSelectable( bool bSelectable ); diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 9d4b6f909d4e..70b410c093cc 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -940,7 +940,7 @@ void SvTreeList::Expand( SvListView* pView, SvTreeListEntry* pEntry ) DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Expand: We expected to have child entries."); SvViewDataEntry* pViewData = pView->GetViewData(pEntry); - pViewData->nFlags |= SVLISTENTRYFLAG_EXPANDED; + pViewData->SetExpanded(true); SvTreeListEntry* pParent = pEntry->pParent; // if parent is visible, invalidate status data if ( pView->IsExpanded( pParent ) ) @@ -959,7 +959,7 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry ) DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Collapse: We expected have child entries."); SvViewDataEntry* pViewData = pView->GetViewData( pEntry ); - pViewData->nFlags &=(~SVLISTENTRYFLAG_EXPANDED); + pViewData->SetExpanded(false); SvTreeListEntry* pParent = pEntry->pParent; if ( pView->IsExpanded(pParent) ) @@ -1198,7 +1198,7 @@ void SvListView::InitTable() // insert root entry pEntry = pModel->pRootItem; pViewData = new SvViewDataEntry; - pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED; + pViewData->SetExpanded(true); maDataTable.insert( pEntry, pViewData ); // now all the other entries pEntry = pModel->First(); @@ -1229,7 +1229,7 @@ void SvListView::Clear() // insert root entry SvTreeListEntry* pEntry = pModel->pRootItem; SvViewDataEntry* pViewData = new SvViewDataEntry; - pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED; + pViewData->SetExpanded(true); maDataTable.insert( pEntry, pViewData ); } } @@ -1304,7 +1304,7 @@ void SvListView::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sal_uLon if (pParent != pModel->pRootItem && pParent->maChildren.size() == 1) { SvViewDataEntry* pViewData = maDataTable.find( pParent )->second; - pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); + pViewData->SetExpanded(false); } // vorlaeufig nVisibleCount = 0; @@ -1408,7 +1408,7 @@ void SvListView::ActionRemoving( SvTreeListEntry* pEntry ) if (pCurEntry && pCurEntry != pModel->pRootItem && pCurEntry->maChildren.size() == 1) { pViewData = maDataTable.find(pCurEntry)->second; - pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); + pViewData->SetExpanded(false); } } diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index 9c3d2d3b7889..99aeaa40e33d 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -94,6 +94,14 @@ void SvViewDataEntry::SetSelected( bool bSelected ) nFlags |= SVLISTENTRYFLAG_SELECTED; } +void SvViewDataEntry::SetExpanded( bool bExpanded ) +{ + if ( !bExpanded ) + nFlags &= (~SVLISTENTRYFLAG_EXPANDED); + else + nFlags |= SVLISTENTRYFLAG_EXPANDED; +} + sal_uInt16 SvViewDataEntry::GetFlags() const { return nFlags; |