lib

KoGlobal.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 Copyright 2002, 2003 David Faure <faure@kde.org>
4 Copyright 2003 Nicolas GOUTTE <goutte@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef koGlobal_h
23#define koGlobal_h
24
25#include <tqstringlist.h>
26#include <tqfont.h>
27#include <tqmap.h>
28class TDEConfig;
29
30#include <koffice_export.h>
31class KOFFICECORE_EXPORT KoGlobal
32{
33public:
35 static void initialize() {
36 (void)self(); // I don't want to make TDEGlobal instances public, so self() is private
37 }
44 static TQFont defaultFont() {
45 return self()->_defaultFont();
46 }
47
54 static TDEConfig* kofficeConfig() {
55 return self()->_kofficeConfig();
56 }
57
58 static int dpiX() {
59 return self()->m_dpiX;
60 }
61 static int dpiY() {
62 return self()->m_dpiY;
63 }
65 static void setDPI( int x, int y );
66
69 static TQStringList listOfLanguages() {
70 return self()->_listOfLanguages();
71 }
74 static TQStringList listTagOfLanguages() { // TODO rename to listOfLanguageTags
75 return self()->_listOfLanguageTags();
76 }
78 static TQString tagOfLanguage( const TQString & _lang );
80 static TQString languageFromTag( const TQString &_lang );
81
82 ~KoGlobal();
83
84private:
85 static KoGlobal* self();
86 KoGlobal();
87 TQFont _defaultFont();
88 TQStringList _listOfLanguages();
89 TQStringList _listOfLanguageTags();
90 TDEConfig* _kofficeConfig();
91 void createListOfLanguages();
92
93 int m_pointSize;
94 typedef TQMap<TQString, TQString> LanguageMap;
95 LanguageMap m_langMap; // display-name -> language tag
96 TDEConfig* m_kofficeConfig;
97 int m_dpiX;
98 int m_dpiY;
99 // No BC problem here, constructor is private, feel free to add members
100
101 // Singleton pattern. Maybe this should even be refcounted, so
102 // that it gets cleaned up when closing all koffice parts in e.g. konqueror?
103 static KoGlobal* s_global;
104 friend class this_is_a_singleton; // work around gcc warning
105};
106
107#endif // koGlobal