summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-03-03 07:47:43 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-03-15 12:47:34 +0100
commit67ad205404211a2ae17c430a17ede6e9d04d0b7e (patch)
treebd79a730aba26b7c69830e518f086ea11ac3ef01 /svx
parentaa0fb6ed5c9bd17f9fe339de981291120431c370 (diff)
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@allotropia.de>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/form/fmview.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 756fa8d2b21e..feb1e43f2f8e 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -41,11 +41,14 @@
#include <fmundo.hxx>
#include <svx/dataaccessdescriptor.hxx>
#include <comphelper/namedvaluecollection.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/XControl.hpp>
#include <tools/debug.hxx>
#include <svx/sdrpagewindow.hxx>
#include <svx/sdrpaintwindow.hxx>
#include <svx/svxids.hrc>
+#include <vcl/i18nhelp.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -493,6 +496,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;