21 #include "backgroundengine.h"
23 #include "defaultdictionary.h"
24 #include "dictionary.h"
33 BackgroundEngine::BackgroundEngine( TQObject *parent )
36 m_filter = Filter::defaultFilter();
40 BackgroundEngine::~BackgroundEngine()
42 delete m_dict; m_dict = 0;
45 void BackgroundEngine::setBroker(
const Broker::Ptr& broker )
49 m_defaultDict = m_broker->defaultDictionary();
50 m_filter->setSettings( m_broker->settings() );
53 void BackgroundEngine::setText(
const TQString& text )
55 m_filter->setBuffer( text );
58 TQString BackgroundEngine::text()
const
60 return m_filter->buffer();
63 void BackgroundEngine::changeLanguage(
const TQString& lang )
66 if ( lang.isEmpty() ) {
69 m_dict = m_broker->dictionary( lang );
73 TQString BackgroundEngine::language()
const
76 return m_dict->language();
78 return m_defaultDict->language();
81 void BackgroundEngine::setFilter(
Filter *filter )
83 TQString oldText = m_filter->buffer();
85 m_filter->setBuffer( oldText );
88 void BackgroundEngine::start()
90 TQTimer::singleShot( 0,
this, TQ_SLOT(checkNext()) );
93 void BackgroundEngine::stop()
97 void BackgroundEngine::continueChecking()
99 TQTimer::singleShot( 0,
this, TQ_SLOT(checkNext()) );
102 void BackgroundEngine::checkNext()
104 Word w = m_filter->nextWord();
112 if ( !dict->
check( w.word ) ) {
114 emit misspelling( w.word, w.start );
120 bool BackgroundEngine::checkWord(
const TQString& word )
123 return dict->
check( word );
126 bool BackgroundEngine::addWord(
const TQString& word )
132 TQStringList BackgroundEngine::suggest(
const TQString& word )
138 #include "backgroundengine.moc"
Class is returned by from Broker.
virtual bool addToPersonal(const TQString &word)=0
Adds word to the list of of personal words.
virtual TQStringList suggest(const TQString &word)=0
Fetches suggestions for the word.
virtual bool check(const TQString &word)=0
Checks the given word.
Filter is used to split text into words which will be spell checked.
Structure abstracts the word and its position in the parent text.