Repository: nvaccess/nvda

Issue:
when a table is copied from excel into word, NVDA fails to detect when you enter a table.
This package has an excel with two sheets, and a word doc with one already pasted in.
1. Write a bunch of text into a word doc.
2. Paste one of the excel tables into a word doc.
3. do the same and paste the other table in.
4. create a new table using word.
5. fill it in with junk.
6. switch to browse mode.
7. go to the top and read.
8. Once you're in a table with data from Excel, NVDA doesn't say anything. Use table nav, it works as  expected.
9. Find the native table. Notice that all is fine.



Discussion:
[browse_mode_bug.zip](https://github.com/nvaccess/nvda/files/251739/browse_mode_bug.zip)

Note that both of these bugs I reported with this document were discovered with real data from a biology lab, and aren't just me trying to exercise NVDA's capabilities.

This is because it gets treated as a layout table. A layout table is currently defined as a table with no borders, and I guess this must be true for Excel tables. This was implemented to prevent spurious announcement of layout tables in Outlook emails.

Any thoughts on how we can restrict this further, @MichaelDCurran?

First thing that comes to mind is to restrict this specifically to Outlook browsemode. Shouldn't be too hard. Other than that we'd need to come up with a better heuristic for layout tables.


Resolving patch:
diff --git a/source/NVDAObjects/window/winword.py b/source/NVDAObjects/window/winword.py
--- a/source/NVDAObjects/window/winword.py
+++ b/source/NVDAObjects/window/winword.py
@@ -932,11 +932,6 @@ def getMathMl(self, field):
 		except:
 			raise LookupError("Couldn't get MathML from MathType")
 
-class WordDocumentTextInfoForTreeInterceptor(WordDocumentTextInfo):
-
-	def _get_shouldIncludeLayoutTables(self):
-		return config.conf['documentFormatting']['includeLayoutTables']
-
 class BrowseModeWordDocumentTextInfo(browseMode.BrowseModeDocumentTextInfo,treeInterceptorHandler.RootProxyTextInfo):
 
 	def __init__(self,obj,position,_rangeObj=None):
@@ -944,8 +939,6 @@ def __init__(self,obj,position,_rangeObj=None):
 			position=textInfos.POSITION_CARET
 		super(BrowseModeWordDocumentTextInfo,self).__init__(obj,position,_rangeObj=_rangeObj)
 
-	InnerTextInfoClass=WordDocumentTextInfoForTreeInterceptor
-
 	def _get_focusableNVDAObjectAtStart(self):
 		return self.obj.rootNVDAObject
 
diff --git a/source/appModules/outlook.py b/source/appModules/outlook.py
--- a/source/appModules/outlook.py
+++ b/source/appModules/outlook.py
@@ -24,7 +24,7 @@
 import ui
 from NVDAObjects.IAccessible import IAccessible
 from NVDAObjects.window import Window
-from NVDAObjects.window.winword import WordDocument, WordDocumentTreeInterceptor
+from NVDAObjects.window.winword import WordDocument, WordDocumentTreeInterceptor, BrowseModeWordDocumentTextInfo, WordDocumentTextInfo
 from NVDAObjects.IAccessible.MSHTML import MSHTML
 from NVDAObjects.behaviors import RowWithFakeNavigation
 from NVDAObjects.UIA import UIA
@@ -468,9 +468,19 @@ def setFocus(self):
 		super(UIAGridRow,self).setFocus()
 		eventHandler.queueEvent("gainFocus",self)
 
+class MailViewerTextInfoForTreeInterceptor(WordDocumentTextInfo):
+
+	def _get_shouldIncludeLayoutTables(self):
+		return config.conf['documentFormatting']['includeLayoutTables']
+
+class MailViewerTreeInterceptorTextInfo(BrowseModeWordDocumentTextInfo):
+	InnerTextInfoClass=MailViewerTextInfoForTreeInterceptor
+
 class MailViewerTreeInterceptor(WordDocumentTreeInterceptor):
 	"""A BrowseMode treeInterceptor specifically for readonly emails, where tab and shift+tab are safe and we know will not edit the document."""
 
+	TextInfo=MailViewerTreeInterceptorTextInfo
+
 	def script_tab(self,gesture):
 		bookmark=self.rootNVDAObject.makeTextInfo(textInfos.POSITION_SELECTION).bookmark
 		gesture.send()


Test patch: