[Libreoffice-commits] core.git: svx/source vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 21 08:20:47 UTC 2020


 svx/source/tbxctrls/tbcontrl.cxx   |    2 +-
 vcl/source/control/imp_listbox.cxx |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit ca5b322fd47f527c559f8806162b84eec7158615
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 17 12:15:06 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Apr 21 10:20:07 2020 +0200

    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 at redhat.com>

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


More information about the Libreoffice-commits mailing list