1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwCssStyleRule_h_
21 #define _KwCssStyleRule_h_
24 * @file KwCssStyleRule.h
25 * @brief Rule for apply cascading styles.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwCssScopeKey.h"
30 #include "KwCssStyles.h"
32 #include "CountedReference.h"
34 #include <kdemacros.h>
37 #include <QStringList>
41 /// Rule for apply cascading styles.
42 class KDE_EXPORT KwCssStyleRule
51 typedef QList
<KwCssScopeKey
> KeyList
;
54 typedef QSet
<QString
> StringSet
;
57 * Constructors + destructors
60 /// Default constructor.
64 virtual ~KwCssStyleRule();
70 /// Set the set of critieria keys.
71 void setCriteriaKeys(const KeyList
& keys
);
73 /// Set the set of required classes.
74 void setCriteriaClasses(const StringSet
& classes
);
76 /// Set the set of included classes.
77 void setIncludedStyles(const StringSet
& includes
);
80 void setRawStyle(const QString
& name
, KwCssAbstractStyle
* style
);
82 /// Set a style of a particular type.
84 void setStyle(const QString
& name
, const T
& value
)
86 m_styles
->setStyle
<T
>(name
, value
);
93 /// Get the list of criteria keys.
94 KeyList
& getCriteriaKeys();
96 /// Get the set of criteria classes.
97 StringSet
& getCriteriaClasses();
99 /// Get the list of included styles.
100 const StringSet
& getIncludedStyles() const;
103 ReferenceCountedExtension
<KwCssStyles
>* getStyles() const;
105 /// Convert to CSS-like format.
106 QString
toString() const;
114 /// List of (sequences of scope keys to match in order).
115 KeyList m_criteriaKeys
;
117 /// Classes required to match.
118 StringSet m_criteriaClasses
;
124 /// Names of included classes.
125 StringSet m_includedStyles
;
128 Reference
<ReferenceCountedExtension
<KwCssStyles
> > m_styles
;
131 #endif // _KwCssStyleRule_h_