vcl/unx/gtk/a11y/atkwrapper.cxx | 43 ++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 19 deletions(-)
New commits: commit 0ed7e590746db719f15b97a5d9cfca9b1ad3c773 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Mar 23 14:23:44 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Mar 23 19:22:48 2019 +0100 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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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 &) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits