diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-08-17 09:34:09 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-08-17 14:52:30 +0200 |
commit | 8c4fa83191e6df5d823386cca2adc30dbbc9e297 (patch) | |
tree | 4816b2ee2e9aa80da37cdfc8672f360e285713a1 /sfx2 | |
parent | 5b7d9f21ef74601f4893dd07e8e3f2bf34427eb0 (diff) |
tdf#156699 a11y: Set a11y name for SvxCharView
Set the character name as a11y name for the `SvXCharView`.
Also add a check for the string to be non-empty in
`SvxCharView::GetDecimalValueAndCharName`, since
`SfxCharmapContainer::updateRecentCharControl` sets the
text to an empty string, and calling
`OUString::iterateCodePoint` on that empts string
would trigger an assert now that
`SvxCharView::SetText` tries to retrieve the character
name right away.
This makes NVDA on Windows announce the focused
character by its name in the Special Characters dialog
and the Special Characters toolbar group button.
Orca with the gtk3 VCL plugin now announces the
focused character in the Special Characters dialog,
but not yet in the toolbar group button.
Change-Id: I79c8e0c2de6e817a467a405dc7d9e103cba07dfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155757
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/charwin.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx index 99fa9dbd1d3d..999aa2e4a95d 100644 --- a/sfx2/source/control/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -68,6 +68,9 @@ void SvxCharView::LoseFocus() { Invalidate(); } bool SvxCharView::GetDecimalValueAndCharName(sal_UCS4& rDecimalValue, OUString& rCharName) { OUString charValue = GetText(); + if (charValue.isEmpty()) + return false; + sal_UCS4 nDecimalValue = charValue.iterateCodePoints(&o3tl::temporary(sal_Int32(1)), -1); /* get the character name */ UErrorCode errorCode = U_ZERO_ERROR; @@ -313,6 +316,12 @@ void SvxCharView::SetText(const OUString& rText) { m_sText = rText; Invalidate(); + + OUString sName; + if (GetDecimalValueAndCharName(o3tl::temporary(sal_UCS4()), sName)) + SetAccessibleName(sName); + else + SetAccessibleName(OUString()); } void SvxCharView::SetHasInsert(bool bInsert) { maHasInsert = bInsert; } |