Skip to content

Commit

Permalink
Merge branch 't1670' into next. Incubates #1670
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelDCurran committed Aug 16, 2013
2 parents 29b91c7 + 4186e10 commit a9e6fff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nvdaHelper/remote/winword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ void winword_getTextInRange_helper(HWND hwnd, winword_getTextInRange_args* args)
}
_com_dispatch_raw_propget(pDispatchRange,wdDISPID_RANGE_END,VT_I4,&chunkEndOffset);
}
XMLStream<<L"<text ";
XMLStream<<L"<text _startOffset=\""<<chunkStartOffset<<L"\" _endOffset=\""<<chunkEndOffset<<L"\" ";
XMLStream<<initialFormatAttribsStream.str();
generateXMLAttribsForFormatting(pDispatchRange,chunkStartOffset,chunkEndOffset,formatConfig,XMLStream);
XMLStream<<L">";
Expand Down
21 changes: 18 additions & 3 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def __init__(self,obj,position,_rangeObj=None):
raise NotImplementedError("position: %s"%position)

def getTextWithFields(self,formatConfig=None):
extraDetail=formatConfig.get('extraDetail',False) if formatConfig else False
if not formatConfig:
formatConfig=config.conf['documentFormatting']
formatConfig['autoLanguageSwitching']=config.conf['speech'].get('autoLanguageSwitching',False)
Expand All @@ -265,7 +266,7 @@ def getTextWithFields(self,formatConfig=None):
if isinstance(field,textInfos.ControlField):
item.field=self._normalizeControlField(field)
elif isinstance(field,textInfos.FormatField):
item.field=self._normalizeFormatField(field)
item.field=self._normalizeFormatField(field,extraDetail=extraDetail)
elif index>0 and isinstance(item,basestring) and item.isspace():
#2047: don't expose language for whitespace as its incorrect for east-asian languages
lastItem=commandList[index-1]
Expand Down Expand Up @@ -330,11 +331,25 @@ def _normalizeControlField(self,field):
field['role']=controlTypes.ROLE_FRAME
return field

def _normalizeFormatField(self,field):
def _normalizeFormatField(self,field,extraDetail=False):
_startOffset=int(field.pop('_startOffset'))
_endOffset=int(field.pop('_endOffset'))
revisionType=int(field.pop('wdRevisionType',0))
revisionLabel=wdRevisionTypeLabels.get(revisionType,None)
if revisionLabel:
field['revision']=revisionLabel
if extraDetail:
try:
r=self.obj.WinwordSelectionObject.range
r.setRange(_startOffset,_endOffset)
rev=r.revisions[0]
author=rev.author
date=rev.date
except COMError:
author=_("unknown author")
date=_("unknown date")
field['revision']=_("{revisionType} by {revisionAuthor} on {revisionDate}").format(revisionType=revisionLabel,revisionAuthor=author,revisionDate=date)
else:
field['revision']=revisionLabel
color=field.pop('color',None)
if color is not None:
field['color']=colors.RGB.fromCOLORREF(int(color))
Expand Down
3 changes: 3 additions & 0 deletions source/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ def speakTextInfo(info,useCache=True,formatConfig=None,unit=None,reason=controlT
extraDetail=unit in (textInfos.UNIT_CHARACTER,textInfos.UNIT_WORD)
if not formatConfig:
formatConfig=config.conf["documentFormatting"]
if extraDetail:
formatConfig=formatConfig.copy()
formatConfig['extraDetail']=True
reportIndentation=unit==textInfos.UNIT_LINE and formatConfig["reportLineIndentation"]

speechSequence=[]
Expand Down

0 comments on commit a9e6fff

Please sign in to comment.