a11y: Get text window doc accessible from Window on demand

Instead of storing a reference to the VCLXWindow (which is
a TextWindowPeer), which is the EditorWindow's accessible
as Document::m_xAccessible member, adjust Document::getAccessible
to get the accessible on demand via vcl::Window::GetAccessible
instead.

This also prepares for no more passing the VCLXWindow
to the ctor in an upcoming commit.

Change-Id: I498f90a456eda453508a4f1ed84983006594ea86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178402
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn
2024-12-13 09:41:24 +01:00
parent 71a9de600a
commit 667823e412
2 changed files with 8 additions and 4 deletions

View File

@@ -319,8 +319,7 @@ public:
Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
::TextView & rView);
const css::uno::Reference< css::accessibility::XAccessible >&
getAccessible() const { return m_xAccessible; }
css::uno::Reference<css::accessibility::XAccessible> getAccessible() const;
css::lang::Locale retrieveLocale();
@@ -531,7 +530,6 @@ private:
Paragraphs::iterator visibleEnd() { return getIter(m_nVisibleEnd); }
Paragraphs::iterator focused() { return getIter(m_nFocused); }
css::uno::Reference< css::accessibility::XAccessible > m_xAccessible;
::TextEngine & m_rEngine;
::TextView & m_rView;

View File

@@ -704,7 +704,6 @@ void Paragraph::checkDisposed()
Document::Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
::TextView & rView):
VCLXAccessibleComponent(pVclXWindow->GetWindow()),
m_xAccessible(pVclXWindow),
m_rEngine(rEngine),
m_rView(rView),
m_aEngineListener(*this),
@@ -729,6 +728,13 @@ Document::Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
m_aViewListener.startListening(*m_rView.GetWindow());
}
css::uno::Reference<css::accessibility::XAccessible> Document::getAccessible() const
{
if (vcl::Window* pWindow = GetWindow())
return pWindow->GetAccessible();
return nullptr;
}
css::lang::Locale Document::retrieveLocale()
{
SolarMutexGuard aGuard;