Skip to content

Commit 5a54124

Browse files
authored
Merge 2a53692 into 6a573cd
2 parents 6a573cd + 2a53692 commit 5a54124

9 files changed

Lines changed: 66 additions & 25 deletions

File tree

nvdaHelper/remote/winword.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ constexpr int formatConfig_reportParagraphIndentation = 0x10000;
5252
constexpr int formatConfig_includeLayoutTables = 0x20000;
5353
constexpr int formatConfig_reportLineSpacing = 0x40000;
5454
constexpr int formatConfig_reportSuperscriptsAndSubscripts = 0x80000;
55+
constexpr int formatConfig_reportGraphics = 0x100000;
5556

5657
constexpr int formatConfig_fontFlags =(formatConfig_reportFontName|formatConfig_reportFontSize|formatConfig_reportFontAttributes|formatConfig_reportColor|formatConfig_reportSuperscriptsAndSubscripts);
5758
constexpr int formatConfig_initialFormatFlags =(formatConfig_reportPage|formatConfig_reportLineNumber|formatConfig_reportTables|formatConfig_reportHeadings|formatConfig_includeLayoutTables);
@@ -717,7 +718,15 @@ inline int generateInlineShapeXML(IDispatch* pDispatchRange, int offset, wostrin
717718
SysFreeString(altText);
718719
}
719720
altText=NULL;
720-
XMLStream<<L"<control _startOfNode=\"1\" role=\""<<((shapeType==wdInlineShapePicture||shapeType==wdInlineShapeLinkedPicture)?L"graphic":(shapeType==wdInlineShapeChart?L"chart":L"object"))<<L"\" value=\""<<altTextStr<<L"\"";
721+
XMLStream<<L"<control _startOfNode=\"1\" ";
722+
auto roleText = L"object";
723+
if(shapeType==wdInlineShapePicture||shapeType==wdInlineShapeLinkedPicture) {
724+
roleText=L"graphic";
725+
} else if(shapeType==wdInlineShapeChart) {
726+
roleText=L"chart";
727+
}
728+
XMLStream<<L"role=\""<<roleText<<L"\" ";
729+
XMLStream<<L"content=\""<<altTextStr<<L"\"";
721730
if(shapeType==wdInlineShapeEmbeddedOLEObject) {
722731
XMLStream<<L" shapeoffset=\""<<offset<<L"\"";
723732
IDispatchPtr pOLEFormat=NULL;

source/NVDAObjects/UIA/wordDocument.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,12 @@ def _getControlFieldForObject(self,obj,isEmbedded=False,startOfNode=False,endOfN
137137
field['role']=controlTypes.ROLE_EDITABLETEXT
138138
if obj.role==controlTypes.ROLE_GRAPHIC:
139139
# Label graphics with a description before name as name seems to be auto-generated (E.g. "rectangle")
140-
field['value']=field.pop('description',None) or obj.description or field.pop('name',None) or obj.name
140+
field['content'] = (
141+
field.pop('description', None)
142+
or obj.description
143+
or field.pop('name', None)
144+
or obj.name
145+
)
141146
return field
142147

143148
def _getTextFromUIARange(self, textRange):

source/NVDAObjects/window/winword.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -308,28 +308,29 @@
308308
textInfos.UNIT_READINGCHUNK:wdSentence,
309309
}
310310

311-
formatConfigFlagsMap={
312-
"reportFontName":0x1,
313-
"reportFontSize":0x2,
314-
"reportFontAttributes":0x4,
315-
"reportColor":0x8,
316-
"reportAlignment":0x10,
317-
"reportStyle":0x20,
318-
"reportSpellingErrors":0x40,
319-
"reportPage":0x80,
320-
"reportLineNumber":0x100,
321-
"reportTables":0x200,
322-
"reportLists":0x400,
323-
"reportLinks":0x800,
324-
"reportComments":0x1000,
325-
"reportHeadings":0x2000,
326-
"autoLanguageSwitching":0x4000,
327-
"reportRevisions":0x8000,
328-
"reportParagraphIndentation":0x10000,
329-
"reportLineSpacing":0x40000,
311+
formatConfigFlagsMap = {
312+
"reportFontName": 0x1,
313+
"reportFontSize": 0x2,
314+
"reportFontAttributes": 0x4,
315+
"reportColor": 0x8,
316+
"reportAlignment": 0x10,
317+
"reportStyle": 0x20,
318+
"reportSpellingErrors": 0x40,
319+
"reportPage": 0x80,
320+
"reportLineNumber": 0x100,
321+
"reportTables": 0x200,
322+
"reportLists": 0x400,
323+
"reportLinks": 0x800,
324+
"reportComments": 0x1000,
325+
"reportHeadings": 0x2000,
326+
"autoLanguageSwitching": 0x4000,
327+
"reportRevisions": 0x8000,
328+
"reportParagraphIndentation": 0x10000,
329+
"reportLineSpacing": 0x40000,
330330
"reportSuperscriptsAndSubscripts": 0x80000,
331+
"reportGraphics": 0x100000,
331332
}
332-
formatConfigFlag_includeLayoutTables=0x20000
333+
formatConfigFlag_includeLayoutTables = 0x20000
333334

334335
# Map some characters from 0 to Unicode. Meant to be used with bullets only.
335336
# Doesn't care about the actual font, so can give incorrect Unicode in rare cases.

source/config/configSpec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
reportBorderStyle = boolean(default=False)
192192
reportBorderColor = boolean(default=False)
193193
reportLinks = boolean(default=true)
194+
reportGraphics = boolean(default=True)
194195
reportComments = boolean(default=true)
195196
reportLists = boolean(default=true)
196197
reportHeadings = boolean(default=true)

source/globalCommands.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,22 @@ def script_toggleReportLinks(self,gesture):
601601
script_toggleReportLinks.__doc__=_("Toggles on and off the reporting of links")
602602
script_toggleReportLinks.category=SCRCAT_DOCUMENTFORMATTING
603603

604+
@scriptHandler.script(
605+
# Translators: Input help mode message for toggle report graphics command.
606+
description=_("Toggles on and off the reporting of graphics"),
607+
category=SCRCAT_DOCUMENTFORMATTING
608+
)
609+
def script_toggleReportGraphics(self, gesture):
610+
if config.conf["documentFormatting"]["reportGraphics"]:
611+
# Translators: The message announced when toggling the report graphics document formatting setting.
612+
state = _("report graphics off")
613+
config.conf["documentFormatting"]["reportGraphics"] = False
614+
else:
615+
# Translators: The message announced when toggling the report graphics document formatting setting.
616+
state = _("report graphics on")
617+
config.conf["documentFormatting"]["reportGraphics"] = True
618+
ui.message(state)
619+
604620
def script_toggleReportComments(self,gesture):
605621
if config.conf["documentFormatting"]["reportComments"]:
606622
# Translators: The message announced when toggling the report comments document formatting setting.

source/gui/settingsDialogs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,6 +2127,11 @@ def makeSettings(self, settingsSizer):
21272127
self.linksCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("Lin&ks")))
21282128
self.linksCheckBox.SetValue(config.conf["documentFormatting"]["reportLinks"])
21292129

