From aa0a39f2be0cf9d633c3654babc6f738d67f871f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 23 Sep 2022 20:26:52 +0200 Subject: [PATCH] a11y: Use FontSlant for "CharPosture" The platform a11y integration code expects a `FontSlant` in the "CharPosture" `Any` (s. e.g. `get_style_value`/`FontSlant2Style` in `vcl/unx/gtk3/a11y/atktextattributes.cxx` or `QtAccessibleWidget::attributes`) and that's also what e.g. Writer sets for that attribute for text in the document, so do the same in `CharacterAttributesHelper::CharacterAttributesHelper`. After handling for "CharPosture" was added for the Qt-based VCL plugins in commit 99841da686625428b8ad2e219dd19e5fbfb145f5 Author: Michael Weghorn Date: Tue Jul 20 13:23:21 2021 +0200 qt a11y: Report font style text attribute (e.g. italic) , clicking through the a11y hierarchy of e.g. Writer's "Page Style" dialog in Accerciser's treeview of the LO a11y hierarchy would otherwise crash LO when used with the qt6 VCL plugin. With this in place, the style is reported correctly there. (Tested by temporarily setting "oblique" style using glade for the "Next style" label in the "Organizer" tab in that dialog's UI file.) Change-Id: Ibea42db067e0cdb3b85c80dbcca5939b3dfe5570 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140527 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- accessibility/source/helper/characterattributeshelper.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/accessibility/source/helper/characterattributeshelper.cxx b/accessibility/source/helper/characterattributeshelper.cxx index 9cbeaaee8a7c..1d6120ff483c 100644 --- a/accessibility/source/helper/characterattributeshelper.cxx +++ b/accessibility/source/helper/characterattributeshelper.cxx @@ -19,6 +19,7 @@ #include #include +#include #include using namespace ::com::sun::star::uno; @@ -39,7 +40,7 @@ CharacterAttributesHelper::CharacterAttributesHelper( const vcl::Font& rFont, sa m_aAttributeMap.emplace( OUString( "CharStrikeout" ), Any( static_cast(rFont.GetStrikeout()) ) ); m_aAttributeMap.emplace( OUString( "CharUnderline" ), Any( static_cast(rFont.GetUnderline()) ) ); m_aAttributeMap.emplace( OUString( "CharWeight" ), Any( static_cast(rFont.GetWeight()) ) ); - m_aAttributeMap.emplace( OUString( "CharPosture" ), Any( static_cast(rFont.GetItalic()) ) ); + m_aAttributeMap.emplace( OUString( "CharPosture" ), Any( vcl::unohelper::ConvertFontSlant(rFont.GetItalic()) ) ); }