include/sfx2/thumbnailviewitem.hxx | 3 - sfx2/source/control/thumbnailview.cxx | 12 ++--- sfx2/source/control/thumbnailviewacc.cxx | 62 +++++++++++++++--------------- sfx2/source/control/thumbnailviewacc.hxx | 7 +-- sfx2/source/control/thumbnailviewitem.cxx | 6 +- 5 files changed, 43 insertions(+), 47 deletions(-)
New commits: commit 5003e1d57dfd39d35859bc17482b5f83bf4136eb Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Feb 25 16:00:35 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Feb 26 08:10:18 2025 +0100 thumbnailview a11y: Drop always false param See also commit d144891269f8b2431d0c954c71894ef525a89335 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Feb 24 18:33:56 2025 +0100 valueset a11y: Drop always false ValueSetItem::GetAccessible param which basically did the same for ValueSetItem. Change-Id: Ibb2b2d23926e618c3380a4b7aff0115fdea41a1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182196 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx index dd417d8d4cad..7d4897482d81 100644 --- a/include/sfx2/thumbnailviewitem.hxx +++ b/include/sfx2/thumbnailviewitem.hxx @@ -110,8 +110,7 @@ public: void setTitle (const OUString& rTitle); - rtl::Reference< ThumbnailViewItemAcc > const & - GetAccessible( bool bIsTransientChildrenDisabled ); + rtl::Reference<ThumbnailViewItemAcc> const & GetAccessible(); void setDrawArea (const tools::Rectangle &area); diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index e1fd5ac139e8..26538e0efc21 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -293,7 +293,7 @@ void ThumbnailView::ImplDeleteItems() { css::uno::Any aOldAny, aNewAny; - aOldAny <<= css::uno::Reference<css::accessibility::XAccessible>(pItem->GetAccessible( false )); + aOldAny <<= css::uno::Reference<css::accessibility::XAccessible>(pItem->GetAccessible()); ImplFireAccessibleEvent( css::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); } @@ -433,11 +433,9 @@ void ThumbnailView::CalculateItemPositions(bool bScrollBarUsed) { css::uno::Any aOldAny, aNewAny; if (bIsVisible) - aNewAny <<= css::uno::Reference<css::accessibility::XAccessible>( - rItem.GetAccessible(false)); + aNewAny <<= css::uno::Reference<css::accessibility::XAccessible>(rItem.GetAccessible()); else - aOldAny <<= css::uno::Reference<css::accessibility::XAccessible>( - rItem.GetAccessible(false)); + aOldAny <<= css::uno::Reference<css::accessibility::XAccessible>(rItem.GetAccessible()); ImplFireAccessibleEvent(css::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny); } }; @@ -1141,7 +1139,7 @@ void ThumbnailView::SelectItem( sal_uInt16 nItemId ) return; // focus event (select) - const rtl::Reference<ThumbnailViewItemAcc> & pItemAcc = pItem->GetAccessible( false ); + const rtl::Reference<ThumbnailViewItemAcc>& pItemAcc = pItem->GetAccessible(); if( pItemAcc ) { @@ -1224,7 +1222,7 @@ void ThumbnailView::filterItems(const std::function<bool (const ThumbnailViewIte { css::uno::Any aOldAny, aNewAny; - aOldAny <<= css::uno::Reference<css::accessibility::XAccessible>(pItem->GetAccessible( false )); + aOldAny <<= css::uno::Reference<css::accessibility::XAccessible>(pItem->GetAccessible()); ImplFireAccessibleEvent( css::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); } diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index 7ec6d9ccbcbe..da477e1b8fff 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -71,7 +71,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getAcces if( !pItem ) throw lang::IndexOutOfBoundsException(); - uno::Reference< accessibility::XAccessible > xRet = pItem->GetAccessible( /*bIsTransientChildrenDisabled*/false ); + uno::Reference< accessibility::XAccessible > xRet = pItem->GetAccessible(); return xRet; } @@ -248,7 +248,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getAcces if( THUMBNAILVIEW_ITEM_NONEITEM != nItemPos ) { ThumbnailViewItem* const pItem = mpThumbnailView->mFilteredItemList[nItemPos]; - xRet = pItem->GetAccessible( /*bIsTransientChildrenDisabled*/false ); + xRet = pItem->GetAccessible(); } } @@ -412,7 +412,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getSelec if (pItem && mpThumbnailView->IsItemSelected(pItem->mnId) && (nSelectedChildIndex == static_cast<sal_Int32>(nSel++))) - xRet = pItem->GetAccessible( /*bIsTransientChildrenDisabled*/false ); + xRet = pItem->GetAccessible(); } return xRet; diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx index 5d76b0db863f..c2295cefd041 100644 --- a/sfx2/source/control/thumbnailviewitem.cxx +++ b/sfx2/source/control/thumbnailviewitem.cxx @@ -111,10 +111,10 @@ void ThumbnailViewItem::setTitle (const OUString& rTitle) maTitle = rTitle; } -const rtl::Reference< ThumbnailViewItemAcc > & ThumbnailViewItem::GetAccessible( bool bIsTransientChildrenDisabled ) +const rtl::Reference< ThumbnailViewItemAcc > & ThumbnailViewItem::GetAccessible() { if( !mxAcc.is() ) - mxAcc = new ThumbnailViewItemAcc( this, bIsTransientChildrenDisabled ); + mxAcc = new ThumbnailViewItemAcc(this, false); return mxAcc; } commit bb5f3c008bfad784ac390206ba73ce167dfb774d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Feb 25 15:56:21 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Feb 26 08:10:11 2025 +0100 thumbnailview a11y: Simplify ThumbnailViewItemAcc::getAccessibleIndexInParent This is basically the same as commit 921609b4b01d65f840233cf332b76b26fcb10b15 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Feb 24 18:07:43 2025 +0100 valueset a11y: Simplify ValueItemAcc::getAccessibleIndexInParent , but now for ThumbnailViewItemAcc. See the above commit for more details. Change-Id: I73cc73e195187fe74dac89e33cf8f23aa1ea8b22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182185 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index 8c8fae586f15..7ec6d9ccbcbe 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -610,13 +610,11 @@ sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleIndexInParent() pItem = nullptr; } - // Do not create an accessible object for the test. - if (pItem != nullptr && pItem->mxAcc.is()) - if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this ) - { - nIndexInParent = i; - bDone = true; - } + if (pItem && pItem == mpThumbnailViewItem) + { + nIndexInParent = i; + bDone = true; + } } } commit cb1615948b6a9f23fc6b47d76c64078921717af6 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Feb 25 15:46:08 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Feb 26 08:10:06 2025 +0100 thumbnailview a11y: Rename ThumbnailViewItemAcc::mpParent Same motivation as in commit 8f0b672a1ac712c75227e9497aa812e17724638b Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Feb 24 15:04:32 2025 +0100 valueset a11y: Rename ValueSetAcc::mpParent to mpValueSet The object referred to by ThumbnailViewItemAcc::mpParent is the ThumbnailViewItem for which this is the accessible object, not any parent widget/accessible, so rename to avoid confusion. Also rename ThumbnailViewItemAcc::ParentDestroyed accordingly. Change-Id: I186b59a23ab6b9b18a713bdd6929594edda3a404 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182184 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index af6a9d8495fd..8c8fae586f15 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -493,9 +493,10 @@ void ThumbnailViewAcc::ThrowIfDisposed() } } -ThumbnailViewItemAcc::ThumbnailViewItemAcc( ThumbnailViewItem* pParent, bool bIsTransientChildrenDisabled ) : - mpParent( pParent ), - mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ) +ThumbnailViewItemAcc::ThumbnailViewItemAcc(ThumbnailViewItem* pThumbnailViewItem, + bool bIsTransientChildrenDisabled) + : mpThumbnailViewItem(pThumbnailViewItem) + , mbIsTransientChildrenDisabled(bIsTransientChildrenDisabled) { } @@ -503,10 +504,10 @@ ThumbnailViewItemAcc::~ThumbnailViewItemAcc() { } -void ThumbnailViewItemAcc::ParentDestroyed() +void ThumbnailViewItemAcc::ThumbnailViewItemDestroyed() { std::scoped_lock aGuard( maMutex ); - mpParent = nullptr; + mpThumbnailViewItem = nullptr; } void ThumbnailViewAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue ) @@ -577,8 +578,8 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewItemAcc::getA const SolarMutexGuard aSolarGuard; uno::Reference< accessibility::XAccessible > xRet; - if( mpParent ) - xRet = mpParent->mrParent.getAccessible(); + if (mpThumbnailViewItem) + xRet = mpThumbnailViewItem->mrParent.getAccessible(); return xRet; } @@ -590,11 +591,11 @@ sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleIndexInParent() // parent. sal_Int64 nIndexInParent = -1; - if( mpParent ) + if (mpThumbnailViewItem) { bool bDone = false; - sal_uInt16 nCount = mpParent->mrParent.ImplGetVisibleItemCount(); + sal_uInt16 nCount = mpThumbnailViewItem->mrParent.ImplGetVisibleItemCount(); ThumbnailViewItem* pItem; for (sal_uInt16 i=0; i<nCount && !bDone; i++) { @@ -602,7 +603,7 @@ sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleIndexInParent() // just in case the number of children changes in the meantime. try { - pItem = mpParent->mrParent.ImplGetVisibleItem (i); + pItem = mpThumbnailViewItem->mrParent.ImplGetVisibleItem(i); } catch (const lang::IndexOutOfBoundsException&) { @@ -637,13 +638,13 @@ OUString SAL_CALL ThumbnailViewItemAcc::getAccessibleName() const SolarMutexGuard aSolarGuard; OUString aRet; - if( mpParent ) + if (mpThumbnailViewItem) { - aRet = mpParent->maTitle; + aRet = mpThumbnailViewItem->maTitle; if( aRet.isEmpty() ) { - aRet = "Item " + OUString::number(static_cast<sal_Int32>(mpParent->mnId)); + aRet = "Item " + OUString::number(static_cast<sal_Int32>(mpThumbnailViewItem->mnId)); } } @@ -660,7 +661,7 @@ sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleStateSet() const SolarMutexGuard aSolarGuard; sal_Int64 nStateSet = 0; - if( mpParent ) + if (mpThumbnailViewItem) { nStateSet |= accessibility::AccessibleStateType::ENABLED; nStateSet |= accessibility::AccessibleStateType::SENSITIVE; @@ -672,10 +673,10 @@ sal_Int64 SAL_CALL ThumbnailViewItemAcc::getAccessibleStateSet() nStateSet |= accessibility::AccessibleStateType::SELECTABLE; nStateSet |= accessibility::AccessibleStateType::FOCUSABLE; - if( mpParent->isSelected() ) + if (mpThumbnailViewItem->isSelected()) { nStateSet |= accessibility::AccessibleStateType::SELECTED; - if (mpParent->mrParent.HasChildFocus()) + if (mpThumbnailViewItem->mrParent.HasChildFocus()) nStateSet |= accessibility::AccessibleStateType::FOCUSED; } } @@ -756,9 +757,9 @@ awt::Rectangle SAL_CALL ThumbnailViewItemAcc::getBounds() const SolarMutexGuard aSolarGuard; awt::Rectangle aRet; - if( mpParent ) + if (mpThumbnailViewItem) { - tools::Rectangle aRect( mpParent->getDrawArea() ); + tools::Rectangle aRect(mpThumbnailViewItem->getDrawArea()); tools::Rectangle aParentRect; // get position of the accessible parent in screen coordinates @@ -800,10 +801,11 @@ awt::Point SAL_CALL ThumbnailViewItemAcc::getLocationOnScreen() const SolarMutexGuard aSolarGuard; awt::Point aRet; - if (mpParent) + if (mpThumbnailViewItem) { - const Point aPos = mpParent->getDrawArea().TopLeft(); - const Point aScreenPos(mpParent->mrParent.GetDrawingArea()->get_accessible_location_on_screen()); + const Point aPos = mpThumbnailViewItem->getDrawArea().TopLeft(); + const Point aScreenPos( + mpThumbnailViewItem->mrParent.GetDrawingArea()->get_accessible_location_on_screen()); aRet.X = aPos.X() + aScreenPos.X(); aRet.Y = aPos.Y() + aScreenPos.X(); diff --git a/sfx2/source/control/thumbnailviewacc.hxx b/sfx2/source/control/thumbnailviewacc.hxx index dd7ee8251876..fe97b73c5f43 100644 --- a/sfx2/source/control/thumbnailviewacc.hxx +++ b/sfx2/source/control/thumbnailviewacc.hxx @@ -156,15 +156,14 @@ private: ::std::vector< css::uno::Reference< css::accessibility::XAccessibleEventListener > > mxEventListeners; std::mutex maMutex; - ThumbnailViewItem* mpParent; + ThumbnailViewItem* mpThumbnailViewItem; bool mbIsTransientChildrenDisabled; public: - - ThumbnailViewItemAcc( ThumbnailViewItem* pParent, bool bIsTransientChildrenDisabled ); + ThumbnailViewItemAcc(ThumbnailViewItem* pThumbnailViewItem, bool bIsTransientChildrenDisabled); virtual ~ThumbnailViewItemAcc() override; - void ParentDestroyed(); + void ThumbnailViewItemDestroyed(); public: diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx index 609e35dd1c59..5d76b0db863f 100644 --- a/sfx2/source/control/thumbnailviewitem.cxx +++ b/sfx2/source/control/thumbnailviewitem.cxx @@ -63,7 +63,7 @@ ThumbnailViewItem::~ThumbnailViewItem() { if( mxAcc.is() ) { - mxAcc->ParentDestroyed(); + mxAcc->ThumbnailViewItemDestroyed(); } }