KDECore
speller.h
Go to the documentation of this file.
00001 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*- 00002 /* 00003 * 00004 * Copyright (C) 2007 Zack Rusin <zack@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA 00020 */ 00021 #ifndef SONNET_SPELLER_H 00022 #define SONNET_SPELLER_H 00023 00024 #include <QtCore/QStringList> 00025 #include <QtCore/QString> 00026 00027 #include <kdecore_export.h> 00028 00029 class KConfig; 00030 00031 namespace Sonnet 00032 { 00038 class KDECORE_EXPORT Speller 00039 { 00040 public: 00041 Speller(const QString &lang=QString()); 00042 ~Speller(); 00043 00044 Speller(const Speller &speller); 00045 Speller &operator=(const Speller &speller); 00046 00051 bool isValid() const; 00052 00056 void setLanguage(const QString &lang); 00060 QString language() const; 00061 00066 bool isCorrect(const QString &word) const; 00067 00072 bool isMisspelled(const QString &word) const; 00073 00079 QStringList suggest(const QString &word) const; 00080 00085 bool checkAndSuggest(const QString &word, 00086 QStringList &suggestions) const; 00087 00092 bool storeReplacement(const QString &bad, 00093 const QString &good); 00094 00099 bool addToPersonal(const QString &word); 00100 00105 bool addToSession(const QString &word); 00106 00107 public: // Configuration API 00108 enum Attribute { 00109 CheckUppercase, 00110 SkipRunTogether 00111 }; 00112 void save(KConfig *config); 00113 void restore(KConfig *config); 00114 00118 QStringList availableBackends() const; 00119 00125 QStringList availableLanguages() const; 00131 QStringList availableLanguageNames() const; 00132 00137 QMap<QString, QString> availableDictionaries() const; 00138 00139 00140 void setDefaultLanguage(const QString &lang); 00141 QString defaultLanguage() const; 00142 00143 void setDefaultClient(const QString &client); 00144 QString defaultClient() const; 00145 00146 void setAttribute(Attribute attr, bool b = true); 00147 bool testAttribute(Attribute attr) const; 00148 private: 00149 class Private; 00150 Private *const d; 00151 }; 00152 } 00153 #endif
KDE 4.6 API Reference