include/vcl/accessibility/AccessibleTextAttributeHelper.hxx | 4 - vcl/source/accessibility/AccessibleTextAttributeHelper.cxx | 25 ++++++++---- 2 files changed, 19 insertions(+), 10 deletions(-)
New commits: commit 942718b8f69b4dc248508954159cc9af005ead8a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jan 22 10:37:31 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jan 22 12:12:10 2025 +0100 a11y: Update links to IA2 text/obj attr spec These are maintained in the IAccessible2 git repo instead of the LinuxFoundation wiki now, see https://github.com/LinuxA11y/IAccessible2/issues/24 . Change-Id: I39213a61ed3d0c4f24ffda98ebbd004c0479bffd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180575 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx index c2bb476aebd6..584127ab5e7a 100644 --- a/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx +++ b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx @@ -32,8 +32,8 @@ * but others should be reported as object attributes (e.g. text alignment is reported * via the "text-align" object attribute on the paragraph object). * - * https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes - * https://wiki.linuxfoundation.org/accessibility/iaccessible2/objectattributes + * https://github.com/LinuxA11y/IAccessible2/blob/master/spec/textattributes.md + * https://github.com/LinuxA11y/IAccessible2/blob/master/spec/objectattributes.md * * This enum class is used to specify the type(s) of attributes of interest. */ commit a2d3c9341f177b720d7a52e70759721d3221037f Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jan 22 10:33:25 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jan 22 12:12:04 2025 +0100 tdf#164795 a11y: Report first line indent via IAccessible2 Translate the UNO "ParaFirstLineIndent" attribute to the corresponding IAccessible "text-indent" object attribute that is mentioned in the IAccessible2 object attributes spec [1] which references the CSS spec [2] that says: > This property specifies the indentation of the first line > of text in a block container. Use a value in millimetres as the IAccessible2 object attr spec [1] says: > This value should be specified in mm, e.g. 4mm. With this in place, querying object attributes of the Writer paragraph that has a first line indent of 1 cm in attachment 198672 from tdf#164795 now gives this in NVDA's Python console: >>> focus.IAccessibleObject.attributes 'text-align:left;text-indent:10mm;' (Reporting of "text-align:left;" was already implemented before, "text-indent:10mm;" is newly implemented by this commit.) In order for NVDA to actually speak the first line indent when requesting announcement for text attributes (via NVDA+F), handling of the "text-indent" attribute will have to be implemented in NVDA as well. [1] https://github.com/LinuxA11y/IAccessible2/blob/master/spec/objectattributes.md [2] https://www.w3.org/TR/CSS2/text.html#propdef-text-indent Change-Id: Id6db1ec832a21f63b6e2d7e99386ddc2453ed24f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180574 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx b/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx index 23f3d66c990d..f0c08a0f43f3 100644 --- a/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx +++ b/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx @@ -317,15 +317,24 @@ static OUString ConvertUnoToIAccessible2TextAttributes( } } - // so far, "ParaAdjust" is the only UNO text attribute that - // maps to an object attribute for IAccessible2 ("text-align") - if (sAttribute.isEmpty() && (eAttributeType & IA2AttributeType::ObjectAttributes) - && prop.Name == "ParaAdjust") + // UNO text attributes that map to IAccessible2 object attributes, + // see https://github.com/LinuxA11y/IAccessible2/blob/master/spec/objectattributes.md + if (sAttribute.isEmpty() && (eAttributeType & IA2AttributeType::ObjectAttributes)) { - sAttribute = "text-align"; - const css::style::ParagraphAdjust eParaAdjust - = static_cast<css::style::ParagraphAdjust>(*o3tl::doAccess<sal_Int16>(prop.Value)); - sValue = lcl_ConvertParagraphAdjust(eParaAdjust); + if (prop.Name == "ParaAdjust") + { + sAttribute = "text-align"; + const css::style::ParagraphAdjust eParaAdjust + = static_cast<css::style::ParagraphAdjust>( + *o3tl::doAccess<sal_Int16>(prop.Value)); + sValue = lcl_ConvertParagraphAdjust(eParaAdjust); + } + else if (prop.Name == "ParaFirstLineIndent") + { + sAttribute = u"text-indent"_ustr; + const sal_Int32 nFirstLineIndent = *o3tl::doAccess<sal_Int32>(prop.Value); + sValue = OUString::number(nFirstLineIndent / 100) + u"mm"_ustr; + } } if (!sAttribute.isEmpty() && !sValue.isEmpty())