summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-02-04 15:07:51 +0100
committerAndras Timar <andras.timar@collabora.com>2014-06-20 03:37:07 -0700
commite9f0fb287cb58d7139bc39e0df89a2b521816aab (patch)
tree5e9fe32d533b958d2cb7c268062f1e5957566786
parent3d7a2e3e5b673600f9f68c2e2dd0d040f4333e93 (diff)
fdo#35105: notify role change through a new UNO a11y event
A new UNO accessibility event called ROLE_CHANGED has been created. It should be triggered when an accessible object changes its role and every accessibility toolkit should use its own methods to make that change effective. Code to support the event in ATK has been added. Change-Id: I132e303bdb148967231334458c3cfa369c36ec8f Reviewed-on: https://gerrit.libreoffice.org/7853 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--offapi/com/sun/star/accessibility/AccessibleEventId.idl7
-rw-r--r--sw/source/core/access/accpara.cxx11
-rw-r--r--vcl/unx/gtk/a11y/atklistener.cxx8
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx8
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.hxx1
5 files changed, 34 insertions, 1 deletions
diff --git a/offapi/com/sun/star/accessibility/AccessibleEventId.idl b/offapi/com/sun/star/accessibility/AccessibleEventId.idl
index 7e31996da099..20d0d0553e58 100644
--- a/offapi/com/sun/star/accessibility/AccessibleEventId.idl
+++ b/offapi/com/sun/star/accessibility/AccessibleEventId.idl
@@ -380,6 +380,13 @@ constants AccessibleEventId
const short PAGE_CHANGED =38;
const short SECTION_CHANGED =39;
const short COLUMN_CHANGED =40;
+
+ /** Constant used to indicate that the role of an accessible object has
+ changed.
+
+ @since LibreOffice 4.3
+ */
+ const short ROLE_CHANGED =41;
};
}; }; }; };
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index b4baca386757..6dcfb8b3e515 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -440,7 +440,16 @@ void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
bIsHeading = bNewIsHeading;
}
- if( bNewIsHeading != bOldIsHeading || rText != sOldText )
+ if( bNewIsHeading != bOldIsHeading )
+ {
+ // The role has changed
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::ROLE_CHANGED;
+
+ FireAccessibleEvent( aEvent );
+ }
+
+ if( rText != sOldText )
{
OUString sNewDesc( GetDescription() );
OUString sOldDesc;
diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx
index f1614d8ed512..f13a0a318601 100644
--- a/vcl/unx/gtk/a11y/atklistener.cxx
+++ b/vcl/unx/gtk/a11y/atklistener.cxx
@@ -549,6 +549,14 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven
g_signal_emit_by_name( G_OBJECT( atk_obj ), "property_change::accessible-hypertext-offset");
break;
+ case accessibility::AccessibleEventId::ROLE_CHANGED:
+ {
+ uno::Reference< accessibility::XAccessibleContext > xContext;
+ xContext = getAccessibleContextFromSource( aEvent.Source );
+ atk_object_wrapper_set_role( mpWrapper, xContext->getAccessibleRole() );
+ break;
+ }
+
default:
g_warning( "Unknown event notification %d", aEvent.EventId );
break;
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index ab0b2753fd4e..5b4da2389e38 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -877,6 +877,14 @@ void atk_object_wrapper_remove_child(AtkObjectWrapper* wrapper, AtkObject *child
/*****************************************************************************/
+void atk_object_wrapper_set_role(AtkObjectWrapper* wrapper, sal_Int16 role)
+{
+ AtkObject *atk_obj = ATK_OBJECT( wrapper );
+ atk_object_set_role( atk_obj, mapToAtkRole( role ) );
+}
+
+/*****************************************************************************/
+
#define RELEASE(i) if( i ) { i->release(); i = NULL; }
void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper)
diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index 2b018b92a9fe..02126cbc541f 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -84,6 +84,7 @@ AtkObject * atk_object_wrapper_new(
void atk_object_wrapper_add_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
void atk_object_wrapper_remove_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
+void atk_object_wrapper_set_role(AtkObjectWrapper* wrapper, sal_Int16 role);
void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper);