diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-10-26 17:05:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-10-27 14:00:00 +0200 |
commit | e210c66015beed1632188764d0680247237b7707 (patch) | |
tree | 2f1901d1a0c8ed5747b47bc33d092c58ace84787 | |
parent | eccd817127d852df98df173513a5c8d91c68e2c8 (diff) |
dont draw highlighted value with focus, only focus the selected value
Change-Id: I63dc0ffd157d79e998156439f88a87c1ecfbea3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124233
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svtools/valueset.hxx | 4 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 3fd4c0b12b18..ffaa49a29b7f 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -230,7 +230,9 @@ private: SVT_DLLPRIVATE void ImplDeleteItems(); SVT_DLLPRIVATE void ImplFormatItem(vcl::RenderContext const & rRenderContext, ValueSetItem* pItem, tools::Rectangle aRect); SVT_DLLPRIVATE void ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rStr); - SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel); + // nItemId is the item to draw selected, but if nothing is selected something else may be drawn as selected instead, the item drawn + // selected is returned + SVT_DLLPRIVATE sal_uInt16 ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel); SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext); SVT_DLLPRIVATE void ImplHighlightItem(sal_uInt16 nItemId, bool bIsSelection = true); SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index f50f7dc01886..4993bb9a7a93 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1189,14 +1189,14 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext) return; } - ImplDrawSelect(rRenderContext, mnSelItemId, bFocus, bDrawSel); - if (mbHighlight) + sal_uInt16 nItemDrawnSelected = ImplDrawSelect(rRenderContext, mnSelItemId, bFocus, bDrawSel); + if (mbHighlight && mnHighItemId != nItemDrawnSelected) { - ImplDrawSelect(rRenderContext, mnHighItemId, bFocus, bDrawSel); + ImplDrawSelect(rRenderContext, mnHighItemId, false, bDrawSel); } } -void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel ) +sal_uInt16 ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel ) { ValueSetItem* pItem; tools::Rectangle aRect; @@ -1217,11 +1217,11 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nIt } else { - return; + return 0; } if (!pItem->mbVisible) - return; + return 0; // draw selection const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); @@ -1314,6 +1314,8 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nIt } ImplDrawItemText(rRenderContext, pItem->maText); + + return pItem->mnId; } void ValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, ValueSetItem* pItem, tools::Rectangle aRect) |