From 224837289cb6c6753026173b35142b10e7e1538e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 8 Nov 2018 16:05:32 +0200 Subject: fix bug in listbox height calc in ExtensionBox_Impl found by loplugin:singlevalfields Change-Id: Ide29da9222c8323e87fe640bd3548306c1778919 Reviewed-on: https://gerrit.libreoffice.org/63125 Tested-by: Jenkins Reviewed-by: Noel Grandin --- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 9 ++++----- desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'desktop/source/deployment') diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index e8442a20f8a1..b09ce623127f 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -183,7 +183,6 @@ ExtensionBox_Impl::ExtensionBox_Impl(vcl::Window* pParent) : m_nActive( 0 ), m_nTopIndex( 0 ), m_nActiveHeight( 0 ), - m_nExtraHeight( 2 ), m_aSharedImage(BitmapEx(RID_BMP_SHARED)), m_aLockedImage(BitmapEx(RID_BMP_LOCKED)), m_aWarningImage(BitmapEx(RID_BMP_WARNING)), @@ -314,10 +313,10 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos ) if ( aTextHeight < m_nStdHeight ) aTextHeight = m_nStdHeight; + m_nActiveHeight = aTextHeight; + if ( m_vEntries[ nPos ]->m_bHasButtons ) - m_nActiveHeight = aTextHeight + m_nExtraHeight; - else - m_nActiveHeight = aTextHeight + 2; + m_nActiveHeight += 2; } tools::Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const @@ -530,7 +529,7 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools: long nExtraHeight = 0; if (rEntry->m_bHasButtons) - nExtraHeight = m_nExtraHeight; + nExtraHeight = 2; rRenderContext.DrawText(tools::Rectangle(aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - nExtraHeight), sDescription, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 356a4ff2e238..abe69cf87623 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -118,7 +118,6 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox long m_nTopIndex; long m_nStdHeight; long m_nActiveHeight; - long m_nExtraHeight; Image m_aSharedImage; Image m_aLockedImage; Image m_aWarningImage; -- cgit