replace member-of in .ui a11y relations

Change-Id: I454c945c5ce17bcc1834923064014b43a0b45be7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131186
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2022-03-08 17:01:26 +01:00
parent 2c37794752
commit c9efbdbfaf
8 changed files with 61 additions and 32 deletions
@@ -23185,7 +23185,6 @@ vcl::Window::SaveFocus()
vcl::Window::SetAccessibleDescription(rtl::OUString const&)
vcl::Window::SetAccessibleRelationLabelFor(vcl::Window*)
vcl::Window::SetAccessibleRelationLabeledBy(vcl::Window*)
vcl::Window::SetAccessibleRelationMemberOf(vcl::Window*)
vcl::Window::SetActivateMode(ActivateModeFlags)
vcl::Window::SetDumpAsPropertyTreeHdl(Link<tools::JsonWriter&, void> const&)
vcl::Window::SetFakeFocus(bool)
+3 -2
View File
@@ -1069,8 +1069,9 @@ def check_a11y_relation(filename, tree):
if len(mnemonic_for_elm[oid]) > 1:
warn(filename, tree, obj, "duplicate-mnemonic", "is referenced by multiple mnemonic_widget " + elms_names_lines(mnemonic_for_elm[oid]))
# Check member-of
member_of = check_rels(filename, tree, root, obj, "member-of")
# Check controlled-by/controller-for
controlled_by = check_rels(filename, tree, root, obj, "controlled-by", "controller-for")
controller_for = check_rels(filename, tree, root, obj, "controlled-for", "controlled-by")
# Labels special case
if klass in widgets_labels:
-1
View File
@@ -1158,7 +1158,6 @@ public:
void SetAccessibleRelationLabelFor( vcl::Window* pLabelFor );
vcl::Window* GetAccessibleRelationLabelFor() const;
void SetAccessibleRelationMemberOf( vcl::Window* pMemberOf );
vcl::Window* GetAccessibleRelationMemberOf() const;
// to avoid sending accessibility events in cases like closing dialogs
+48 -13
View File
@@ -153,6 +153,14 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="sortdialog|order">Order</property>
<accessibility>
<relation type="label-for" target="up1"/>
<relation type="label-for" target="down1"/>
<relation type="label-for" target="up2"/>
<relation type="label-for" target="down2"/>
<relation type="label-for" target="up3"/>
<relation type="label-for" target="down3"/>
</accessibility>
</object>
<packing>
<property name="left-attach">3</property>
@@ -175,7 +183,8 @@
<property name="active">True</property>
<property name="draw-indicator">True</property>
<accessibility>
<relation type="member-of" target="key1"/>
<relation type="controlled-by" target="key1"/>
<relation type="labelled-by" target="order"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="up1-atkobject">
@@ -198,7 +207,8 @@
<property name="draw-indicator">True</property>
<property name="group">up1</property>
<accessibility>
<relation type="member-of" target="key1"/>
<relation type="controlled-by" target="key1"/>
<relation type="labelled-by" target="order"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="down1-atkobject">
@@ -233,7 +243,8 @@
<property name="active">True</property>
<property name="draw-indicator">True</property>
<accessibility>
<relation type="member-of" target="key2"/>
<relation type="controlled-by" target="key2"/>
<relation type="labelled-by" target="order"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="up2-atkobject">
@@ -256,7 +267,8 @@
<property name="draw-indicator">True</property>
<property name="group">up2</property>
<accessibility>
<relation type="member-of" target="key2"/>
<relation type="controlled-by" target="key2"/>
<relation type="labelled-by" target="order"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="down2-atkobject">
@@ -291,7 +303,8 @@
<property name="active">True</property>
<property name="draw-indicator">True</property>
<accessibility>
<relation type="member-of" target="key3"/>
<relation type="controlled-by" target="key3"/>
<relation type="labelled-by" target="order"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="up3-atkobject">
@@ -314,7 +327,8 @@
<property name="draw-indicator">True</property>
<property name="group">up3</property>
<accessibility>
<relation type="member-of" target="key3"/>
<relation type="controlled-by" target="key3"/>
<relation type="labelled-by" target="order"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="down3-atkobject">
@@ -343,6 +357,12 @@
<property name="use-underline">True</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
<accessibility>
<relation type="controller-for" target="up1"/>
<relation type="controller-for" target="down1"/>
<relation type="controller-for" target="colsb1"/>
<relation type="controller-for" target="typelb1"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="key1-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="sortdialog|extended_tip|key1">Specifies additional sorting criteria. You can also combine sort keys.</property>
@@ -363,6 +383,12 @@
<property name="valign">center</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
<accessibility>
<relation type="controller-for" target="up2"/>
<relation type="controller-for" target="down2"/>
<relation type="controller-for" target="colsb2"/>
<relation type="controller-for" target="typelb2"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="key2-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="sortdialog|extended_tip|key2">Specifies additional sorting criteria. You can also combine sort keys.</property>
@@ -383,6 +409,12 @@
<property name="valign">center</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
<accessibility>
<relation type="controller-for" target="up3"/>
<relation type="controller-for" target="down3"/>
<relation type="controller-for" target="colsb3"/>
<relation type="controller-for" target="typelb3"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="key3-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="sortdialog|extended_tip|key3">Specifies additional sorting criteria. You can also combine sort keys.</property>
@@ -403,8 +435,8 @@
<property name="truncate-multiline">True</property>
<property name="adjustment">adjustment1</property>
<accessibility>
<relation type="controlled-by" target="key1"/>
<relation type="labelled-by" target="column"/>
<relation type="member-of" target="key1"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="colsb1-atkobject">
@@ -426,8 +458,8 @@
<property name="truncate-multiline">True</property>
<property name="adjustment">adjustment2</property>
<accessibility>
<relation type="controlled-by" target="key2"/>
<relation type="labelled-by" target="column"/>
<relation type="member-of" target="key2"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="colsb2-atkobject">
@@ -449,8 +481,8 @@
<property name="truncate-multiline">True</property>
<property name="adjustment">adjustment3</property>
<accessibility>
<relation type="controlled-by" target="key3"/>
<relation type="labelled-by" target="column"/>
<relation type="member-of" target="key3"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="colsb3-atkobject">
@@ -470,8 +502,8 @@
<property name="valign">center</property>
<property name="hexpand">True</property>
<accessibility>
<relation type="controlled-by" target="key1"/>
<relation type="labelled-by" target="keytype"/>
<relation type="member-of" target="key1"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="typelb1-atkobject">
@@ -493,8 +525,8 @@
<property name="valign">center</property>
<property name="hexpand">True</property>
<accessibility>
<relation type="controlled-by" target="key2"/>
<relation type="labelled-by" target="keytype"/>
<relation type="member-of" target="key2"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="typelb2-atkobject">
@@ -515,8 +547,8 @@
<property name="valign">center</property>
<property name="hexpand">True</property>
<accessibility>
<relation type="controlled-by" target="key3"/>
<relation type="labelled-by" target="keytype"/>
<relation type="member-of" target="key3"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="typelb3-atkobject">
@@ -680,6 +712,8 @@
<property name="draw-indicator">True</property>
<property name="group">tabs</property>
<accessibility>
<relation type="controller-for" target="separator"/>
<relation type="controller-for" target="delimpb"/>
<relation type="label-for" target="separator"/>
<relation type="label-for" target="delimpb"/>
</accessibility>
@@ -711,6 +745,7 @@
<property name="max-width-chars">1</property>
<property name="truncate-multiline">True</property>
<accessibility>
<relation type="controlled-by" target="character"/>
<relation type="labelled-by" target="character"/>
</accessibility>
<child internal-child="accessible">
@@ -731,8 +766,8 @@
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<accessibility>
<relation type="controlled-by" target="character"/>
<relation type="labelled-by" target="character"/>
<relation type="member-of" target="character"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="delimpb-atkobject">
-1
View File
@@ -193,7 +193,6 @@ struct ImplAccessibleInfos
pAccessibleDescription;
VclPtr<vcl::Window> pLabeledByWindow;
VclPtr<vcl::Window> pLabelForWindow;
VclPtr<vcl::Window> pMemberOfWindow;
ImplAccessibleInfos();
~ImplAccessibleInfos();
-11
View File
@@ -46,7 +46,6 @@ ImplAccessibleInfos::ImplAccessibleInfos()
nAccessibleRole = 0xFFFF;
pLabeledByWindow = nullptr;
pLabelForWindow = nullptr;
pMemberOfWindow = nullptr;
}
ImplAccessibleInfos::~ImplAccessibleInfos()
@@ -490,18 +489,8 @@ void Window::SetAccessibleRelationLabelFor( vcl::Window* pLabelFor )
mpWindowImpl->mpAccessibleInfos->pLabelForWindow = pLabelFor;
}
void Window::SetAccessibleRelationMemberOf( vcl::Window* pMemberOfWin )
{
if ( !mpWindowImpl->mpAccessibleInfos )
mpWindowImpl->mpAccessibleInfos.reset( new ImplAccessibleInfos );
mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin;
}
vcl::Window* Window::GetAccessibleRelationMemberOf() const
{
if (mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pMemberOfWindow)
return mpWindowImpl->mpAccessibleInfos->pMemberOfWindow;
if (!isContainerWindow(this) && !isContainerWindow(GetParent()))
return getLegacyNonLayoutAccessibleRelationMemberOf();
-2
View File
@@ -518,8 +518,6 @@ VclBuilder::VclBuilder(vcl::Window* pParent, const OUString& sUIDir, const OUStr
pSource->SetAccessibleRelationLabeledBy(pTarget);
else if (rType == "label-for")
pSource->SetAccessibleRelationLabelFor(pTarget);
else if (rType == "member-of")
pSource->SetAccessibleRelationMemberOf(pTarget);
else
{
SAL_WARN("vcl.builder", "unhandled a11y relation :" << rType);
+10 -1
View File
@@ -901,6 +901,12 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
// there will be a matching labelled-by which should be sufficient in the gtk4 world
xRemoveList.push_back(xChild);
}
if (xType->getNodeValue() == "controlled-by")
{
// there will be a matching controller-for converted to -> controls
// which should be sufficient in the gtk4 world
xRemoveList.push_back(xChild);
}
else
{
css::uno::Reference<css::xml::dom::XNode> xTarget = xMap->getNamedItem("target");
@@ -910,7 +916,10 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
xChild->appendChild(xValue);
css::uno::Reference<css::xml::dom::XAttr> xName = xDoc->createAttribute("name");
xName->setValue(xType->getNodeValue());
if (xType->getNodeValue() == "controller-for")
xName->setValue("controls");
else
xName->setValue(xType->getNodeValue());
css::uno::Reference<css::xml::dom::XElement> xElem(xChild,
css::uno::UNO_QUERY_THROW);