include/vcl/menu.hxx | 7 +++-- sd/source/ui/inc/DrawViewShell.hxx | 4 +-- sd/source/ui/inc/NotesPanelViewShell.hxx | 2 - sd/source/ui/inc/OutlineViewShell.hxx | 4 +-- sd/source/ui/inc/SlideSorterViewShell.hxx | 4 +-- sd/source/ui/inc/ViewShell.hxx | 6 ++-- sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 4 +-- sd/source/ui/view/drviews5.cxx | 6 ++-- sd/source/ui/view/outlnvsh.cxx | 6 ++-- sd/source/ui/view/viewshel.cxx | 6 ++-- vcl/source/accessibility/vclxaccessiblecomponent.cxx | 11 +++----- vcl/source/window/menu.cxx | 21 ++++++++-------- 12 files changed, 40 insertions(+), 41 deletions(-)
New commits: commit 26bb3a353b1130a6ee8e6b43e1aee8646a0cfbce Author: Michael Weghorn <[email protected]> AuthorDate: Mon May 26 14:54:48 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Jun 25 07:40:54 2025 +0200 sd a11y: Return more concrete type ... in ViewShell::CreateAccessibleDocumentView Change-Id: I2d198b55ed2a25ccfc44e726b0bf268e5d3dc970 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185853 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index e236c186cf7d..65744b1423f0 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -317,8 +317,8 @@ public: @return Returns an <type>AccessibleDrawDocumentView</type> object. */ - virtual css::uno::Reference<css::accessibility::XAccessible> - CreateAccessibleDocumentView (::sd::Window* pWindow) override; + virtual rtl::Reference<comphelper::OAccessibleComponentHelper> + CreateAccessibleDocumentView(::sd::Window* pWindow) override; /** Return the number of layers managed by the layer tab control. This will usually differ from the number of layers managed by the layer diff --git a/sd/source/ui/inc/NotesPanelViewShell.hxx b/sd/source/ui/inc/NotesPanelViewShell.hxx index c261d2f428f0..d8070896c6af 100644 --- a/sd/source/ui/inc/NotesPanelViewShell.hxx +++ b/sd/source/ui/inc/NotesPanelViewShell.hxx @@ -81,7 +81,7 @@ public: virtual void ReadFrameViewData(FrameView* pView) override; virtual void WriteFrameViewData() override; - virtual css::uno::Reference<css::accessibility::XAccessible> + virtual rtl::Reference<comphelper::OAccessibleComponentHelper> CreateAccessibleDocumentView(::sd::Window* /*pWindow*/) override { // TODO diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx index 377fec99947e..f3323b3db021 100644 --- a/sd/source/ui/inc/OutlineViewShell.hxx +++ b/sd/source/ui/inc/OutlineViewShell.hxx @@ -125,8 +125,8 @@ public: @return Returns an <type>AccessibleDrawDocumentView</type> object. */ - virtual css::uno::Reference<css::accessibility::XAccessible> - CreateAccessibleDocumentView (::sd::Window* pWindow) override; + virtual rtl::Reference<comphelper::OAccessibleComponentHelper> + CreateAccessibleDocumentView(::sd::Window* pWindow) override; /** Update the preview to show the specified page. */ diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx index cb2533740b66..0646010091b7 100644 --- a/sd/source/ui/inc/SlideSorterViewShell.hxx +++ b/sd/source/ui/inc/SlideSorterViewShell.hxx @@ -176,8 +176,8 @@ public: @return Returns an <type>AccessibleSlideSorterView</type> object. */ - virtual css::uno::Reference<css::accessibility::XAccessible> - CreateAccessibleDocumentView (::sd::Window* pWindow) override; + virtual rtl::Reference<comphelper::OAccessibleComponentHelper> + CreateAccessibleDocumentView(::sd::Window* pWindow) override; // handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase virtual void SwitchViewFireFocus( const css::uno::Reference< css::accessibility::XAccessible >& xAcc ) override; diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index ced1a5e48b95..e40ab13b9a80 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -19,8 +19,8 @@ #pragma once +#include <comphelper/accessiblecomponenthelper.hxx> #include <rtl/ref.hxx> - #include <sfx2/viewsh.hxx> #include <svl/typedwhich.hxx> #include <svtools/scrolladaptor.hxx> @@ -293,8 +293,8 @@ public: @return This default implementation returns an empty reference. */ - virtual css::uno::Reference<css::accessibility::XAccessible> - CreateAccessibleDocumentView (::sd::Window* pWindow); + virtual rtl::Reference<comphelper::OAccessibleComponentHelper> + CreateAccessibleDocumentView(::sd::Window* pWindow); virtual void SwitchViewFireFocus( const css::uno::Reference< css::accessibility::XAccessible >& xAcc ); void SwitchActiveViewFireFocus( ); diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index a3b85897aea2..ff176b836ab8 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -252,8 +252,8 @@ Reference<drawing::XDrawSubController> SlideSorterViewShell::CreateSubController to the base class to return a default object (probably an empty reference). */ -css::uno::Reference<css::accessibility::XAccessible> - SlideSorterViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow) +rtl::Reference<comphelper::OAccessibleComponentHelper> +SlideSorterViewShell::CreateAccessibleDocumentView(::sd::Window* pWindow) { // When the view is not set then the initialization is not yet complete // and we can not yet provide an accessibility object. diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index ad4fb46a08bb..d7ce9642542e 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -587,8 +587,8 @@ void DrawViewShell::VisAreaChanged(const ::tools::Rectangle& rRect) <type>AccessibleDrawDocumentView</type>. Otherwise return an empty reference. */ -css::uno::Reference<css::accessibility::XAccessible> - DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow) +rtl::Reference<comphelper::OAccessibleComponentHelper> +DrawViewShell::CreateAccessibleDocumentView(::sd::Window* pWindow) { if (GetViewShellBase().GetController() != nullptr) { @@ -603,7 +603,7 @@ css::uno::Reference<css::accessibility::XAccessible> } SAL_WARN("sd", "DrawViewShell::CreateAccessibleDocumentView: no controller"); - return css::uno::Reference< css::accessibility::XAccessible>(); + return {}; } int DrawViewShell::GetActiveTabLayerIndex() const diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index ba3d5461ea44..5904e354ea78 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1820,8 +1820,8 @@ void OutlineViewShell::VisAreaChanged(const ::tools::Rectangle& rRect) <type>AccessibleDrawDocumentView</type>. Otherwise return an empty reference. */ -css::uno::Reference<css::accessibility::XAccessible> - OutlineViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow) +rtl::Reference<comphelper::OAccessibleComponentHelper> +OutlineViewShell::CreateAccessibleDocumentView(::sd::Window* pWindow) { OSL_ASSERT (GetViewShell()!=nullptr); if (GetViewShell()->GetController() != nullptr) @@ -1837,7 +1837,7 @@ css::uno::Reference<css::accessibility::XAccessible> } SAL_WARN("sd", "OutlineViewShell::CreateAccessibleDocumentView: no controller"); - return css::uno::Reference< css::accessibility::XAccessible >(); + return {}; } void OutlineViewShell::GetState (SfxItemSet& rSet) diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index d26fbfcd1c84..43c6d62f3359 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -1511,12 +1511,12 @@ void ViewShell::ExecReq( SfxRequest& rReq ) /** This default implementation returns only an empty reference. See derived classes for more interesting examples. */ -css::uno::Reference<css::accessibility::XAccessible> -ViewShell::CreateAccessibleDocumentView (::sd::Window* ) +rtl::Reference<comphelper::OAccessibleComponentHelper> +ViewShell::CreateAccessibleDocumentView(::sd::Window*) { OSL_FAIL("ViewShell::CreateAccessibleDocumentView should not be called!, perhaps Meyers, 3rd edition, Item 9:"); - return css::uno::Reference<css::accessibility::XAccessible> (); + return {}; } ::sd::WindowUpdater* ViewShell::GetWindowUpdater() const commit ebde1a106d3638295baeaac925659286524ed7ce Author: Michael Weghorn <[email protected]> AuthorDate: Mon May 26 14:41:06 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Jun 25 07:40:48 2025 +0200 vcl a11y: Use more concrete OAccessibleComponentHelper for menu acc Change-Id: Ie7749155d7eb5fce5137767a8056a801517d8e1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185852 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 2d610d68ca8e..ceab8f3453ef 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -23,6 +23,7 @@ #include <memory> #include <string_view> +#include <comphelper/accessiblecomponenthelper.hxx> #include <vcl/vclenum.hxx> #include <tools/link.hxx> #include <tools/long.hxx> @@ -152,7 +153,7 @@ private: bool bInCallback : 1; ///< In Activate/Deactivate bool bKilled : 1; ///< Killed - css::uno::Reference<css::accessibility::XAccessible > mxAccessible; + rtl::Reference<comphelper::OAccessibleComponentHelper> mpAccessible; mutable std::unique_ptr<vcl::MenuLayoutData> mpLayoutData; std::unique_ptr<SalMenu> mpSalMenu; @@ -368,7 +369,7 @@ public: tools::Rectangle GetBoundingRectangle( sal_uInt16 nItemPos ) const; css::uno::Reference<css::accessibility::XAccessible> GetAccessible(); - void SetAccessible(const css::uno::Reference<css::accessibility::XAccessible >& rxAccessible); + void SetAccessible(const rtl::Reference<comphelper::OAccessibleComponentHelper>& rAccessible); // gets the activation key of the specified item KeyEvent GetActivationKey( sal_uInt16 nItemId ) const; @@ -404,7 +405,7 @@ public: virtual void DumpAsPropertyTree(tools::JsonWriter&) const; private: - css::uno::Reference<css::accessibility::XAccessible> CreateAccessible(); + rtl::Reference<comphelper::OAccessibleComponentHelper> CreateAccessible(); }; struct MenuBarButtonCallbackArg diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index b85bd19bb98c..9ea2055dfe58 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -175,8 +175,9 @@ void Menu::dispose() m_pWindow.disposeAndClear(); - // dispose accessible components - comphelper::disposeComponent(mxAccessible); + if (mpAccessible.is()) + mpAccessible->dispose(); + mpAccessible.clear(); if ( nEventId ) Application::RemoveUserEvent( nEventId ); @@ -1298,7 +1299,7 @@ bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const return bSelectable; } -css::uno::Reference<css::accessibility::XAccessible> Menu::CreateAccessible() +rtl::Reference<comphelper::OAccessibleComponentHelper> Menu::CreateAccessible() { rtl::Reference<OAccessibleMenuBaseComponent> xAccessible; if (IsMenuBar()) @@ -1311,9 +1312,9 @@ css::uno::Reference<css::accessibility::XAccessible> Menu::CreateAccessible() css::uno::Reference<css::accessibility::XAccessible> Menu::GetAccessible() { - // Since PopupMenu are sometimes shared by different instances of MenuBar, the mxAccessible member gets + // Since PopupMenu are sometimes shared by different instances of MenuBar, the mpAccessible member gets // overwritten and may contain a disposed object when the initial menubar gets set again. So use the - // mxAccessible member only for sub menus. + // mpAccessible member only for sub menus. if (pStartedFrom && pStartedFrom != this) { for ( sal_uInt16 i = 0, nCount = pStartedFrom->GetItemCount(); i < nCount; ++i ) @@ -1331,15 +1332,15 @@ css::uno::Reference<css::accessibility::XAccessible> Menu::GetAccessible() } } } - else if ( !mxAccessible.is() ) - mxAccessible = CreateAccessible(); + else if (!mpAccessible.is()) + mpAccessible = CreateAccessible(); - return mxAccessible; + return mpAccessible; } -void Menu::SetAccessible(const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible ) +void Menu::SetAccessible(const rtl::Reference<comphelper::OAccessibleComponentHelper>& rAccessible) { - mxAccessible = rxAccessible; + mpAccessible = rAccessible; } Size Menu::ImplGetNativeCheckAndRadioSize(vcl::RenderContext const & rRenderContext, tools::Long& rCheckHeight, tools::Long& rRadioHeight ) const commit 7d49fc2ef89c0390c6835c624f1ac3c0c1510252 Author: Michael Weghorn <[email protected]> AuthorDate: Mon May 26 13:40:18 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Jun 25 07:40:42 2025 +0200 vcl a11y: Switch OSL_ASSERT -> assert, drop check Change-Id: Ic5499bad8de23a8f0598def54609a5215112feb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185851 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/source/accessibility/vclxaccessiblecomponent.cxx b/vcl/source/accessibility/vclxaccessiblecomponent.cxx index f2ce96d9a028..1509b32e5d27 100644 --- a/vcl/source/accessibility/vclxaccessiblecomponent.cxx +++ b/vcl/source/accessibility/vclxaccessiblecomponent.cxx @@ -43,13 +43,10 @@ using namespace ::comphelper; VCLXAccessibleComponent::VCLXAccessibleComponent(vcl::Window* pWindow) : m_xWindow(pWindow) { - DBG_ASSERT(pWindow, "VCLXAccessibleComponent - no window!"); - if (m_xWindow) - { - m_xWindow->AddEventListener(LINK(this, VCLXAccessibleComponent, WindowEventListener)); - m_xWindow->AddChildEventListener( - LINK(this, VCLXAccessibleComponent, WindowChildEventListener)); - } + assert(m_xWindow && "VCLXAccessibleComponent - no window!"); + + m_xWindow->AddEventListener(LINK(this, VCLXAccessibleComponent, WindowEventListener)); + m_xWindow->AddChildEventListener(LINK(this, VCLXAccessibleComponent, WindowChildEventListener)); } void VCLXAccessibleComponent::DisconnectEvents()
