tdf#161853 vcl: Simplify SvxIconChoiceCtrl_Impl::CalcTextRect
Drop the `OUString* pStr` param and always use the entry
text instead. This is the default, and all callers explicitly
passing a string were passing the entry text anyway.
Change-Id: I0ef46ca001fe568febb02e132df379c360d8282a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169802
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 a139529..6154c02 100644
--- a/vcl/source/control/imivctl.hxx
+++ b/vcl/source/control/imivctl.hxx
@@ -317,8 +317,7 @@ public:
tools::Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = nullptr );
tools::Rectangle CalcTextRect(
SvxIconChoiceCtrlEntry*,
const Point* pPos = nullptr,
const OUString* pStr = nullptr
const Point* pPos = nullptr
);
tools::Long CalcBoundingWidth() const;
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index f8aaf42..9ba6008 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -1390,8 +1390,7 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
rRenderContext.Push(vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR);
OUString aEntryText(SvtIconChoiceCtrl::GetEntryText(pEntry));
tools::Rectangle aTextRect(CalcTextRect(pEntry, &rPos, &aEntryText));
tools::Rectangle aTextRect(CalcTextRect(pEntry, &rPos));
tools::Rectangle aBmpRect(CalcBmpRect(pEntry, &rPos));
bool bShowSelection = (bSelected && (eSelectionMode != SelectionMode::NONE));
@@ -1577,19 +1576,14 @@ tools::Rectangle SvxIconChoiceCtrl_Impl::CalcBmpRect( SvxIconChoiceCtrlEntry* pE
}
tools::Rectangle SvxIconChoiceCtrl_Impl::CalcTextRect( SvxIconChoiceCtrlEntry* pEntry,
const Point* pEntryPos, const OUString* pStr )
const Point* pEntryPos)
{
OUString aEntryText;
if( !pStr )
aEntryText = SvtIconChoiceCtrl::GetEntryText( pEntry );
else
aEntryText = *pStr;
const tools::Rectangle aMaxTextRect( CalcMaxTextRect( pEntry ) );
tools::Rectangle aBound( GetEntryBoundRect( pEntry ) );
if( pEntryPos )
aBound.SetPos( *pEntryPos );
const OUString aEntryText = SvtIconChoiceCtrl::GetEntryText(pEntry);
tools::Rectangle aTextRect = pView->GetTextRect( aMaxTextRect, aEntryText, nCurTextDrawFlags );
Size aTextSize( aTextRect.GetSize() );
@@ -2772,8 +2766,8 @@ bool SvxIconChoiceCtrl_Impl::RequestHelp( const HelpEvent& rHEvt )
return false;
OUString sQuickHelpText = pEntry->GetQuickHelpText();
tools::Rectangle aTextRect(CalcTextRect(pEntry, nullptr));
OUString aEntryText( SvtIconChoiceCtrl::GetEntryText( pEntry ) );
tools::Rectangle aTextRect( CalcTextRect( pEntry, nullptr, &aEntryText ) );
if ( ( !aTextRect.Contains( aPos ) || aEntryText.isEmpty() ) && sQuickHelpText.isEmpty() )
return false;