From 3f1c3a0faa6e0023e326f88d1bd9b84aef386a7e Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 22 Jul 2024 09:21:28 +0200 Subject: [PATCH] tdf#161501 Drop bSelected param for SvxIconChoiceCtrl_Impl::PaintEmphasis The method doesn't do anything for `bSelected = true`, so drop the param, and only call it for the `bSelected = false` case in `SvxIconChoiceCtrl_Impl::PaintEntry` instead. Change-Id: I5e180a42f2960531d16e5df35ce0a4e9c63a1f91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170845 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/control/imivctl.hxx | 3 +-- vcl/source/control/imivctl1.cxx | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx index e616215bc7ef..9bd81e4fda5a 100644 --- a/vcl/source/control/imivctl.hxx +++ b/vcl/source/control/imivctl.hxx @@ -263,8 +263,7 @@ public: } static bool IsBoundingRectValid( const tools::Rectangle& rRect ) { return ( rRect.Right() != LONG_MAX ); } - static void PaintEmphasis(const tools::Rectangle& rRect1, bool bSelected, - vcl::RenderContext& rRenderContext ); + static void PaintEmphasis(const tools::Rectangle& rRect1, vcl::RenderContext& rRenderContext); void PaintItem(const tools::Rectangle& rRect, IcnViewFieldType eItem, SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nPaintFlags, vcl::RenderContext& rRenderContext); diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 5a79779e4dd2..d3e91f194a3f 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -959,20 +959,17 @@ void SvxIconChoiceCtrl_Impl::LoseFocus() } // priorities of the emphasis: bSelected -void SvxIconChoiceCtrl_Impl::PaintEmphasis(const tools::Rectangle& rTextRect, bool bSelected, +void SvxIconChoiceCtrl_Impl::PaintEmphasis(const tools::Rectangle& rTextRect, vcl::RenderContext& rRenderContext) { - if (!bSelected) - { - Color aOldFillColor(rRenderContext.GetFillColor()); - const Color& rFillColor = rRenderContext.GetFont().GetFillColor(); - rRenderContext.SetFillColor(rFillColor); - // draw text rectangle - if (rFillColor != COL_TRANSPARENT) - rRenderContext.DrawRect(rTextRect); + Color aOldFillColor(rRenderContext.GetFillColor()); + const Color& rFillColor = rRenderContext.GetFont().GetFillColor(); + rRenderContext.SetFillColor(rFillColor); + // draw text rectangle + if (rFillColor != COL_TRANSPARENT) + rRenderContext.DrawRect(rTextRect); - rRenderContext.SetFillColor(aOldFillColor); - } + rRenderContext.SetFillColor(aOldFillColor); } @@ -1051,8 +1048,6 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po nBmpPaintFlags |= PAINTFLAG_HOR_CENTERED; sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED; - PaintEmphasis(aTextRect, bSelected, rRenderContext); - // Background of selected entry tools::Rectangle aFocusRect(CalcFocusRect(pEntry)); bool bNativeSelection = rRenderContext.IsNativeControlSupported(ControlType::WindowBackground, ControlPart::Entire); @@ -1085,6 +1080,10 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po pView->HasFocus() ? 1 : 2, false, false, false); } } + else + { + PaintEmphasis(aTextRect, rRenderContext); + } if (pEntry->IsFocused()) DrawFocusRect(rRenderContext, pEntry);