Kaydet (Commit) 0ed7e590 authored tarafından Caolán McNamara's avatar Caolán McNamara

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: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst b88821ee
......@@ -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 &) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment