Skip to content

Commit

Permalink
Microsoft Word documents (both with UIA enabled and disabled) now get…
Browse files Browse the repository at this point in the history
… a treeInterceptor created straight way, but with passThrough (focus mode) enabled. Thus, NVDA+f7 (elements list) is now available with out having to switch to browse mode in Microsoft Word first. (#12051)
  • Loading branch information
michaelDCurran authored Mar 3, 2021
1 parent 2c4316d commit db664be
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
7 changes: 5 additions & 2 deletions source/NVDAObjects/IAccessible/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
from NVDAObjects.window import DisplayModelEditableText
from ..behaviors import EditableTextWithoutAutoSelectDetection
from NVDAObjects.window.winword import *
from NVDAObjects.window.winword import WordDocumentTreeInterceptor


class WordDocument(IAccessible,EditableTextWithoutAutoSelectDetection,WordDocument):

treeInterceptorClass=WordDocumentTreeInterceptor
shouldCreateTreeInterceptor=False
treeInterceptorClass = WordDocumentTreeInterceptor
shouldCreateTreeInterceptor = True

TextInfo=WordDocumentTextInfo

def _get_ignoreEditorRevisions(self):
Expand Down
12 changes: 10 additions & 2 deletions source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ def getTextWithFields(self,formatConfig=None):

class WordBrowseModeDocument(UIABrowseModeDocument):

# This treeInterceptor starts in focus mode, thus escape should not switch back to browse mode
disableAutoPassThrough = True

def __init__(self, rootNVDAObject):
super(WordBrowseModeDocument, self).__init__(rootNVDAObject)
self.passThrough = True
browseMode.reportPassThrough.last = True

def shouldSetFocusToObj(self,obj):
# Ignore strange editable text fields surrounding most inner fields (links, table cells etc)
if obj.role==controlTypes.ROLE_EDITABLETEXT and obj.UIAElement.cachedAutomationID.startswith('UIA_AutomationId_Word_Content'):
Expand Down Expand Up @@ -341,8 +349,8 @@ def _get_role(self):
return role

class WordDocument(UIADocumentWithTableNavigation,WordDocumentNode,WordDocumentBase):
treeInterceptorClass=WordBrowseModeDocument
shouldCreateTreeInterceptor=False
treeInterceptorClass = WordBrowseModeDocument
shouldCreateTreeInterceptor = True
announceEntireNewLine=True

# Microsoft Word duplicates the full title of the document on this control, which is redundant as it appears in the title of the app itself.
Expand Down
8 changes: 8 additions & 0 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,14 @@ def _get_focusableNVDAObjectAtStart(self):

class WordDocumentTreeInterceptor(browseMode.BrowseModeDocumentTreeInterceptor):

# This treeInterceptor starts in focus mode, thus escape should not switch back to browse mode
disableAutoPassThrough = True

def __init__(self, rootNVDAObject):
super(WordDocumentTreeInterceptor, self).__init__(rootNVDAObject)
self.passThrough = True
browseMode.reportPassThrough.last = True

TextInfo=BrowseModeWordDocumentTextInfo

def _activateLongDesc(self,controlField):
Expand Down

0 comments on commit db664be

Please sign in to comment.