tdf#135586 a11y: Add a new BLOCK_QUOTE a11y role

A block quote role exists in all of WAI-ARIA 1.3
(role "blockquote", [1]), IAccessible2
(`IA2_ROLE_BLOCK_QUOTE`,  [2]) and AT-SPI
(`ROLE_BLOCK_QUOTE`, [3]).

Take over the definition that is the same in WAI-ARIA
and IAccessible2:

> A section of content that is quoted from another source.

The intended use for now is for a Writer paragraph using
the "Block Quotation" paragraph style, similar to how the
HEADING role is used for paragraphs using a corresponding
paragraph style.

For gtk3 (ATK) and winaccessibility (IAccessible2),
map the new role to the equivalant roles.

For macOS and the gtk4 as well as the Qt-based VCL plugins
on Linux which currently don't have an equivalent role,
fall back to the same role that the PARAGRAPH role is
mapped to.
This way, the behavior there will remain unchanged
once the BLOCK_QUOTE role is used for Writer paragraphs
with the corresponding style.

In general, treat BLOCK_QUOTE like PARAGRAPH
in code applying special handling for the PARAGRAPH
role.

[1] https://w3c.github.io/aria/#blockquote
[2] 3d8c7f0b83/api/AccessibleRole.idl (L318)
[3] 7cc4cee53d/xml/Accessible.xml (L615-616)

Change-Id: I248c183a2e7ec5d6f0a89bf3cb4829bbd8588c77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158573
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2023-10-27 14:53:59 +02:00
parent 33061be5a7
commit f44eae4912
11 changed files with 26 additions and 4 deletions

View File

@@ -744,6 +744,14 @@ constants AccessibleRole
*/
const short NOTIFICATION = 87;
/** Block quote role.
<p>A section of content that is quoted from another source.</p>
@since LibreOffice 24.2
*/
const short BLOCK_QUOTE = 88;
};
}; }; }; };

View File

@@ -220,6 +220,8 @@ OUString AccessibilityTools::getRoleName(const sal_Int16 role)
return "UNKNOWN";
case accessibility::AccessibleRole::ALERT:
return "ALERT";
case accessibility::AccessibleRole::BLOCK_QUOTE:
return "BLOCK_QUOTE";
case accessibility::AccessibleRole::BUTTON_DROPDOWN:
return "BUTTON_DROPDOWN";
case accessibility::AccessibleRole::BUTTON_MENU:

View File

@@ -46,6 +46,7 @@ using namespace ::com::sun::star::uno;
MAP( AccessibleRole::UNKNOWN, NSAccessibilityUnknownRole );
MAP( AccessibleRole::ALERT, NSAccessibilityUnknownRole ); // FIXME
MAP( AccessibleRole::BLOCK_QUOTE, NSAccessibilityTextAreaRole );
MAP( AccessibleRole::COLUMN_HEADER, NSAccessibilityColumnRole );
MAP( AccessibleRole::CANVAS, NSAccessibilityUnknownRole ); // FIXME
MAP( AccessibleRole::CHECK_BOX, NSAccessibilityCheckBoxRole );
@@ -186,6 +187,7 @@ using namespace ::com::sun::star::uno;
MAP( AccessibleRole::UNKNOWN, NSAccessibilityUnknownSubrole );
MAP( AccessibleRole::ALERT, NSAccessibilitySystemDialogSubrole );
MAP( AccessibleRole::BLOCK_QUOTE, @"" );
MAP( AccessibleRole::COLUMN_HEADER, @"" );
MAP( AccessibleRole::CANVAS, @"" );
MAP( AccessibleRole::CHECK_BOX, @"" );

View File

@@ -36,6 +36,7 @@ static AtspiRole mapToAtspiRole(sal_Int16 nRole)
MAP_DIRECT(UNKNOWN);
MAP_DIRECT(ALERT);
MAP_DIRECT(BLOCK_QUOTE);
MAP_DIRECT(COLUMN_HEADER);
MAP_DIRECT(CANVAS);
MAP_DIRECT(CHECK_BOX);

View File

@@ -462,6 +462,7 @@ QAccessible::Role QtAccessibleWidget::role() const
case AccessibleRole::PANEL:
return QAccessible::Pane;
case AccessibleRole::PARAGRAPH:
case AccessibleRole::BLOCK_QUOTE:
return QAccessible::Paragraph;
case AccessibleRole::PASSWORD_TEXT:
return QAccessible::EditableText;