2130+
# Translators: This is the label for a checkbox in the
2131+
# document formatting settings panel.
2132+
self.graphicsCheckBox = elementsGroup.addItem(wx.CheckBox(self, label=_("&Graphics")))
2133+
self.graphicsCheckBox.SetValue(config.conf["documentFormatting"]["reportGraphics"])
2134+
21302135
# Translators: This is the label for a checkbox in the
21312136
# document formatting settings panel.
21322137
self.listsCheckBox=elementsGroup.addItem(wx.CheckBox(self,label=_("&Lists")))
@@ -2200,6 +2205,7 @@ def onSave(self):
22002205
config.conf["documentFormatting"]["reportBorderStyle"] = choice in (1,2)
22012206
config.conf["documentFormatting"]["reportBorderColor"] = (choice == 2)
22022207
config.conf["documentFormatting"]["reportLinks"]=self.linksCheckBox.IsChecked()
2208+
config.conf["documentFormatting"]["reportGraphics"] = self.graphicsCheckBox.IsChecked()
22032209
config.conf["documentFormatting"]["reportHeadings"]=self.headingsCheckBox.IsChecked()
22042210
config.conf["documentFormatting"]["reportLists"]=self.listsCheckBox.IsChecked()
22052211
config.conf["documentFormatting"]["reportBlockQuotes"]=self.blockQuotesCheckBox.IsChecked()

source/speech/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,7 @@ def getControlFieldSpeech( # noqa: C901
18121812
types.logBadSequenceTypes(tableCellSequence)
18131813
return tableCellSequence
18141814

1815+
content = attrs.get("content")
18151816
# General cases.
18161817
if ((
18171818
speakEntry and ((
@@ -1830,7 +1831,6 @@ def getControlFieldSpeech( # noqa: C901
18301831
and fieldType == "start_inControlFieldStack"
18311832
)):
18321833
out = []
1833-
content = attrs.get("content")
18341834
if content and speakContentFirst:
18351835
out.append(content)
18361836
if placeholderValue:
@@ -1894,7 +1894,9 @@ def getControlFieldSpeech( # noqa: C901
18941894
out = []
18951895
if ariaCurrent:
18961896
out.extend(ariaCurrentSequence)
1897-
types.logBadSequenceTypes(out)
1897+
if role == controlTypes.ROLE_GRAPHIC and content:
1898+
out.append(content)
1899+
types.logBadSequenceTypes(out)
18981900
return out
18991901
else:
19001902
return []

source/textInfos/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
7373
landmark = self.get("landmark")
7474
if reason in (controlTypes.REASON_CARET, controlTypes.REASON_SAYALL, controlTypes.REASON_FOCUS) and (
7575
(role == controlTypes.ROLE_LINK and not formatConfig["reportLinks"])
76+
or (role == controlTypes.ROLE_GRAPHIC and not formatConfig["reportGraphics"])
7677
or (role == controlTypes.ROLE_HEADING and not formatConfig["reportHeadings"])
7778
or (role == controlTypes.ROLE_BLOCKQUOTE and not formatConfig["reportBlockQuotes"])
7879
or (role == controlTypes.ROLE_GROUPING and (not name or not formatConfig["reportGroupings"]))

user_docs/en/userGuide.t2t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,7 @@ You can configure reporting of:
17211721
- Elements
17221722
- Headings
17231723
- Links
1724+
- Graphics
17241725
- Lists
17251726
- Block quotes
17261727
- Groupings
@@ -1729,7 +1730,6 @@ You can configure reporting of:
17291730
- Frames
17301731
- Clickable
17311732
-
1732-
-
17331733

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

0 commit comments

Comments
 (0)