summaryrefslogtreecommitdiff
path: root/winaccessibility
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-10-20 13:43:56 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-10-21 13:49:32 +0200
commit701563366c717c21ffa0588de6be1005df92a779 (patch)
treed009ebfb3836e355fc5e427cfc3c8ac7221db222 /winaccessibility
parentcfaa52ed74278aab0e44f7cc9a66afe1c4166715 (diff)
tdf#135922 wina11y: Report text-related IA2 obj attrs
Extend `CMAccessible::get_attributes` so that it also reports the text-related IAccessible2 object attributes, since what is meant to be reported as a text attribute and what is meant to be reported as an object attribute differs between the IAccessible2 specificiation and what LibreOffice does on the UNO level, s. the commit message in this previous change for more details: Change-Id Ief7c840d3c5274714a914ca0e56df0c5eaffb06d tdf#135922 a11y: Prepare reporting text attrs as IA2 obj attrs Just use a character offset of 0 when querying via the `XAccessibleText` interface here. The exct offset used used shouldn't make any difference for paragraph-specific attributes. With this and the NVDA pull request [1] to evaluate attributes according to the IAccessible2 text attributes and IAccessible2 object attributes specifications, NVDA now reports the alignment of paragraphs in Writer, e.g. says "align center" since the corresponding attribute is now reported for the paragraph object, as can also be seen by querying the IAccessible2 interface manually in NVDA's Python console: >>> focus.IAccessibleObject.attributes 'heading-level:;level:;text-align:center;' ("text-align:center;" was not yet reported without this change in place.) [1] https://github.com/nvaccess/nvda/pull/15649 Change-Id: I5723797232f89db6a2b74d4a601344f2078ee630 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158260 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'winaccessibility')
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 30e9b043b0fb..e4b17fa43826 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -38,6 +38,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <unotools/configmgr.hxx>
+#include <vcl/accessibility/AccessibleTextAttributeHelper.hxx>
#include <vcl/svapp.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <comphelper/AccessibleImplementationHelper.hxx>
@@ -2735,6 +2736,17 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *p
sAttributes += val;
}
+ // some text-specific IAccessible2 object attributes (like text alignment
+ // of a paragraph) are handled as text attributes in LibreOffice
+ Reference<XAccessibleText> xText(pRContext, UNO_QUERY);
+ if (xText.is())
+ {
+ sal_Int32 nStartOffset = 0;
+ sal_Int32 nEndOffset = 0;
+ sAttributes += AccessibleTextAttributeHelper::GetIAccessible2TextAttributes(
+ xText, IA2AttributeType::ObjectAttributes, 0, nStartOffset, nEndOffset);
+ }
+
if (*pAttr)
SysFreeString(*pAttr);
*pAttr = SysAllocString(o3tl::toW(sAttributes.getStr()));