2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiSpellchecker.h
|
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
|
|
|
|
* \author Kalle Dalheimer
|
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.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUISPELLCHECKER_H
|
|
|
|
#define GUISPELLCHECKER_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "GuiDialog.h"
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_SpellcheckerUi.h"
|
2007-10-06 19:51:03 +00:00
|
|
|
#include "Dialog.h"
|
|
|
|
#include "WordLangTuple.h"
|
2007-04-24 15:32:14 +00:00
|
|
|
|
|
|
|
class QListWidgetItem;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
2007-10-06 19:51:03 +00:00
|
|
|
|
|
|
|
class SpellBase;
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-09 19:34:27 +00:00
|
|
|
class GuiSpellchecker : public GuiDialog, public Ui::SpellcheckerUi
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2007-04-24 15:32:14 +00:00
|
|
|
Q_OBJECT
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2007-04-24 15:32:14 +00:00
|
|
|
public:
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiSpellchecker(GuiView & lv);
|
2007-10-06 19:51:03 +00:00
|
|
|
~GuiSpellchecker();
|
2007-04-24 15:32:14 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
void suggestionChanged(QListWidgetItem *);
|
2007-04-24 15:32:14 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
private Q_SLOTS:
|
2007-10-06 19:51:03 +00:00
|
|
|
void accept();
|
|
|
|
void add();
|
|
|
|
void ignore();
|
|
|
|
void replace();
|
2007-09-05 20:33:29 +00:00
|
|
|
void replaceChanged(const QString &);
|
|
|
|
void reject();
|
2007-04-24 15:32:14 +00:00
|
|
|
|
|
|
|
private:
|
2006-03-05 17:24:44 +00:00
|
|
|
/// update from controller
|
|
|
|
void partialUpdate(int id);
|
|
|
|
///
|
2007-09-11 18:33:42 +00:00
|
|
|
void updateContents();
|
2007-10-06 19:51:03 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
enum State {
|
|
|
|
SPELL_PROGRESSED, //< update progress bar
|
|
|
|
SPELL_FOUND_WORD //< found a bad word
|
|
|
|
};
|
|
|
|
|
|
|
|
///
|
|
|
|
bool initialiseParams(std::string const & data);
|
|
|
|
///
|
|
|
|
void clearParams();
|
|
|
|
/// Not needed here
|
|
|
|
void dispatchParams() {}
|
|
|
|
///
|
|
|
|
bool isBufferDependent() const { return true; }
|
|
|
|
///
|
|
|
|
bool exitEarly() const { return exitEarly_; }
|
|
|
|
|
|
|
|
/// replace word with replacement
|
|
|
|
void replace(docstring const &);
|
|
|
|
|
|
|
|
/// replace all occurances of word
|
|
|
|
void replaceAll(docstring const &);
|
|
|
|
/// insert word in personal dictionary
|
|
|
|
void insert();
|
|
|
|
/// ignore all occurances of word
|
|
|
|
void ignoreAll();
|
|
|
|
/// check text until next misspelled/unknown word
|
|
|
|
/// returns true when finished
|
|
|
|
void check();
|
|
|
|
/// get suggestion
|
|
|
|
docstring getSuggestion() const;
|
|
|
|
/// get word
|
|
|
|
docstring getWord() const;
|
|
|
|
/// returns progress value
|
|
|
|
int getProgress() const { return oldval_; }
|
|
|
|
/// returns word count
|
|
|
|
int getCount() const { return count_; }
|
|
|
|
/// give error message is spellchecker dies
|
|
|
|
bool checkAlive();
|
|
|
|
/// show count of checked words at normal exit
|
|
|
|
void showSummary();
|
|
|
|
|
|
|
|
/// set to true when spellchecking is finished
|
|
|
|
bool exitEarly_;
|
|
|
|
/// current word being checked and lang code
|
|
|
|
WordLangTuple word_;
|
|
|
|
/// values for progress
|
|
|
|
int oldval_;
|
|
|
|
int newvalue_;
|
|
|
|
/// word count
|
|
|
|
int count_;
|
|
|
|
/// The actual spellchecker object
|
|
|
|
SpellBase * speller_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUISPELLCHECKER_H
|