lib Library API Documentation

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 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., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef SYMBOLTABLE_H 00022 #define SYMBOLTABLE_H 00023 00024 #include <qfont.h> 00025 #include <qmap.h> 00026 #include <qstring.h> 00027 #include <qstringlist.h> 00028 #include <qvaluevector.h> 00029 00030 #include "kformuladefs.h" 00031 00032 class KConfig; 00033 00034 KFORMULA_NAMESPACE_BEGIN 00035 00036 class ContextStyle; 00037 00043 class CharTableEntry { 00044 public: 00045 00049 CharTableEntry( CharClass cl=ORDINARY, char font=0, uchar ch=0 ) 00050 : m_charClass( static_cast<char>( cl ) ), m_font( font ), m_character( ch ) {} 00051 00052 char font() const { return m_font; } 00053 uchar character() const { return m_character; } 00054 CharClass charClass() const { return static_cast<CharClass>( m_charClass ); } 00055 00056 private: 00057 00058 char m_charClass; 00059 char m_font; 00060 uchar m_character; 00061 }; 00062 00063 00067 class SymbolFontHelper { 00068 public: 00069 00070 SymbolFontHelper(); 00071 00075 QString greekLetters() const { return greek; } 00076 00080 QChar unicodeFromSymbolFont( QChar pos ) const; 00081 00082 private: 00083 00087 QMap<uchar, QChar> compatibility; 00088 00092 QString greek; 00093 }; 00094 00095 00101 class SymbolTable { 00102 public: 00103 00104 SymbolTable(); 00105 00109 void init( ContextStyle* context ); 00110 00111 bool contains( QString name ) const; 00112 00117 QChar unicode( QString name ) const; 00118 QString name( QChar symbol ) const; 00119 00120 const CharTableEntry& entry( QChar symbol, CharStyle style=normalChar ) const; 00121 QFont font( QChar symbol, CharStyle style=normalChar ) const; 00122 uchar character( QChar symbol, CharStyle style=normalChar ) const; 00123 CharClass charClass( QChar symbol, CharStyle style=normalChar ) const; 00124 00128 QChar unicodeFromSymbolFont( QChar pos ) const; 00129 00133 QString greekLetters() const; 00134 00138 QStringList allNames() const; 00139 00140 typedef QMap<QChar, CharTableEntry> UnicodeTable; 00141 typedef QMap<QChar, QString> NameTable; 00142 typedef QMap<QString, QChar> EntryTable; 00143 typedef QValueVector<QFont> FontTable; 00144 00145 bool inTable( QChar ch, CharStyle style=anyChar ) const; 00146 00147 void initFont( const InternFontTable* table, 00148 const char* fontname, 00149 const NameTable& tempNames ); 00150 00151 private: 00152 00153 UnicodeTable& unicodeTable( CharStyle style ); 00154 const UnicodeTable& unicodeTable( CharStyle style ) const; 00155 00159 UnicodeTable normalChars; 00160 UnicodeTable boldChars; 00161 UnicodeTable italicChars; 00162 UnicodeTable boldItalicChars; 00163 00167 NameTable names; 00168 00172 EntryTable entries; 00173 00178 FontTable fontTable; 00179 00183 SymbolFontHelper symbolFontHelper; 00184 00185 // An empty entry that's used if nothing was found. 00186 CharTableEntry dummyEntry; 00187 }; 00188 00189 KFORMULA_NAMESPACE_END 00190 00191 #endif // SYMBOLTABLE_H
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 06:54:20 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003