kspread

kspread_style_manager.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Norbert Andres, nandres@web.de
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __kspread_style_manager__
00021 #define __kspread_style_manager__
00022 
00023 #include <qmap.h>
00024 
00025 #include <koffice_export.h>
00026 
00027 class QDomElement;
00028 class QDomDocument;
00029 class QStringList;
00030 
00031 class KoGenStyles;
00032 class KoOasisStyles;
00033 
00034 namespace KSpread
00035 {
00036 class CustomStyle;
00037 class Sheet;
00038 class StyleDlg;
00039 class View;
00040 
00041 class KSPREAD_EXPORT StyleManager
00042 {
00043  public:
00044   StyleManager();
00045   ~StyleManager();
00046 
00047   QDomElement save( QDomDocument & doc );
00048   bool loadXML( QDomElement const & styles );
00049 
00050     void saveOasis( KoGenStyles &mainStyles );
00051     void loadOasisStyleTemplate(  KoOasisStyles& oasisStyles );
00052 
00053   CustomStyle * defaultStyle() const { return m_defaultStyle; }
00054   CustomStyle * style( QString const & name ) const;
00055 
00056   bool checkCircle( QString const & name, QString const & parent );
00057   bool validateStyleName( QString const & name, CustomStyle * style );
00058   void changeName( QString const & oldName, QString const & newName );
00059 
00060   void takeStyle( CustomStyle * style );
00061   void createBuiltinStyles();
00062 
00063   QStringList styleNames() const;
00064   int count() const { return m_styles.count(); }
00065 
00066  private:
00067   friend class StyleDlg;
00068   friend class View;
00069   class Styles : public QMap<QString, CustomStyle *> {};
00070 
00071   CustomStyle * m_defaultStyle;
00072   Styles               m_styles; // builtin and custom made styles
00073 };
00074 
00075 } // namespace KSpread
00076 
00077 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys