cui/source/options/optaccessibility.cxx | 20 --------- cui/source/options/optaccessibility.hxx | 1 cui/uiconfig/ui/optaccessibilitypage.ui | 38 +---------------- desktop/source/app/app.cxx | 4 - framework/source/uielement/menubarmanager.cxx | 2 include/vcl/settings.hxx | 5 -- officecfg/registry/schema/org/openoffice/VCL.xcs | 2 vcl/source/app/settings.cxx | 50 +++-------------------- vcl/win/window/salframe.cxx | 16 ------- 9 files changed, 15 insertions(+), 123 deletions(-)
New commits: commit c5b6e3ac564c35aa10744d498b372fa5d4f68bf3 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Oct 29 15:08:37 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Oct 30 08:27:28 2024 +0100 win a11y: Stop using setting to indicate AT support No longer use a "Accessibility"/"EnableATToolSupport" VCL setting to control/report whether support for assistive technology is (or should be) enabled, which was primarily used on Windows. As described in previous commit Change-Id: I32624b830d39d08510e4731edd06fd7a77642c50 Author: Michael Weghorn <[email protected]> Date: Mon Oct 28 21:12:48 2024 +0100 win a11y: Drop "Enable AT Tool support" from options UI , that setting got automatically enabled when an assistive technology was active on Windows, and never got reset to "false" automatically, so AT support would be enabled next time LO starts as well. Instead of persisting this via a setting, enable the Windows a11y bridge if and when a WM_GETOBJECT message is received only, see `ImplHandleGetObject` (where this was already done earlier) and no longer alternatively start the a11y bridge in Desktop::Main when the mentioned setting is enabled. Drop MiscSettings::SetEnableATToolSupport altogether. Adjust MiscSettings::GetEnableATToolSupport to no longer read a setting, but return `true` if the AT bridge has been activated (or a SAL_ACCESSIBILITY_ENABLED environment variable is set, as was already checked before). This already returns `true` when called from MenuBarManager::FillMenuManager when starting LO while the NVDA screen reader is running. With this in place, the a11y bridge on Windows should now become active whenever an AT requests information (by sending a WM_GETOBJECT message), but not otherwise, and restarting LO will result in the a11y bridge no longer being active unless AT requests information again. Change-Id: I42f0059cecd43205690d958a875d3c17ff9a197b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175795 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index f33080482bba..901e8ae67fe0 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1403,10 +1403,6 @@ int Desktop::Main() return EXIT_FAILURE; } } - - // check if accessibility is enabled - if( Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() ) - InitAccessBridge(); #endif // terminate if requested... diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 7264eab1fcde..c262a990a8c6 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -959,7 +959,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF framework::AddonMenuManager::MergeAddonHelpMenu( rFrame, static_cast<MenuBar *>(pMenu) ); } - bool bAccessibilityEnabled( Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() ); + const bool bAccessibilityEnabled = MiscSettings::GetEnableATToolSupport(); sal_uInt16 nItemCount = pMenu->GetItemCount(); OUString aItemCommand; m_aMenuItemHandlerVector.reserve(nItemCount); diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 4379c4dd9822..d7cbcc174792 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -663,10 +663,7 @@ class VCL_DLLPUBLIC MiscSettings public: MiscSettings(); -#ifdef _WIN32 - void SetEnableATToolSupport( bool bEnable ); -#endif - bool GetEnableATToolSupport() const; + static bool GetEnableATToolSupport(); bool GetDisablePrinting() const; void SetEnableLocalizedDecimalSep( bool bEnable ); bool GetEnableLocalizedDecimalSep() const; diff --git a/officecfg/registry/schema/org/openoffice/VCL.xcs b/officecfg/registry/schema/org/openoffice/VCL.xcs index 0a6db737f7e9..fe878f851497 100644 --- a/officecfg/registry/schema/org/openoffice/VCL.xcs +++ b/officecfg/registry/schema/org/openoffice/VCL.xcs @@ -54,7 +54,7 @@ </group> <group oor:name="ConfigurableSettings" oor:extensible="true"> <info> - <desc>Specifies an extensible set of options that are ordered into key/value pairs for the VCL. For example, a valid key for describing when ATTools is activated is: "EnableATToolSupport" (valid values = "true", "false").</desc> + <desc>Specifies an extensible set of options that are ordered into key/value pairs for the VCL. For example, a valid key for describing whether printing is deactivated is: "DisablePrinting" (valid values = "true", "false").</desc> </info> </group> <group oor:name="ExtraLanguage"> diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 26c398c3f063..518402fda580 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -224,7 +224,6 @@ struct ImplStyleData struct ImplMiscData { ImplMiscData(); - TriState mnEnableATT; bool mbEnableLocalizedDecimalSep; TriState mnDisablePrinting; }; @@ -2666,7 +2665,6 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const } ImplMiscData::ImplMiscData() : - mnEnableATT(TRISTATE_INDET), mnDisablePrinting(TRISTATE_INDET) { static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI @@ -2683,8 +2681,7 @@ bool MiscSettings::operator ==( const MiscSettings& rSet ) const if ( mxData == rSet.mxData ) return true; - return (mxData->mnEnableATT == rSet.mxData->mnEnableATT ) && - (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) && + return (mxData->mnDisablePrinting == rSet.mxData->mnDisablePrinting ) && (mxData->mbEnableLocalizedDecimalSep == rSet.mxData->mbEnableLocalizedDecimalSep ); } @@ -2708,48 +2705,15 @@ bool MiscSettings::GetDisablePrinting() const return mxData->mnDisablePrinting != TRISTATE_FALSE; } -bool MiscSettings::GetEnableATToolSupport() const +bool MiscSettings::GetEnableATToolSupport() { - if( mxData->mnEnableATT == TRISTATE_INDET ) - { - static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" ); - if( !pEnv || !*pEnv ) - { - OUString aEnable = - vcl::SettingsConfigItem::get()-> - getValue( u"Accessibility"_ustr, - u"EnableATToolSupport"_ustr ); - mxData->mnEnableATT = aEnable.equalsIgnoreAsciiCase("true") ? TRISTATE_TRUE : TRISTATE_FALSE; - } - else - { - mxData->mnEnableATT = TRISTATE_TRUE; - } - } - - return mxData->mnEnableATT != TRISTATE_FALSE; -} - -#ifdef _WIN32 -void MiscSettings::SetEnableATToolSupport( bool bEnable ) -{ - if ( (bEnable ? TRISTATE_TRUE : TRISTATE_FALSE) != mxData->mnEnableATT ) - { - if (bEnable) - ImplInitAccessBridge(); - - mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE; - - if (o3tl::IsRunningUnitTest()) - return; // no SettingsConfigItem modification + static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED"); + if (pEnv && *pEnv) + return true; - vcl::SettingsConfigItem::get()-> - setValue( "Accessibility", - "EnableATToolSupport", - bEnable ? OUString("true") : OUString("false" ) ); - } + ImplSVData* pSVData = ImplGetSVData(); + return pSVData->mxAccessBridge.is(); } -#endif void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable ) { diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 16c75d094735..f6ca2eaf6d74 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -5612,19 +5612,6 @@ ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet) uno::Reference<accessibility::XMSAAService> xMSAA; if (ImplSalYieldMutexTryToAcquire()) { - if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport()) - { - // IA2 should be enabled automatically - AllSettings aSettings = Application::GetSettings(); - MiscSettings aMisc = aSettings.GetMiscSettings(); - aMisc.SetEnableATToolSupport(true); - // The above is enough, since aMisc changes the same shared ImplMiscData as used in global - // settings, so no need to call aSettings.SetMiscSettings and Application::SetSettings - - if (!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport()) - return false; // locked down somehow ? - } - ImplSVData* pSVData = ImplGetSVData(); // Make sure to launch Accessibility only the following criteria are satisfied @@ -5638,8 +5625,7 @@ ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet) } else { // tdf#155794: access without locking: hopefully this should be fine - // as the bridge is typically inited in Desktop::Main() already and the - // WM_GETOBJECT is received only on the main thread and by the time in + // as WM_GETOBJECT is received only on the main thread and by the time in // VCL shutdown when ImplSvData dies there should not be Windows any // more that could receive messages. xMSAA.set(ImplGetSVData()->mxAccessBridge, uno::UNO_QUERY); commit 069d2c079664cf44fc471216b1204cb71a6362cd Author: Michael Weghorn <[email protected]> AuthorDate: Mon Oct 28 21:12:48 2024 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Oct 30 08:27:19 2024 +0100 win a11y: Drop "Enable AT Tool support" from options UI Drop the "Support assistive technology tools (program restart required)" checkbox from the "Accessibility" options page. It was only shown on Windows. While having this in the UI seems to suggest that this is a setting that users explicitly toggle on and off, the setting is automatically switched on when an AT is active anyway, see `ImplHandleGetObject` in vcl/win/window/salframe.cxx. Therefore, only switching explicitly off after using an AT, but no longer planning to do so any more is the only case I can think of where changing this option via the UI might have been a use case. The plan is to rework the handling in an upcoming commit instead: to enable AT support when an AT is active, i.e. in `ImplHandleGetObject`, and not persist that setting any more across LO runs. Related change for the Windows registry: commit 77e1c0bfa2e643f017b829cd775d08c5a40d9b6b Author: Michael Weghorn <[email protected]> Date: Wed Oct 23 12:17:02 2024 +0100 win a11y: No longer read/write registry key Change-Id: I32624b830d39d08510e4731edd06fd7a77642c50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175787 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index 15cf144add0d..69825d26f341 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -65,7 +65,6 @@ namespace SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) : SfxTabPage(pPage, pController, u"cui/ui/optaccessibilitypage.ui"_ustr, u"OptAccessibilityPage"_ustr, &rSet) - , m_xAccessibilityTool(m_xBuilder->weld_check_button(u"acctool"_ustr)) , m_xTextSelectionInReadonly(m_xBuilder->weld_check_button(u"textselinreadonly"_ustr)) , m_xTextSelectionInReadonlyImg(m_xBuilder->weld_widget(u"locktextselinreadonly"_ustr)) , m_xAnimatedGraphics(m_xBuilder->weld_combo_box(u"animatedgraphicenabled"_ustr)) @@ -87,10 +86,6 @@ SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(weld::Container* , m_xOptionsLB(m_xBuilder->weld_tree_view(u"options"_ustr)) , m_xDefaultPB(m_xBuilder->weld_button(u"default"_ustr)) { -#ifdef UNX - // UNIX: read the gconf2 setting instead to use the checkbox - m_xAccessibilityTool->hide(); -#endif m_xOptionsLB->enable_toggle_buttons(weld::ColumnToggleType::Check); @@ -127,7 +122,7 @@ OUString SvxAccessibilityOptionsTabPage::GetAllStrings() sAllStrings += pString->get_label() + " "; } - OUString checkButton[] = { u"acctool"_ustr, u"textselinreadonly"_ustr, + OUString checkButton[] = { u"textselinreadonly"_ustr, u"autofontcolor"_ustr, u"systempagepreviewcolor"_ustr }; for (const auto& check : checkButton) @@ -298,15 +293,6 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* ) } batch->commit(); - AllSettings aAllSettings = Application::GetSettings(); - MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); -#ifndef UNX - aMiscSettings.SetEnableATToolSupport(m_xAccessibilityTool->get_active()); -#endif - aAllSettings.SetMiscSettings(aMiscSettings); - Application::MergeSystemSettings( aAllSettings ); - Application::SetSettings(aAllSettings); - return false; } @@ -504,10 +490,6 @@ void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* ) m_xOptionsLB->set_toggle(i, value); m_aSavedOptions[aIssues.first] = value; } - - AllSettings aAllSettings = Application::GetSettings(); - const MiscSettings& aMiscSettings = aAllSettings.GetMiscSettings(); - m_xAccessibilityTool->set_active(aMiscSettings.GetEnableATToolSupport()); } IMPL_LINK_NOARG(SvxAccessibilityOptionsTabPage, UseAsDefaultHdl, weld::Button&, void) diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx index 5cdfee45d69d..eeb84ab6d6ee 100644 --- a/cui/source/options/optaccessibility.hxx +++ b/cui/source/options/optaccessibility.hxx @@ -24,7 +24,6 @@ class SvxAccessibilityOptionsTabPage : public SfxTabPage { - std::unique_ptr<weld::CheckButton> m_xAccessibilityTool; std::unique_ptr<weld::CheckButton> m_xTextSelectionInReadonly; std::unique_ptr<weld::Widget> m_xTextSelectionInReadonlyImg; std::unique_ptr<weld::ComboBox> m_xAnimatedGraphics; diff --git a/cui/uiconfig/ui/optaccessibilitypage.ui b/cui/uiconfig/ui/optaccessibilitypage.ui index 40ef75de4afc..52c27345fbad 100644 --- a/cui/uiconfig/ui/optaccessibilitypage.ui +++ b/cui/uiconfig/ui/optaccessibilitypage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.40.0 --> +<!-- Generated with glade 3.40.0 --> <interface domain="cui"> <requires lib="gtk+" version="3.20"/> <object class="GtkListStore" id="liststore1"> @@ -453,7 +453,7 @@ <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=2 n-rows=2 --> + <!-- n-columns=2 n-rows=1 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -461,25 +461,6 @@ <property name="margin-top">6</property> <property name="orientation">vertical</property> <property name="row-spacing">6</property> - <child> - <object class="GtkCheckButton" id="acctool"> - <property name="label" translatable="yes" context="optaccessibilitypage|acctool">Support _assistive technology tools (program restart required)</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">False</property> - <property name="use-underline">True</property> - <property name="draw-indicator">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="acctool-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|acctool">Allows you to use assistive tools, such as external screen readers, Braille devices or speech recognition input devices. The Java Runtime Environment must be installed on your computer before you can enable assistive support.</property> - </object> - </child> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">0</property> - </packing> - </child> <child> <object class="GtkCheckButton" id="textselinreadonly"> <property name="label" translatable="yes" context="optaccessibilitypage|textselinreadonly">Use te_xt selection cursor in read-only text documents</property> @@ -496,7 +477,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> @@ -507,19 +488,6 @@ <property name="valign">center</property> <property name="icon-name">res/lock.png</property> </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> - <child> - <object class="GtkImage" id="lockacctool"> - <property name="can-focus">False</property> - <property name="no-show-all">True</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="icon-name">res/lock.png</property> - </object> <packing> <property name="left-attach">0</property> <property name="top-attach">0</property>
