lib Library API Documentation

qcomplextext_p.h

00001 /****************************************************************************
00002 ** $Id: qcomplextext_p.h,v 1.7 2002/04/05 16:23:58 faure Exp $
00003 **
00004 ** Internal header file.
00005 **
00006 ** Created :
00007 **
00008 ** Copyright (C) 2001 Trolltech AS.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech AS of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QCOMPLEXTEXT_H
00039 #define QCOMPLEXTEXT_H
00040 
00041 //
00042 //  W A R N I N G
00043 //  -------------
00044 //
00045 // This file is not part of the Qt API.  It exists for the convenience
00046 // of Qt Remote Control. This header file may change from version to
00047 // version without notice, or even be removed.
00048 //
00049 // We mean it.
00050 //
00051 //
00052 
00053 #ifndef QT_H
00054 #include <qstring.h>
00055 #include <qpointarray.h>
00056 #include <qfont.h>
00057 #include <qpainter.h>
00058 #include <qptrlist.h>
00059 #include <qshared.h>
00060 #endif // QT_H
00061 
00062 #ifndef QT_NO_COMPLEXTEXT
00063 
00064 // bidi helper classes. Internal to Qt
00065 struct Q_EXPORT KoBidiStatus {
00066     KoBidiStatus() {
00067     eor = QChar::DirON;
00068     lastStrong = QChar::DirON;
00069     last = QChar:: DirON;
00070     }
00071     QChar::Direction eor;
00072     QChar::Direction lastStrong;
00073     QChar::Direction last;
00074 };
00075 
00076 struct Q_EXPORT KoBidiContext : public QShared {
00077     // ### ref and deref parent?
00078     KoBidiContext( uchar level, QChar::Direction embedding, KoBidiContext *parent = 0, bool override = FALSE );
00079     ~KoBidiContext();
00080 
00081     unsigned char level;
00082     bool override : 1;
00083     QChar::Direction dir : 5;
00084 
00085     KoBidiContext *parent;
00086 };
00087 
00088 struct Q_EXPORT KoBidiControl {
00089     KoBidiControl() { context = 0; }
00090     KoBidiControl( KoBidiContext *c, KoBidiStatus s)
00091     { context = c; if( context ) context->ref(); status = s; }
00092     ~KoBidiControl() { if ( context && context->deref() ) delete context; }
00093     void setContext( KoBidiContext *c ) { if ( context == c ) return; if ( context && context->deref() ) delete context; context = c; context->ref(); }
00094     KoBidiContext *context;
00095     KoBidiStatus status;
00096 };
00097 
00098 struct Q_EXPORT KoTextRun {
00099     KoTextRun(int _start, int _stop, KoBidiContext *context, QChar::Direction dir);
00100 
00101     int start;
00102     int stop;
00103     // explicit + implicit levels here
00104     uchar level;
00105 };
00106 
00107 class Q_EXPORT KoComplexText {
00108 public:
00109     enum Shape {
00110     XIsolated,
00111     XFinal,
00112     XInitial,
00113     XMedial
00114     };
00115     static Shape glyphVariant( const QString &str, int pos);
00116     static Shape glyphVariantLogical( const QString &str, int pos);
00117 
00118     static QString shapedString( const QString &str, int from = 0, int len = -1, QPainter::TextDirection dir = QPainter::Auto, const QFontMetrics *fm = 0);
00119     static QChar shapedCharacter(const QString &str, int pos, const QFontMetrics *fm = 0);
00120 
00121     // positions non spacing marks relative to the base character at position pos.
00122     //static QPointArray positionMarks( QFontPrivate *f, const QString &str, int pos, QRect *boundingRect = 0 );
00123 
00124     static QPtrList<KoTextRun> *bidiReorderLine( KoBidiControl *control, const QString &str, int start, int len,
00125                         QChar::Direction basicDir = QChar::DirON );
00126     static QString bidiReorderString( const QString &str, QChar::Direction basicDir = QChar::DirON );
00127 };
00128 
00129 #endif //QT_NO_COMPLEXTEXT
00130 
00131 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:28 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003