diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-04-17 12:15:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-04-21 10:20:07 +0200 |
commit | ca5b322fd47f527c559f8806162b84eec7158615 (patch) | |
tree | 1fad433983b75bade6b6d92aa83143275a53f5ac | |
parent | 2e0a32b51681fb356699b4a722f461f55a46b890 (diff) |
don't add maUserItemSize to text width, just use it as-is
which means we don't need the reverse calculation in the style
dropdown to force that result
Change-Id: I3c8421e964af4339abfacb455b75db5ad75456fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92446
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 9dd130a1dcc1..523d2816fa64 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1190,7 +1190,7 @@ IMPL_LINK(SvxStyleBox_Impl, CalcOptimalExtraUserWidth, VclWindowEvent&, event, v nMaxUserDrawFontWidth = std::max(nWidth, nMaxUserDrawFontWidth); } - SetUserItemSize(Size(nMaxUserDrawFontWidth - nMaxNormalFontWidth, ITEM_HEIGHT)); + SetUserItemSize(Size(nMaxUserDrawFontWidth, ITEM_HEIGHT)); } // test is the color between Font- and background-color to be identify diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 3fe90de21906..ad33bb85a3a7 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -667,16 +667,18 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) aMetrics.nEntryHeight = std::max( aMetrics.nImgHeight, aMetrics.nEntryHeight ); } - if ( IsUserDrawEnabled() || aMetrics.bImage ) + + bool bIsUserDrawEnabled = IsUserDrawEnabled(); + if (bIsUserDrawEnabled || aMetrics.bImage) { aMetrics.nEntryWidth = std::max( aMetrics.nImgWidth, maUserItemSize.Width() ); - if ( aMetrics.bText ) + if (!bIsUserDrawEnabled && aMetrics.bText) aMetrics.nEntryWidth += aMetrics.nTextWidth + IMG_TXT_DISTANCE; aMetrics.nEntryHeight = std::max( std::max( mnMaxImgHeight, maUserItemSize.Height() ) + 2, aMetrics.nEntryHeight ); } - if ( !aMetrics.bText && !aMetrics.bImage && !IsUserDrawEnabled() ) + if (!aMetrics.bText && !aMetrics.bImage && !bIsUserDrawEnabled) { // entries which have no (aka an empty) text, and no image, // and are not user-drawn, should be shown nonetheless |