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

Avoid direct use of flag value.

Change-Id: I4279c352a990b2ffda482e9c69b63b18b3c13dc9
üst 1ea411fb
...@@ -65,6 +65,7 @@ public: ...@@ -65,6 +65,7 @@ public:
void SetFocus( bool bFocus ); void SetFocus( bool bFocus );
void SetCursored( bool bCursored ); void SetCursored( bool bCursored );
void SetSelected( bool bSelected ); void SetSelected( bool bSelected );
void SetExpanded( bool bExpanded );
sal_uInt16 GetFlags() const; sal_uInt16 GetFlags() const;
void SetSelectable( bool bSelectable ); void SetSelectable( bool bSelectable );
......
...@@ -940,7 +940,7 @@ void SvTreeList::Expand( SvListView* pView, SvTreeListEntry* pEntry ) ...@@ -940,7 +940,7 @@ void SvTreeList::Expand( SvListView* pView, SvTreeListEntry* pEntry )
DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Expand: We expected to have child entries."); DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Expand: We expected to have child entries.");
SvViewDataEntry* pViewData = pView->GetViewData(pEntry); SvViewDataEntry* pViewData = pView->GetViewData(pEntry);
pViewData->nFlags |= SVLISTENTRYFLAG_EXPANDED; pViewData->SetExpanded(true);
SvTreeListEntry* pParent = pEntry->pParent; SvTreeListEntry* pParent = pEntry->pParent;
// if parent is visible, invalidate status data // if parent is visible, invalidate status data
if ( pView->IsExpanded( pParent ) ) if ( pView->IsExpanded( pParent ) )
...@@ -959,7 +959,7 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry ) ...@@ -959,7 +959,7 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry )
DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Collapse: We expected have child entries."); DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Collapse: We expected have child entries.");
SvViewDataEntry* pViewData = pView->GetViewData( pEntry ); SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
pViewData->nFlags &=(~SVLISTENTRYFLAG_EXPANDED); pViewData->SetExpanded(false);
SvTreeListEntry* pParent = pEntry->pParent; SvTreeListEntry* pParent = pEntry->pParent;
if ( pView->IsExpanded(pParent) ) if ( pView->IsExpanded(pParent) )
...@@ -1198,7 +1198,7 @@ void SvListView::InitTable() ...@@ -1198,7 +1198,7 @@ void SvListView::InitTable()
// insert root entry // insert root entry
pEntry = pModel->pRootItem; pEntry = pModel->pRootItem;
pViewData = new SvViewDataEntry; pViewData = new SvViewDataEntry;
pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED; pViewData->SetExpanded(true);
maDataTable.insert( pEntry, pViewData ); maDataTable.insert( pEntry, pViewData );
// now all the other entries // now all the other entries
pEntry = pModel->First(); pEntry = pModel->First();
...@@ -1229,7 +1229,7 @@ void SvListView::Clear() ...@@ -1229,7 +1229,7 @@ void SvListView::Clear()
// insert root entry // insert root entry
SvTreeListEntry* pEntry = pModel->pRootItem; SvTreeListEntry* pEntry = pModel->pRootItem;
SvViewDataEntry* pViewData = new SvViewDataEntry; SvViewDataEntry* pViewData = new SvViewDataEntry;
pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED; pViewData->SetExpanded(true);
maDataTable.insert( pEntry, pViewData ); maDataTable.insert( pEntry, pViewData );
} }
} }
...@@ -1304,7 +1304,7 @@ void SvListView::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sal_uLon ...@@ -1304,7 +1304,7 @@ void SvListView::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sal_uLon
if (pParent != pModel->pRootItem && pParent->maChildren.size() == 1) if (pParent != pModel->pRootItem && pParent->maChildren.size() == 1)
{ {
SvViewDataEntry* pViewData = maDataTable.find( pParent )->second; SvViewDataEntry* pViewData = maDataTable.find( pParent )->second;
pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); pViewData->SetExpanded(false);
} }
// vorlaeufig // vorlaeufig
nVisibleCount = 0; nVisibleCount = 0;
...@@ -1408,7 +1408,7 @@ void SvListView::ActionRemoving( SvTreeListEntry* pEntry ) ...@@ -1408,7 +1408,7 @@ void SvListView::ActionRemoving( SvTreeListEntry* pEntry )
if (pCurEntry && pCurEntry != pModel->pRootItem && pCurEntry->maChildren.size() == 1) if (pCurEntry && pCurEntry != pModel->pRootItem && pCurEntry->maChildren.size() == 1)
{ {
pViewData = maDataTable.find(pCurEntry)->second; pViewData = maDataTable.find(pCurEntry)->second;
pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); pViewData->SetExpanded(false);
} }
} }
......
...@@ -94,6 +94,14 @@ void SvViewDataEntry::SetSelected( bool bSelected ) ...@@ -94,6 +94,14 @@ void SvViewDataEntry::SetSelected( bool bSelected )
nFlags |= SVLISTENTRYFLAG_SELECTED; nFlags |= SVLISTENTRYFLAG_SELECTED;
} }
void SvViewDataEntry::SetExpanded( bool bExpanded )
{
if ( !bExpanded )
nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
else
nFlags |= SVLISTENTRYFLAG_EXPANDED;
}
sal_uInt16 SvViewDataEntry::GetFlags() const sal_uInt16 SvViewDataEntry::GetFlags() const
{ {
return nFlags; return nFlags;
......
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