summaryrefslogtreecommitdiff
path: root/svx/source/form/fmview.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/form/fmview.cxx')
-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 6c089c44c98c..e090d7c73640 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -58,12 +58,15 @@
#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/debug.hxx>
#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;
@@ -511,6 +514,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;