lib

KoUserStyleCollection.h
1/* This file is part of the KDE project
2 Copyright (C) 2005 David Faure <faure@kde.org>
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 version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#ifndef KOUSERSTYLECOLLECTION_H
20#define KOUSERSTYLECOLLECTION_H
21
22class KoUserStyle;
23#include <koffice_export.h>
24#include <tqstringlist.h>
25
32class KOTEXT_EXPORT KoUserStyleCollection
33{
34public:
40 KoUserStyleCollection( const TQString& prefix );
41
47
51 void clear();
52
56 bool isEmpty() const { return m_styleList.isEmpty(); }
60 int count() const { return m_styleList.count(); }
64 int indexOf( KoUserStyle* style ) const { return m_styleList.findIndex( style ); }
65
69 TQValueList<KoUserStyle *> styleList() const { return m_styleList; }
70
76 TQString generateUniqueName() const;
77
81 TQStringList displayNameList() const;
82
89 KoUserStyle* findStyle( const TQString & name, const TQString& defaultStyleName ) const;
90
98 KoUserStyle* findStyleByDisplayName( const TQString& displayName ) const;
99
104 void removeStyle( KoUserStyle *style );
105
111 void updateStyleListOrder( const TQStringList& list );
112
123 KoUserStyle* addStyle( KoUserStyle* sty );
124
129 bool isDefault() const { return m_default; }
133 void setDefault( bool d ) { m_default = d; }
134
135protected:
137 void operator=( const KoUserStyleCollection& rhs );
138
139 TQValueList<KoUserStyle *> m_styleList;
140
141private:
142 TQValueList<KoUserStyle *> m_deletedStyles;
143 const TQString m_prefix;
144 // can become d pointer if needed
145 mutable KoUserStyle *m_lastStyle;
146 bool m_default;
147 bool m_unused1;
148 bool m_unused2;
149 bool m_unused3;
150};
151
152
153#endif /* KOUSERSTYLECOLLECTION_H */
154
Generic style collection class, for all "user styles" (see KoUserStyle).
TQValueList< KoUserStyle * > styleList() const
Return the list of all styles in the collection.
int indexOf(KoUserStyle *style) const
void setDefault(bool d)
Set whether this collection only holds the default styles provided by the application.
KoUserStyleCollection(const KoUserStyleCollection &rhs)
forbidden
void operator=(const KoUserStyleCollection &rhs)
forbidden
Base class for any kind of style that the user can create/modify/delete/display.
Definition KoUserStyle.h:34