include/vcl/toolkit/treelistbox.hxx | 2 - vcl/source/accessibility/accessiblelistboxentry.cxx | 7 ---- vcl/source/treelist/treelistbox.cxx | 27 ------------------ vcl/unx/gtk3/gtkinst.cxx | 29 -------------------- 4 files changed, 1 insertion(+), 64 deletions(-)
New commits: commit be7ee86fff11807035d54b5515a91abfc418e748 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Feb 13 17:27:42 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Feb 13 19:45:22 2025 +0100 gtk3 a11y: No longer report IconView item tooltip as a11y desc This is the gtk3 (GtkInstanceIconView) version of Change-Id: I153e91292ec70bb3a6dc4e1d473dc0362af55c79 Author: Michael Weghorn <[email protected]> Date: Thu Feb 13 16:43:03 2025 +0100 vcl a11y: No longer report IconView item tooltip as a11y desc that effectively did the same for the VCL version (SalInstanceIconView). See commit message of the above-mentioned commit and those commits referenced from it for more details. Change-Id: I98eba69cf0061d15d0bfc4da9e4b7a1e1e8428b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181639 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 40c6378deefb..924b64655108 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -17106,31 +17106,6 @@ private: return !aTooltip.isEmpty(); } - /* Set the item's tooltip text as its accessible description as well. */ - void set_item_accessible_description_from_tooltip(GtkTreeIter& iter) - { -#if GTK_CHECK_VERSION(4, 0, 0) - (void)iter; -#else - AtkObject* pAtkObject = gtk_widget_get_accessible(GTK_WIDGET(m_pIconView)); - assert(pAtkObject); - GtkTreePath* pPath = gtk_tree_model_get_path(GTK_TREE_MODEL(m_pTreeStore), &iter); - assert(gtk_tree_path_get_depth(pPath) == 1); - int* indices = gtk_tree_path_get_indices(pPath); - const int nIndex = indices[0]; - assert(nIndex < atk_object_get_n_accessible_children(pAtkObject) - && "item index too high for ItemView's accessible child count"); - - const OUString sTooltipText = signal_query_tooltip(GtkInstanceTreeIter(iter)); - AtkObject* pChild = atk_object_ref_accessible_child(pAtkObject, nIndex); - atk_object_set_description(pChild, - OUStringToOString(sTooltipText, RTL_TEXTENCODING_UTF8).getStr()); - g_object_unref(pChild); - gtk_tree_path_free(pPath); - -#endif - } - void insert_item(GtkTreeIter& iter, int pos, const OUString* pId, const OUString* pText, const OUString* pIconName) { // m_nTextCol may be -1, so pass it last, to not terminate the sequence before the Id value @@ -17145,8 +17120,6 @@ private: if (pixbuf) g_object_unref(pixbuf); } - - set_item_accessible_description_from_tooltip(iter); } void insert_item(GtkTreeIter& iter, int pos, const OUString* pId, const OUString* pText, const VirtualDevice* pIcon) @@ -17163,8 +17136,6 @@ private: if (pixbuf) g_object_unref(pixbuf); } - - set_item_accessible_description_from_tooltip(iter); } OUString get(const GtkTreeIter& iter, int col) const commit b446ea138b4ce0ac674008edf3e181c4f8476b87 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Feb 13 17:15:10 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Feb 13 19:45:15 2025 +0100 vcl a11y: Don't use same text for list item a11y name and description Unless an accessible name has explicitly been set, AccessibleListBoxEntry::getAccessibleName calls AccessibleListBoxEntry::implGetText which calls SvTreeListBox::SearchEntryTextWithHeadTitle to get an accessible name. AccessibleListBoxEntry::getAccessibleDescription either returns an empty string or also calls SvTreeListBox::SearchEntryTextWithHeadTitle, in which case the accessible description would be the same as the accessible name (unless an a11y name was explicitly set). Reporting the same string for both, a11y name and a11y description doesn't make much sense. Let AccessibleListBoxEntry::getAccessibleDescription always return an empty string instead. In case there is a need to set/report an accessible description, introducing a new method in the weld API to set the a11y description explicitly would likely be the better approach, see Change-Id: I8fcbdddd74d75283469f046ff5b60f111051b021 Author: Michael Weghorn <[email protected]> Date: Thu Feb 13 13:42:05 2025 +0100 a11y: Introduce weld::IconView::set_item_accessible_name which did the same for the accessible name for icon views. (That would also ensure that it works for other implementations, not just the VCL one.) Change-Id: I1026d6a2c3d5a79359fd4b65352491ebe98db092 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181638 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/source/accessibility/accessiblelistboxentry.cxx b/vcl/source/accessibility/accessiblelistboxentry.cxx index d2a3e873caad..a1f47be52c68 100644 --- a/vcl/source/accessibility/accessiblelistboxentry.cxx +++ b/vcl/source/accessibility/accessiblelistboxentry.cxx @@ -374,31 +374,7 @@ OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - if( getAccessibleRole() == AccessibleRole::TREE_ITEM ) - { - return OUString(); - } - - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath(m_aEntryPath); - assert(pEntry); - - //want to count the real column number in the list box. - sal_uInt16 iRealItemCount = 0; - for (size_t i = 0; i < pEntry->ItemCount(); ++i) - { - const SvLBoxItem& rItem = pEntry->GetItem(i); - if (rItem.GetType() == SvLBoxItemType::String && - !static_cast<const SvLBoxString&>(rItem).GetText().isEmpty()) - { - iRealItemCount++; - } - } - // No idea why <= 1; that was in AccessibleListBoxEntry::getAccessibleDescription - // since the "Integrate branch of IAccessible2" commit - if (iRealItemCount <= 1) - return {}; - else - return SvTreeListBox::SearchEntryTextWithHeadTitle(pEntry); + return OUString(); } OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) commit a4422ce3049da23439fb18daebba90da9d8614d8 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Feb 13 16:58:44 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Feb 13 19:45:07 2025 +0100 vcl a11y: Move listbox entry a11y desc logic to only caller Since Change-Id: I153e91292ec70bb3a6dc4e1d473dc0362af55c79 Author: Michael Weghorn <[email protected]> Date: Thu Feb 13 16:43:03 2025 +0100 vcl a11y: No longer report IconView item tooltip as a11y desc , SvTreeListBox::GetEntryAccessibleDescription is a static method used only in AccessibleListBoxEntry::getAccessibleDescription. Move the existing logic right into that method instead. (Let AccessibleListBoxEntry, the a11y class, be responsible.) Change-Id: I3faf5fc8643ca4f39b7926b43b251ab9c7f92c5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181637 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx index 973a93d65f50..43882465aaa5 100644 --- a/include/vcl/toolkit/treelistbox.hxx +++ b/include/vcl/toolkit/treelistbox.hxx @@ -459,8 +459,6 @@ public: /** Fills the StateSet of one entry. */ void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, sal_Int64& rStateSet ) const; - static OUString GetEntryAccessibleDescription(SvTreeListEntry* pEntry); - /** Calculate and return the bounding rectangle of an entry. @param pEntry The entry. diff --git a/vcl/source/accessibility/accessiblelistboxentry.cxx b/vcl/source/accessibility/accessiblelistboxentry.cxx index 8db62a3260ca..d2a3e873caad 100644 --- a/vcl/source/accessibility/accessiblelistboxentry.cxx +++ b/vcl/source/accessibility/accessiblelistboxentry.cxx @@ -378,8 +378,27 @@ OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) { return OUString(); } - return SvTreeListBox::GetEntryAccessibleDescription( - m_pTreeListBox->GetEntryFromPath(m_aEntryPath)); + + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath(m_aEntryPath); + assert(pEntry); + + //want to count the real column number in the list box. + sal_uInt16 iRealItemCount = 0; + for (size_t i = 0; i < pEntry->ItemCount(); ++i) + { + const SvLBoxItem& rItem = pEntry->GetItem(i); + if (rItem.GetType() == SvLBoxItemType::String && + !static_cast<const SvLBoxString&>(rItem).GetText().isEmpty()) + { + iRealItemCount++; + } + } + // No idea why <= 1; that was in AccessibleListBoxEntry::getAccessibleDescription + // since the "Integrate branch of IAccessible2" commit + if (iRealItemCount <= 1) + return {}; + else + return SvTreeListBox::SearchEntryTextWithHeadTitle(pEntry); } OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 5c4dc75fdaee..5dd1dff72688 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -3504,33 +3504,6 @@ void SvTreeListBox::FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, sal_In } } -OUString SvTreeListBox::GetEntryAccessibleDescription(SvTreeListEntry* pEntry) -{ - assert(pEntry); - - //want to count the real column number in the list box. - sal_uInt16 iRealItemCount = 0; - for (size_t i = 0; i < pEntry->ItemCount(); ++i) - { - const SvLBoxItem& rItem = pEntry->GetItem(i); - if (rItem.GetType() == SvLBoxItemType::String && - !static_cast<const SvLBoxString&>(rItem).GetText().isEmpty()) - { - iRealItemCount++; - } - } - // No idea why <= 1; that was in AccessibleListBoxEntry::getAccessibleDescription - // since the "Integrate branch of IAccessible2" commit - if (iRealItemCount <= 1) - { - return {}; - } - else - { - return SearchEntryTextWithHeadTitle(pEntry); - } -} - tools::Rectangle SvTreeListBox::GetBoundingRect(const SvTreeListEntry* pEntry) { Point aPos = GetEntryPosition( pEntry );
