include/sfx2/charmapcontainer.hxx | 2 +- include/sfx2/charwin.hxx | 4 ++-- include/svx/cuicharmap.hxx | 2 +- sfx2/inc/charmapcontrol.hxx | 2 +- sfx2/source/control/charmapcontainer.cxx | 2 +- sfx2/source/control/charmapcontrol.cxx | 4 ++-- sfx2/source/control/charwin.cxx | 5 ++--- svx/source/dialog/cuicharmap.cxx | 18 +++++++++--------- sw/qa/extras/accessibility/dialogs.cxx | 11 ++--------- 9 files changed, 21 insertions(+), 29 deletions(-)
New commits: commit 7ae5b227f7461b7e1d937e50aa57c121c19fda22 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Dec 19 20:51:11 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Dec 19 22:52:50 2025 +0100 tdf#168594 a11y: Update special char info on keyboard triggered focus So far, the information about the currently focused recent/favorite character in the "Insert" -> "Special Character..." dialog was only updated when a recent or favorite character was clicked using the mouse, not when it received focus because of moving focus to it using the Tab key. Also update the info when focus is changed using the keyboard, by connecting the handler to the corresponding callback instead of the one specific for mouse clicks. Rename the handler for consistency. Other than the special characters dialog, the toolbar popup already implemented updating the displayed info on focus change (see SfxCharmapCtrl::CharFocusInHdl), so doesn't need to be modified in that regard. As a consequence of this, the last recent/favorite character that had focus is now also used when pressing the "Insert" button in the special characters dialog, not necessarily the one that was previously picked in the character table at the top. This is consistent with the existing behavior when a favorite/recent character was clicked on, so seems fine to me. Adjust the special character dialog a11y tests accordingly, to press the Enter key while the character to be inserted in the table is still the active character. This triggers the dialog's default action, which is the "Insert" one. Change-Id: I0ff3067853a8f71f8ed7915f965ee6d78bfe8f8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195933 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/include/svx/cuicharmap.hxx b/include/svx/cuicharmap.hxx index fcd48759beff..632f4db6b5c7 100644 --- a/include/svx/cuicharmap.hxx +++ b/include/svx/cuicharmap.hxx @@ -118,7 +118,7 @@ private: DECL_DLLPRIVATE_LINK(SearchCharHighlightHdl, SvxShowCharSet&, void); DECL_DLLPRIVATE_LINK(DecimalCodeChangeHdl, weld::Entry&, void); DECL_DLLPRIVATE_LINK(HexCodeChangeHdl, weld::Entry&, void); - DECL_DLLPRIVATE_LINK(CharClickHdl, const CharAndFont&, void); + DECL_DLLPRIVATE_LINK(CharFocusHdl, const CharAndFont&, void); DECL_DLLPRIVATE_LINK(InsertClickHdl, weld::Button&, void); DECL_DLLPRIVATE_LINK(FavSelectHdl, weld::Button&, void); DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry&, void); diff --git a/svx/source/dialog/cuicharmap.cxx b/svx/source/dialog/cuicharmap.cxx index e6ecfda6a2aa..9926fa43c0f6 100644 --- a/svx/source/dialog/cuicharmap.cxx +++ b/svx/source/dialog/cuicharmap.cxx @@ -262,9 +262,10 @@ void SvxCharacterMap::init() } m_aCharmapContents.init(m_xFrame.is(), - LINK(this, SvxCharacterMap, CharClickHdl), + Link<const CharAndFont&, void>(), LINK(this, SvxCharacterMap, UpdateFavHdl), - Link<void*, void>()); + Link<void*, void>(), + LINK(this, SvxCharacterMap, CharFocusHdl)); setCharName(90); @@ -524,7 +525,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, weld::Entry&, void) } } -IMPL_LINK(SvxCharacterMap, CharClickHdl, const CharAndFont&, rView, void) +IMPL_LINK(SvxCharacterMap, CharFocusHdl, const CharAndFont&, rView, void) { vcl::Font aCharFont = GetCharFont(); aCharFont.SetFamilyName(rView.sFont); diff --git a/sw/qa/extras/accessibility/dialogs.cxx b/sw/qa/extras/accessibility/dialogs.cxx index 3774b10f819f..d50d7c6c843e 100644 --- a/sw/qa/extras/accessibility/dialogs.cxx +++ b/sw/qa/extras/accessibility/dialogs.cxx @@ -43,14 +43,7 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, BasicTestSpecialCharactersDialog) CPPUNIT_ASSERT(dialog.tabTo(accessibility::AccessibleRole::TABLE_CELL, u"©")); - /* there was a focus issue in this dialog: the table holding the characters always had the - * selected element as focused, even when tabbing outside. - * Fixed with https://gerrit.libreoffice.org/c/core/+/147660. - * Anyway, we still use the target element match API to also exercise it. */ - auto xChild = AccessibilityTools::getAccessibleObjectForName( - dialog.getAccessible(), accessibility::AccessibleRole::PUSH_BUTTON, u"Insert"); - CPPUNIT_ASSERT(xChild); - CPPUNIT_ASSERT(dialog.tabTo(xChild)); + // close the dialog using the default action to insert the currently selected character dialog.postKeyEventAsync(0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); @@ -82,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, TestSpecialCharactersDialogFocus) dialog.getAccessible(), accessibility::AccessibleRole::TABLE_CELL, u"!"), getFocusedObject(dialog.getAccessible())); - CPPUNIT_ASSERT(dialog.tabTo(accessibility::AccessibleRole::PUSH_BUTTON, u"Insert")); + // close the dialog using the default action to insert the currently selected character dialog.postKeyEventAsync(0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); commit 3840382ebf4259558d88d86be6e9796d0e87a74c Author: Michael Weghorn <[email protected]> AuthorDate: Fri Dec 19 17:04:16 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Dec 19 22:52:42 2025 +0100 tdf#168594 Change SvxCharView click callback param to CharAndFont What exact widget was clicked is not of interest, but only what special character it holds. Therefore, switch the param of the handler from SvxCharView to CharAndFont. This is one more step to prepare porting SfxCharmapCtrl away from using SvxCharView in an upcoming commit. Change-Id: I9b22b84214997a5ba58475caf88a09eb4b53bc52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195932 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/include/sfx2/charmapcontainer.hxx b/include/sfx2/charmapcontainer.hxx index 22b33790f05b..062dbb610717 100644 --- a/include/sfx2/charmapcontainer.hxx +++ b/include/sfx2/charmapcontainer.hxx @@ -66,7 +66,7 @@ public: SfxCharmapContainer(weld::Builder& rBuilder, const VclPtr<VirtualDevice>& rVirDev, bool bLockGridSizes); - void init(bool bHasInsert, const Link<SvxCharView&, void>& rMouseClickHdl, + void init(bool bHasInsert, const Link<const CharAndFont&, void>& rMouseClickHdl, const Link<void*, void>& rUpdateFavHdl, const Link<void*, void>& rUpdateRecentHdl, const Link<const CharAndFont&, void>& rFocusInHdl = Link<const CharAndFont&, void>()); diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx index 710adf8f615a..c0fe040579a3 100644 --- a/include/sfx2/charwin.hxx +++ b/include/sfx2/charwin.hxx @@ -48,7 +48,7 @@ private: OUString m_sToolTip; Link<const CharAndFont&, void> maFocusInHdl; - Link<SvxCharView&, void> maMouseClickHdl; + Link<const CharAndFont&, void> maMouseClickHdl; Link<const CommandEvent&, void> maContextMenuHdl; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; @@ -78,7 +78,7 @@ public: Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); } void setFocusInHdl(const Link<const CharAndFont&, void>& rLink); - void setMouseClickHdl(const Link<SvxCharView&, void>& rLink); + void setMouseClickHdl(const Link<const CharAndFont&, void>& rLink); void setContextMenuHdl(const Link<const CommandEvent&, void>& rLink); }; diff --git a/include/svx/cuicharmap.hxx b/include/svx/cuicharmap.hxx index 6d8492da7118..fcd48759beff 100644 --- a/include/svx/cuicharmap.hxx +++ b/include/svx/cuicharmap.hxx @@ -118,7 +118,7 @@ private: DECL_DLLPRIVATE_LINK(SearchCharHighlightHdl, SvxShowCharSet&, void); DECL_DLLPRIVATE_LINK(DecimalCodeChangeHdl, weld::Entry&, void); DECL_DLLPRIVATE_LINK(HexCodeChangeHdl, weld::Entry&, void); - DECL_DLLPRIVATE_LINK(CharClickHdl, SvxCharView&, void); + DECL_DLLPRIVATE_LINK(CharClickHdl, const CharAndFont&, void); DECL_DLLPRIVATE_LINK(InsertClickHdl, weld::Button&, void); DECL_DLLPRIVATE_LINK(FavSelectHdl, weld::Button&, void); DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry&, void); diff --git a/sfx2/inc/charmapcontrol.hxx b/sfx2/inc/charmapcontrol.hxx index 34a21374a142..614d7d7fd4ea 100644 --- a/sfx2/inc/charmapcontrol.hxx +++ b/sfx2/inc/charmapcontrol.hxx @@ -45,7 +45,7 @@ private: std::unique_ptr<weld::Label> m_xCharInfoLabel; DECL_LINK(CharFocusInHdl, const CharAndFont&, void); - DECL_LINK(CharClickHdl, SvxCharView&, void); + DECL_LINK(CharClickHdl, const CharAndFont&, void); DECL_LINK(OpenDlgHdl, weld::Button&, void); DECL_LINK(DlgBtnFocusInHdl, weld::Widget&, void); DECL_LINK(UpdateRecentHdl, void*, void); diff --git a/sfx2/source/control/charmapcontainer.cxx b/sfx2/source/control/charmapcontainer.cxx index 16198aba9162..45d5cc115c98 100644 --- a/sfx2/source/control/charmapcontainer.cxx +++ b/sfx2/source/control/charmapcontainer.cxx @@ -110,7 +110,7 @@ SfxCharmapContainer::SfxCharmapContainer(weld::Builder& rBuilder, const VclPtr<V } } -void SfxCharmapContainer::init(bool bHasInsert, const Link<SvxCharView&, void>& rMouseClickHdl, +void SfxCharmapContainer::init(bool bHasInsert, const Link<const CharAndFont&, void>& rMouseClickHdl, const Link<void*, void>& rUpdateFavHdl, const Link<void*, void>& rUpdateRecentHdl, const Link<const CharAndFont&, void>& rFocusInHdl) diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx index d3e520f53f3a..9f2cc2c9f3c6 100644 --- a/sfx2/source/control/charmapcontrol.cxx +++ b/sfx2/source/control/charmapcontrol.cxx @@ -55,11 +55,11 @@ IMPL_LINK(SfxCharmapCtrl, CharFocusInHdl, const CharAndFont&, rChar, void) m_xCharInfoLabel->set_label(SfxCharmapContainer::GetCharInfoText(rChar.sChar)); } -IMPL_LINK(SfxCharmapCtrl, CharClickHdl, SvxCharView&, rView, void) +IMPL_LINK(SfxCharmapCtrl, CharClickHdl, const CharAndFont&, rChar, void) { m_xControl->EndPopupMode(); - SfxCharmapContainer::InsertCharToDoc(rView.GetCharAndFont()); + SfxCharmapContainer::InsertCharToDoc(rChar); } IMPL_LINK_NOARG(SfxCharmapCtrl, OpenDlgHdl, weld::Button&, void) diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx index 6c6259939b37..eab18e268a5c 100644 --- a/sfx2/source/control/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -75,10 +75,9 @@ bool SvxCharView::MouseButtonDown(const MouseEvent& rMEvt) { InsertCharToDoc(); } - GrabFocus(); Invalidate(); - maMouseClickHdl.Call(*this); + maMouseClickHdl.Call(GetCharAndFont()); return true; } @@ -215,7 +214,7 @@ void SvxCharView::setFocusInHdl(const Link<const CharAndFont&, void>& rLink) maFocusInHdl = rLink; } -void SvxCharView::setMouseClickHdl(const Link<SvxCharView&, void>& rLink) +void SvxCharView::setMouseClickHdl(const Link<const CharAndFont&, void>& rLink) { maMouseClickHdl = rLink; } diff --git a/svx/source/dialog/cuicharmap.cxx b/svx/source/dialog/cuicharmap.cxx index cae8cedbc6bd..e6ecfda6a2aa 100644 --- a/svx/source/dialog/cuicharmap.cxx +++ b/svx/source/dialog/cuicharmap.cxx @@ -524,23 +524,22 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, weld::Entry&, void) } } -IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView&, rView, void) +IMPL_LINK(SvxCharacterMap, CharClickHdl, const CharAndFont&, rView, void) { - const OUString sFontFamily = rView.GetFontFamilyName(); vcl::Font aCharFont = GetCharFont(); - aCharFont.SetFamilyName(sFontFamily); + aCharFont.SetFamilyName(rView.sFont); SetCharFont(aCharFont); - m_aShowChar.SetText(rView.GetText()); + m_aShowChar.SetText(rView.sChar); vcl::Font aShowCharFont = m_aShowChar.GetFont(); - aShowCharFont.SetFamilyName(sFontFamily); + aShowCharFont.SetFamilyName(rView.sFont); m_aShowChar.SetFont(aShowCharFont); m_aShowChar.Invalidate(); - setFavButtonState(rView.GetText(), sFontFamily); //check state + setFavButtonState(rView.sChar, rView.sFont); //check state // Get the hexadecimal code - OUString charValue = rView.GetText(); + OUString charValue = rView.sChar; sal_UCS4 cChar = charValue.iterateCodePoints(&o3tl::temporary(sal_Int32(1)), -1); OUString aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
