tdf#161853 vcl: Move logic into SvxIconChoiceCtrl_Impl::DrawFocusRect
Move calculating the focus rect from
`SvxIconChoiceCtrl_Impl::PaintItem` to
`SvxIconChoiceCtrl_Impl::DrawFocusRect`.
The former is currently the only caller
of the latter, so behavior should remain
unchanged.
Change-Id: I1c3dd73acb3a1a6b8bb61034c06a79d75c5ed3f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169793
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx
index f79e010..95435c7 100644
--- a/vcl/source/control/imivctl.hxx
+++ b/vcl/source/control/imivctl.hxx
@@ -237,7 +237,7 @@ class SvxIconChoiceCtrl_Impl
void SetOrigin( const Point& );
void ShowFocus ( tools::Rectangle const & rRect );
void DrawFocusRect(vcl::RenderContext& rRenderContext);
void DrawFocusRect(vcl::RenderContext& rRenderContext, SvxIconChoiceCtrlEntry* pEntry);
bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const;
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index 3b26c6b..bb4d9a4 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -1368,11 +1368,7 @@ void SvxIconChoiceCtrl_Impl::PaintItem(const tools::Rectangle& rRect,
rRenderContext.DrawText(rRect, aText, nCurTextDrawFlags);
if (pEntry->IsFocused())
{
tools::Rectangle aRect (CalcFocusRect(pEntry));
ShowFocus(aRect);
DrawFocusRect(rRenderContext);
}
DrawFocusRect(rRenderContext, pEntry);
}
else
{
@@ -2465,8 +2461,11 @@ void SvxIconChoiceCtrl_Impl::ShowFocus ( tools::Rectangle const & rRect )
aFocus.aRect = rRect;
}
void SvxIconChoiceCtrl_Impl::DrawFocusRect(vcl::RenderContext& rRenderContext)
void SvxIconChoiceCtrl_Impl::DrawFocusRect(vcl::RenderContext& rRenderContext, SvxIconChoiceCtrlEntry* pEntry)
{
tools::Rectangle aRect (CalcFocusRect(pEntry));
ShowFocus(aRect);
rRenderContext.SetLineColor(aFocus.aPenColor);
rRenderContext.SetFillColor();
tools::Polygon aPolygon (aFocus.aRect);