Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UIA to access MS Word documents by default for MS Office build 16.0.13901 and above #12770

Merged
merged 7 commits into from
Sep 16, 2021
25 changes: 18 additions & 7 deletions source/_UIAHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,19 +748,30 @@ def _isUIAWindowHelper(self,hwnd):
if res:
# The window does support UIA natively, but MS Word documents now
# have a fairly usable UI Automation implementation.
# However, builds of MS Office 2016 before build 9000 or so had bugs which
# However, builds of MS Office 2016 before build 13901 or so had bugs which
# we cannot work around.
# And even current builds of Office 2016 are still missing enough info from
# UIA that it is still impossible to switch to UIA completely.
# Therefore, if we can inject in-process, refuse to use UIA and instead
# Therefore for less recent versions of Office,
# if we can inject in-process, refuse to use UIA and instead
# fall back to the MS Word object model.
canUseOlderInProcessApproach = bool(appModule.helperLocalBindingHandle)
isOfficeApp = appModule.productName.startswith(("Microsoft Office", "Microsoft Outlook"))
if (
# An MS Word document window
windowClass=="_WwG"
(
winVersion.getWinVer() < winVersion.WIN10
or (
# An MS Office app before build 13901
isOfficeApp
and (
tuple(int(x) for x in appModule.productVersion.split('.')[:3])
< (16, 0, 13901)
)
)
)
# An MS Word document window
and windowClass == "_WwG"
# Disabling is only useful if we can inject in-process (and use our older code)
and canUseOlderInProcessApproach
# Allow the user to explicitly force UIA support for MS Word documents
# Allow the user to still explicitly force UIA support
# no matter the Office version
and not config.conf['UIA']['useInMSWordWhenAvailable']
):
Expand Down
2 changes: 1 addition & 1 deletion source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2593,7 +2593,7 @@ def __init__(self, parent):

# Translators: This is the label for a checkbox in the
# Advanced settings panel.
label = _("Use UI Automation to access Microsoft &Word document controls when available")
label = _("Always use UI Automation to access Microsoft &Word document controls when available")
self.UIAInMSWordCheckBox = UIAGroup.addItem(wx.CheckBox(UIABox, label=label))
self.bindHelpEvent("AdvancedSettingsUseUiaForWord", self.UIAInMSWordCheckBox)
self.UIAInMSWordCheckBox.SetValue(config.conf["UIA"]["useInMSWordWhenAvailable"])
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ What's New in NVDA
- Espeak-ng has been updated to 1.51-dev commit ``74068b91bcd578bd7030a7a6cde2085114b79b44``. (#12665)
- NVDA will default to eSpeak if no installed OneCore voices support the NVDA preferred language. (#10451)
- If OneCore voices consistently fail to speak, revert to eSpeak as a synthesizer. (#11544)
- For builds of Microsoft Office 2016/365 greater than 13900, NVDA will now always use UI Automation to access Microsoft Word document controls, no matter whether the user has toggled the `Use UI Automation to access Microsoft word document controls` advanced setting on or off.
-


Expand Down
10 changes: 5 additions & 5 deletions user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -1834,12 +1834,12 @@ This has a major negative impact on performance, especially in applications like
Therefore, when this option is enabled, NVDA will limit event registration to the system focus for most events.
If you suffer from performance issues in one or more applications, We recommend you to try this functionality to see whether performance improves.

==== Use UI automation to access Microsoft Word document controls when available ====[AdvancedSettingsUseUiaForWord]
When this option is enabled, NVDA will try to use the Microsoft UI Automation accessibility API in order to fetch information from Microsoft Word document controls.
==== Always use UI automation to access Microsoft Word document controls when available ====[AdvancedSettingsUseUiaForWord]
When this option is enabled, NVDA will always try to use the Microsoft UI Automation accessibility API in order to fetch information from Microsoft Word document controls, even for less recent builds of Microsoft Office 2016/365.
This includes Microsoft Word itself, and also the Microsoft Outlook message viewer and composer.
For the most recent versions of Microsoft Office 2016/365 running on Windows 10 and later, UI Automation support is complete enough to provide access to Microsoft Word documents almost equal to NVDA's existing Microsoft Word support, with the added advantage that responsiveness is majorly increased.
However, There may be some information which is either not exposed, or exposed incorrectly in some versions of Microsoft Office, which means this UI automation support cannot always be relied upon.
We still do not recommend that the majority of users turn this on by default, though we do welcome users of Office 2016/365 to test this feature and provide feedback.
For Microsoft Office with a build version of 16.0.13901 or greater, NVDA will always use UI Automation to access Microsoft Word documents no matter how this setting is configured.
For the most recent versions of Microsoft Office 2016/365 running on Windows 10 and later, UI Automation support is complete enough to provide access to Microsoft Word documents almost equal to NVDA's existing Microsoft Word support, with the added advantage that responsiveness is majorly increased.
However, There may be some information which is either not exposed, or exposed incorrectly in some older builds of Microsoft Office, which means this UI automation support cannot always be relied upon.

==== Use UI Automation to access the Windows Console when available ====[AdvancedSettingsConsoleUIA]
When this option is enabled, NVDA will use a new, work in progress version of its support for Windows Console which takes advantage of [accessibility improvements made by Microsoft https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/]. This feature is highly experimental and is still incomplete, so its use is not yet recommended. However, once completed, it is anticipated that this new support will become the default, improving NVDA's performance and stability in Windows command consoles.
Expand Down