]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiSpellchecker.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiSpellchecker.cpp
index c223bf095eeaab8eeaf1179d6c61338cb01fcc4a..561b99168f61460ca75be644ed489e0572427259 100644 (file)
 #include "BufferView.h"
 #include "Cursor.h"
 #include "CutAndPaste.h"
-#include "debug.h"
-#include "gettext.h"
 #include "Language.h"
 #include "LyXRC.h"
 #include "Paragraph.h"
 
-#include "support/textutils.h"
+#include "support/debug.h"
 #include "support/docstring.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
+#include "support/textutils.h"
 
-#include <QProgressBar>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QListWidget>
 #include <QListWidgetItem>
-#include <QCloseEvent>
-#include <QSyntaxHighlighter>
-#include <QTextCharFormat>
-#include <QTextDocument>
 
 #if defined(USE_ASPELL)
 # include "ASpell_local.h"
 
 #include "frontends/alert.h"
 
-using std::advance;
-using std::distance;
-using std::endl;
-using std::string;
-
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 namespace frontend {
 
-using support::bformat;
-using support::contains;
 
-GuiSpellchecker::GuiSpellchecker(LyXView & lv)
-       : GuiDialog(lv, "spellchecker"), exitEarly_(false),
+GuiSpellchecker::GuiSpellchecker(GuiView & lv)
+       : GuiDialog(lv, "spellchecker", qt_("Spellchecker")), exitEarly_(false),
          oldval_(0), newvalue_(0), count_(0), speller_(0)
 {
        setupUi(this);
-       setViewTitle(_("Spellchecker"));
 
        connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
        connect(replacePB, SIGNAL(clicked()), this, SLOT(replace()));
@@ -124,13 +110,6 @@ void GuiSpellchecker::replaceChanged(const QString & str)
 }
 
 
-void GuiSpellchecker::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       GuiDialog::closeEvent(e);
-}
-
-
 void GuiSpellchecker::reject()
 {
        slotClose();
@@ -219,7 +198,7 @@ void GuiSpellchecker::partialUpdate(int state)
 }
 
 
-static SpellBase * getSpeller(BufferParams const & bp)
+static SpellBase * createSpeller(BufferParams const & bp)
 {
        string lang = (lyxrc.isp_use_alt_lang)
                      ? lyxrc.isp_alt_lang
@@ -244,11 +223,11 @@ static SpellBase * getSpeller(BufferParams const & bp)
 }
 
 
-bool GuiSpellchecker::initialiseParams(std::string const &)
+bool GuiSpellchecker::initialiseParams(string const &)
 {
        LYXERR(Debug::GUI, "Spellchecker::initialiseParams");
 
-       speller_ = getSpeller(buffer().params());
+       speller_ = createSpeller(buffer().params());
        if (!speller_)
                return false;
 
@@ -347,8 +326,8 @@ void GuiSpellchecker::check()
 
        ptrdiff_t start = 0;
        ptrdiff_t total = 0;
-       DocIterator it = DocIterator(buffer().inset());
-       for (start = 0; it != cur; it.forwardPos())
+       DocIterator it = doc_iterator_begin(buffer().inset());
+       for (start = 1; it != cur; it.forwardPos())
                ++start;
 
        for (total = start; it; it.forwardPos())
@@ -491,7 +470,7 @@ void GuiSpellchecker::ignoreAll()
 }
 
 
-Dialog * createGuiSpellchecker(LyXView & lv) { return new GuiSpellchecker(lv); }
+Dialog * createGuiSpellchecker(GuiView & lv) { return new GuiSpellchecker(lv); }
 
 } // namespace frontend
 } // namespace lyx