void SpellCheckRequest::didCancel() { if (!m_checker) return; SpellChecker* checker = m_checker; m_checker = 0; checker->didCheckCancel(m_requestData.sequence()); }
void SpellCheckRequest::didSucceed(const Vector<TextCheckingResult>& results) { if (!m_checker) return; SpellChecker* checker = m_checker; m_checker = 0; checker->didCheckSucceed(m_requestData.sequence(), results); }
void SpellChecker::checkDocument(Editor* document) { SpellChecker* checker = new SpellChecker(document); checker->m_start_cursor = document->textCursor(); checker->m_cursor = checker->m_start_cursor; checker->m_cursor.movePosition(QTextCursor::Start); checker->show(); checker->check(); }
void SpellChecker::checkDocument(QPlainTextEdit* document, Dictionary& dictionary) { SpellChecker* checker = new SpellChecker(document, dictionary); checker->m_start_cursor = document->textCursor(); checker->m_cursor = checker->m_start_cursor; checker->m_cursor.movePosition(QTextCursor::Start); checker->show(); checker->check(); }
static VALUE check(VALUE self, VALUE val) { SpellChecker *obj; Data_Get_Struct(self, SpellChecker, obj); char *word = RSTRING_PTR(val); //cout << obj->exists(word); if(obj->exists(word)) return Qtrue; else return Qfalse; }
static VALUE load(VALUE self, VALUE val) { SpellChecker *obj; Data_Get_Struct(self, SpellChecker, obj); std::string words_list_file = RSTRING_PTR(val); //cout << obj->exists(word); if(obj->load(words_list_file)) return Qtrue; else return Qfalse; }
void SpellChecker::checkDocument(QTextEdit* document, DictionaryRef& dictionary) { SpellChecker* checker = new SpellChecker(document, dictionary); checker->m_start_cursor = document->textCursor(); checker->m_cursor = checker->m_start_cursor; checker->m_cursor.movePosition(QTextCursor::StartOfBlock); checker->m_loop_available = checker->m_start_cursor.block().previous().isValid(); checker->show(); checker->check(); }
int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode& ec) { SpellChecker* checker = spellchecker(document); if (!checker) { ec = INVALID_ACCESS_ERR; return -1; } return checker->lastProcessedSequence(); }
/* Creates a vector with a list of support languages for spell checking You must to g_free the allocated memory */ UT_Vector* XAP_Dialog_Language::getAvailableDictionaries() { #ifdef ENABLE_SPELL SpellChecker * checker = SpellManager::instance().getInstance(); UT_Vector& vec= checker->getMapping(); DictionaryMapping * mapping; UT_Vector* vecRslt = new UT_Vector(); const UT_uint32 nItems = vec.getItemCount(); for (UT_uint32 iItem = nItems; iItem; --iItem) { mapping = static_cast<DictionaryMapping*>(const_cast<void*>(vec.getNthItem(iItem - 1))); if (checker->doesDictionaryExist(mapping->lang.c_str())) vecRslt->addItem( g_strdup(mapping->lang.c_str())); } return vecRslt; #else return NULL; #endif }
void SpellcheckerWidget::Private::check() { BufferView * bv = gv_->documentBufferView(); if (!bv || bv->buffer().text().empty()) return; fixPositionsIfBroken(); SpellChecker * speller = theSpellChecker(); if (speller && !speller->hasDictionary(bv->buffer().language())) { int dsize = speller->numDictionaries(); if (0 == dsize) { hide(); QMessageBox::information(p, qt_("Spell Checker"), qt_("Spell checker has no dictionaries.")); return; } } DocIterator from = bv->cursor(); DocIterator to = isCurrentBuffer(from) ? end_ : doc_iterator_end(&bv->buffer()); WordLangTuple word_lang; docstring_list suggestions; LYXERR(Debug::GUI, "Spellchecker: start check at " << from); try { bv->buffer().spellCheck(from, to, word_lang, suggestions); } catch (ExceptionMessage const & message) { if (message.type_ == WarningException) { Alert::warning(message.title_, message.details_); return; } throw message; } // end of document or selection? if (atLastPos(from)) { if (isWrapAround()) { hide(); return; } if (continueFromBeginning()) check(); return; } if (isWrapAround(from)) { hide(); return; } word_ = word_lang; // set suggestions updateSuggestions(suggestions); // set language if (!word_lang.lang()) return; setLanguage(word_lang.lang()); // mark misspelled word setSelection(from, to); }