diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-06-15 20:37:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-06-16 09:31:24 +0200 |
commit | 4e41879586fb24e925fb59dd06c43235f298e66d (patch) | |
tree | f98c87917ebd4aa7440dbe2cf26fa0550d3cdf94 /sw | |
parent | a447b5b6d1114111c92e5e3e3f3ae83d4c2f3bca (diff) |
Related: tdf#123846 don't auto toggle radiobuttons with left/right
just do the default cursor move, toggle can be triggered with
space/return or directly with 0-9 (+ a for 10)
Change-Id: I654ca64e49b3a9d4672668553095e971a5c9d1e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135921
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/index/cnttab.cxx | 45 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/assignstylesdialog.ui | 1 |
2 files changed, 38 insertions, 8 deletions
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 1aac737639b9..759dccc46721 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -480,6 +480,8 @@ class SwAddStylesDlg_Impl : public SfxDialogController std::unique_ptr<weld::Button> m_xRightPB; std::unique_ptr<weld::TreeView> m_xHeaderTree; + void ToggleOn(int nEntry, int nToggleColumn); + DECL_LINK(OkHdl, weld::Button&, void); DECL_LINK(LeftRightHdl, weld::Button&, void); DECL_LINK(KeyInput, const KeyEvent&, bool); @@ -614,15 +616,37 @@ IMPL_LINK(SwAddStylesDlg_Impl, KeyInput, const KeyEvent&, rKEvt, bool) vcl::KeyCode aCode = rKEvt.GetKeyCode(); bool bHandled = false; - if (aCode.GetCode() == KEY_ADD || aCode.GetCode() == KEY_RIGHT) - { - LeftRightHdl(*m_xRightPB); - bHandled = true; - } - else if (aCode.GetCode() == KEY_SUBTRACT || aCode.GetCode() == KEY_LEFT) + sal_uInt16 nCode = aCode.GetCode(); + switch (nCode) { - LeftRightHdl(*m_xLeftPB); - bHandled = true; + case KEY_ADD: + LeftRightHdl(*m_xRightPB); + bHandled = true; + break; + case KEY_SUBTRACT: + LeftRightHdl(*m_xLeftPB); + bHandled = true; + break; + case KEY_0: + case KEY_1: + case KEY_2: + case KEY_3: + case KEY_4: + case KEY_5: + case KEY_6: + case KEY_7: + case KEY_8: + case KEY_9: + case KEY_A: + { + int nEntry = m_xHeaderTree->get_selected_index(); + if (nEntry != -1) + { + ToggleOn(nEntry, nCode != KEY_A ? nCode - KEY_0 : 10); + bHandled = true; + } + break; + } } return bHandled; @@ -686,6 +710,11 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, weld::Button&, rBtn, void) ++nToggleColumn; } + ToggleOn(nEntry, nToggleColumn); +} + +void SwAddStylesDlg_Impl::ToggleOn(int nEntry, int nToggleColumn) +{ for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j) { m_xHeaderTree->set_toggle(nEntry, j == nToggleColumn ? TRISTATE_TRUE : TRISTATE_FALSE, j + 1); diff --git a/sw/uiconfig/swriter/ui/assignstylesdialog.ui b/sw/uiconfig/swriter/ui/assignstylesdialog.ui index f3d53261511b..c87d3f40c9a5 100644 --- a/sw/uiconfig/swriter/ui/assignstylesdialog.ui +++ b/sw/uiconfig/swriter/ui/assignstylesdialog.ui @@ -259,6 +259,7 @@ <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="model">liststore1</property> + <property name="enable-search">False</property> <property name="search-column">0</property> <property name="show-expanders">False</property> <child internal-child="selection"> |