include/vcl/weld.hxx | 2 + sc/source/ui/sidebar/CellBorderStyleControl.cxx | 16 ++++++++++++++ solenv/sanitizers/ui/modules/scalc.false | 19 +++++++++++++++++ solenv/sanitizers/ui/modules/scalc.suppr | 19 ----------------- vcl/inc/salvtables.hxx | 4 +++ vcl/source/app/salvtables.cxx | 10 +++++++++ vcl/unx/gtk3/gtkinst.cxx | 26 ++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 19 deletions(-)
New commits: commit 54f7308641c79d4907bd30cf6afc5bb62481637a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Jun 21 09:00:41 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Jun 21 11:17:24 2024 +0200 tdf#161648 sc a11y: Set a11y names for items in border style control Set accessible names for the items in the "Borders" control in the Calc Sidebar, "Properties" deck, section "Cell Appearance". Use the same text as is used for the tooltip. With this in place, Orca now announces what each item is about when using the gtk3 VCL plugin, instead of just saying "Button". Move the gla11y suppressions to the .false file, as they have been dealt with now, see doc at [1]. [1] https://wiki.documentfoundation.org/Development/Accessibility Change-Id: Id1856e4b116acad9bf6d14132bc6d9c91a01ae06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169321 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/sc/source/ui/sidebar/CellBorderStyleControl.cxx index f8e792ee183b..1ffbc213fb19 100644 --- a/sc/source/ui/sidebar/CellBorderStyleControl.cxx +++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx @@ -66,27 +66,43 @@ void CellBorderStylePopup::Initialize() { mxTBBorder1->connect_clicked ( LINK(this, CellBorderStylePopup, TB1SelectHdl) ); mxTBBorder1->set_item_tooltip_text(0, SvxResId(RID_SVXSTR_TABLE_PRESET_NONE)); + mxTBBorder1->set_item_accessible_name(0, SvxResId(RID_SVXSTR_TABLE_PRESET_NONE)); mxTBBorder1->set_item_tooltip_text(1, SvxResId(RID_SVXSTR_TABLE_PRESET_OUTERALL)); + mxTBBorder1->set_item_accessible_name(1, SvxResId(RID_SVXSTR_TABLE_PRESET_OUTERALL)); mxTBBorder1->set_item_tooltip_text(2, SvxResId(RID_SVXSTR_TABLE_PRESET_OUTER)); + mxTBBorder1->set_item_accessible_name(2, SvxResId(RID_SVXSTR_TABLE_PRESET_OUTER)); mxTBBorder1->set_item_tooltip_text(3, SvxResId(RID_SVXSTR_TABLE_PRESET_THICK)); + mxTBBorder1->set_item_accessible_name(3, SvxResId(RID_SVXSTR_TABLE_PRESET_THICK)); mxTBBorder2->connect_clicked ( LINK(this, CellBorderStylePopup, TB2and3SelectHdl) ); mxTBBorder2->set_item_tooltip_text(0, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYLEFT)); + mxTBBorder2->set_item_accessible_name(0, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYLEFT)); mxTBBorder2->set_item_tooltip_text(1, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYRIGHT)); + mxTBBorder2->set_item_accessible_name(1, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYRIGHT)); mxTBBorder2->set_item_tooltip_text(2, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYTOP)); + mxTBBorder2->set_item_accessible_name(2, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYTOP)); mxTBBorder2->set_item_tooltip_text(3, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYBOTTOM)); + mxTBBorder2->set_item_accessible_name(3, SvxResId(RID_SVXSTR_PARA_PRESET_ONLYBOTTOM)); mxTBBorder3->connect_clicked ( LINK(this, CellBorderStylePopup, TB2and3SelectHdl) ); mxTBBorder3->set_item_tooltip_text(0, SvxResId(RID_SVXSTR_PARA_PRESET_DIAGONALUP)); + mxTBBorder3->set_item_accessible_name(0, SvxResId(RID_SVXSTR_PARA_PRESET_DIAGONALUP)); mxTBBorder3->set_item_tooltip_text(1, SvxResId(RID_SVXSTR_PARA_PRESET_DIAGONALDOWN)); + mxTBBorder3->set_item_accessible_name(1, SvxResId(RID_SVXSTR_PARA_PRESET_DIAGONALDOWN)); mxTBBorder3->set_item_tooltip_text(2, SvxResId(RID_SVXSTR_PARA_PRESET_TOPBOTTOM)); + mxTBBorder3->set_item_accessible_name(2, SvxResId(RID_SVXSTR_PARA_PRESET_TOPBOTTOM)); mxTBBorder3->set_item_tooltip_text(3, SvxResId(RID_SVXSTR_PARA_PRESET_LEFTRIGHT)); + mxTBBorder3->set_item_accessible_name(3, SvxResId(RID_SVXSTR_PARA_PRESET_LEFTRIGHT)); mxTBBorder4->connect_clicked ( LINK(this, CellBorderStylePopup, TB4SelectHdl) ); mxTBBorder4->set_item_tooltip_text(0, SvxResId(RID_SVXSTR_TABLE_PRESET_THICKBOTTOM)); + mxTBBorder4->set_item_accessible_name(0, SvxResId(RID_SVXSTR_TABLE_PRESET_THICKBOTTOM)); mxTBBorder4->set_item_tooltip_text(1, SvxResId(RID_SVXSTR_TABLE_PRESET_DOUBLEBOTTOM)); + mxTBBorder4->set_item_accessible_name(1, SvxResId(RID_SVXSTR_TABLE_PRESET_DOUBLEBOTTOM)); mxTBBorder4->set_item_tooltip_text(2, SvxResId(RID_SVXSTR_TABLE_PRESET_TOPTHICKBOTTOM)); + mxTBBorder4->set_item_accessible_name(2, SvxResId(RID_SVXSTR_TABLE_PRESET_TOPTHICKBOTTOM)); mxTBBorder4->set_item_tooltip_text(3, SvxResId(RID_SVXSTR_TABLE_PRESET_TOPDOUBLEBOTTOM)); + mxTBBorder4->set_item_accessible_name(3, SvxResId(RID_SVXSTR_TABLE_PRESET_TOPDOUBLEBOTTOM)); } IMPL_LINK(CellBorderStylePopup, TB1SelectHdl, const OUString&, rId, void) diff --git a/solenv/sanitizers/ui/modules/scalc.false b/solenv/sanitizers/ui/modules/scalc.false index e798fa3e68e5..7284f732888e 100644 --- a/solenv/sanitizers/ui/modules/scalc.false +++ b/solenv/sanitizers/ui/modules/scalc.false @@ -18,6 +18,25 @@ sc/uiconfig/scalc/ui/descriptivestatisticsdialog.ui://GtkButton[@id='input-range sc/uiconfig/scalc/ui/descriptivestatisticsdialog.ui://GtkButton[@id='output-range-button'] button-no-label sc/uiconfig/scalc/ui/exponentialsmoothingdialog.ui://GtkButton[@id='input-range-button'] button-no-label sc/uiconfig/scalc/ui/exponentialsmoothingdialog.ui://GtkButton[@id='output-range-button'] button-no-label + +// accessible names for these are set in code, see CellBorderStylePopup::Initialize +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='none'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='all'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='outside'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='thickbox'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='thickbottom'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='doublebottom'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='topthickbottom'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='topdoublebottom'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='left'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='right'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='top'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='bottom'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='diagup'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='diagdown'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='topbottom'] button-no-label +sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='leftright'] button-no-label + sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkButton[@id='input-range-button'] button-no-label sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkButton[@id='output-range-button'] button-no-label sc/uiconfig/scalc/ui/goalseekdlg.ui://GtkButton[@id='formulabutton'] button-no-label diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr index e2e164de3b01..bdc95e795200 100644 --- a/solenv/sanitizers/ui/modules/scalc.suppr +++ b/solenv/sanitizers/ui/modules/scalc.suppr @@ -45,25 +45,6 @@ sc/uiconfig/scalc/ui/definedatabaserangedialog.ui://GtkLabel[@id='invalid'] orph sc/uiconfig/scalc/ui/definename.ui://GtkLabel[@id='label'] orphan-label sc/uiconfig/scalc/ui/doubledialog.ui://GtkEntry[@id='value'] no-labelled-by sc/uiconfig/scalc/ui/externaldata.ui://GtkLabel[@id='secondsft'] orphan-label - -// Tooltip values now controlled in svx/strings.hrc instead of sc/uiconfig/scalc/ui/floatingborderstyle.ui -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='none'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='all'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='outside'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='thickbox'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='thickbottom'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='doublebottom'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='topthickbottom'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='topdoublebottom'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='left'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='right'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='top'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='bottom'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='diagup'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='diagdown'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='topbottom'] button-no-label -sc/uiconfig/scalc/ui/floatingborderstyle.ui://GtkToolButton[@id='leftright'] button-no-label - sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkLabel[@id='error-message'] orphan-label sc/uiconfig/scalc/ui/groupbynumber.ui://GtkEntry[@id='edit_by'] no-labelled-by sc/uiconfig/scalc/ui/headerfootercontent.ui://GtkLabel[@id='labelFT_H_CUSTOM'] orphan-label commit ad3b33d01baaef1f1a950cd2c54d9649f0383446 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Jun 21 08:44:58 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Jun 21 11:17:17 2024 +0200 tdf#161648 vcl a11y: Add weld::Toolbar::set_item_accessible_name Add API to set the accessible name of toolbar items and implement it for the VCL, gtk3 and gtk4 implementations. This will be used in an upcoming commit to set a11y names for the border items in Calc's sidebar. Change-Id: I958390d8736da8f1281f91586cacbefb5975e229 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169320 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index c3a688d84be0..427c0f869c05 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2538,6 +2538,8 @@ public: const css::uno::Reference<css::graphic::XGraphic>& rIcon) = 0; virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) = 0; + virtual void set_item_accessible_name(int nIndex, const OUString& rName) = 0; + virtual void set_item_accessible_name(const OUString& rIdent, const OUString& rName) = 0; virtual vcl::ImageType get_icon_size() const = 0; virtual void set_icon_size(vcl::ImageType eType) = 0; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 984baf4e61b8..47c692793001 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1426,6 +1426,10 @@ public: virtual void set_item_tooltip_text(const OUString& rIdent, const OUString& rTip) override; + virtual void set_item_accessible_name(int nIndex, const OUString& rName) override; + + virtual void set_item_accessible_name(const OUString& rIdent, const OUString& rName) override; + virtual OUString get_item_tooltip_text(const OUString& rIdent) const override; virtual vcl::ImageType get_icon_size() const override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index e086def8434c..176944cca54c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1217,6 +1217,16 @@ void SalInstanceToolbar::set_item_tooltip_text(const OUString& rIdent, const OUS m_xToolBox->SetQuickHelpText(m_xToolBox->GetItemId(rIdent), rTip); } +void SalInstanceToolbar::set_item_accessible_name(int nIndex, const OUString& rName) +{ + m_xToolBox->SetAccessibleName(m_xToolBox->GetItemId(nIndex), rName); +} + +void SalInstanceToolbar::set_item_accessible_name(const OUString& rIdent, const OUString& rName) +{ + m_xToolBox->SetAccessibleName(m_xToolBox->GetItemId(rIdent), rName); +} + OUString SalInstanceToolbar::get_item_tooltip_text(const OUString& rIdent) const { return m_xToolBox->GetQuickHelpText(m_xToolBox->GetItemId(rIdent)); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index d3e1493f8f3b..9ad11bb3103a 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -12449,6 +12449,32 @@ public: gtk_widget_set_tooltip_text(pItem, OUStringToOString(rTip, RTL_TEXTENCODING_UTF8).getStr()); } + virtual void set_item_accessible_name(int nIndex, const OUString& rName) override + { + GtkWidget* pItem = toolbar_get_nth_item(nIndex); +#if !GTK_CHECK_VERSION(4, 0, 0) + AtkObject* pAccessible = gtk_widget_get_accessible(pItem); + assert(pAccessible); + atk_object_set_name(pAccessible, OUStringToOString(rName, RTL_TEXTENCODING_UTF8).getStr()); +#else + gtk_accessible_update_property(GTK_ACCESSIBLE(pItem), GTK_ACCESSIBLE_PROPERTY_LABEL, + OUStringToOString(rName, RTL_TEXTENCODING_UTF8).getStr()); +#endif + } + + virtual void set_item_accessible_name(const OUString& rIdent, const OUString& rName) override + { + GtkWidget* pItem = GTK_WIDGET(m_aMap[rIdent]); +#if !GTK_CHECK_VERSION(4, 0, 0) + AtkObject* pAccessible = gtk_widget_get_accessible(pItem); + assert(pAccessible); + atk_object_set_name(pAccessible, OUStringToOString(rName, RTL_TEXTENCODING_UTF8).getStr()); +#else + gtk_accessible_update_property(GTK_ACCESSIBLE(pItem), GTK_ACCESSIBLE_PROPERTY_LABEL, + OUStringToOString(rName, RTL_TEXTENCODING_UTF8).getStr()); +#endif + } + virtual OUString get_item_tooltip_text(const OUString& rIdent) const override { GtkWidget* pItem = GTK_WIDGET(m_aMap.find(rIdent)->second);