Kate
spellcheck.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries and the Kate part. 00002 * 00003 * Copyright (C) 2008-2009 by Michel Ludwig <michel.ludwig@kdemail.net> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef SPELLCHECK_H 00022 #define SPELLCHECK_H 00023 00024 #include <QList> 00025 #include <QObject> 00026 #include <QPair> 00027 #include <QString> 00028 00029 #include <ktexteditor/document.h> 00030 #include <sonnet/backgroundchecker.h> 00031 #include <sonnet/speller.h> 00032 00033 class KateDocument; 00034 class KateView; 00035 00036 class KateSpellCheckManager : public QObject { 00037 Q_OBJECT 00038 00039 typedef QPair<KTextEditor::Range, QString> RangeDictionaryPair; 00040 00041 public: 00042 KateSpellCheckManager(QObject* parent = NULL); 00043 virtual ~KateSpellCheckManager(); 00044 00045 QStringList suggestions(const QString& word, const QString& dictionary); 00046 00047 void ignoreWord(const QString& word, const QString& dictionary); 00048 void addToDictionary(const QString& word, const QString& dictionary); 00049 00053 static QList<KTextEditor::Range> rangeDifference(const KTextEditor::Range& r1, const KTextEditor::Range& r2); 00054 00055 public: 00056 QList<QPair<KTextEditor::Range, QString> > spellCheckLanguageRanges(KateDocument *doc, const KTextEditor::Range& range); 00057 00058 QList<QPair<KTextEditor::Range, QString> > spellCheckWrtHighlightingRanges(KateDocument *doc, const KTextEditor::Range& range, 00059 const QString& dictionary = QString(), 00060 bool singleLine = false, 00061 bool returnSingleRange = false); 00062 QList<QPair<KTextEditor::Range, QString> > spellCheckRanges(KateDocument *doc, const KTextEditor::Range& range, 00063 bool singleLine = false); 00064 00065 void replaceCharactersEncodedIfNecessary(const QString& newWord, KateDocument *doc, const KTextEditor::Range& replacementRange); 00066 00067 private: 00068 void trimRange(KateDocument *doc, KTextEditor::Range &r); 00069 }; 00070 00071 #endif 00072 00073 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference