2626import NVDAObjects .window .winword as winWordWindowModule
2727from speech import sayAll
2828import inputCore
29-
29+ from globalCommands import SCRCAT_SYSTEMCARET
3030
3131class WordDocument (IAccessible , EditableTextWithoutAutoSelectDetection , winWordWindowModule .WordDocument ):
3232
@@ -212,6 +212,12 @@ def fetchAssociatedHeaderCellText(self,cell,columnHeader=False):
212212 if text :
213213 return text
214214
215+ @script (
216+ gesture = "kb:NVDA+shift+c" ,
217+ # Translators: The label of a shortcut of NVDA.
218+ description = _ ("Set column header" ),
219+ category = SCRCAT_SYSTEMCARET
220+ )
215221 def script_setColumnHeader (self ,gesture ):
216222 scriptCount = scriptHandler .getLastScriptRepeatCount ()
217223 try :
@@ -234,8 +240,13 @@ def script_setColumnHeader(self,gesture):
234240 else :
235241 # Translators: a message reported in the SetColumnHeader script for Microsoft Word.
236242 ui .message (_ ("Cannot find row {rowNumber} column {columnNumber} in column headers" ).format (rowNumber = cell .rowIndex ,columnNumber = cell .columnIndex ))
237- script_setColumnHeader .__doc__ = _ ("Pressing once will set this cell as the first column header for any cells lower and to the right of it within this table. Pressing twice will forget the current column header for this cell." )
238243
244+ @script (
245+ gesture = "kb:NVDA+shift+r" ,
246+ # Translators: The label of a shortcut of NVDA.
247+ description = _ ("Set row header." ),
248+ category = SCRCAT_SYSTEMCARET
249+ )
239250 def script_setRowHeader (self ,gesture ):
240251 scriptCount = scriptHandler .getLastScriptRepeatCount ()
241252 try :
@@ -258,14 +269,24 @@ def script_setRowHeader(self,gesture):
258269 else :
259270 # Translators: a message reported in the SetRowHeader script for Microsoft Word.
260271 ui .message (_ ("Cannot find row {rowNumber} column {columnNumber} in row headers" ).format (rowNumber = cell .rowIndex ,columnNumber = cell .columnIndex ))
261- script_setRowHeader .__doc__ = _ ("Pressing once will set this cell as the first row header for any cells lower and to the right of it within this table. Pressing twice will forget the current row header for this cell." )
262272
273+ @script (
274+ gesture = "kb:NVDA+shift+h" ,
275+ )
263276 def script_reportCurrentHeaders (self ,gesture ):
264277 cell = self .WinwordSelectionObject .cells [1 ]
265278 rowText = self .fetchAssociatedHeaderCellText (cell ,False )
266279 columnText = self .fetchAssociatedHeaderCellText (cell ,True )
267280 ui .message ("Row %s, column %s" % (rowText or "empty" ,columnText or "empty" ))
268281
282+ @script (
283+ gestures = (
284+ "kb:alt+home" ,
285+ "kb:alt+end" ,
286+ "kb:alt+pageUp" ,
287+ "kb:alt+pageDown"
288+ )
289+ )
269290 def script_caret_moveByCell (self , gesture : inputCore .InputGesture ) -> None :
270291 info = self .makeTextInfo (textInfos .POSITION_SELECTION )
271292 inTable = info ._rangeObj .tables .count > 0
@@ -301,6 +322,7 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
301322 # Translators: a description for a script
302323 description = _ ("Reports the text of the comment where the system caret is located." ),
303324 gesture = "kb:NVDA+alt+c" ,
325+ category = SCRCAT_SYSTEMCARET ,
304326 speakOnDemand = True ,
305327 )
306328 def script_reportCurrentComment (self ,gesture ):
@@ -375,33 +397,51 @@ def _moveInTable(self,row=True,forward=True):
375397 newInfo .updateCaret ()
376398 return True
377399
400+ @script (
401+ gesture = "kb:control+alt+downArrow"
402+ )
378403 def script_nextRow (self ,gesture ):
379404 self ._moveInTable (row = True ,forward = True )
380405
406+ @script (
407+ gesture = "kb:control+alt+upArrow"
408+ )
381409 def script_previousRow (self ,gesture ):
382410 self ._moveInTable (row = True ,forward = False )
383411
412+ @script (
413+ gesture = "kb:control+alt+rightArrow"
414+ )
384415 def script_nextColumn (self ,gesture ):
385416 self ._moveInTable (row = False ,forward = True )
386417
418+ @script (
419+ gesture = "kb:control+alt+leftArrow"
420+ )
387421 def script_previousColumn (self ,gesture ):
388422 self ._moveInTable (row = False ,forward = False )
389423
424+ @script (
425+ gesture = "kb:control+downArrow" ,
426+ resumeSayAllMode = sayAll .CURSOR .CARET
427+ )
390428 def script_nextParagraph (self ,gesture ):
391429 info = self .makeTextInfo (textInfos .POSITION_CARET )
392430 # #4375: can't use self.move here as it may check document.chracters.count which can take for ever on large documents.
393431 info ._rangeObj .move (winWordWindowModule .wdParagraph , 1 )
394432 info .updateCaret ()
395433 self ._caretScriptPostMovedHelper (textInfos .UNIT_PARAGRAPH ,gesture ,None )
396- script_nextParagraph .resumeSayAllMode = sayAll .CURSOR .CARET
397434
435+ @script (
436+ gesture = "kb:control+upArrow" ,
437+ resumeSayAllMode = sayAll .CURSOR .CARET
438+ )
398439 def script_previousParagraph (self ,gesture ):
399440 info = self .makeTextInfo (textInfos .POSITION_CARET )
400441 # #4375: keeping symmetrical with nextParagraph script.
401442 info ._rangeObj .move (winWordWindowModule .wdParagraph , - 1 )
402443 info .updateCaret ()
403444 self ._caretScriptPostMovedHelper (textInfos .UNIT_PARAGRAPH ,gesture ,None )
404- script_previousParagraph .resumeSayAllMode = sayAll .CURSOR .CARET
405445
406446 @script (
407447 gestures = (
@@ -435,23 +475,6 @@ def focusOnActiveDocument(self, officeChartObject):
435475 import api
436476 eventHandler .executeEvent ("gainFocus" , api .getDesktopObject ().objectWithFocus ())
437477
438- __gestures = {
439- "kb:NVDA+shift+c" :"setColumnHeader" ,
440- "kb:NVDA+shift+r" :"setRowHeader" ,
441- "kb:NVDA+shift+h" :"reportCurrentHeaders" ,
442- "kb:control+alt+upArrow" : "previousRow" ,
443- "kb:control+alt+downArrow" : "nextRow" ,
444- "kb:control+alt+leftArrow" : "previousColumn" ,
445- "kb:control+alt+rightArrow" : "nextColumn" ,
446- "kb:control+downArrow" :"nextParagraph" ,
447- "kb:control+upArrow" :"previousParagraph" ,
448- "kb:alt+home" :"caret_moveByCell" ,
449- "kb:alt+end" :"caret_moveByCell" ,
450- "kb:alt+pageUp" :"caret_moveByCell" ,
451- "kb:alt+pageDown" :"caret_moveByCell" ,
452- }
453-
454-
455478class SpellCheckErrorField (IAccessible , winWordWindowModule .WordDocument_WwN ):
456479
457480 parentSDMCanOverrideName = False
0 commit comments