[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - sc/source sd/source svx/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 16 08:55:13 UTC 2021


 sc/source/ui/inc/gridwin.hxx   |    2 +-
 sc/source/ui/view/gridwin.cxx  |    2 +-
 sc/source/ui/view/gridwin3.cxx |    6 +++++-
 sd/source/ui/view/drviews4.cxx |    4 ++--
 svx/source/form/fmview.cxx     |   28 ++++++++++++++++++++++++++++
 5 files changed, 37 insertions(+), 5 deletions(-)

New commits:
commit 5597f149a27dae43cbc9dfc469689bd6e4f03a17
Author:     Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
AuthorDate: Wed Mar 3 07:47:43 2021 +0100
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Tue Mar 16 09:54:34 2021 +0100

    tdf#139804 Focus form controls inside document with Alt-<Mnemonic>
    
    Change-Id: I710a23a53ca0eb256a477a78ce1b7ae01129f717
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111865
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
    (cherry picked from commit 67ad205404211a2ae17c430a17ede6e9d04d0b7e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112555
    Tested-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 1775114c27c8..5e5760d30f62 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -247,7 +247,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
     bool            DrawMouseButtonDown(const MouseEvent& rMEvt);
     bool            DrawMouseButtonUp(const MouseEvent& rMEvt);
     bool            DrawMouseMove(const MouseEvent& rMEvt);
-    bool            DrawKeyInput(const KeyEvent& rKEvt);
+    bool            DrawKeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
     bool            DrawCommand(const CommandEvent& rCEvt);
     bool            DrawHasMarkedObj();
     void            DrawEndAction();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b2bd86673130..182d7bf4d9b3 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3199,7 +3199,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt)
         if (pViewData->GetDocShell()->GetProgress())
             return;
 
-        if (DrawKeyInput(rKEvt))
+        if (DrawKeyInput(rKEvt, this))
         {
             const vcl::KeyCode& rLclKeyCode = rKEvt.GetKeyCode();
             if (rLclKeyCode.GetCode() == KEY_DOWN
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index 337bb7a72beb..a7ac09421a91 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -151,10 +151,14 @@ bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt)
     return false;
 }
 
-bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt)
+bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
 {
     ScDrawView* pDrView = pViewData->GetScDrawView();
     FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr();
+
+    if (pDrView && pDrView->KeyInput(rKEvt, pWin))
+        return true;
+
     if (pDrView && pDraw && !pViewData->IsRefMode())
     {
         pDraw->SetWindow( this );
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index f8aca149a4ae..91b00f978496 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -124,9 +124,9 @@ void DrawViewShell::DeleteActualLayer()
 
 bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
 {
-    bool bRet = false;
+    bool bRet = GetView()->KeyInput(rKEvt, pWin);
 
-    if ( !IsInputLocked() || ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE ) )
+    if (!bRet && (!IsInputLocked() || (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)))
     {
         if(KEY_RETURN == rKEvt.GetKeyCode().GetCode()
             && rKEvt.GetKeyCode().IsMod1()
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 15df6aa0adfb..806b9cade78c 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -59,11 +59,14 @@
 #include <com/sun/star/beans/PropertyState.hpp>
 #include <com/sun/star/form/FormComponentType.hpp>
 #include <vcl/svapp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/awt/XControl.hpp>
 #include <tools/diagnose_ex.h>
 #include <vcl/stdtext.hxx>
 #include <svx/fmglob.hxx>
 #include <svx/sdrpagewindow.hxx>
 #include <svx/sdrpaintwindow.hxx>
+#include <vcl/i18nhelp.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -510,6 +513,31 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
 
     }
 
+    // tdf#139804 Allow selecting form controls with Alt-<Mnemonic>
+    if (rKeyCode.IsMod2() && rKeyCode.GetCode())
+    {
+        FmFormPage* pCurPage = GetCurPage();
+        for (size_t a = 0; a < pCurPage->GetObjCount(); ++a)
+        {
+            SdrObject* pObj = pCurPage->GetObj(a);
+            FmFormObj* pFormObject = FmFormObj::GetFormObject(pObj);
+            if (!pFormObject)
+                continue;
+
+            Reference<awt::XControl> xControl = pFormObject->GetUnoControl(*this, *pWin);
+            if (!xControl.is())
+                continue;
+            const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
+            VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
+            if (rI18nHelper.MatchMnemonic(pWindow->GetText(), rKEvt.GetCharCode()))
+            {
+                pWindow->GrabFocus();
+                bDone = true;
+                break;
+            }
+        }
+    }
+
     if ( !bDone )
         bDone = E3dView::KeyInput(rKEvt,pWin);
     return bDone;


More information about the Libreoffice-commits mailing list