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 <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2024-07-22 09:21:28 +02:00
parent 9288e66770
commit 3f1c3a0faa
2 changed files with 13 additions and 15 deletions

View file

@ -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);

View file

@ -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);