desktop/source/app/app.cxx | 7 ++----- include/vcl/svapp.hxx | 2 +- vcl/inc/svdata.hxx | 2 +- vcl/source/app/settings.cxx | 4 ++-- vcl/source/app/svapp.cxx | 22 ++++------------------ vcl/source/app/svdata.cxx | 7 ++----- vcl/win/window/salframe.cxx | 3 +-- 7 files changed, 13 insertions(+), 34 deletions(-)
New commits: commit 2d25e27069ba01d564352d59a7ec8bd8317d092c Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Oct 24 14:15:03 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Oct 25 11:09:35 2024 +0200 win a11y: Assert creating MSAAService succeeds Add an assert that creating the MSAAservice/a11 bridge succeeds in ImplInitAccessBridge on Windows, as this should never fail unless the LibreOffice installation is broken. Drop the return values of the ImplInitAccessBridge and InitAccessBridge functions accordingly and simplify code calling them. While at it, also switch to using `#ifdef _WIN32` for the Windows-specific code in `InitAccessBridge` instead of having it in the `#else` branch of `#if defined UNX`, to align this with the `#ifdef _WIN32` condition for the `ImplInitAccessBridge` declaration, as that's the function that gets called. Even if the creation of the service should fail for some reason, the DeploymentException in ImplInitAccessBridge is still handled, so unless I'm missing something, this commit shouldn't cause any harm. The "EnableATToolSupport" setting would then incorrectly be set to true indicating that AT support is enabled, but besides being used in the a11y bridge code itself, that's only used to determine whether or not to pre-populate menus, so they are available in the a11y hierarchy before the corresponding (sub)menu gets activated, s. MenuBarManager::FillMenuManager, the corresponding commit that originally introduced this, commit 08fe2669a0ed807812d005195b54cc41f092d09a Author: RĂ¼diger Timm <r...@openoffice.org> Date: Fri May 13 06:29:54 2005 +0000 INTEGRATION: CWS tbe22 (1.25.30); FILE MERGED 2005/05/04 14:21:00 tbe 1.25.30.1: #i48612# Opening a menu with GOK shows Tips instead of entries (fixed by CD) and the referenced bug report [1], in particular comment 3 [2]: > TBE->CD: As discussed, the accessibility hierarchy is built up, but part of the > information is missing, e.g. Menu::GetItemText() returns an empty string. > Also keyboard shortcuts should be available. > In addition, the File/New menu and the File/Wizards menu are missing. > All this information is only available, after the corresponding menus have > been opened by the user. > > In OO.o 1.1.x all this was working. The AT tools require, that the whole menu > hierarchy is available as soon as the menu bar is visible, that means before > a user has opened a menu. > > The whole menu hierarchy must be only provided, if accessiblity is enabled. > This can be checked by > BOOL bAccessibilityEnabled = > Application::GetSettings().GetMiscSettings().GetEnableATToolSupport(); This commit is also in preparation of further simplifying the handling for that setting. [1] https://bz.apache.org/ooo/show_bug.cgi?id=48612 [2] https://bz.apache.org/ooo/show_bug.cgi?id=48612#c3 Change-Id: I46149ed215c354d33003513d55defe4920a7c381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175565 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 624b5cb0b6b4..f33080482bba 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1404,12 +1404,9 @@ int Desktop::Main() } } - // check if accessibility is enabled but not working and allow to quit + // check if accessibility is enabled if( Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() ) - { - if( !InitAccessBridge() ) - return EXIT_FAILURE; - } + InitAccessBridge(); #endif // terminate if requested... diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 57836fc59794..c22daf19fcc2 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1434,7 +1434,7 @@ VCL_DLLPUBLIC bool IsVCLInit(); VCL_DLLPUBLIC bool InitVCL(); VCL_DLLPUBLIC void DeInitVCL(); -VCL_DLLPUBLIC bool InitAccessBridge(); +VCL_DLLPUBLIC void InitAccessBridge(); // only allowed to call, if no thread is running. You must call JoinMainLoopThread to free all memory. VCL_DLLPUBLIC void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData ); diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 584018ccfdbe..f3c2f43a369f 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -462,7 +462,7 @@ VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData(); VCL_PLUGIN_PUBLIC void ImplHideSplash(); #ifdef _WIN32 -bool ImplInitAccessBridge(); +void ImplInitAccessBridge(); #endif const FieldUnitStringList& ImplGetFieldUnits(); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 3f2160420806..26c398c3f063 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2735,8 +2735,8 @@ void MiscSettings::SetEnableATToolSupport( bool bEnable ) { if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT ) { - if( bEnable && !ImplInitAccessBridge() ) - return; + if (bEnable) + ImplInitAccessBridge(); mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index debd5ec920ff..819fdaf729d7 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1634,25 +1634,11 @@ void Application::AddToRecentDocumentList(const OUString& rFileUrl, const OUStri pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType, rDocumentService); } -bool InitAccessBridge() +void InitAccessBridge() { -// Disable MSAA bridge on UNIX -#if defined UNX - return true; -#else - bool bRet = ImplInitAccessBridge(); - - if( !bRet ) - { - // disable accessibility if the user chooses to continue - AllSettings aSettings = Application::GetSettings(); - MiscSettings aMisc = aSettings.GetMiscSettings(); - aMisc.SetEnableATToolSupport( false ); - aSettings.SetMiscSettings( aMisc ); - Application::SetSettings( aSettings ); - } - return bRet; -#endif // !UNX +#ifdef _WIN32 + ImplInitAccessBridge(); +#endif } // MT: AppEvent was in oldsv.cxx, but is still needed... diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index b48fc6695a3a..6f0732ef498c 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -330,7 +330,7 @@ BlendFrameCache* ImplGetBlendFrameCache() } #ifdef _WIN32 -bool ImplInitAccessBridge() +void ImplInitAccessBridge() { ImplSVData* pSVData = ImplGetSVData(); if( ! pSVData->mxAccessBridge.is() ) @@ -340,16 +340,13 @@ bool ImplInitAccessBridge() { pSVData->mxAccessBridge = css::accessibility::MSAAService::create(xContext); SAL_INFO("vcl", "got IAccessible2 bridge"); - return true; } catch (css::uno::DeploymentException &) { TOOLS_WARN_EXCEPTION("vcl", "got no IAccessible2 bridge"); - return false; + assert(false && "failed to create IAccessible2 bridge"); } } - - return true; } #endif diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 3a688858b312..e35d55ff30f3 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -5631,8 +5631,7 @@ ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet) // to avoid RFT interrupts regular accessibility processing if ( !pSVData->mxAccessBridge.is() ) { - if( !InitAccessBridge() ) - return false; + InitAccessBridge(); } xMSAA.set(pSVData->mxAccessBridge, uno::UNO_QUERY); ImplSalYieldMutexRelease();