Skip to content

Commit

Permalink
Merge branch 'master' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsteh committed Jun 10, 2016
2 parents 289178f + a989f5e commit f3206a4
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 193 deletions.
19 changes: 5 additions & 14 deletions nvdaHelper/remote/winword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ using namespace std;
#define wdDISPID_CONTENTCONTROL_TITLE 12
#define wdDISPID_STYLE_NAMELOCAL 0
#define wdDISPID_STYLE_PARENT 1002
#define wdDISPID_RANGE_GRAMMATICALERRORS 315
#define wdDISPID_RANGE_SPELLINGERRORS 316
#define wdDISPID_SPELLINGERRORS_ITEM 0
#define wdDISPID_SPELLINGERRORS_COUNT 1
Expand Down Expand Up @@ -336,7 +335,7 @@ BOOL generateFormFieldXML(IDispatch* pDispatchRange, wostringstream& XMLStream,
return foundFormField;
}

bool collectSpellingGrammarErrorOffsets(int spellingGrammarErrorsDispId, IDispatchPtr pDispatchRange, vector<pair<long,long>>& errorVector) {
bool collectSpellingErrorOffsets(IDispatchPtr pDispatchRange, vector<pair<long,long>>& errorVector) {
IDispatchPtr pDispatchApplication=NULL;
if(_com_dispatch_raw_propget(pDispatchRange,wdDISPID_RANGE_APPLICATION ,VT_DISPATCH,&pDispatchApplication)!=S_OK||!pDispatchApplication) {
return false;
Expand All @@ -348,7 +347,7 @@ bool collectSpellingGrammarErrorOffsets(int spellingGrammarErrorsDispId, IDispat
return false;
}
IDispatchPtr pDispatchSpellingErrors=NULL;
if(_com_dispatch_raw_propget(pDispatchRange,spellingGrammarErrorsDispId,VT_DISPATCH,&pDispatchSpellingErrors)!=S_OK||!pDispatchSpellingErrors) {
if(_com_dispatch_raw_propget(pDispatchRange,wdDISPID_RANGE_SPELLINGERRORS,VT_DISPATCH,&pDispatchSpellingErrors)!=S_OK||!pDispatchSpellingErrors) {
return false;
}
long iVal=0;
Expand Down Expand Up @@ -889,11 +888,9 @@ void winword_getTextInRange_helper(HWND hwnd, winword_getTextInRange_args* args)
}
//Check for any inline shapes in the entire range to work out whether its worth checking for them by word
bool hasInlineShapes=(getInlineShapesCount(pDispatchRange)>0);
vector<pair<long,long> > spellingErrorVector;
vector<pair<long,long> > grammarErrorVector;
vector<pair<long,long> > errorVector;
if(formatConfig&formatConfig_reportSpellingErrors) {
collectSpellingGrammarErrorOffsets(wdDISPID_RANGE_SPELLINGERRORS,pDispatchRange,spellingErrorVector);
collectSpellingGrammarErrorOffsets(wdDISPID_RANGE_GRAMMATICALERRORS,pDispatchRange,grammarErrorVector);
collectSpellingErrorOffsets(pDispatchRange,errorVector);
}
_com_dispatch_raw_method(pDispatchRange,wdDISPID_RANGE_COLLAPSE,DISPATCH_METHOD,VT_EMPTY,NULL,L"\x0003",wdCollapseStart);
int chunkStartOffset=args->startOffset;
Expand Down Expand Up @@ -992,18 +989,12 @@ void winword_getTextInRange_helper(HWND hwnd, winword_getTextInRange_args* args)
XMLStream<<L"<text _startOffset=\""<<chunkStartOffset<<L"\" _endOffset=\""<<chunkEndOffset<<L"\" ";
XMLStream<<initialFormatAttribsStream.str();
generateXMLAttribsForFormatting(pDispatchRange,chunkStartOffset,chunkEndOffset,formatConfig&(~curDisabledFormatConfig),XMLStream);
for(auto i=spellingErrorVector.cbegin();i!=spellingErrorVector.cend();++i) {
for(vector<pair<long,long>>::iterator i=errorVector.begin();i!=errorVector.end();++i) {
if(chunkStartOffset>=i->first&&chunkStartOffset<i->second) {
XMLStream<<L" invalid-spelling=\"1\" ";
break;
}
}
for(auto i=grammarErrorVector.cbegin();i!=grammarErrorVector.cend();++i) {
if(chunkStartOffset>=i->first&&chunkStartOffset<i->second) {
XMLStream<<L" invalid-grammar=\"1\" ";
break;
}
}
for(vector<pair<long,long>>::iterator i=commentVector.begin();i!=commentVector.end();++i) {
if(!(chunkStartOffset>=i->second||chunkEndOffset<=i->first)) {
XMLStream<<L" comment=\""<<(i->second)<<L"\" ";
Expand Down
1 change: 0 additions & 1 deletion source/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def validateConfig(configObj,validator,validationResult=None,keyList=None):
reportLineSpacing = boolean(default=false)
reportStyle = boolean(default=false)
reportSpellingErrors = boolean(default=true)
reportGrammarErrors = boolean(default=true)
reportPage = boolean(default=true)
reportLineNumber = boolean(default=False)
reportLineIndentation = boolean(default=False)
Expand Down
16 changes: 1 addition & 15 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,20 +430,6 @@ def script_toggleReportSpellingErrors(self,gesture):
script_toggleReportSpellingErrors.__doc__=_("Toggles on and off the reporting of spelling errors")
script_toggleReportSpellingErrors.category=SCRCAT_DOCUMENTFORMATTING

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

def script_toggleReportPage(self,gesture):
if config.conf["documentFormatting"]["reportPage"]:
# Translators: The message announced when toggling the report pages document formatting setting.
Expand Down Expand Up @@ -1254,7 +1240,7 @@ def script_reportFormatting(self,gesture):
formatConfig={
"detectFormatAfterCursor":False,
"reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,"reportRevisions":False,"reportEmphasis":False,
"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,"reportGrammarErrors":True,
"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,
"reportPage":False,"reportLineNumber":False,"reportParagraphIndentation":True,"reportLineSpacing":True,"reportTables":False,
"reportLinks":False,"reportHeadings":False,"reportLists":False,
"reportBlockQuotes":False,"reportComments":False,
Expand Down
6 changes: 0 additions & 6 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,11 +1098,6 @@ def makeSettings(self, settingsSizer):
settingsSizer.Add(self.spellingErrorsCheckBox,border=10,flag=wx.BOTTOM)
# Translators: This is the label for a checkbox in the
# document formatting settings dialog.
self.grammarErrorsCheckBox=wx.CheckBox(self,wx.ID_ANY,label=_("Report &grammar errors"))
self.grammarErrorsCheckBox.SetValue(config.conf["documentFormatting"]["reportGrammarErrors"])
settingsSizer.Add(self.grammarErrorsCheckBox,border=10,flag=wx.BOTTOM)
# Translators: This is the label for a checkbox in the
# document formatting settings dialog.
self.pageCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Report &pages"))
self.pageCheckBox.SetValue(config.conf["documentFormatting"]["reportPage"])
settingsSizer.Add(self.pageCheckBox,border=10,flag=wx.BOTTOM)
Expand Down Expand Up @@ -1192,7 +1187,6 @@ def onOk(self,evt):
config.conf["documentFormatting"]["reportAlignment"]=self.alignmentCheckBox.IsChecked()
config.conf["documentFormatting"]["reportStyle"]=self.styleCheckBox.IsChecked()
config.conf["documentFormatting"]["reportSpellingErrors"]=self.spellingErrorsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportGrammarErrors"]=self.grammarErrorsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportPage"]=self.pageCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLineNumber"]=self.lineNumberCheckBox.IsChecked()
config.conf["documentFormatting"]["reportLineIndentation"]=self.lineIndentationCheckBox.IsChecked()
Expand Down
2 changes: 1 addition & 1 deletion source/locale/de/symbols.dic
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ symbols:
decimal Komma none always
in-word ' Apostroph all norep
negative number Minus none norep
thousands separator Punkt none norep
thousands separator Punkt all norep
date separator none always

# Whitespace
Expand Down
Loading

0 comments on commit f3206a4

Please sign in to comment.