summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk/a11y
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-03-23 14:23:44 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-03-23 19:22:48 +0100
commit0ed7e590746db719f15b97a5d9cfca9b1ad3c773 (patch)
treee38ac82a1d9a64c627b347e7eec09d64aef4bcb6 /vcl/unx/gtk/a11y
parentb88821ee24f492615ff1c144e2ddfde1de1e01da (diff)
factor out the adding to an atk relation set code
Change-Id: Ie81cfaab1fac15648fc8ba89391bdedd5c1e6c90 Reviewed-on: https://gerrit.libreoffice.org/69590 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk/a11y')
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx43
1 files changed, 24 insertions, 19 deletions
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 875d5a26fb9f..2aa1e50bc6c7 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -496,6 +496,29 @@ wrapper_get_index_in_parent( AtkObject *atk_obj )
/*****************************************************************************/
+static void
+relation_set_add(AtkRelationSet *pSet, const accessibility::AccessibleRelation& rRelation)
+{
+ sal_uInt32 nTargetCount = rRelation.TargetSet.getLength();
+
+ std::vector<AtkObject*> aTargets;
+
+ for (sal_uInt32 i = 0; i < nTargetCount; ++i)
+ {
+ uno::Reference< accessibility::XAccessible > xAccessible(
+ rRelation.TargetSet[i], uno::UNO_QUERY );
+ aTargets.push_back(atk_object_wrapper_ref(xAccessible));
+ }
+
+ AtkRelation *pRel =
+ atk_relation_new(
+ aTargets.data(), nTargetCount,
+ mapRelationType( rRelation.RelationType )
+ );
+ atk_relation_set_add( pSet, pRel );
+ g_object_unref( G_OBJECT( pRel ) );
+}
+
static AtkRelationSet *
wrapper_ref_relation_set( AtkObject *atk_obj )
{
@@ -517,25 +540,7 @@ wrapper_ref_relation_set( AtkObject *atk_obj )
sal_Int32 nRelations = xRelationSet.is() ? xRelationSet->getRelationCount() : 0;
for( sal_Int32 n = 0; n < nRelations; n++ )
{
- accessibility::AccessibleRelation aRelation = xRelationSet->getRelation( n );
- sal_uInt32 nTargetCount = aRelation.TargetSet.getLength();
-
- std::vector<AtkObject*> aTargets;
-
- for (sal_uInt32 i = 0; i < nTargetCount; ++i)
- {
- uno::Reference< accessibility::XAccessible > xAccessible(
- aRelation.TargetSet[i], uno::UNO_QUERY );
- aTargets.push_back(atk_object_wrapper_ref(xAccessible));
- }
-
- AtkRelation *pRel =
- atk_relation_new(
- aTargets.data(), nTargetCount,
- mapRelationType( aRelation.RelationType )
- );
- atk_relation_set_add( pSet, pRel );
- g_object_unref( G_OBJECT( pRel ) );
+ relation_set_add(pSet, xRelationSet->getRelation(n));
}
}
catch(const uno::Exception &) {