home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / private / qcomplextext_p.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  133 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qcomplextext_p.h   3.0.0   edited Sep 30 17:14 $
  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 <qstring.h>
  55. #include <qpointarray.h>
  56. #include <qfont.h>
  57. #include <qpainter.h>
  58. #include <qptrlist.h>
  59. #include <qshared.h>
  60. #endif // QT_H
  61.  
  62. #ifndef QT_NO_COMPLEXTEXT
  63.  
  64. // bidi helper classes. Internal to Qt
  65. struct Q_EXPORT QBidiStatus {
  66.     QBidiStatus() {
  67.     eor = QChar::DirON;
  68.     lastStrong = QChar::DirON;
  69.     last = QChar:: DirON;
  70.     }
  71.     QChar::Direction eor;
  72.     QChar::Direction lastStrong;
  73.     QChar::Direction last;
  74. };
  75.  
  76. struct Q_EXPORT QBidiContext : public QShared {
  77.     // ### ref and deref parent?
  78.     QBidiContext( uchar level, QChar::Direction embedding, QBidiContext *parent = 0, bool override = FALSE );
  79.     ~QBidiContext();
  80.  
  81.     unsigned char level;
  82.     bool override : 1;
  83.     QChar::Direction dir : 5;
  84.  
  85.     QBidiContext *parent;
  86. };
  87.  
  88. struct Q_EXPORT QBidiControl {
  89.     QBidiControl() { context = 0; }
  90.     QBidiControl( QBidiContext *c, QBidiStatus s)
  91.     { context = c; if( context ) context->ref(); status = s; }
  92.     ~QBidiControl() { if ( context && context->deref() ) delete context; }
  93.     void setContext( QBidiContext *c ) { if ( context == c ) return; if ( context && context->deref() ) delete context; context = c; context->ref(); }
  94.     QBidiContext *context;
  95.     QBidiStatus status;
  96. };
  97.  
  98. struct Q_EXPORT QTextRun {
  99.     QTextRun(int _start, int _stop, QBidiContext *context, QChar::Direction dir);
  100.  
  101.     int start;
  102.     int stop;
  103.     // explicit + implicit levels here
  104.     uchar level;
  105. };
  106.  
  107. class Q_EXPORT QComplexText {
  108. public:
  109.     enum Shape {
  110.     XIsolated,
  111.     XFinal,
  112.     XInitial,
  113.     XMedial
  114.     };
  115.     static Shape glyphVariant( const QString &str, int pos);
  116.     static Shape glyphVariantLogical( const QString &str, int pos);
  117.  
  118.     static QString shapedString( const QString &str, int from = 0, int len = -1, QPainter::TextDirection dir = QPainter::Auto);
  119.     static QChar shapedCharacter(const QString &str, int pos);
  120.  
  121.     // positions non spacing marks relative to the base character at position pos.
  122.     static QPointArray positionMarks( QFontPrivate *f, const QString &str, int pos, QRect *boundingRect = 0 );
  123.  
  124.     static QPtrList<QTextRun> *bidiReorderLine( QBidiControl *control, const QString &str, int start, int len, 
  125.                         QChar::Direction basicDir = QChar::DirON );
  126.     static QString bidiReorderString( const QString &str, QChar::Direction basicDir = QChar::DirON );
  127. };
  128.  
  129.  
  130. #endif //QT_NO_COMPLEXTEXT
  131.  
  132. #endif
  133.