lib

symboltable.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
00003                   Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
00004    Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com>              
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 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    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 SYMBOLTABLE_H
00023 #define SYMBOLTABLE_H
00024 
00025 #include <qfont.h>
00026 #include <qmap.h>
00027 #include <qstring.h>
00028 #include <qstringlist.h>
00029 #include <qvaluevector.h>
00030 
00031 #include "kformuladefs.h"
00032 
00033 class KConfig;
00034 
00035 KFORMULA_NAMESPACE_BEGIN
00036 
00037 class ContextStyle;
00038 struct UnicodeNameTable;
00039 
00043 class SymbolFontHelper {
00044 public:
00045 
00046     SymbolFontHelper();
00047 
00051     QString greekLetters() const { return greek; }
00052 
00056     QChar unicodeFromSymbolFont( QChar pos ) const;
00057 
00058 private:
00059 
00063     QMap<QChar, QChar> compatibility;
00064 
00068     QString greek;
00069 };
00070 
00071 
00077 class KOFORMULA_EXPORT SymbolTable {
00078 public:
00079 
00080     SymbolTable();
00081 
00086     void init( const QFont& font );
00087 
00088     bool contains( QString name ) const;
00089 
00094     QChar unicode( QString name ) const;
00095     QString name( QChar symbol ) const;
00096 
00097     QFont font( QChar symbol, const QFont& f ) const;
00098 
00099     CharClass charClass( QChar symbol ) const;
00100 
00104     QString greekLetters() const;
00105 
00109     QChar unicodeFromSymbolFont( QChar pos ) const;
00110 
00114     QStringList allNames() const;
00115 
00116     typedef QMap<QChar, QString> NameTable;
00117     typedef QMap<QString, QChar> EntryTable;
00118 
00119 private:
00120 
00121     QString get_name( UnicodeNameTable entry ) const;
00122 
00126     NameTable names;
00127 
00131     EntryTable entries;
00132 
00136     SymbolFontHelper symbolFontHelper;
00137 
00143     QFont backupFont;
00144 };
00145 
00146 KFORMULA_NAMESPACE_END
00147 
00148 #endif // SYMBOLTABLE_H
KDE Home | KDE Accessibility Home | Description of Access Keys