Repository: nvaccess/nvda

Issue:
NVDA Should Announce Tracked Changes in Microsoft Office Word
**Reported by Pat on 2010-09-25 11:51**
NVDA should provide this information whenever tracked changes are turned on or turned off in a Word document by pressing CTRL + Shift + E.



Discussion:
Attachment trackchanges.patch added by rameshwar.nagar on 2013-03-21 12:25
Description:
now it's announcing trackchanges on\off on pressing control+shift+e.

Comment 1 by rameshwar.nagar on 2013-03-21 12:29
Hi,
   I attached patch file review this.

Note: when you close MS word that time trackchanges state should be off.

Regards & Thanks,

Rameshwar Nagar
The Center for Internet & Society.

Comment 2 by jteh on 2013-03-21 23:05
Thanks for the patch. However, this isn't an acceptable solution for two reasons:
1. It needs to check the state in Word, not just base it on a flag you set. It might already be enabled in a given document, the user might have started NVDA after enabling it, etc.
2. It has been suggested that this command is different in different localisations of Word. Therefore, any solution needs to take this into account.

A proper fix for this could be a small productivity boost. Tracking changes is quite common in office environments. On the other hand, there are many toggles on the ribbon, so where do we draw the line? Also, it would be nice to have a way to query the status of this setting in an existing document. @leonardder thoughts?
As I understand it, there needs to be a way to identifiy when track changes are turned on or off, correct? Changes are already reported.
Correct, with the side note that changes aren't yet reported in braille (#6785).
In office 365, navigating to the "track changes" ribbon item advises whether it is "pressed" or not.  Admittedly not efficient, but it works.

If "Track changes" has been enabled to be shown in the status bar, pressing NVDA+end to read the status bar will advise the state of track changes along with anything else on the status bar.

These can both be seen visually as well.

Overall, I agree with the original idea of reporting the status when CONTROL+SHIFT+E (or the local equivalent) is pressed.  This does not introduce a new keystroke and at worst, for the user, it is two keypresses - if say it was already on and they turned it off in order to check..  Querying the status bar gives a lot of additional information that may not be needed, and opening the ribbon is complex.

Currently the other way to check is to type a character, then left arrow to check whether NVDA reports "inserted".  This isn't foolproof, as if track changes was turned on this session, and the focus is in text which had been inserted, NVDA won't report "inserted" as that will not have changed from the surrounding text (and assuming "report editor revisions" is enabled in NVDA's document formatting).


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
@@ -1360,6 +1360,24 @@ def script_increaseDecreaseFontSize(self,gesture):
 		# Translators: a message when increasing or decreasing font size in Microsoft Word
 		ui.message(_("{size:g} point font").format(size=val))
 
+	def script_toggleChangeTracking(self, gesture):
+		if not self.WinwordDocumentObject:
+			# We cannot fetch the Word object model, so we therefore cannot report the status change.
+			# The object model may be unavailable because this is a pure UIA implementation such as Windows 10 Mail,
+			# or it's within Windows Defender Application Guard.
+			# In this case, just let the gesture through and don't report anything.
+			return gesture.send()
+		val = self._WaitForValueChangeForAction(
+			lambda: gesture.send(),
+			lambda: self.WinwordDocumentObject.TrackRevisions
+		)
+		if val:
+			# Translators: a message when toggling change tracking in Microsoft word
+			ui.message(_("Change tracking on"))
+		else:
+			# Translators: a message when toggling change tracking in Microsoft word
+			ui.message(_("Change tracking off"))
+	
 	def script_tab(self,gesture):
 		"""
 		A script for the tab key which:
@@ -1464,6 +1482,7 @@ def initOverlayClass(self):
 		"kb:control+1":"changeLineSpacing",
 		"kb:control+2":"changeLineSpacing",
 		"kb:control+5":"changeLineSpacing",
+		"kb:control+shift+e": "toggleChangeTracking",
 		"kb:tab": "tab",
 		"kb:shift+tab": "tab",
 		"kb:control+pageUp": "caret_moveByLine",


Test patch: