vcl/source/control/button.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit dabb6176407067ef8d46bdde863b087457805c6a
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Wed Jan 29 16:41:02 2020 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Tue Feb 4 08:48:41 2020 +0100

    Place button text in tooltip if it doesn't fit into the button
    
    Seen this happening in custom sidebars (from extensions).
    When the text is too long for the button, it will get cut off
    and there is no way to view the button text.
    
    Change-Id: I86ce72154e0371bdf24480be41517855dc3ce050
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87692
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 6408709e393c..72849df32944 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -216,6 +216,11 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, 
Point& rPos,
     else if (bDrawText && !bDrawImage && !bHasSymbol)
     {
         aOutRect = DrawControlText(*pDev, aOutRect, aText, nTextStyle, 
nullptr, nullptr);
+        tools::Rectangle textRect = GetTextRect(
+            tools::Rectangle(Point(), Size(0x7fffffff, 0x7fffffff)), aText, 
nTextStyle);
+        // If the button text doesn't fit into it, put it into a tooltip 
(might happen in sidebar)
+        if (GetQuickHelpText().isEmpty() && textRect.getWidth() > 
rSize.getWidth())
+            SetQuickHelpText(aText);
 
         ImplSetFocusRect(aOutRect);
         rSize = aOutRect.GetSize();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to