include/svtools/valueset.hxx        |    3 +--
 svtools/source/control/valueset.cxx |   14 ++++----------
 2 files changed, 5 insertions(+), 12 deletions(-)

New commits:
commit 5fbc81640770dfe11907b2f92f3ae455e582a302
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Nov 1 20:37:06 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Nov 2 14:54:34 2021 +0100

    mbDrawSelection is always true when evaluated
    
    Change-Id: I043e68d5a5a6af8814f1db0f61f1cd95078ad11c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124570
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index ada2641c2eb4..baee0108af9e 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -217,7 +217,6 @@ private:
     bool            mbFormat : 1;
     bool            mbHighlight : 1;
     bool            mbNoSelection : 1;
-    bool            mbDrawSelection : 1;
     bool            mbDoubleSel : 1;
     bool            mbScroll : 1;
     bool            mbFullMode : 1;
@@ -238,7 +237,7 @@ private:
                                                const bool bFocus, const bool 
bDrawSel,
                                                const bool bSelected, const 
bool bHover);
     SVT_DLLPRIVATE void         ImplDrawSelect(vcl::RenderContext& 
rRenderContext);
-    SVT_DLLPRIVATE void         ImplHighlightItem(sal_uInt16 nItemId, bool 
bIsSelection = true);
+    SVT_DLLPRIVATE void         ImplHighlightItem(sal_uInt16 nItemId);
     SVT_DLLPRIVATE void         ImplDraw(vcl::RenderContext& rRenderContext);
     SVT_DLLPRIVATE size_t       ImplGetItem( const Point& rPoint ) const;
     SVT_DLLPRIVATE ValueSetItem*    ImplGetItem( size_t nPos );
diff --git a/svtools/source/control/valueset.cxx 
b/svtools/source/control/valueset.cxx
index 0a73e0418c72..2afd1dfdeb57 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -100,7 +100,6 @@ ValueSet::ValueSet(std::unique_ptr<weld::ScrolledWindow> 
pScrolledWindow)
     mnSpacing           = 0;
     mnFrameStyle        = DrawFrameStyle::NONE;
     mbNoSelection       = true;
-    mbDrawSelection     = true;
     mbDoubleSel         = false;
     mbScroll            = false;
     mbFullMode          = true;
@@ -468,14 +467,14 @@ void ValueSet::ImplTracking(bool bLeaveWindow, const 
Point& rPos)
         if( GetStyle() & WB_MENUSTYLEVALUESET || GetStyle() & WB_FLATVALUESET )
             mbHighlight = true;
 
-        ImplHighlightItem( pItem->mnId );
+        ImplHighlightItem(pItem->mnId);
     }
     else
     {
         if( GetStyle() & WB_MENUSTYLEVALUESET || GetStyle() & WB_FLATVALUESET )
             mbHighlight = true;
 
-        ImplHighlightItem( 0, false );
+        ImplHighlightItem(0);
     }
 }
 
@@ -668,7 +667,7 @@ tools::Rectangle ValueSet::ImplGetItemRect( size_t nPos ) 
const
     return tools::Rectangle( Point(x, y), Size(mnItemWidth, mnItemHeight) );
 }
 
-void ValueSet::ImplHighlightItem( sal_uInt16 nItemId, bool bIsSelection )
+void ValueSet::ImplHighlightItem(sal_uInt16 nItemId)
 {
     if ( mnHighItemId == nItemId )
         return;
@@ -676,13 +675,8 @@ void ValueSet::ImplHighlightItem( sal_uInt16 nItemId, bool 
bIsSelection )
     // remember the old item to delete the previous selection
     mnHighItemId = nItemId;
 
-    // don't draw the selection if nothing is selected
-    if ( !bIsSelection && mbNoSelection )
-        mbDrawSelection = false;
-
     // remove the old selection and draw the new one
     Invalidate();
-    mbDrawSelection = true;
 }
 
 void ValueSet::ImplDraw(vcl::RenderContext& rRenderContext)
@@ -1184,7 +1178,7 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& 
rRenderContext)
         return;
 
     const bool bFocus = HasFocus();
-    const bool bDrawSel = !((mbNoSelection && !mbHighlight) || 
(!mbDrawSelection && mbHighlight));
+    const bool bDrawSel = !mbNoSelection || mbHighlight;
 
     if (!bFocus && !bDrawSel)
     {

Reply via email to