summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-write/qcomplextext_p.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-write/qcomplextext_p.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-write/qcomplextext_p.h133
1 files changed, 133 insertions, 0 deletions
diff --git a/noncore/apps/opie-write/qcomplextext_p.h b/noncore/apps/opie-write/qcomplextext_p.h
new file mode 100644
index 0000000..b2d8293
--- a/dev/null
+++ b/noncore/apps/opie-write/qcomplextext_p.h
@@ -0,0 +1,133 @@
1/****************************************************************************
2** $Id$
3**
4** Internal header file.
5**
6** Created :
7**
8** Copyright (C) 2001 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 QCOMPLEXTEXT_H
39#define QCOMPLEXTEXT_H
40
41//
42// W A R N I N G
43// -------------
44//
45// This file is not part of the Qt API. It exists for the convenience
46// of Qt Remote Control. This header file may change from version to
47// version without notice, or even be removed.
48//
49// We mean it.
50//
51//
52
53#ifndef QT_H
54#include "qt3namespace.h"
55#include <qstring.h>
56#include <qpointarray.h>
57#include <qfont.h>
58#include <qpainter.h>
59#include <qlist.h>
60#include <qshared.h>
61#endif // QT_H
62
63class QFontPrivate;
64
65namespace Qt3 {
66
67// bidi helper classes. Internal to Qt
68struct Q_EXPORT QBidiStatus {
69 QBidiStatus() {
70 eor = QChar::DirON;
71 lastStrong = QChar::DirON;
72 last = QChar:: DirON;
73 }
74 QChar::Direction eor;
75 QChar::Direction lastStrong;
76 QChar::Direction last;
77};
78
79struct Q_EXPORT QBidiContext : public QShared {
80 // ### ref and deref parent?
81 QBidiContext( uchar level, QChar::Direction embedding, QBidiContext *parent = 0, bool override = FALSE );
82 ~QBidiContext();
83
84 unsigned char level;
85 bool override : 1;
86 QChar::Direction dir : 5;
87
88 QBidiContext *parent;
89};
90
91struct Q_EXPORT QBidiControl {
92 QBidiControl() { context = 0; }
93 QBidiControl( QBidiContext *c, QBidiStatus s)
94 { context = c; if( context ) context->ref(); status = s; }
95 ~QBidiControl() { if ( context && context->deref() ) delete context; }
96 void setContext( QBidiContext *c ) { if ( context == c ) return; if ( context && context->deref() ) delete context; context = c; context->ref(); }
97 QBidiContext *context;
98 QBidiStatus status;
99};
100
101struct Q_EXPORT QTextRun {
102 QTextRun(int _start, int _stop, QBidiContext *context, QChar::Direction dir);
103
104 int start;
105 int stop;
106 // explicit + implicit levels here
107 uchar level;
108};
109
110class Q_EXPORT QComplexText {
111public:
112 enum Shape {
113 XIsolated,
114 XFinal,
115 XInitial,
116 XMedial
117 };
118 static Shape glyphVariant( const QString &str, int pos);
119 static Shape glyphVariantLogical( const QString &str, int pos);
120
121 static QChar shapedCharacter(const QString &str, int pos, const QFontMetrics *fm = 0);
122
123 // positions non spacing marks relative to the base character at position pos.
124 static QPointArray positionMarks( QFontPrivate *f, const QString &str, int pos, QRect *boundingRect = 0 );
125
126 static QPtrList<QTextRun> *bidiReorderLine( QBidiControl *control, const QString &str, int start, int len,
127 QChar::Direction basicDir = QChar::DirON );
128 static QString bidiReorderString( const QString &str, QChar::Direction basicDir = QChar::DirON );
129};
130
131} // namespace Qt3
132
133#endif