bidi.h Source File (khtml Library)

| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# bidi.h

    00001 /*
    00002  * This file is part of the html renderer for KDE.
    00003  *
    00004  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the GNU Library General Public
    00008  * License as published by the Free Software Foundation; either
    00009  * version 2 of the License, or (at your option) any later version.
    00010  *
    00011  * This library is distributed in the hope that it will be useful,
    00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  * Library General Public License for more details.
    00015  *
    00016  * You should have received a copy of the GNU Library General Public License
    00017  * along with this library; see the file COPYING.LIB.  If not, write to
    00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019  * Boston, MA 02111-1307, USA.
    00020  *
    00021  * $Id: bidi.h,v 1.14.2.1 2003/05/18 12:34:40 mueller Exp $
    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         // refcounting....
    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             // add level of run (cases I1 & I2)
    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         // explicit + implicit levels here
    00083         uchar level;
    00084     };
    00085
    00086     // an iterator which goes through a BidiParagraph
    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             // ### isText ?
    00099         }
    00100
    00101         void operator ++ ();
    00102
    00103         bool atEnd() const;
    00104
    00105         const QChar &current() 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.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:28 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001