summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-write/qstylesheet.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-write/qstylesheet.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-write/qstylesheet.h221
1 files changed, 221 insertions, 0 deletions
diff --git a/noncore/apps/opie-write/qstylesheet.h b/noncore/apps/opie-write/qstylesheet.h
new file mode 100644
index 0000000..bb209fa
--- a/dev/null
+++ b/noncore/apps/opie-write/qstylesheet.h
@@ -0,0 +1,221 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of the QStyleSheet class
5**
6** Created : 990101
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the kernel module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QSTYLESHEET_H
39#define QSTYLESHEET_H
40
41#ifndef QT_H
42#include "qt3namespace.h"
43#include "qstring.h"
44#include "qvaluelist.h"
45#include "qvector.h"
46#include "qdict.h"
47#include "qobject.h"
48#endif // QT_H
49
50template<class Key, class T> class QMap;
51
52namespace Qt3 {
53
54class QStyleSheet;
55class QTextDocument;
56class QStyleSheetItemData;
57
58class Q_EXPORT QStyleSheetItem : public Qt
59{
60public:
61 QStyleSheetItem( QStyleSheet* parent, const QString& name );
62 QStyleSheetItem( const QStyleSheetItem & );
63 ~QStyleSheetItem();
64
65 QString name() const;
66
67 QStyleSheet* styleSheet();
68 const QStyleSheet* styleSheet() const;
69
70 enum AdditionalStyleValues { Undefined = - 1};
71
72 enum DisplayMode {
73 DisplayBlock,
74 DisplayInline,
75 DisplayListItem,
76 DisplayNone
77 };
78
79 DisplayMode displayMode() const;
80 void setDisplayMode(DisplayMode m);
81
82 int alignment() const;
83 void setAlignment( int f);
84
85 enum VerticalAlignment {
86 VAlignBaseline,
87 VAlignSub,
88 VAlignSuper
89 };
90
91 VerticalAlignment verticalAlignment() const;
92 void setVerticalAlignment( VerticalAlignment valign );
93
94 int fontWeight() const;
95 void setFontWeight(int w);
96
97 int logicalFontSize() const;
98 void setLogicalFontSize(int s);
99
100 int logicalFontSizeStep() const;
101 void setLogicalFontSizeStep( int s );
102
103 int fontSize() const;
104 void setFontSize(int s);
105
106 QString fontFamily() const;
107 void setFontFamily( const QString& );
108
109 int numberOfColumns() const;
110 void setNumberOfColumns(int ncols);
111
112 QColor color() const;
113 void setColor( const QColor &);
114
115 bool fontItalic() const;
116 void setFontItalic( bool );
117 bool definesFontItalic() const;
118
119 bool fontUnderline() const;
120 void setFontUnderline( bool );
121 bool definesFontUnderline() const;
122
123 bool isAnchor() const;
124 void setAnchor(bool anc);
125
126 enum WhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap };
127 WhiteSpaceMode whiteSpaceMode() const;
128 void setWhiteSpaceMode(WhiteSpaceMode m);
129
130 enum Margin {
131 MarginLeft,
132 MarginRight,
133 MarginTop,
134 MarginBottom,
135 MarginFirstLine,
136 MarginAll,
137 MarginVertical,
138 MarginHorizontal
139 };
140
141 int margin( Margin m) const;
142 void setMargin( Margin, int);
143
144 enum ListStyle {
145 ListDisc,
146 ListCircle,
147 ListSquare,
148 ListDecimal,
149 ListLowerAlpha,
150 ListUpperAlpha
151 };
152
153 ListStyle listStyle() const;
154 void setListStyle( ListStyle );
155
156 QString contexts() const;
157 void setContexts( const QString& );
158 bool allowedInContext( const QStyleSheetItem* ) const;
159
160 bool selfNesting() const;
161 void setSelfNesting( bool );
162
163 void setLineSpacing( int ls );
164 int lineSpacing() const;
165
166private:
167 void init();
168 QStyleSheetItemData* d;
169};
170
171
172#if defined(Q_TEMPLATEDLL)
173// MOC_SKIP_BEGIN
174template class Q_EXPORT QDict<QStyleSheetItem>;
175template class Q_EXPORT QValueList< QPtrVector<QStyleSheetItem> >;
176template class Q_EXPORT QPtrVector<QStyleSheetItem>;
177template class Q_EXPORT QValueList<QStyleSheetItem::ListStyle>;
178// MOC_SKIP_END
179#endif
180
181class QTextCustomItem;
182
183class Q_EXPORT QStyleSheet : public QObject
184{
185 Q_OBJECT
186public:
187 QStyleSheet( QObject *parent=0, const char *name=0 );
188 virtual ~QStyleSheet();
189
190 static QStyleSheet* defaultSheet();
191 static void setDefaultSheet( QStyleSheet* );
192
193
194 QStyleSheetItem* item( const QString& name);
195 const QStyleSheetItem* item( const QString& name) const;
196
197 void insert( QStyleSheetItem* item);
198
199 virtual QTextCustomItem* tag( const QString& name,
200 const QMap<QString, QString> &attr,
201 const QString& context,
202 const QMimeSourceFactory& factory,
203 bool emptyTag, QTextDocument *doc ) const;
204
205 static QString escape( const QString& );
206 static QString convertFromPlainText( const QString&, QStyleSheetItem::WhiteSpaceMode mode = QStyleSheetItem::WhiteSpacePre );
207 static bool mightBeRichText( const QString& );
208
209 virtual void scaleFont( QFont& font, int logicalSize ) const;
210
211 virtual void error( const QString& ) const;
212
213private:
214 void init();
215 QDict<QStyleSheetItem> styles;
216 QStyleSheetItem* nullstyle;
217};
218
219} // namespace Qt3
220
221#endif // QSTYLESHEET_H