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

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Laurent Montel <montel@kde.org>
00003                       David Faure <faure@kde.org>
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., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 
00022 #ifndef KOOASISSETTINGS_H
00023 #define KOOASISSETTINGS_H
00024 
00025 #include <qdom.h>
00026 #include <koffice_export.h>
00027 #include <KoXmlReader.h>
00028 
00071 class KOFFICECORE_EXPORT KoOasisSettings
00072 {
00073 public:
00077     explicit KoOasisSettings( const KoXmlDocument& doc );
00078 
00082     KoOasisSettings( const KoXmlDocument& doc, const char* officeNSURI, const char* configNSURI );
00083 
00084     class Items;
00085 
00090     Items itemSet( const QString& itemSetName ) const;
00091 
00092     class IndexedMap;
00093     class NamedMap;
00095     class KOFFICECORE_EXPORT Items
00096     {
00097         friend class KoOasisSettings;
00098         friend class IndexedMap;
00099         friend class NamedMap;
00100         Items( const KoXmlElement& elem, const KoOasisSettings* settings )
00101             : m_element( elem ), m_settings( settings ) {}
00102     public:
00103         bool isNull() const { return m_element.isNull(); }
00104 
00111         IndexedMap indexedMap( const QString& itemMapName ) const;
00112 
00119         NamedMap namedMap( const QString& itemMapName ) const;
00120 
00121         int parseConfigItemInt( const QString& configName, int defValue = 0 ) const;
00122         double parseConfigItemDouble( const QString& configName, double defValue = 0 ) const;
00123         QString parseConfigItemString( const QString& configName, const QString& defValue = QString::null ) const;
00124         bool parseConfigItemBool( const QString& configName, bool defValue = false ) const;
00125         short parseConfigItemShort( const QString& configName, short defValue = 0 ) const;
00126         long parseConfigItemLong( const QString& configName, long defValue = 0 ) const;
00127     private:
00129         QString findConfigItem( const QString& item, bool* ok ) const;
00131         QString findConfigItem( const KoXmlElement& element, const QString& item, bool* ok ) const;
00132 
00133         KoXmlElement m_element;
00134         const KoOasisSettings* m_settings;
00135     };
00136 
00138     class Map
00139     {
00140     public:
00141         bool isNull() const { return m_element.isNull(); }
00142     protected:
00143         Map( const KoXmlElement& elem, const KoOasisSettings* settings )
00144             : m_element( elem ), m_settings( settings ) {}
00145         const KoXmlElement m_element;
00146         const KoOasisSettings* m_settings;
00147     };
00148 
00149     class KOFFICECORE_EXPORT IndexedMap : public Map
00150     {
00151         friend class Items;
00152         IndexedMap( const KoXmlElement& elem, const KoOasisSettings* settings )
00153             : Map( elem, settings ) {}
00154     public:
00156         Items entry( int entryIndex ) const;
00157     };
00158 
00159     class KOFFICECORE_EXPORT NamedMap : public Map
00160     {
00161         friend class Items;
00162         NamedMap( const KoXmlElement& elem, const KoOasisSettings* settings )
00163             : Map( elem, settings ) {}
00164     public:
00166         Items entry( const QString& entryName ) const;
00167     };
00168 
00169 private:
00170     friend class Items;
00171     friend class IndexedMap;
00172     friend class NamedMap;
00173     const KoXmlElement m_settingsElement;
00174     const char* m_configNSURI;
00175 
00176     class Private;
00177     Private* d;
00178 };
00179 
00180 #endif

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