+void SpellcheckerWidget::Private::setSelection(
+ DocIterator const & from, DocIterator const & to) const
+{
+ BufferView * bv = gv_->documentBufferView();
+ DocIterator end = to;
+
+ if (from.pit() != end.pit()) {
+ // there are multiple paragraphs in selection
+ Cursor & bvcur = bv->cursor();
+ bvcur.setCursor(from);
+ bvcur.clearSelection();
+ bvcur.selection(true);
+ bvcur.setCursor(end);
+ bvcur.selection(true);
+ } else {
+ // FIXME LFUN
+ // If we used a LFUN, dispatch would do all of this for us
+ int const size = end.pos() - from.pos();
+ bv->putSelectionAt(from, size, false);
+ }
+ bv->processUpdateFlags(Update::Force | Update::FitCursor);
+}
+
+void SpellcheckerWidget::Private::forward()
+{
+ DocIterator const from = cursor();
+
+ dispatch(FuncRequest(LFUN_ESCAPE));
+ fixPositionsIfBroken();
+ if (!atLastPos(cursor())) {
+ dispatch(FuncRequest(LFUN_CHAR_FORWARD));
+ }
+ if (atLastPos(cursor())) {
+ return;
+ }
+ if (from == cursor()) {
+ //FIXME we must be at the end of a cell
+ dispatch(FuncRequest(LFUN_CHAR_FORWARD));
+ }
+ if (isWrapAround(cursor())) {
+ hide();
+ }
+}
+
+
+void SpellcheckerWidget::on_languageCO_activated(int index)
+{
+ string const lang =
+ fromqstr(d->ui.languageCO->itemData(index).toString());
+ if (!d->word_.lang() || d->word_.lang()->lang() == lang)
+ // nothing changed
+ return;
+ dispatch(FuncRequest(LFUN_LANGUAGE, lang));
+ d->check();
+}
+
+
+bool SpellcheckerWidget::initialiseParams(std::string const &)
+{
+ BufferView * bv = d->gv_->documentBufferView();
+ if (bv == 0)
+ return false;
+ std::set<Language const *> languages =
+ bv->buffer().masterBuffer()->getLanguages();
+ if (!languages.empty())
+ d->setLanguage(*languages.begin());
+ d->start_ = DocIterator();
+ d->wrapAround(false);
+ d->canCheck();
+ return true;
+}
+
+
+void SpellcheckerWidget::on_ignoreAllPB_clicked()
+{
+ /// ignore all occurrences of word
+ if (d->disabled())
+ return;
+ LYXERR(Debug::GUI, "Spellchecker: ignore all button");
+ if (d->word_.lang() && !d->word_.word().empty())
+ theSpellChecker()->accept(d->word_);
+ d->forward();
+ d->check();
+ d->canCheck();
+}
+
+
+void SpellcheckerWidget::on_addPB_clicked()