mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
918df906bb
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8024 a592a061-630c-0410-9148-cb99ea01b6c8
99 lines
1.9 KiB
C++
99 lines
1.9 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file ControlSpellchecker.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Edwin Leuven
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef CONTROLSPELLCHECKER_H
|
|
#define CONTROLSPELLCHECKER_H
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
#include "ControlDialog_impl.h"
|
|
#include "WordLangTuple.h"
|
|
|
|
class SpellBase;
|
|
|
|
/** A controller for Spellchecker dialogs.
|
|
*/
|
|
class ControlSpellchecker : public ControlDialogBD {
|
|
public:
|
|
enum State {
|
|
SPELL_PROGRESSED, //< update progress bar
|
|
SPELL_FOUND_WORD //< found a bad word
|
|
};
|
|
|
|
ControlSpellchecker(LyXView &, Dialogs &);
|
|
|
|
~ControlSpellchecker();
|
|
|
|
/// replace word with replacement
|
|
void replace(std::string const &);
|
|
|
|
/// replace all occurances of word
|
|
void replaceAll(std::string 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
|
|
std::string const getSuggestion() const;
|
|
|
|
/// get word
|
|
std::string const getWord() const;
|
|
|
|
/// returns progress value
|
|
int getProgress() const { return oldval_; }
|
|
|
|
/// returns word count
|
|
int getCount() const { return count_; }
|
|
|
|
private:
|
|
/// give error message is spellchecker dies
|
|
bool checkAlive();
|
|
|
|
/// start a spell-checking session
|
|
void startSession();
|
|
|
|
/// end a spell-checking session
|
|
void endSession();
|
|
|
|
/// show count of checked words at normal exit
|
|
void showSummary();
|
|
|
|
/// set the params before show or update
|
|
void setParams();
|
|
/// clean-up on hide.
|
|
void clearParams();
|
|
|
|
/// not needed.
|
|
virtual void apply() {}
|
|
|
|
/// current word being checked and lang code
|
|
WordLangTuple word_;
|
|
|
|
/// values for progress
|
|
int oldval_;
|
|
int newvalue_;
|
|
|
|
/// word count
|
|
int count_;
|
|
|
|
/// The actual spellchecker object
|
|
boost::scoped_ptr<SpellBase> speller_;
|
|
};
|
|
|
|
#endif // CONTROLSPELLCHECKER_H
|