Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion nvdaHelper/remote/winword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ constexpr int formatConfig_reportRevisions = 0x8000;
constexpr int formatConfig_reportParagraphIndentation = 0x10000;
constexpr int formatConfig_includeLayoutTables = 0x20000;
constexpr int formatConfig_reportLineSpacing = 0x40000;
constexpr int formatConfig_reportGraphics = 0x80000;

constexpr int formatConfig_fontFlags =(formatConfig_reportFontName|formatConfig_reportFontSize|formatConfig_reportFontAttributes|formatConfig_reportColor);
constexpr int formatConfig_initialFormatFlags =(formatConfig_reportPage|formatConfig_reportLineNumber|formatConfig_reportTables|formatConfig_reportHeadings|formatConfig_includeLayoutTables);
Expand Down Expand Up @@ -711,7 +712,15 @@ inline int generateInlineShapeXML(IDispatch* pDispatchRange, int offset, wostrin
SysFreeString(altText);
}
altText=NULL;
XMLStream<<L"<control _startOfNode=\"1\" role=\""<<((shapeType==wdInlineShapePicture||shapeType==wdInlineShapeLinkedPicture)?L"graphic":(shapeType==wdInlineShapeChart?L"chart":L"object"))<<L"\" value=\""<<altTextStr<<L"\"";
XMLStream<<L"<control _startOfNode=\"1\" ";
auto roleText = L"object";
if(shapeType==wdInlineShapePicture||shapeType==wdInlineShapeLinkedPicture) {
roleText=L"graphic";
} else if(shapeType==wdInlineShapeChart) {
roleText=L"chart";
}
XMLStream<<L"role=\""<<roleText<<L"\" ";
XMLStream<<L"content=\""<<altTextStr<<L"\"";
if(shapeType==wdInlineShapeEmbeddedOLEObject) {
XMLStream<<L" shapeoffset=\""<<offset<<L"\"";
IDispatchPtr pOLEFormat=NULL;
Expand Down
2 changes: 1 addition & 1 deletion source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _getControlFieldForObject(self,obj,isEmbedded=False,startOfNode=False,endOfN
field['role']=controlTypes.ROLE_EDITABLETEXT
if obj.role==controlTypes.ROLE_GRAPHIC:
# Label graphics with a description before name as name seems to be auto-generated (E.g. "rectangle")
field['value']=field.pop('description',None) or obj.description or field.pop('name',None) or obj.name
field['content']=field.pop('description',None) or obj.description or field.pop('name',None) or obj.name
return field

def _getTextFromUIARange(self,range):
Expand Down
1 change: 1 addition & 0 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
"reportRevisions":0x8000,
"reportParagraphIndentation":0x10000,
"reportLineSpacing":0x40000,
"reportGraphics":0x80000,
}
formatConfigFlag_includeLayoutTables=0x20000

Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
reportBorderStyle = boolean(default=False)
reportBorderColor = boolean(default=False)
reportLinks = boolean(default=true)
reportGraphics = boolean(default=True)
reportComments = boolean(default=true)
reportLists = boolean(default=true)
reportHeadings = boolean(default=true)
Expand Down
48 changes: 41 additions & 7 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,22 @@ def script_toggleReportLinks(self,gesture):
script_toggleReportLinks.__doc__=_("Toggles on and off the reporting of links")
script_toggleReportLinks.category=SCRCAT_DOCUMENTFORMATTING

@scriptHandler.script(
# Translators: Input help mode message for toggle report graphics command.
description=_("Toggles on and off the reporting of graphics"),
category=SCRCAT_DOCUMENTFORMATTING
)
def script_toggleReportGraphics(self,gesture):
if config.conf["documentFormatting"]["reportGraphics"]:
# Translators: The message announced when toggling the report graphics document formatting setting.
state = _("report graphics off")
config.conf["documentFormatting"]["reportGraphics"]=False
else:
# Translators: The message announced when toggling the report graphics document formatting setting.
state = _("report graphics on")
config.conf["documentFormatting"]["reportGraphics"]=True
ui.message(state)

def script_toggleReportComments(self,gesture):
if config.conf["documentFormatting"]["reportComments"]:
# Translators: The message announced when toggling the report comments document formatting setting.
Expand Down Expand Up @@ -1301,13 +1317,31 @@ def script_sayAll(self,gesture):

def _reportFormattingHelper(self, info, browseable=False):
formatConfig={
"detectFormatAfterCursor":False,
"reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False,
"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,
"reportPage":False,"reportLineNumber":False,"reportLineIndentation":True,"reportLineIndentationWithTones":False,"reportParagraphIndentation":True,"reportLineSpacing":True,"reportTables":False,
"reportLinks":False,"reportHeadings":False,"reportLists":False,
"reportBlockQuotes":False,"reportComments":False,
"reportBorderStyle":True,"reportBorderColor":True,
"detectFormatAfterCursor": False,
"reportFontName": True,
"reportFontSize": True,
"reportFontAttributes": True,
"reportColor": True,
"reportRevisions": False,
"reportEmphasis": False,
"reportStyle": True,
"reportAlignment": True,
"reportSpellingErrors": True,
"reportPage": False,
"reportLineNumber": False,
"reportLineIndentation": True,
"reportLineIndentationWithTones": False,
"reportParagraphIndentation": True,
"reportLineSpacing":True,
"reportTables": False,
"reportLinks": False,
"reportGraphics": False,
"reportHeadings": False,
"reportLists": False,
"reportBlockQuotes": False,
"reportComments": False,
"reportBorderStyle": True,
"reportBorderColor": True,
}
textList=[]

Expand Down
6 changes: 6 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,11 @@ def makeSettings(self, settingsSizer):
self.linksCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Lin&ks")))
self.linksCheckBox.SetValue(config.conf["documentFormatting"]["reportLinks"])

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
self.graphicsCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("&Graphics")))
self.graphicsCheckBox.SetValue(config.conf["documentFormatting"]["reportGraphics"])

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
self.listsCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("&Lists")))
Expand Down Expand Up @@ -1948,6 +1953,7 @@ def onSave(self):
config.conf["documentFormatting"]["reportBorderStyle"] = choice in (1,2)
config.conf["documentFormatting"]["reportBorderColor"] = (choice == 2)
config.conf["documentFormatting"]["reportLinks"]=self.linksCheckBox.IsChecked()
config.conf["documentFormatting"]["reportGraphics"]=self.graphicsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportHeadings"]=self.headingsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLists"]=self.listsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportBlockQuotes"]=self.blockQuotesCheckBox.IsChecked()
Expand Down
5 changes: 3 additions & 2 deletions source/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,13 +1284,13 @@ def getControlFieldSpeech(attrs,ancestorAttrs,fieldType,formatConfig=None,extraD
+ (" %s" % stateText if stateText else "")
+ (" %s" % ariaCurrentText if ariaCurrent else ""))

content = attrs.get("content")
# General cases.
if (
(speakEntry and ((speakContentFirst and fieldType in ("end_relative","end_inControlFieldStack")) or (not speakContentFirst and fieldType in ("start_addedToControlFieldStack","start_relative"))))
or (speakWithinForLine and not speakContentFirst and not extraDetail and fieldType=="start_inControlFieldStack")
):
out = []
content = attrs.get("content")
if content and speakContentFirst:
out.append(content)
if placeholderValue:
Expand All @@ -1301,7 +1301,6 @@ def getControlFieldSpeech(attrs,ancestorAttrs,fieldType,formatConfig=None,extraD
if content and not speakContentFirst:
out.append(content)
return CHUNK_SEPARATOR.join(out)

elif fieldType in ("end_removedFromControlFieldStack","end_relative") and roleText and ((not extraDetail and speakExitForLine) or (extraDetail and speakExitForOther)):
# Translators: Indicates end of something (example output: at the end of a list, speaks out of list).
return _("out of %s")%roleText
Expand All @@ -1311,6 +1310,8 @@ def getControlFieldSpeech(attrs,ancestorAttrs,fieldType,formatConfig=None,extraD
out = []
if ariaCurrent:
out.append(ariaCurrentText)
if role == controlTypes.ROLE_GRAPHIC and content:
out.append(content)
return CHUNK_SEPARATOR.join(out)
else:
return ""
Expand Down
1 change: 1 addition & 0 deletions source/textInfos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
return self.PRESCAT_LAYOUT
if reason in (controlTypes.REASON_CARET, controlTypes.REASON_SAYALL, controlTypes.REASON_FOCUS) and (
(role == controlTypes.ROLE_LINK and not formatConfig["reportLinks"])
or (role == controlTypes.ROLE_GRAPHIC and not formatConfig["reportGraphics"])
or (role == controlTypes.ROLE_HEADING and not formatConfig["reportHeadings"])
or (role == controlTypes.ROLE_BLOCKQUOTE and not formatConfig["reportBlockQuotes"])
or (role in (controlTypes.ROLE_TABLE, controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLEROWHEADER, controlTypes.ROLE_TABLECOLUMNHEADER) and not formatConfig["reportTables"])
Expand Down
2 changes: 1 addition & 1 deletion user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -1605,13 +1605,13 @@ You can configure reporting of:
- Elements
- Headings
- Links
- Graphics
- Lists
- Block quotes
- Landmarks
- Frames
- Clickable
-
-

To toggle these settings from anywhere, please assign custom gestures using the [Input Gestures dialog #InputGestures].

Expand Down