bidi.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef BIDI_H
00024 #define BIDI_H
00025
00026 #include <qstring.h>
00027
00028 namespace khtml {
00029 class RenderFlow;
00030 class RenderObject;
00031
00032 class BidiContext {
00033 public:
00034 BidiContext(unsigned char level, QChar::Direction embedding, BidiContext *parent = 0, bool override = false);
00035 ~BidiContext();
00036
00037 void ref() const;
00038 void deref() const;
00039
00040 unsigned char level;
00041 bool override : 1;
00042 QChar::Direction dir : 5;
00043 QChar::Direction basicDir : 5;
00044
00045 BidiContext *parent;
00046
00047
00048
00049 mutable int count;
00050 };
00051
00052 struct BidiRun {
00053 BidiRun(int _start, int _stop, RenderObject *_obj, BidiContext *context, QChar::Direction dir)
00054 : vertical( 0 ), baseline( 0 ), height( 0 ), width( 0 ),
00055 start( _start ), stop( _stop ), obj( _obj )
00056 {
00057 if(dir == QChar::DirON) dir = context->dir;
00058
00059 level = context->level;
00060
00061
00062 if( level % 2 ) {
00063 if(dir == QChar::DirL || dir == QChar::DirAN || dir == QChar::DirEN )
00064 level++;
00065 } else {
00066 if( dir == QChar::DirR )
00067 level++;
00068 else if( dir == QChar::DirAN || dir == QChar::DirEN )
00069 level += 2;
00070 }
00071 }
00072
00073 int vertical;
00074 short baseline;
00075 short height;
00076 int width;
00077
00078 int start;
00079 int stop;
00080 RenderObject *obj;
00081
00082
00083 uchar level;
00084 };
00085
00086
00087 class BidiIterator
00088 {
00089 public:
00090 BidiIterator();
00091 BidiIterator(RenderFlow *par);
00092 BidiIterator(RenderFlow *par, RenderObject *_obj, int _pos = 0);
00093
00094 BidiIterator(const BidiIterator &it);
00095 BidiIterator &operator = (const BidiIterator &it);
00096 void operator= (RenderObject* _obj) {
00097 obj = _obj; pos = 0;
00098
00099 }
00100
00101 void operator ++ ();
00102
00103 bool atEnd() const;
00104
00105 const QChar ¤t() const;
00106 QChar::Direction direction() const;
00107
00108 RenderFlow *par;
00109 RenderObject *obj;
00110 bool isText : 1;
00111 unsigned int pos : 30;
00112 };
00113
00114 struct BidiStatus {
00115 BidiStatus() {
00116 eor = QChar::DirON;
00117 lastStrong = QChar::DirON;
00118 last = QChar:: DirON;
00119 }
00120 QChar::Direction eor : 5;
00121 QChar::Direction lastStrong : 5;
00122 QChar::Direction last : 5;
00123 };
00124
00125 }
00126
00127 #endif
This file is part of the documentation for kdelibs Version 3.1.4.