[Libreoffice-commits] core.git: offapi/com sw/source vcl/unx

Jacobo Aragunde Pérez jaragunde at igalia.com
Wed Feb 5 08:50:59 PST 2014


 offapi/com/sun/star/accessibility/AccessibleEventId.idl |    7 +++++++
 sw/source/core/access/accpara.cxx                       |   11 ++++++++++-
 vcl/unx/gtk/a11y/atklistener.cxx                        |    8 ++++++++
 vcl/unx/gtk/a11y/atkwrapper.cxx                         |    8 ++++++++
 vcl/unx/gtk/a11y/atkwrapper.hxx                         |    1 +
 5 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit c1d69c0e9e3361f9dd340ac133407e1dbb1d08ca
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Feb 4 15:07:51 2014 +0100

    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 at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/offapi/com/sun/star/accessibility/AccessibleEventId.idl b/offapi/com/sun/star/accessibility/AccessibleEventId.idl
index 7e31996..20d0d05 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 e5d6b42..6935f43 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -437,7 +437,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 f1614d8..f13a0a3 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 6e48230..ac5075b 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -876,6 +876,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 2b018b9..02126cb 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);
 


More information about the Libreoffice-commits mailing list