diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-06-01 11:18:26 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-06-09 17:49:16 +0200 |
commit | 2a28ebeef5ea3e2b01d836a7233d2316b765bf38 (patch) | |
tree | 2231192775cb5544b8335d92f8756aa9a6176073 /accessibility | |
parent | 2910ce0b43552cbd6415e5930953c660e41b1965 (diff) |
Accessibility for IconView
Change-Id: I65ca9d43f70a50e2e95aabfc3b8ba1b15f9ff8be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135226
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/Library_acc.mk | 1 | ||||
-rw-r--r-- | accessibility/inc/extended/AccessibleIconView.hxx | 30 | ||||
-rw-r--r-- | accessibility/inc/extended/accessiblelistbox.hxx | 9 | ||||
-rw-r--r-- | accessibility/source/extended/AccessibleIconView.cxx | 53 | ||||
-rw-r--r-- | accessibility/source/extended/accessiblelistboxentry.cxx | 25 | ||||
-rw-r--r-- | accessibility/source/helper/acc_factory.cxx | 13 |
6 files changed, 104 insertions, 27 deletions
diff --git a/accessibility/Library_acc.mk b/accessibility/Library_acc.mk index 0926fee97e5d..34c4dc7eb0c5 100644 --- a/accessibility/Library_acc.mk +++ b/accessibility/Library_acc.mk @@ -62,6 +62,7 @@ $(eval $(call gb_Library_add_exception_objects,acc,\ accessibility/source/extended/accessibleeditbrowseboxcell \ accessibility/source/extended/accessibleiconchoicectrl \ accessibility/source/extended/accessibleiconchoicectrlentry \ + accessibility/source/extended/AccessibleIconView \ accessibility/source/extended/accessiblelistbox \ accessibility/source/extended/accessiblelistboxentry \ accessibility/source/extended/accessibletablistbox \ diff --git a/accessibility/inc/extended/AccessibleIconView.hxx b/accessibility/inc/extended/AccessibleIconView.hxx new file mode 100644 index 000000000000..d5ab5eafb198 --- /dev/null +++ b/accessibility/inc/extended/AccessibleIconView.hxx @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sal/config.h> + +#include "accessiblelistbox.hxx" + +namespace accessibility +{ +class AccessibleIconView final : public AccessibleListBox +{ +public: + AccessibleIconView(SvTreeListBox const& _rListBox, + const css::uno::Reference<css::accessibility::XAccessible>& _xParent); + +protected: + // VCLXAccessibleComponent + virtual void ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent) override; +}; +} // namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/accessibility/inc/extended/accessiblelistbox.hxx b/accessibility/inc/extended/accessiblelistbox.hxx index 4f4104701709..40b01ea180a5 100644 --- a/accessibility/inc/extended/accessiblelistbox.hxx +++ b/accessibility/inc/extended/accessiblelistbox.hxx @@ -37,7 +37,7 @@ namespace accessibility /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry */ - class AccessibleListBox final : + class AccessibleListBox : public cppu::ImplHelper2< css::accessibility::XAccessible, css::accessibility::XAccessibleSelection>, @@ -45,18 +45,17 @@ namespace accessibility { css::uno::Reference< css::accessibility::XAccessible > m_xParent; - - virtual ~AccessibleListBox() override; - // OComponentHelper overridables /** this function is called upon disposing the component */ virtual void SAL_CALL disposing() override; + protected: // VCLXAccessibleComponent virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) override; virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + private: VclPtr< SvTreeListBox > getListBox() const; void RemoveChildEntries(SvTreeListEntry*); @@ -73,6 +72,8 @@ namespace accessibility AccessibleListBox( SvTreeListBox const & _rListBox, const css::uno::Reference< css::accessibility::XAccessible >& _xParent ); + virtual ~AccessibleListBox() override; + rtl::Reference<AccessibleListBoxEntry> implGetAccessible(SvTreeListEntry & rEntry); // XTypeProvider diff --git a/accessibility/source/extended/AccessibleIconView.cxx b/accessibility/source/extended/AccessibleIconView.cxx new file mode 100644 index 000000000000..6bc5c99e9243 --- /dev/null +++ b/accessibility/source/extended/AccessibleIconView.cxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <com/sun/star/accessibility/AccessibleEventId.hpp> + +#include <toolkit/helper/convert.hxx> +#include <vcl/event.hxx> + +#include <extended/AccessibleIconView.hxx> + +namespace accessibility +{ +AccessibleIconView::AccessibleIconView( + SvTreeListBox const& _rListBox, + const css::uno::Reference<css::accessibility::XAccessible>& _xParent) + : AccessibleListBox(_rListBox, _xParent) +{ +} + +void AccessibleIconView::ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent) +{ + if (!isAlive()) + return; + + switch (rVclWindowEvent.GetId()) + { + case VclEventId::WindowMouseMove: + if (MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rVclWindowEvent.GetData())) + { + if (auto xChild = getAccessibleAtPoint(AWTPoint(pMouseEvt->GetPosPixel()))) + { + // Allow announcing the element on mouse hover + css::uno::Any aNew(xChild); + NotifyAccessibleEvent( + css::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, {}, aNew); + } + } + break; + default: + AccessibleListBox::ProcessWindowEvent(rVclWindowEvent); + } +} +} // namespace accessibility + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index a1e38012dfff..2fff77b03699 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -439,33 +439,12 @@ namespace accessibility SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); if( getAccessibleRole() == AccessibleRole::TREE_ITEM ) { return OUString(); } - //want to count the real column number in the list box. - sal_uInt16 iRealItemCount = 0; - sal_uInt16 iCount = 0; - sal_uInt16 iTotleItemCount = pEntry->ItemCount(); - while( iCount < iTotleItemCount ) - { - const SvLBoxItem& rItem = pEntry->GetItem( iCount ); - if ( rItem.GetType() == SvLBoxItemType::String && - !static_cast<const SvLBoxString&>( rItem ).GetText().isEmpty() ) - { - iRealItemCount++; - } - iCount++; - } - if(iRealItemCount<=1 ) - { - return OUString(); - } - else - { - return SvTreeListBox::SearchEntryTextWithHeadTitle( pEntry ); - } + return m_pTreeListBox->GetEntryAccessibleDescription( + m_pTreeListBox->GetEntryFromPath(m_aEntryPath)); } OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index 53ed173c15b2..10cc27f007c6 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -46,6 +46,7 @@ #include <extended/accessibletablistbox.hxx> #include <extended/AccessibleBrowseBox.hxx> #include <extended/accessibleiconchoicectrl.hxx> +#include <extended/AccessibleIconView.hxx> #include <extended/accessibletabbar.hxx> #include <extended/accessiblelistbox.hxx> #include <extended/AccessibleBrowseBoxHeaderBar.hxx> @@ -156,6 +157,12 @@ public: ) const override; virtual css::uno::Reference< css::accessibility::XAccessible > + createAccessibleIconView( + SvTreeListBox& _rListBox, + const css::uno::Reference< css::accessibility::XAccessible >& _xParent + ) const override; + + virtual css::uno::Reference< css::accessibility::XAccessible > createAccessibleBrowseBoxHeaderBar( const css::uno::Reference< css::accessibility::XAccessible >& rxParent, vcl::IAccessibleTableProvider& _rOwningTable, @@ -407,6 +414,12 @@ Reference< XAccessible > AccessibleFactory::createAccessibleTreeListBox( return new AccessibleListBox( _rListBox, _xParent ); } +Reference< XAccessible > AccessibleFactory::createAccessibleIconView( + SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) const +{ + return new AccessibleIconView( _rListBox, _xParent ); +} + Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderBar( const Reference< XAccessible >& rxParent, vcl::IAccessibleTableProvider& _rOwningTable, AccessibleBrowseBoxObjType _eObjType ) const |