Skip to content

Commit cf7ed06

Browse files
authored
Merge 736d6eb into 4125274
2 parents 4125274 + 736d6eb commit cf7ed06

4 files changed

Lines changed: 41 additions & 11 deletions

File tree

source/NVDAObjects/UIA/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,17 @@ def _getFormatFieldAtRange(self,textRange,formatConfig,ignoreMixedValues=False):
157157
if formatConfig["reportFontSize"]:
158158
IDs.add(UIAHandler.UIA_FontSizeAttributeId)
159159
if formatConfig["reportFontAttributes"]:
160-
IDs.update({UIAHandler.UIA_FontWeightAttributeId,UIAHandler.UIA_IsItalicAttributeId,UIAHandler.UIA_UnderlineStyleAttributeId,UIAHandler.UIA_StrikethroughStyleAttributeId,UIAHandler.UIA_IsSuperscriptAttributeId,UIAHandler.UIA_IsSubscriptAttributeId,})
160+
IDs.update({
161+
UIAHandler.UIA_FontWeightAttributeId,
162+
UIAHandler.UIA_IsItalicAttributeId,
163+
UIAHandler.UIA_UnderlineStyleAttributeId,
164+
UIAHandler.UIA_StrikethroughStyleAttributeId
165+
})
166+
if formatConfig["reportSuperscriptsAndSubscripts"]:
167+
IDs.update({
168+
UIAHandler.UIA_IsSuperscriptAttributeId,
169+
UIAHandler.UIA_IsSubscriptAttributeId
170+
})
161171
if formatConfig["reportAlignment"]:
162172
IDs.add(UIAHandler.UIA_HorizontalTextAlignmentAttributeId)
163173
if formatConfig["reportColor"]:
@@ -196,6 +206,7 @@ def _getFormatFieldAtRange(self,textRange,formatConfig,ignoreMixedValues=False):
196206
val=fetcher.getValue(UIAHandler.UIA_StrikethroughStyleAttributeId,ignoreMixedValues=ignoreMixedValues)
197207
if val!=UIAHandler.handler.reservedNotSupportedValue:
198208
formatField['strikethrough']=bool(val)
209+
if formatConfig["reportSuperscriptsAndSubscripts"]:
199210
textPosition=None
200211
val=fetcher.getValue(UIAHandler.UIA_IsSuperscriptAttributeId,ignoreMixedValues=ignoreMixedValues)
201212
if val!=UIAHandler.handler.reservedNotSupportedValue and val:

source/NVDAObjects/window/edit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ def _getFormatFieldAndOffsets(self,offset,formatConfig,calculateOffsets=True):
264264
formatField["italic"]=bool(charFormat.dwEffects&CFE_ITALIC)
265265
formatField["underline"]=bool(charFormat.dwEffects&CFE_UNDERLINE)
266266
formatField["strikethrough"]=bool(charFormat.dwEffects&CFE_STRIKEOUT)
267+
if formatConfig["reportSuperscriptsAndSubscripts"]:
267268
if charFormat.dwEffects&CFE_SUBSCRIPT:
268269
formatField["text-position"]="sub"
269270
elif charFormat.dwEffects&CFE_SUPERSCRIPT:

source/appModules/powerpnt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,7 @@ def _getFormatFieldAndOffsets(self,offset,formatConfig,calculateOffsets=True):
929929
formatField['bold']=bool(font.bold)
930930
formatField['italic']=bool(font.italic)
931931
formatField['underline']=bool(font.underline)
932+
if formatConfig['reportSuperscriptAndSubscript']:
932933
if font.subscript:
933934
formatField['text-position']='sub'
934935
elif font.superscript:

source/globalCommands.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,17 +1371,34 @@ def script_sayAll(self,gesture):
13711371
script_sayAll.category=SCRCAT_SYSTEMCARET
13721372

13731373
def _reportFormattingHelper(self, info, browseable=False):
1374-
formatConfig={
1375-
"detectFormatAfterCursor":False,
1376-
"reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False,
1377-
"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,
1378-
"reportPage":False,"reportLineNumber":False,"reportLineIndentation":True,"reportLineIndentationWithTones":False,"reportParagraphIndentation":True,"reportLineSpacing":True,"reportTables":False,
1379-
"reportLinks":False,"reportHeadings":False,"reportLists":False,
1380-
"reportBlockQuotes":False,"reportComments":False,
1381-
"reportBorderStyle":True,"reportBorderColor":True,
1382-
}
1383-
textList=[]
1374+
# Report all formatting-related changes regardless of user settings
1375+
# when explicitly requested.
1376+
# These are the options we want reported when reporting formatting manually.
1377+
# for full list of options that may be reported see the "documentFormatting" section of L{config.configSpec}
1378+
reportFormattingOptions = (
1379+
"reportFontName",
1380+
"reportFontSize",
1381+
"reportFontAttributes",
1382+
"reportSuperscriptsAndSubscripts",
1383+
"reportColor",
1384+
"reportStyle",
1385+
"reportAlignment",
1386+
"reportSpellingErrors",
1387+
"reportLineIndentation",
1388+
"reportParagraphIndentation",
1389+
"reportLineSpacing",
1390+
"reportBorderStyle",
1391+
"reportBorderColor",
1392+
)
1393+
1394+
# Create a dictionary to replace the config section that would normally be
1395+
# passed to getFormatFieldsSpeech / getFormatFieldsBraille
1396+
formatConfig = dict()
1397+
from config import conf
1398+
for i in conf["documentFormatting"]:
1399+
formatConfig [i] = i in reportFormattingOptions
13841400

1401+
textList=[]
13851402
# First, fetch indentation.
13861403
line=info.copy()
13871404
line.expand(textInfos.UNIT_LINE)

0 commit comments

Comments
 (0)