F:/KPlato/koffice/libs/kofficecore/KoGlobal.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003    Copyright 2002, 2003 David Faure <faure@kde.org>
00004    Copyright 2003 Nicolas GOUTTE <goutte@kde.org>
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 koGlobal_h
00023 #define koGlobal_h
00024 
00025 #include <QStringList>
00026 #include <QFont>
00027 #include <QMap>
00028 
00029 #include <koffice_export.h>
00030 
00031 class KConfig;
00032 
00033 class KOFFICECORE_EXPORT KoGlobal
00034 {
00035 public:
00037     static void initialize()  {
00038         (void)self(); // I don't want to make KGlobal instances public, so self() is private
00039     }
00046     static QFont defaultFont()  {
00047         return self()->_defaultFont();
00048     }
00049 
00056     static KConfig* kofficeConfig() {
00057         return self()->_kofficeConfig();
00058     }
00059 
00060     static int dpiX() {
00061         return self()->m_dpiX;
00062     }
00063     static int dpiY() {
00064         return self()->m_dpiY;
00065     }
00067     static void setDPI( int x, int y );
00068 
00071     static QStringList listOfLanguages() {
00072         return self()->_listOfLanguages();
00073     }
00076     static QStringList listTagOfLanguages() { // TODO rename to listOfLanguageTags
00077         return self()->_listOfLanguageTags();
00078     }
00080     static QString tagOfLanguage( const QString & _lang );
00082     static QString languageFromTag( const QString &_lang );
00083 
00084     ~KoGlobal();
00085 
00086 private:
00087     static KoGlobal* self();
00088     KoGlobal();
00089     QFont _defaultFont();
00090     QStringList _listOfLanguages();
00091     QStringList _listOfLanguageTags();
00092     KConfig* _kofficeConfig();
00093     void createListOfLanguages();
00094 
00095     int m_pointSize;
00096     typedef QMap<QString, QString> LanguageMap;
00097     LanguageMap m_langMap; // display-name -> language tag
00098     KConfig* m_kofficeConfig;
00099     int m_dpiX;
00100     int m_dpiY;
00101     // No BC problem here, constructor is private, feel free to add members
00102 
00103     // Singleton pattern. Maybe this should even be refcounted, so
00104     // that it gets cleaned up when closing all koffice parts in e.g. konqueror?
00105     static KoGlobal* s_global;
00106     friend class this_is_a_singleton; // work around gcc warning
00107 };
00108 
00109 #endif // koGlobal

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