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 99841da686
    Author: Michael Weghorn <m.weghorn@posteo.de>
    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 <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2022-09-23 20:26:52 +02:00
parent 6f3532f6aa
commit aa0a39f2be

View File

@@ -19,6 +19,7 @@
#include <helper/characterattributeshelper.hxx>
#include <tools/gen.hxx>
#include <vcl/unohelp.hxx>
#include <comphelper/sequence.hxx>
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<sal_Int16>(rFont.GetStrikeout()) ) );
m_aAttributeMap.emplace( OUString( "CharUnderline" ), Any( static_cast<sal_Int16>(rFont.GetUnderline()) ) );
m_aAttributeMap.emplace( OUString( "CharWeight" ), Any( static_cast<float>(rFont.GetWeight()) ) );
m_aAttributeMap.emplace( OUString( "CharPosture" ), Any( static_cast<sal_Int16>(rFont.GetItalic()) ) );
m_aAttributeMap.emplace( OUString( "CharPosture" ), Any( vcl::unohelper::ConvertFontSlant(rFont.GetItalic()) ) );
}