2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiSpellchecker.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
2007-10-06 19:51:03 +00:00
|
|
|
* \author Edwin Leuven
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiSpellchecker.h"
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
#include "Buffer.h"
|
|
|
|
#include "BufferParams.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "Cursor.h"
|
|
|
|
#include "CutAndPaste.h"
|
|
|
|
#include "Language.h"
|
|
|
|
#include "LyXRC.h"
|
|
|
|
#include "Paragraph.h"
|
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
2007-10-06 19:51:03 +00:00
|
|
|
#include "support/docstring.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/gettext.h"
|
2007-11-13 23:21:29 +00:00
|
|
|
#include "support/lstrings.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/textutils.h"
|
2007-10-06 19:51:03 +00:00
|
|
|
|
2006-05-03 19:51:15 +00:00
|
|
|
#include <QListWidgetItem>
|
2007-04-24 15:32:14 +00:00
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
#if defined(USE_ASPELL)
|
|
|
|
# include "ASpell_local.h"
|
|
|
|
#elif defined(USE_PSPELL)
|
|
|
|
# include "PSpell.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(USE_ISPELL)
|
|
|
|
# include "ISpell.h"
|
|
|
|
#else
|
|
|
|
# include "SpellBase.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "frontends/alert.h"
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
using namespace lyx::support;
|
2007-10-06 19:51:03 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiSpellchecker::GuiSpellchecker(GuiView & lv)
|
2008-02-05 12:43:19 +00:00
|
|
|
: GuiDialog(lv, "spellchecker", qt_("Spellchecker")), exitEarly_(false),
|
2007-10-06 19:51:03 +00:00
|
|
|
oldval_(0), newvalue_(0), count_(0), speller_(0)
|
2007-04-24 15:32:14 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-11-06 13:40:31 +00:00
|
|
|
connect(replacePB, SIGNAL(clicked()), this, SLOT(replace()));
|
|
|
|
connect(ignorePB, SIGNAL(clicked()), this, SLOT(ignore()));
|
|
|
|
connect(replacePB_3, SIGNAL(clicked()), this, SLOT(accept()));
|
|
|
|
connect(addPB, SIGNAL(clicked()), this, SLOT(add()));
|
2007-04-24 15:32:14 +00:00
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
connect(replaceCO, SIGNAL(highlighted(QString)),
|
|
|
|
this, SLOT(replaceChanged(QString)));
|
2007-04-24 15:32:14 +00:00
|
|
|
connect(suggestionsLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
|
2007-11-06 13:40:31 +00:00
|
|
|
this, SLOT(replace()));
|
2007-04-24 15:32:14 +00:00
|
|
|
connect(suggestionsLW, SIGNAL(itemClicked(QListWidgetItem*)),
|
|
|
|
this, SLOT(suggestionChanged(QListWidgetItem*)));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
wordED->setReadOnly(true);
|
|
|
|
|
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
GuiSpellchecker::~GuiSpellchecker()
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2007-10-06 19:51:03 +00:00
|
|
|
delete speller_;
|
2007-04-24 15:32:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::suggestionChanged(QListWidgetItem * item)
|
2007-04-24 15:32:14 +00:00
|
|
|
{
|
|
|
|
if (replaceCO->count() != 0)
|
|
|
|
replaceCO->setItemText(0, item->text());
|
|
|
|
else
|
|
|
|
replaceCO->addItem(item->text());
|
|
|
|
|
|
|
|
replaceCO->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::replaceChanged(const QString & str)
|
2007-04-24 15:32:14 +00:00
|
|
|
{
|
|
|
|
if (suggestionsLW->currentItem()->text() == str)
|
|
|
|
return;
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
for (int i = 0; i != suggestionsLW->count(); ++i) {
|
2007-04-24 15:32:14 +00:00
|
|
|
if (suggestionsLW->item(i)->text() == str) {
|
|
|
|
suggestionsLW->setCurrentRow(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::reject()
|
2007-04-24 15:32:14 +00:00
|
|
|
{
|
2007-09-11 17:06:15 +00:00
|
|
|
slotClose();
|
2007-04-24 15:32:14 +00:00
|
|
|
QDialog::reject();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-11-06 13:40:31 +00:00
|
|
|
// The clauses below are needed because the spellchecker
|
|
|
|
// has many flaws (see bugs 1950, 2218).
|
|
|
|
// Basically, we have to distinguish the case where a
|
|
|
|
// spellcheck has already been performed for the whole
|
|
|
|
// document (exitEarly() == true, isVisible() == false)
|
|
|
|
// from the rest (exitEarly() == false, isVisible() == true).
|
|
|
|
// FIXME: rewrite the whole beast!
|
|
|
|
static bool check_after_early_exit;
|
|
|
|
if (exitEarly()) {
|
|
|
|
// a spellcheck has already been performed,
|
2007-10-06 19:51:03 +00:00
|
|
|
check();
|
2007-11-06 13:40:31 +00:00
|
|
|
check_after_early_exit = true;
|
|
|
|
}
|
|
|
|
else if (isVisible()) {
|
|
|
|
// the above check triggers a second update,
|
|
|
|
// and isVisible() is true then. Prevent a
|
|
|
|
// second check that skips the first word
|
|
|
|
if (check_after_early_exit)
|
|
|
|
// don't check, but reset the bool.
|
|
|
|
// business as usual after this.
|
|
|
|
check_after_early_exit = false;
|
|
|
|
else
|
|
|
|
// perform spellcheck (default case)
|
|
|
|
check();
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::accept()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 19:51:03 +00:00
|
|
|
ignoreAll();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::add()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 19:51:03 +00:00
|
|
|
insert();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::ignore()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 19:51:03 +00:00
|
|
|
check();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::replace()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 19:51:03 +00:00
|
|
|
replace(qstring_to_ucs4(replaceCO->currentText()));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
void GuiSpellchecker::partialUpdate(int state)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
switch (state) {
|
2007-10-06 19:51:03 +00:00
|
|
|
case SPELL_PROGRESSED:
|
|
|
|
spellcheckPR->setValue(getProgress());
|
2007-09-05 20:33:29 +00:00
|
|
|
break;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
case SPELL_FOUND_WORD: {
|
|
|
|
wordED->setText(toqstr(getWord()));
|
2007-09-05 20:33:29 +00:00
|
|
|
suggestionsLW->clear();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
docstring w;
|
2007-10-06 19:51:03 +00:00
|
|
|
while (!(w = getSuggestion()).empty())
|
2007-09-05 20:33:29 +00:00
|
|
|
suggestionsLW->addItem(toqstr(w));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
if (suggestionsLW->count() == 0)
|
|
|
|
suggestionChanged(new QListWidgetItem(wordED->text()));
|
|
|
|
else
|
|
|
|
suggestionChanged(suggestionsLW->item(0));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
suggestionsLW->setCurrentRow(0);
|
|
|
|
break;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
|
2008-03-16 17:06:26 +00:00
|
|
|
static SpellBase * createSpeller(BufferParams const & bp)
|
2007-10-06 19:51:03 +00:00
|
|
|
{
|
|
|
|
string lang = (lyxrc.isp_use_alt_lang)
|
|
|
|
? lyxrc.isp_alt_lang
|
|
|
|
: bp.language->code();
|
|
|
|
|
|
|
|
#if defined(USE_ASPELL)
|
|
|
|
if (lyxrc.use_spell_lib)
|
|
|
|
return new ASpell(bp, lang);
|
|
|
|
#elif defined(USE_PSPELL)
|
|
|
|
if (lyxrc.use_spell_lib)
|
|
|
|
return new PSpell(bp, lang);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(USE_ISPELL)
|
|
|
|
lang = lyxrc.isp_use_alt_lang ?
|
|
|
|
lyxrc.isp_alt_lang : bp.language->lang();
|
|
|
|
|
|
|
|
return new ISpell(bp, lang);
|
|
|
|
#else
|
|
|
|
return new SpellBase;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
bool GuiSpellchecker::initialiseParams(string const &)
|
2007-10-06 19:51:03 +00:00
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "Spellchecker::initialiseParams");
|
2007-10-06 19:51:03 +00:00
|
|
|
|
2008-03-16 17:06:26 +00:00
|
|
|
speller_ = createSpeller(buffer().params());
|
2007-10-06 19:51:03 +00:00
|
|
|
if (!speller_)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// reset values to initial
|
|
|
|
oldval_ = 0;
|
|
|
|
newvalue_ = 0;
|
|
|
|
count_ = 0;
|
|
|
|
|
|
|
|
bool const success = speller_->error().empty();
|
|
|
|
|
|
|
|
if (!success) {
|
|
|
|
Alert::error(_("Spellchecker error"),
|
|
|
|
_("The spellchecker could not be started\n")
|
|
|
|
+ speller_->error());
|
|
|
|
delete speller_;
|
|
|
|
speller_ = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiSpellchecker::clearParams()
|
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "Spellchecker::clearParams");
|
2007-10-06 19:51:03 +00:00
|
|
|
delete speller_;
|
|
|
|
speller_ = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool isLetter(DocIterator const & dit)
|
|
|
|
{
|
|
|
|
return dit.inTexted()
|
|
|
|
&& dit.inset().allowSpellCheck()
|
|
|
|
&& dit.pos() != dit.lastpos()
|
|
|
|
&& (dit.paragraph().isLetter(dit.pos())
|
|
|
|
// We want to pass the ' and escape chars to ispell
|
|
|
|
|| contains(from_utf8(lyxrc.isp_esc_chars + '\''),
|
|
|
|
dit.paragraph().getChar(dit.pos())))
|
|
|
|
&& !dit.paragraph().isDeleted(dit.pos());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static WordLangTuple nextWord(Cursor & cur, ptrdiff_t & progress)
|
|
|
|
{
|
|
|
|
BufferParams const & bp = cur.bv().buffer().params();
|
|
|
|
bool inword = false;
|
|
|
|
bool ignoreword = false;
|
|
|
|
cur.resetAnchor();
|
|
|
|
docstring word;
|
|
|
|
string lang_code;
|
|
|
|
|
|
|
|
while (cur.depth()) {
|
|
|
|
if (isLetter(cur)) {
|
|
|
|
if (!inword) {
|
|
|
|
inword = true;
|
|
|
|
ignoreword = false;
|
|
|
|
cur.resetAnchor();
|
|
|
|
word.clear();
|
|
|
|
lang_code = cur.paragraph().getFontSettings(bp, cur.pos()).language()->code();
|
|
|
|
}
|
|
|
|
// Insets like optional hyphens and ligature
|
|
|
|
// break are part of a word.
|
|
|
|
if (!cur.paragraph().isInset(cur.pos())) {
|
2007-10-24 07:08:55 +00:00
|
|
|
char_type const c = cur.paragraph().getChar(cur.pos());
|
2007-10-06 19:51:03 +00:00
|
|
|
word += c;
|
|
|
|
if (isDigit(c))
|
|
|
|
ignoreword = true;
|
|
|
|
}
|
|
|
|
} else { // !isLetter(cur)
|
|
|
|
if (inword)
|
|
|
|
if (!word.empty() && !ignoreword) {
|
|
|
|
cur.setSelection();
|
|
|
|
return WordLangTuple(word, lang_code);
|
|
|
|
}
|
|
|
|
inword = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
cur.forwardPos();
|
|
|
|
++progress;
|
|
|
|
}
|
|
|
|
|
|
|
|
return WordLangTuple(docstring(), string());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiSpellchecker::check()
|
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "Check the spelling of a word");
|
2007-10-06 19:51:03 +00:00
|
|
|
|
|
|
|
SpellBase::Result res = SpellBase::OK;
|
|
|
|
|
|
|
|
Cursor cur = bufferview()->cursor();
|
|
|
|
while (cur && cur.pos() && isLetter(cur))
|
|
|
|
cur.backwardPos();
|
|
|
|
|
|
|
|
ptrdiff_t start = 0;
|
|
|
|
ptrdiff_t total = 0;
|
2008-02-09 15:23:05 +00:00
|
|
|
DocIterator it = doc_iterator_begin(buffer().inset());
|
|
|
|
for (start = 1; it != cur; it.forwardPos())
|
2007-10-06 19:51:03 +00:00
|
|
|
++start;
|
|
|
|
|
|
|
|
for (total = start; it; it.forwardPos())
|
|
|
|
++total;
|
|
|
|
|
|
|
|
exitEarly_ = false;
|
|
|
|
|
|
|
|
while (res == SpellBase::OK || res == SpellBase::IGNORED_WORD) {
|
|
|
|
word_ = nextWord(cur, start);
|
|
|
|
|
|
|
|
// end of document
|
|
|
|
if (getWord().empty()) {
|
|
|
|
showSummary();
|
|
|
|
exitEarly_ = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
++count_;
|
|
|
|
|
|
|
|
// Update slider if and only if value has changed
|
|
|
|
float progress = total ? float(start)/total : 1;
|
|
|
|
newvalue_ = int(100.0 * progress);
|
|
|
|
if (newvalue_!= oldval_) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "Updating spell progress.");
|
2007-10-06 19:51:03 +00:00
|
|
|
oldval_ = newvalue_;
|
|
|
|
// set progress bar
|
2007-11-06 13:40:31 +00:00
|
|
|
partialUpdate(SPELL_PROGRESSED);
|
2007-10-06 19:51:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// speller might be dead ...
|
|
|
|
if (!checkAlive())
|
|
|
|
return;
|
|
|
|
|
|
|
|
res = speller_->check(word_);
|
|
|
|
|
|
|
|
// ... or it might just be reporting an error
|
|
|
|
if (!checkAlive())
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "Found word \"" << to_utf8(getWord()) << "\"");
|
2007-10-06 19:51:03 +00:00
|
|
|
|
|
|
|
int const size = cur.selEnd().pos() - cur.selBegin().pos();
|
|
|
|
cur.pos() -= size;
|
2008-09-29 10:52:17 +00:00
|
|
|
BufferView * bv = const_cast<BufferView *>(bufferview());
|
|
|
|
bv->putSelectionAt(cur, size, false);
|
2007-10-06 19:51:03 +00:00
|
|
|
// FIXME: if we used a lfun like in find/replace, dispatch would do
|
|
|
|
// that for us
|
|
|
|
// FIXME: this Controller is very badly designed...
|
2008-09-29 10:52:17 +00:00
|
|
|
bv->processUpdateFlags(Update::Force | Update::FitCursor);
|
2007-10-06 19:51:03 +00:00
|
|
|
|
|
|
|
// set suggestions
|
|
|
|
if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "Found a word needing checking.");
|
2007-11-06 13:40:31 +00:00
|
|
|
partialUpdate(SPELL_FOUND_WORD);
|
2007-10-06 19:51:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiSpellchecker::checkAlive()
|
|
|
|
{
|
|
|
|
if (speller_->alive() && speller_->error().empty())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
docstring message;
|
|
|
|
if (speller_->error().empty())
|
|
|
|
message = _("The spellchecker has died for some reason.\n"
|
|
|
|
"Maybe it has been killed.");
|
|
|
|
else
|
|
|
|
message = _("The spellchecker has failed.\n") + speller_->error();
|
|
|
|
|
2007-10-09 21:21:01 +00:00
|
|
|
slotClose();
|
2007-10-06 19:51:03 +00:00
|
|
|
|
|
|
|
Alert::error(_("The spellchecker has failed"), message);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiSpellchecker::showSummary()
|
|
|
|
{
|
|
|
|
if (!checkAlive() || count_ == 0) {
|
2007-10-09 21:21:01 +00:00
|
|
|
slotClose();
|
2007-10-06 19:51:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
docstring message;
|
|
|
|
if (count_ != 1)
|
|
|
|
message = bformat(_("%1$d words checked."), count_);
|
|
|
|
else
|
|
|
|
message = _("One word checked.");
|
|
|
|
|
2007-10-09 21:21:01 +00:00
|
|
|
slotClose();
|
2007-10-06 19:51:03 +00:00
|
|
|
Alert::information(_("Spelling check completed"), message);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiSpellchecker::replace(docstring const & replacement)
|
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "GuiSpellchecker::replace("
|
|
|
|
<< to_utf8(replacement) << ")");
|
2008-09-29 10:52:17 +00:00
|
|
|
BufferView * bv = const_cast<BufferView *>(bufferview());
|
|
|
|
cap::replaceSelectionWithString(bv->cursor(), replacement, true);
|
|
|
|
bv->buffer().markDirty();
|
2007-10-06 19:51:03 +00:00
|
|
|
// If we used an LFUN, we would not need that
|
2008-09-29 10:52:17 +00:00
|
|
|
bv->processUpdateFlags(Update::Force | Update::FitCursor);
|
2007-10-06 19:51:03 +00:00
|
|
|
// fix up the count
|
|
|
|
--count_;
|
|
|
|
check();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiSpellchecker::replaceAll(docstring const & replacement)
|
|
|
|
{
|
|
|
|
// TODO: add to list
|
|
|
|
replace(replacement);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiSpellchecker::insert()
|
|
|
|
{
|
|
|
|
speller_->insert(word_);
|
|
|
|
check();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
docstring GuiSpellchecker::getSuggestion() const
|
|
|
|
{
|
|
|
|
return speller_->nextMiss();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
docstring GuiSpellchecker::getWord() const
|
|
|
|
{
|
|
|
|
return word_.word();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiSpellchecker::ignoreAll()
|
|
|
|
{
|
|
|
|
speller_->accept(word_);
|
|
|
|
check();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiSpellchecker(GuiView & lv) { return new GuiSpellchecker(lv); }
|
2007-10-06 19:51:03 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 15:32:14 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiSpellchecker_moc.cpp"
|