F:/KPlato/koffice/libs/kotext/KoComplexText.h

Aller à la documentation de ce fichier.
00001 /****************************************************************************
00002 ** $Id: KoComplexText.h 589972 2006-09-29 04:34:44Z ybodson $
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 #include <koffice_export.h>
00042 
00043 #include <QString>
00044 #include <q3pointarray.h>
00045 #include <QFont>
00046 #include <QPainter>
00047 #include <q3ptrlist.h>
00048 #include <q3shared.h>
00049 #include <QPainter>
00050 
00051 // bidi helper classes. Internal to Qt
00052 struct KOTEXT_EXPORT KoBidiStatus {
00053     KoBidiStatus() {
00054         eor = QChar::DirON;
00055         lastStrong = QChar::DirON;
00056         last = QChar:: DirON;
00057     }
00058     QChar::Direction eor;
00059     QChar::Direction lastStrong;
00060     QChar::Direction last;
00061 };
00062 
00063 struct KOTEXT_EXPORT KoBidiContext : public Q3Shared {
00064     // ### ref and deref parent?
00065     KoBidiContext( uchar level, QChar::Direction embedding, KoBidiContext *parent = 0, bool override = false );
00066     ~KoBidiContext();
00067 
00068     unsigned char level;
00069     bool override : 1;
00070     QChar::Direction dir : 5;
00071 
00072     KoBidiContext *parent;
00073 };
00074 
00075 struct KOTEXT_EXPORT KoBidiControl {
00076     KoBidiControl() { context = 0; }
00077     KoBidiControl( KoBidiContext *c, KoBidiStatus s)
00078     { context = c; if( context ) context->ref(); status = s; }
00079     ~KoBidiControl() { if ( context && context->deref() ) delete context; }
00080     void setContext( KoBidiContext *c ) { if ( context == c ) return; if ( context && context->deref() ) delete context; context = c; context->ref(); }
00081     KoBidiContext *context;
00082     KoBidiStatus status;
00083 };
00084 
00085 struct KOTEXT_EXPORT KoTextRun {
00086     KoTextRun(int _start, int _stop, KoBidiContext *context, QChar::Direction dir);
00087 
00088     int start;
00089     int stop;
00090     // explicit + implicit levels here
00091     uchar level;
00092 };
00093 
00094 class KOTEXT_EXPORT KoComplexText {
00095 public:
00096     enum Shape {
00097         XIsolated,
00098         XFinal,
00099         XInitial,
00100         XMedial
00101     };
00102     static Shape glyphVariant( const QString &str, int pos);
00103     static Shape glyphVariantLogical( const QString &str, int pos);
00104 
00105     static QString shapedString( const QString &str, int from = 0, int len = -1, QPainter::LayoutDirection dir = QPainter::Auto, const QFontMetrics *fm = 0);
00106     static QChar shapedCharacter(const QString &str, int pos, const QFontMetrics *fm = 0);
00107 
00108     // positions non spacing marks relative to the base character at position pos.
00109     //static QPointArray positionMarks( QFontPrivate *f, const QString &str, int pos, QRect *boundingRect = 0 );
00110 
00111     static Q3PtrList<KoTextRun> *bidiReorderLine( KoBidiControl *control, const QString &str, int start, int len,
00112                                                 QChar::Direction basicDir = QChar::DirON );
00113     static QString bidiReorderString( const QString &str, QChar::Direction basicDir = QChar::DirON );
00114 };
00115 
00116 #endif

Généré le Wed Nov 22 23:41:07 2006 pour KPlato par  doxygen 1.5.1-p1