F:/KPlato/koffice/libs/kotext/kohyphen/kohyphen.h

Aller à la documentation de ce fichier.
00001 /******************************************************************************
00002  *   Copyright (C) 2002 by Alexander Dymo <cloudtemple@mskat.net>             *
00003  *   Copyright (C) 2002-2003 by Lukas Tinkl <lukas.tinkl@suse.cz>             *
00004  *   Copyright (C) 2003 David Faure <faure@kde.org>                           *
00005  *                                                                            *
00006  *   This program is free software; you can redistribute it and/or modify     *
00007  *   it under the terms of the GNU Library General Public License as          *
00008  *   published by the Free Software Foundation; either version 2 of the       *
00009  *   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  *  Library General Public License for more details.                          *
00015  *                                                                            *
00016  *  You should have received a copy of the GNU Library General Public License *
00017  *  along with this library; see the file COPYING.LIB.  If not, write to      *
00018  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.                                               *
00020  ******************************************************************************/
00021 
00022 #ifndef KOHYPHEN_H
00023 #define KOHYPHEN_H
00024 
00025 #include <QMap>
00026 #include <QString>
00027 //Added by qt3to4:
00028 #include <QByteArray>
00029 #include "hyphen.h"
00030 #include <koffice_export.h>
00031 
00032 class KoHyphenatorException{
00033 public:
00034         KoHyphenatorException(const QString& MessageText): messageText(MessageText) {}
00035         QString message() const { return messageText; }
00036 private:
00037         QString messageText;
00038 };
00039 
00059 class KOTEXT_EXPORT KoHyphenator{ // exported for unit-test
00060 public:
00066         static KoHyphenator* self();
00067 
00068         ~KoHyphenator();
00069 
00076         bool checkHyphenPos(const QString& str, int pos, const QString& lang) const;
00077 
00094         char *hyphens(const QString& str, const QString& lang) const;
00095 
00106         QString hyphenate(const QString& str, const QString& lang) const;
00107 
00108 private:
00112         QTextCodec* codecForLang(const QString& lang) const;
00113 
00114         KoHyphenator();
00115         HyphenDict *dict(const QString &lang) const;
00116 
00117         QMap<QString, HyphenDict*> dicts;
00118         struct EncodingStruct {
00119             EncodingStruct() // for QMap
00120                 : encoding(), codec(0L) {}
00121             EncodingStruct(const QByteArray& _encoding)
00122                 : encoding(_encoding), codec(0L) {}
00123             QByteArray encoding;
00124             QTextCodec* codec;
00125         };
00126         typedef QMap<QString, EncodingStruct> EncodingMap;
00127         mutable EncodingMap encodings; // key is the language code
00128 
00129         static KoHyphenator* s_self;
00130 };
00131 
00132 #endif

Généré le Wed Nov 22 23:41:08 2006 pour KPlato par  doxygen 1.5.1-p1