svx/source/sidebar/text/TextCharacterSpacingControl.cxx |   25 +++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

New commits:
commit c0f914ad912796ef521ea151abf8ea7e9bc2f771
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Tue Jan 25 10:40:21 2022 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Feb 1 07:07:37 2022 +0100

    tdf#111733 TextCharacterSpacingControl::GrabFocus kerning spinbutton
    
    When the kerning menu opens, it defaulted to very tight,
    regardless of what the current setting was.
    However, the current value can easily be connected to the
    menu options, so lets do that.
    
    This depends on increasing the spinbutton range beyond -2.0,
    done via LO 7.4 commit 2334561bf15ec9b061636919efbd0e2a7b89e29b
    
    Change-Id: I0be0956bf1cc3604faecc691aeac70a5bbba807b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128909
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx 
b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index e3685146b6f5..3da72391476a 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -67,7 +67,30 @@ 
TextCharacterSpacingControl::TextCharacterSpacingControl(TextCharacterSpacingPop
 
 void TextCharacterSpacingControl::GrabFocus()
 {
-    mxVeryTight->grab_focus();
+    tools::Long nKerning = mxEditKerning->get_value(FieldUnit::NONE);
+    switch (nKerning)
+    {
+        case SPACING_VERY_TIGHT:
+            mxVeryTight->grab_focus();
+            break;
+        case SPACING_TIGHT:
+            mxTight->grab_focus();
+            break;
+        case SPACING_NORMAL:
+            mxNormal->grab_focus();
+            break;
+        case SPACING_LOOSE:
+            mxLoose->grab_focus();
+            break;
+        case SPACING_VERY_LOOSE:
+            mxVeryLoose->grab_focus();
+            break;
+        default:
+            if (nKerning == mnCustomKern)
+                mxLastCustom->grab_focus();
+            else
+                mxEditKerning->grab_focus();
+    }
 }
 
 TextCharacterSpacingControl::~TextCharacterSpacingControl()

Reply via email to