View File

@@ -2438,7 +2438,7 @@ namespace BuilderUtils
{ "info bar", AccessibleRole::UNKNOWN },
{ "level bar", AccessibleRole::UNKNOWN },
{ "title bar", AccessibleRole::UNKNOWN },
{ "block quote", AccessibleRole::UNKNOWN },
{ "block quote", AccessibleRole::BLOCK_QUOTE },
{ "audio", AccessibleRole::UNKNOWN },
{ "video", AccessibleRole::UNKNOWN },
{ "definition", AccessibleRole::UNKNOWN },

View File

@@ -174,6 +174,8 @@ static AtkRole mapToAtkRole( sal_Int16 nRole )
return ATK_ROLE_UNKNOWN;
case accessibility::AccessibleRole::ALERT:
return ATK_ROLE_ALERT;
case accessibility::AccessibleRole::BLOCK_QUOTE:
return ATK_ROLE_BLOCK_QUOTE;
case accessibility::AccessibleRole::COLUMN_HEADER:
return ATK_ROLE_COLUMN_HEADER;
case accessibility::AccessibleRole::CANVAS:

View File

@@ -138,6 +138,7 @@ map_accessible_role(const css::uno::Reference<css::accessibility::XAccessible>&
eRole = GTK_ACCESSIBLE_ROLE_WIDGET;
break;
case css::accessibility::AccessibleRole::PARAGRAPH:
case css::accessibility::AccessibleRole::BLOCK_QUOTE:
#if GTK_CHECK_VERSION(4, 13, 1)
eRole = GTK_ACCESSIBLE_ROLE_PARAGRAPH;
#else

View File

@@ -26,8 +26,8 @@
/**
* AccParagraphEventListener is inherited from AccContainerEventListener. It handles the events
* generated by container controls. The accessible roles are: PARAGRAPH and HEADING.
* It defines the procedure of specific event handling related with text containsers and provides
* generated by container controls. The accessible roles are: PARAGRAPH, HEADING and BLOCK_QUOTE.
* It defines the procedure of specific event handling related with text containers and provides
* the detailed support for some related methods.
*/
class AccParagraphEventListener : public AccContainerEventListener

View File

@@ -67,6 +67,8 @@ short lcl_mapToIAccessible2Role(sal_Int16 nUnoRole)
return IA2_ROLE_UNKNOWN;
case css::accessibility::AccessibleRole::ALERT:
return ROLE_SYSTEM_DIALOG;
case css::accessibility::AccessibleRole::BLOCK_QUOTE:
return IA2_ROLE_BLOCK_QUOTE;
case css::accessibility::AccessibleRole::COLUMN_HEADER:
return ROLE_SYSTEM_COLUMNHEADER;
case css::accessibility::AccessibleRole::CANVAS:
@@ -369,7 +371,7 @@ void AccObject::UpdateName( )
if( ( TEXT_FRAME == m_accRole ) && ( m_pParentObj !=nullptr )&& ( SCROLL_PANE == m_pParentObj -> m_accRole ) )
m_pIMAcc->Put_XAccName( o3tl::toW(m_pParentObj->m_xAccContextRef->getAccessibleName().getStr()) );
//IAccessibility2 Implementation 2009-----
if ( PARAGRAPH == m_accRole)
if (m_accRole == AccessibleRole::PARAGRAPH || m_accRole == AccessibleRole::BLOCK_QUOTE)
{
m_pIMAcc->Put_XAccName(L"");
}
@@ -470,6 +472,7 @@ void AccObject::SetValue( Any pAny )
// 3. date editor's msaa value should be the same as spinbox
case DATE_EDITOR:
case TEXT:
case BLOCK_QUOTE:
case PARAGRAPH:
case HEADING:
case TABLE_CELL:
@@ -924,6 +927,7 @@ void AccObject::UpdateState()
case HEADING:
//Image Map
case BLOCK_QUOTE:
case PARAGRAPH:
case PASSWORD_TEXT:
case SHAPE:

View File

@@ -749,6 +749,7 @@ AccObjectWinManager::CreateAccEventListener(XAccessible* pXAcc)
case AccessibleRole::VIEW_PORT:
pRet = new AccContainerEventListener(pXAcc, this);
break;
case AccessibleRole::BLOCK_QUOTE:
case AccessibleRole::PARAGRAPH:
case AccessibleRole::HEADING:
pRet = new AccParagraphEventListener(pXAcc, this);