include/svtools/ctrlbox.hxx        |    2 ++
 svtools/source/control/ctrlbox.cxx |   31 ++++++++++++++-----------------
 svx/source/tbxctrls/tbcontrl.cxx   |    2 +-
 3 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 23548f4ff51e28fec6751604a0a28197d6680773
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Mar 3 15:28:15 2021 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Mar 4 08:15:29 2021 +0100

    Related tdf#140762 Add texts for "Border style" toolbar item
    
    Make 'GetLineStyleName' a static method of 'SvtLineListBox'
    and use it to retrieve and set the names for the items used
    in the "Border Style" dropdown button in Calc's formatting
    toolbar.
    
    This ensures that the corresponding names are available as
    tooltips and for screen readers.
    
    Change-Id: I6b775e1bcd62deefd8a8a6a778dcee426bf3a1f3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111905
    Tested-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 43347a14ce40..0aff598ff705 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -207,6 +207,8 @@ public:
     SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl);
     ~SvtLineListBox();
 
+    static OUString GetLineStyleName(SvxBorderLineStyle eStyle);
+
     /** Set the width in Twips */
     void SetWidth(tools::Long nWidth)
     {
diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 2f7c3eb4dfdd..393c7439e2cb 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1403,23 +1403,6 @@ void SvtLineListBox::ImpGetLine( tools::Long nLine1, 
tools::Long nLine2, tools::
     rBmp = aVirDev->GetBitmapEx( Point(), Size( aSize.Width(), n1+nDist+n2 ) );
 }
 
-namespace
-{
-    OUString GetLineStyleName(SvxBorderLineStyle eStyle)
-    {
-        OUString sRet;
-        for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(RID_SVXSTR_BORDERLINE); ++i)
-        {
-            if (eStyle == RID_SVXSTR_BORDERLINE[i].second)
-            {
-                sRet = SvtResId(RID_SVXSTR_BORDERLINE[i].first);
-                break;
-            }
-        }
-        return sRet;
-    }
-}
-
 SvtLineListBox::SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl)
     : m_xControl(std::move(pControl))
     , m_xBuilder(Application::CreateBuilder(m_xControl.get(), 
"svt/ui/linewindow.ui"))
@@ -1486,6 +1469,20 @@ SvtLineListBox::~SvtLineListBox()
 {
 }
 
+OUString SvtLineListBox::GetLineStyleName(SvxBorderLineStyle eStyle)
+{
+    OUString sRet;
+    for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(RID_SVXSTR_BORDERLINE); ++i)
+    {
+        if (eStyle == RID_SVXSTR_BORDERLINE[i].second)
+        {
+            sRet = SvtResId(RID_SVXSTR_BORDERLINE[i].first);
+            break;
+        }
+    }
+    return sRet;
+}
+
 sal_Int32 SvtLineListBox::GetStylePos( sal_Int32 nListPos )
 {
     sal_Int32 nPos = -1;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index e9cb9b1a0d31..ab4a7d124e63 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -738,7 +738,7 @@ private:
                         GetColorLine2( GetItemCount( ) ),
                         GetColorDist( GetItemCount( ) ),
                         pData->GetStyle(), aBmp );
-                InsertItem(nId, Image(aBmp));
+                InsertItem(nId, Image(aBmp), 
SvtLineListBox::GetLineStyleName(pData->GetStyle()));
                 Size aBmpSize = aBmp.GetSizePixel();
                 if (aBmpSize.Width() > aSize.Width())
                     aSize.setWidth(aBmpSize.getWidth());
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to