Skip to content

Commit

Permalink
Use UIA to access MS Word documents by default for MS Office build 16…
Browse files Browse the repository at this point in the history
….0.13901 and above (#12770)

Microsoft Word 2016 exposes a rich UI Automation implementation. For some time now, users have been able to optionally turn this on with an advanced setting. NVDA's support for MS Word via UIA has major performance advantages over the older object model support, so NVDA should use the UIA support by default where available. However, as the UIA implementation improved throughout Office 2016's lifetime, we should only enable our support for recent builds of Office 2016, specifically for build 13901 and higher.

Description of how this pull request fixes the issue:
For a _WwG window that is found to have a native UI Automation implementation, the only situation where this UIA implementation will be ignored and therefore NVDA will fall back to the Office object model is: If it is an MS Office app, the build is < 13901, NVDA is able to inject in-process, and the user has not turned on Always use UI Automation to access Microsoft Word document controls.
The user guide has been updated to note that UIA will be used by default for MS Word version 13901 and higher.
  • Loading branch information
michaelDCurran committed Sep 16, 2021
1 parent 2cc3aa4 commit e38b5b4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
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 @@ -2603,7 +2603,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
2 changes: 2 additions & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ 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.
- When reading status bar with ``NVDA+end``, the review cursor is no longer moved to its location.
If you need this functionality please assign a gesture to the appropriate script in the Object Navigation category in the Input Gestures dialog. (#8600)
- When opening a settings dialog which is already open, NVDA sets focus on the existing dialog rather than raise an error. (#5383)
- 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. (#12770)
-


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 @@ -1835,12 +1835,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

0 comments on commit e38b5b4

Please sign in to comment.