diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 1c3cb78569..0879169376 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -108,7 +108,7 @@ src_header_files = Split(''' ServerSocket.h Session.h Spacing.h - SpellBase.h + SpellChecker.h TexRow.h Text.h TextClass.h @@ -236,7 +236,6 @@ src_post_files = Split(''' Dimension.cpp ModuleList.cpp PrinterParams.cpp - SpellBase.cpp Thesaurus.cpp boost.cpp ''') diff --git a/src/ASpell_local.h b/src/ASpell_local.h index 09fb17e8cd..1f81370c60 100644 --- a/src/ASpell_local.h +++ b/src/ASpell_local.h @@ -13,7 +13,7 @@ #ifndef LYX_ASPELL_H #define LYX_ASPELL_H -#include "SpellBase.h" +#include "SpellChecker.h" #include #include @@ -28,7 +28,7 @@ namespace lyx { class BufferParams; -class ASpell : public SpellBase { +class ASpell : public SpellChecker { public: /** * Initialise the spellchecker with the given buffer params and language. @@ -37,12 +37,6 @@ public: virtual ~ASpell(); - /** - * return true if the spellchecker instance still exists - * Always true for aspell, since there is no separate process - */ - virtual bool alive() { return true; } - /// check the given word and return the result virtual enum Result check(WordLangTuple const &); diff --git a/src/Makefile.am b/src/Makefile.am index 59a3d1ce9c..d4f233b5f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -58,7 +58,7 @@ endif # and in fact libtools seems not able to do that. lyx_SOURCES = \ main.cpp \ - $(ASPELL) SpellBase.cpp \ + $(ASPELL) \ BiblioInfo.h \ BiblioInfo.cpp \ Box.cpp \ @@ -252,7 +252,7 @@ HEADERFILESCORE = \ Session.h \ sgml.h \ Spacing.h \ - SpellBase.h \ + SpellChecker.h \ TexRow.h \ TexStream.h \ Text.h \ diff --git a/src/SpellBase.cpp b/src/SpellBase.cpp deleted file mode 100644 index ea76127bad..0000000000 --- a/src/SpellBase.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file SpellBase.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author unknown - * \author John Levon - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "SpellBase.h" -#include "support/gettext.h" -#include "support/docstring.h" - -using namespace std; - -namespace lyx { - - -bool SpellBase::alive() -{ - return false; -} - - -SpellBase::Result SpellBase::check(WordLangTuple const &) -{ - return UNKNOWN_WORD; -} - - -void SpellBase::insert(WordLangTuple const &) -{} - - -void SpellBase::accept(WordLangTuple const &) -{} - - -docstring const SpellBase::nextMiss() -{ - return docstring(); -} - - -docstring const SpellBase::error() -{ - return _("Native OS API not yet supported."); -} - - -} // namespace lyx diff --git a/src/SpellBase.h b/src/SpellChecker.h similarity index 76% rename from src/SpellBase.h rename to src/SpellChecker.h index 75336376f3..a1ed9ebc7a 100644 --- a/src/SpellBase.h +++ b/src/SpellChecker.h @@ -1,6 +1,6 @@ // -*- C++ -*- /** - * \file SpellBase.h + * \file SpellChecker.h * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * @@ -25,7 +25,7 @@ class WordLangTuple; * Base class of all spellchecker implementations. * The class can be instantiated but will have no functionality. */ -class SpellBase { +class SpellChecker { public: /// the result from checking a single word @@ -44,25 +44,23 @@ public: IGNORED_WORD }; - virtual ~SpellBase() {} - - /// return true if the spellchecker instance still exists - virtual bool alive(); + virtual ~SpellChecker() {} /// check the given word of the given lang code and return the result - virtual enum Result check(WordLangTuple const &); + virtual enum Result check(WordLangTuple const &) = 0; + /// insert the given word into the personal dictionary - virtual void insert(WordLangTuple const &); + virtual void insert(WordLangTuple const &) = 0; /// accept the given word temporarily - virtual void accept(WordLangTuple const &); + virtual void accept(WordLangTuple const &) = 0; /// return the next near miss after a SUGGESTED_WORDS result - virtual docstring const nextMiss(); + virtual docstring const nextMiss() = 0; /// give an error message on messy exit - virtual docstring const error(); + virtual docstring const error() = 0; }; diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 41aa782bab..e939aaad0e 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -36,7 +36,7 @@ # include "ASpell_local.h" #endif -#include "SpellBase.h" +#include "SpellChecker.h" #include "frontends/alert.h" @@ -193,7 +193,7 @@ void GuiSpellchecker::partialUpdate(int state) } -static SpellBase * createSpeller(BufferParams const & bp) +static SpellChecker * createSpeller(BufferParams const & bp) { string lang = lyxrc.spellchecker_use_alt_lang ? lyxrc.spellchecker_alt_lang @@ -202,7 +202,7 @@ static SpellBase * createSpeller(BufferParams const & bp) #if defined(USE_ASPELL) return new ASpell(bp, lang); #endif - return new SpellBase; + return 0; } @@ -265,7 +265,7 @@ void GuiSpellchecker::check() { LYXERR(Debug::GUI, "Check the spelling of a word"); - SpellBase::Result res = SpellBase::OK; + SpellChecker::Result res = SpellChecker::OK; Cursor cur = bufferview()->cursor(); while (cur && cur.pos() && isLetter(cur)) @@ -282,7 +282,7 @@ void GuiSpellchecker::check() exitEarly_ = false; - while (res == SpellBase::OK || res == SpellBase::IGNORED_WORD) { + while (res == SpellChecker::OK || res == SpellChecker::IGNORED_WORD) { word_ = nextWord(cur, start); // end of document @@ -327,7 +327,7 @@ void GuiSpellchecker::check() bv->processUpdateFlags(Update::Force | Update::FitCursor); // set suggestions - if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) { + if (res != SpellChecker::OK && res != SpellChecker::IGNORED_WORD) { LYXERR(Debug::GUI, "Found a word needing checking."); partialUpdate(SPELL_FOUND_WORD); } @@ -336,7 +336,7 @@ void GuiSpellchecker::check() bool GuiSpellchecker::checkAlive() { - if (speller_->alive() && speller_->error().empty()) + if (speller_->error().empty()) return true; docstring message; diff --git a/src/frontends/qt4/GuiSpellchecker.h b/src/frontends/qt4/GuiSpellchecker.h index 19186ee211..a6dbcb8eb0 100644 --- a/src/frontends/qt4/GuiSpellchecker.h +++ b/src/frontends/qt4/GuiSpellchecker.h @@ -23,7 +23,7 @@ class QListWidgetItem; namespace lyx { -class SpellBase; +class SpellChecker; namespace frontend { @@ -104,7 +104,7 @@ private: /// word count int count_; /// The actual spellchecker object - SpellBase * speller_; + SpellChecker * speller_; }; } // namespace frontend