diff options
author | Rafael Lima <rafael.palma.lima@gmail.com> | 2023-07-20 20:39:31 +0200 |
---|---|---|
committer | Rafael Lima <rafael.palma.lima@gmail.com> | 2023-07-26 23:29:17 +0200 |
commit | 1f10a5b5a04a9d0cd5f456293e62e4f2c0fd7bb3 (patch) | |
tree | c0829505696fba0df77bfe66d3b2dbcc30065c9e /starmath/source | |
parent | ec912956903b2657f4a6b67a68c2687e8be32508 (diff) |
tdf#149888 Make F1 work in Math initial state
Currently, when Math is opened and F1 is pressed in its initial state, no help page is opened. This is caused by the GrabFocus call in InitialFocusTimerHdl (see comments in its implementation).
This patch ensures that pressing F1 both in the Edit and Graphics windows will open the main help page of the Math module.
NOTE: This patch will only work after the related patch in helpcontent2 gets accepted, since it is responsible for creating the HID target in the XHP file.
Change-Id: I59980cea1816a863e1aaa2d0757d9b141437ead5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154691
Tested-by: Jenkins
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/edit.cxx | 6 | ||||
-rw-r--r-- | starmath/source/view.cxx | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 1eee64ad04c7..4cb4f6532f64 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -288,6 +288,12 @@ bool SmEditTextWindow::Command(const CommandEvent& rCEvt) bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt) { + if (rKEvt.GetKeyCode().GetCode() == KEY_F1) + { + mrEditWindow.GetView()->StartMainHelp(); + return true; + } + if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) { bool bCallBase = true; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index a67745184e34..449dc0e586e7 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -66,6 +66,7 @@ #include <sfx2/zoomitem.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> +#include <vcl/help.hxx> #include <vcl/settings.hxx> #include <vcl/virdev.hxx> #include <sal/log.hxx> @@ -700,6 +701,12 @@ bool CharInput(sal_uInt32 c, SmCursor& rCursor, OutputDevice& rDevice) bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) { + if (rKEvt.GetKeyCode().GetCode() == KEY_F1) + { + GetView().StartMainHelp(); + return true; + } + if (!SmViewShell::IsInlineEditEnabled()) return GetView().KeyInput(rKEvt); @@ -2329,6 +2336,13 @@ bool SmViewShell::IsInlineEditEnabled() || officecfg::Office::Common::Misc::ExperimentalMode::get(); } +void SmViewShell::StartMainHelp() +{ + Help* pHelp = Application::GetHelp(); + if (pHelp) + pHelp->Start(HID_SMA_MAIN_HELP, GetViewFrame().GetFrameWeld()); +} + void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet) { assert(pSet); |