Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -52,6 +52,7 @@ constexpr int formatConfig_reportParagraphIndentation = 0x10000;
constexpr int formatConfig_includeLayoutTables = 0x20000;
constexpr int formatConfig_reportLineSpacing = 0x40000;
constexpr int formatConfig_reportSuperscriptsAndSubscripts = 0x80000;
constexpr int formatConfig_reportGraphics = 0x100000;

constexpr int formatConfig_fontFlags =(formatConfig_reportFontName|formatConfig_reportFontSize|formatConfig_reportFontAttributes|formatConfig_reportColor|formatConfig_reportSuperscriptsAndSubscripts);
constexpr int formatConfig_initialFormatFlags =(formatConfig_reportPage|formatConfig_reportLineNumber|formatConfig_reportTables|formatConfig_reportHeadings|formatConfig_includeLayoutTables);
Expand Down Expand Up @@ -717,7 +718,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
7 changes: 6 additions & 1 deletion source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ 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, textRange):
Expand Down
41 changes: 21 additions & 20 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,28 +308,29 @@
textInfos.UNIT_READINGCHUNK:wdSentence,
}

formatConfigFlagsMap={
"reportFontName":0x1,
"reportFontSize":0x2,
"reportFontAttributes":0x4,
"reportColor":0x8,
"reportAlignment":0x10,
"reportStyle":0x20,
"reportSpellingErrors":0x40,
"reportPage":0x80,
"reportLineNumber":0x100,
"reportTables":0x200,
"reportLists":0x400,
"reportLinks":0x800,
"reportComments":0x1000,
"reportHeadings":0x2000,
"autoLanguageSwitching":0x4000,
"reportRevisions":0x8000,
"reportParagraphIndentation":0x10000,
"reportLineSpacing":0x40000,
formatConfigFlagsMap = {
"reportFontName": 0x1,
"reportFontSize": 0x2,
"reportFontAttributes": 0x4,
"reportColor": 0x8,
"reportAlignment": 0x10,
"reportStyle": 0x20,
"reportSpellingErrors": 0x40,
"reportPage": 0x80,
"reportLineNumber": 0x100,
"reportTables": 0x200,
"reportLists": 0x400,
"reportLinks": 0x800,
"reportComments": 0x1000,
"reportHeadings": 0x2000,
"autoLanguageSwitching": 0x4000,
"reportRevisions": 0x8000,
"reportParagraphIndentation": 0x10000,
"reportLineSpacing": 0x40000,
"reportSuperscriptsAndSubscripts": 0x80000,
"reportGraphics": 0x100000,
}
formatConfigFlag_includeLayoutTables=0x20000
formatConfigFlag_includeLayoutTables = 0x20000

# Map some characters from 0 to Unicode. Meant to be used with bullets only.
# Doesn't care about the actual font, so can give incorrect Unicode in rare cases.
Expand Down
4 changes: 3 additions & 1 deletion source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,11 +665,14 @@ def getControlFieldBraille(info, field, ancestors, reportStart, formatConfig):
landmark = field.get("landmark")
if not roleText and role == controlTypes.ROLE_LANDMARK and landmark:
roleText = f"{roleLabels[controlTypes.ROLE_LANDMARK]} {landmarkLabels[landmark]}"
content = field.get("content")

if presCat == field.PRESCAT_LAYOUT:
text = []
if current:
text.append(getPropertiesBraille(current=current))
if role == controlTypes.ROLE_GRAPHIC and content:
text.append(content)
return TEXT_SEPARATOR.join(text) if len(text) != 0 else None

elif role in (controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLECOLUMNHEADER, controlTypes.ROLE_TABLEROWHEADER) and field.get("table-id"):
Expand Down Expand Up @@ -713,7 +716,6 @@ def getControlFieldBraille(info, field, ancestors, reportStart, formatConfig):
if level:
props["positionInfo"] = {"level": level}
text = getPropertiesBraille(**props)
content = field.get("content")
if content:
if text:
text += TEXT_SEPARATOR
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,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
16 changes: 16 additions & 0 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,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
6 changes: 6 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,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 @@ -2203,6 +2208,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
7 changes: 4 additions & 3 deletions source/speech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
WaveFileCommand,
ConfigProfileTriggerCommand,
)

from . import types
from .types import (
SpeechSequence,
Expand Down Expand Up @@ -1824,6 +1823,7 @@ def getControlFieldSpeech( # noqa: C901
types.logBadSequenceTypes(tableCellSequence)
return tableCellSequence

content = attrs.get("content")
# General cases.
if ((
speakEntry and ((
Expand All @@ -1842,7 +1842,6 @@ def getControlFieldSpeech( # noqa: C901
and fieldType == "start_inControlFieldStack"
)):
out = []
content = attrs.get("content")
if content and speakContentFirst:
out.append(content)
if placeholderValue:
Expand Down Expand Up @@ -1906,7 +1905,9 @@ def getControlFieldSpeech( # noqa: C901
out = []
if ariaCurrent:
out.extend(ariaCurrentSequence)
types.logBadSequenceTypes(out)
if role == controlTypes.ROLE_GRAPHIC and content:
out.append(content)
types.logBadSequenceTypes(out)
return 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 @@ -73,6 +73,7 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
landmark = self.get("landmark")
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 == controlTypes.ROLE_GROUPING and (not name or not formatConfig["reportGroupings"]))
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,7 @@ You can configure reporting of:
- Elements
- Headings
- Links
- Graphics
- Lists
- Block quotes
- Groupings
Expand Down