kspread

kspread_style_manager.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Norbert Andres, nandres@web.de
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef __kspread_style_manager__
21#define __kspread_style_manager__
22
23#include <tqmap.h>
24
25#include <koffice_export.h>
26
27class TQDomElement;
28class TQDomDocument;
29class TQStringList;
30
31class KoGenStyles;
32class KoOasisStyles;
33
34namespace KSpread
35{
36class CustomStyle;
37class Sheet;
38class StyleDlg;
39class View;
40
41class KSPREAD_EXPORT StyleManager
42{
43 public:
44 StyleManager();
45 ~StyleManager();
46
47 TQDomElement save( TQDomDocument & doc );
48 bool loadXML( TQDomElement const & styles );
49
50 void saveOasis( KoGenStyles &mainStyles );
51 void loadOasisStyleTemplate( KoOasisStyles& oasisStyles );
52
53 CustomStyle * defaultStyle() const { return m_defaultStyle; }
54 CustomStyle * style( TQString const & name ) const;
55
56 bool checkCircle( TQString const & name, TQString const & parent );
57 bool validateStyleName( TQString const & name, CustomStyle * style );
58 void changeName( TQString const & oldName, TQString const & newName );
59
60 void takeStyle( CustomStyle * style );
61 void createBuiltinStyles();
62
63 TQStringList styleNames() const;
64 int count() const { return m_styles.count(); }
65
75 TQDict<Style> loadOasisAutoStyles( KoOasisStyles& oasisStyles );
76
86 void releaseUnusedAutoStyles( TQDict<Style> autoStyles );
87
88 private:
89 friend class StyleDlg;
90 friend class View;
91 class Styles : public TQMap<TQString, CustomStyle *> {};
92
93 CustomStyle * m_defaultStyle;
94 Styles m_styles; // builtin and custom made styles
95
96 // Same styles as above, but with the internal OpenDocument name as key.
97 // NOTE: Temporary! Only valid while loading OpenDocument files.
98 Styles m_oasisStyles;
99};
100
101} // namespace KSpread
102
103#endif
The KSpread namespace.
Definition commands.h:39