diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 21:25:53 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 21:29:31 -0500 |
commit | a013ffa4f71faa77a35352f00bf72195fa7aa499 (patch) | |
tree | 46bbab95f79be46339017cbb04666183707b1a46 /svtools | |
parent | 7a49685adc7e926f320427ee15003acde71053c4 (diff) |
Introduce a 'highlighted' state which differs from a 'selected' state.
And use that to only highlight child entries which should logically be
treated as not-selected but should have the same appearance as the
selected entries.
A 'selected' state is logically registered as 'selected' as well as
visually. A 'highlighted' state should only appear as if it's selected
but logically it's treated the same way as non-selected entry.
Change-Id: Ic4bc6923c7678044cf552194ad9865371465c614
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/viewdataentry.hxx | 13 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 4 | ||||
-rw-r--r-- | svtools/source/contnr/viewdataentry.cxx | 14 |
3 files changed, 26 insertions, 5 deletions
diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx index abd1ead34a29..304b5fa4f4de 100644 --- a/svtools/inc/svtools/viewdataentry.hxx +++ b/svtools/inc/svtools/viewdataentry.hxx @@ -32,9 +32,13 @@ struct SvViewDataItem }; /** - * View-dependent data for an Entry is created in the virtual function - * SvTreeListBox::CreateViewData. The View creation of Items should not be - * changed. + * View-dependent data for a tree list entry created in the virtual function + * SvTreeListBox::CreateViewData(). The item array contains the same number + * of items as that of the items in its corresponding tree list entry. + * + * When an entry is selected, it is both logically and visually selected. + * When an entry is highlighted, it appears selected visually, but it's not + * logically selected. */ class SVT_DLLPUBLIC SvViewDataEntry { @@ -43,6 +47,7 @@ class SVT_DLLPUBLIC SvViewDataEntry std::vector<SvViewDataItem> maItems; sal_uLong nVisPos; bool mbSelected:1; + bool mbHighlighted:1; bool mbExpanded:1; bool mbFocused:1; bool mbCursored:1; @@ -54,6 +59,7 @@ public: ~SvViewDataEntry(); bool IsSelected() const; + bool IsHighlighted() const; bool IsExpanded() const; bool HasFocus() const; bool IsCursored() const; @@ -61,6 +67,7 @@ public: void SetFocus( bool bFocus ); void SetCursored( bool bCursored ); void SetSelected( bool bSelected ); + void SetHighlighted( bool bHighlighted ); void SetExpanded( bool bExpanded ); void SetSelectable( bool bSelectable ); diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index b9c41805a949..945fbb77015f 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -3007,7 +3007,9 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nT int bSelTab = nFlags & SV_LBOXTAB_SHOW_SELECTION; sal_uInt16 nItemType = pItem->GetType(); - if ( pViewDataEntry->IsSelected() && bSelTab && !pViewDataEntry->IsCursored() ) + bool bHighlighted = pViewDataEntry->IsHighlighted() || pViewDataEntry->IsSelected(); + + if (bHighlighted && bSelTab && !pViewDataEntry->IsCursored()) { Color aNewWallColor = rSettings.GetHighlightColor(); if ( !bInUse || nItemType != SV_ITEM_ID_LBOXCONTEXTBMP ) diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index bcdcb110ae77..a7f1a9093a5a 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -33,6 +33,7 @@ DBG_NAME(SvViewDataEntry); SvViewDataEntry::SvViewDataEntry() : nVisPos(0), mbSelected(false), + mbHighlighted(false), mbExpanded(false), mbFocused(false), mbCursored(false), @@ -44,6 +45,7 @@ SvViewDataEntry::SvViewDataEntry() : SvViewDataEntry::SvViewDataEntry( const SvViewDataEntry& rData ) : nVisPos(rData.nVisPos), mbSelected(false), + mbHighlighted(rData.mbHighlighted), mbExpanded(rData.mbExpanded), mbFocused(false), mbCursored(rData.mbCursored), @@ -65,6 +67,11 @@ bool SvViewDataEntry::IsSelected() const return mbSelected; } +bool SvViewDataEntry::IsHighlighted() const +{ + return mbHighlighted; +} + bool SvViewDataEntry::IsExpanded() const { return mbExpanded; @@ -100,6 +107,11 @@ void SvViewDataEntry::SetSelected( bool bSelected ) mbSelected = bSelected; } +void SvViewDataEntry::SetHighlighted( bool bHighlighted ) +{ + mbHighlighted = bHighlighted; +} + void SvViewDataEntry::SetExpanded( bool bExpanded ) { mbExpanded = bExpanded; @@ -107,7 +119,7 @@ void SvViewDataEntry::SetExpanded( bool bExpanded ) void SvViewDataEntry::SetSelectable( bool bSelectable ) { - mbSelectable; + mbSelectable = bSelectable; } void SvViewDataEntry::Init(size_t nSize) |