Index: trunk/BNC/qwt/qwt_text.cpp
===================================================================
--- trunk/BNC/qwt/qwt_text.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_text.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,4 +11,6 @@
 #include "qwt_painter.h"
 #include "qwt_text_engine.h"
+#include "qwt_math.h"
+
 #include <qmap.h>
 #include <qfont.h>
@@ -17,121 +19,146 @@
 #include <qbrush.h>
 #include <qpainter.h>
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-#include <qmath.h>
-
-class QwtTextEngineDict
-{
-public:
-    static QwtTextEngineDict &dict();
-
-    void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
-
-    const QwtTextEngine *textEngine( QwtText::TextFormat ) const;
-    const QwtTextEngine *textEngine( const QString &,
-        QwtText::TextFormat ) const;
-
-private:
-    QwtTextEngineDict();
-    ~QwtTextEngineDict();
-
-    typedef QMap<int, QwtTextEngine *> EngineMap;
-
-    inline const QwtTextEngine *engine( EngineMap::const_iterator &it ) const
-    {
-        return it.value();
-    }
-
-    EngineMap d_map;
-};
-
-QwtTextEngineDict &QwtTextEngineDict::dict()
-{
-    static QwtTextEngineDict engineDict;
-    return engineDict;
-}
-
-QwtTextEngineDict::QwtTextEngineDict()
-{
-    d_map.insert( QwtText::PlainText, new QwtPlainTextEngine() );
-#ifndef QT_NO_RICHTEXT
-    d_map.insert( QwtText::RichText, new QwtRichTextEngine() );
+
+#if QT_VERSION >= 0x050200
+
+static QwtText qwtStringToText( const QString& text )
+{
+    return QwtText( text );
+}
+
 #endif
-}
-
-QwtTextEngineDict::~QwtTextEngineDict()
-{
-    for ( EngineMap::const_iterator it = d_map.constBegin();
-        it != d_map.constEnd(); ++it )
-    {
-        const QwtTextEngine *textEngine = engine( it );
-        delete textEngine;
-    }
-}
-
-const QwtTextEngine *QwtTextEngineDict::textEngine( const QString& text,
-    QwtText::TextFormat format ) const
-{
-    if ( format == QwtText::AutoText )
-    {
-        for ( EngineMap::const_iterator it = d_map.begin();
-            it != d_map.end(); ++it )
+
+namespace
+{
+    static const struct RegisterQwtText
+    {
+        inline RegisterQwtText()
         {
-            if ( it.key() != QwtText::PlainText )
+            qRegisterMetaType< QwtText >();
+
+#if QT_VERSION >= 0x050200
+            QMetaType::registerConverter< QString, QwtText >( qwtStringToText );
+#endif
+        }
+
+    } qwtRegisterQwtText;
+}
+
+namespace
+{
+    class TextEngineDict
+    {
+      public:
+        static TextEngineDict& dict();
+
+        void setTextEngine( QwtText::TextFormat, QwtTextEngine* );
+
+        const QwtTextEngine* textEngine( QwtText::TextFormat ) const;
+        const QwtTextEngine* textEngine( const QString&,
+            QwtText::TextFormat ) const;
+
+      private:
+        TextEngineDict();
+        ~TextEngineDict();
+
+        typedef QMap< int, QwtTextEngine* > EngineMap;
+
+        inline const QwtTextEngine* engine( EngineMap::const_iterator& it ) const
+        {
+            return it.value();
+        }
+
+        EngineMap m_map;
+    };
+
+    TextEngineDict& TextEngineDict::dict()
+    {
+        static TextEngineDict engineDict;
+        return engineDict;
+    }
+
+    TextEngineDict::TextEngineDict()
+    {
+        m_map.insert( QwtText::PlainText, new QwtPlainTextEngine() );
+    #ifndef QT_NO_RICHTEXT
+        m_map.insert( QwtText::RichText, new QwtRichTextEngine() );
+    #endif
+    }
+
+    TextEngineDict::~TextEngineDict()
+    {
+        for ( EngineMap::const_iterator it = m_map.constBegin();
+            it != m_map.constEnd(); ++it )
+        {
+            const QwtTextEngine* textEngine = engine( it );
+            delete textEngine;
+        }
+    }
+
+    const QwtTextEngine* TextEngineDict::textEngine( const QString& text,
+        QwtText::TextFormat format ) const
+    {
+        if ( format == QwtText::AutoText )
+        {
+            for ( EngineMap::const_iterator it = m_map.begin();
+                it != m_map.end(); ++it )
             {
-                const QwtTextEngine *e = engine( it );
-                if ( e && e->mightRender( text ) )
-                    return e;
+                if ( it.key() != QwtText::PlainText )
+                {
+                    const QwtTextEngine* e = engine( it );
+                    if ( e && e->mightRender( text ) )
+                        return e;
+                }
             }
         }
-    }
-
-    EngineMap::const_iterator it = d_map.find( format );
-    if ( it != d_map.end() )
-    {
-        const QwtTextEngine *e = engine( it );
-        if ( e )
-            return e;
-    }
-
-    it = d_map.find( QwtText::PlainText );
-    return engine( it );
-}
-
-void QwtTextEngineDict::setTextEngine( QwtText::TextFormat format,
-    QwtTextEngine *engine )
-{
-    if ( format == QwtText::AutoText )
-        return;
-
-    if ( format == QwtText::PlainText && engine == NULL )
-        return;
-
-    EngineMap::const_iterator it = d_map.constFind( format );
-    if ( it != d_map.constEnd() )
-    {
-        delete this->engine( it );
-        d_map.remove( format );
-    }
-
-    if ( engine != NULL )
-        d_map.insert( format, engine );
-}
-
-const QwtTextEngine *QwtTextEngineDict::textEngine(
-    QwtText::TextFormat format ) const
-{
-    const QwtTextEngine *e = NULL;
-
-    EngineMap::const_iterator it = d_map.find( format );
-    if ( it != d_map.end() )
-        e = engine( it );
-
-    return e;
+
+        EngineMap::const_iterator it = m_map.find( format );
+        if ( it != m_map.end() )
+        {
+            const QwtTextEngine* e = engine( it );
+            if ( e )
+                return e;
+        }
+
+        it = m_map.find( QwtText::PlainText );
+        return engine( it );
+    }
+
+    void TextEngineDict::setTextEngine( QwtText::TextFormat format,
+        QwtTextEngine* engine )
+    {
+        if ( format == QwtText::AutoText )
+            return;
+
+        if ( format == QwtText::PlainText && engine == NULL )
+            return;
+
+        EngineMap::const_iterator it = m_map.constFind( format );
+        if ( it != m_map.constEnd() )
+        {
+            delete this->engine( it );
+            m_map.remove( format );
+        }
+
+        if ( engine != NULL )
+            m_map.insert( format, engine );
+    }
+
+    const QwtTextEngine* TextEngineDict::textEngine(
+        QwtText::TextFormat format ) const
+    {
+        const QwtTextEngine* e = NULL;
+
+        EngineMap::const_iterator it = m_map.find( format );
+        if ( it != m_map.end() )
+            e = engine( it );
+
+        return e;
+    }
 }
 
 class QwtText::PrivateData
 {
-public:
+  public:
     PrivateData():
         renderFlags( Qt::AlignCenter ),
@@ -139,6 +166,4 @@
         borderPen( Qt::NoPen ),
         backgroundBrush( Qt::NoBrush ),
-        paintAttributes( 0 ),
-        layoutAttributes( 0 ),
         textEngine( NULL )
     {
@@ -156,10 +181,10 @@
     QwtText::LayoutAttributes layoutAttributes;
 
-    const QwtTextEngine *textEngine;
+    const QwtTextEngine* textEngine;
 };
 
 class QwtText::LayoutCache
 {
-public:
+  public:
     void invalidate()
     {
@@ -173,25 +198,36 @@
 /*!
    Constructor
+ */
+QwtText::QwtText()
+{
+    m_data = new PrivateData;
+    m_data->textEngine = textEngine( m_data->text, PlainText );
+
+    m_layoutCache = new LayoutCache;
+}
+
+/*!
+   Constructor
 
    \param text Text content
    \param textFormat Text format
-*/
-QwtText::QwtText( const QString &text, QwtText::TextFormat textFormat )
-{
-    d_data = new PrivateData;
-    d_data->text = text;
-    d_data->textEngine = textEngine( text, textFormat );
-
-    d_layoutCache = new LayoutCache;
+ */
+QwtText::QwtText( const QString& text, QwtText::TextFormat textFormat )
+{
+    m_data = new PrivateData;
+    m_data->text = text;
+    m_data->textEngine = textEngine( text, textFormat );
+
+    m_layoutCache = new LayoutCache;
 }
 
 //! Copy constructor
-QwtText::QwtText( const QwtText &other )
-{
-    d_data = new PrivateData;
-    *d_data = *other.d_data;
-
-    d_layoutCache = new LayoutCache;
-    *d_layoutCache = *other.d_layoutCache;
+QwtText::QwtText( const QwtText& other )
+{
+    m_data = new PrivateData;
+    *m_data = *other.m_data;
+
+    m_layoutCache = new LayoutCache;
+    *m_layoutCache = *other.m_layoutCache;
 }
 
@@ -199,32 +235,32 @@
 QwtText::~QwtText()
 {
-    delete d_data;
-    delete d_layoutCache;
+    delete m_data;
+    delete m_layoutCache;
 }
 
 //! Assignment operator
-QwtText &QwtText::operator=( const QwtText & other )
-{
-    *d_data = *other.d_data;
-    *d_layoutCache = *other.d_layoutCache;
+QwtText& QwtText::operator=( const QwtText& other )
+{
+    *m_data = *other.m_data;
+    *m_layoutCache = *other.m_layoutCache;
     return *this;
 }
 
 //! Relational operator
-bool QwtText::operator==( const QwtText &other ) const
-{
-    return d_data->renderFlags == other.d_data->renderFlags &&
-        d_data->text == other.d_data->text &&
-        d_data->font == other.d_data->font &&
-        d_data->color == other.d_data->color &&
-        d_data->borderRadius == other.d_data->borderRadius &&
-        d_data->borderPen == other.d_data->borderPen &&
-        d_data->backgroundBrush == other.d_data->backgroundBrush &&
-        d_data->paintAttributes == other.d_data->paintAttributes &&
-        d_data->textEngine == other.d_data->textEngine;
+bool QwtText::operator==( const QwtText& other ) const
+{
+    return m_data->renderFlags == other.m_data->renderFlags &&
+           m_data->text == other.m_data->text &&
+           m_data->font == other.m_data->font &&
+           m_data->color == other.m_data->color &&
+           m_data->borderRadius == other.m_data->borderRadius &&
+           m_data->borderPen == other.m_data->borderPen &&
+           m_data->backgroundBrush == other.m_data->backgroundBrush &&
+           m_data->paintAttributes == other.m_data->paintAttributes &&
+           m_data->textEngine == other.m_data->textEngine;
 }
 
 //! Relational operator
-bool QwtText::operator!=( const QwtText &other ) const // invalidate
+bool QwtText::operator!=( const QwtText& other ) const // invalidate
 {
     return !( other == *this );
@@ -238,11 +274,11 @@
 
    \sa text()
-*/
-void QwtText::setText( const QString &text,
+ */
+void QwtText::setText( const QString& text,
     QwtText::TextFormat textFormat )
 {
-    d_data->text = text;
-    d_data->textEngine = textEngine( text, textFormat );
-    d_layoutCache->invalidate();
+    m_data->text = text;
+    m_data->textEngine = textEngine( text, textFormat );
+    m_layoutCache->invalidate();
 }
 
@@ -250,8 +286,8 @@
    \return Text as QString.
    \sa setText()
-*/
+ */
 QString QwtText::text() const
 {
-    return d_data->text;
+    return m_data->text;
 }
 
@@ -265,11 +301,11 @@
    \sa renderFlags(), QwtTextEngine::draw()
    \note Some renderFlags might have no effect, depending on the text format.
-*/
+ */
 void QwtText::setRenderFlags( int renderFlags )
 {
-    if ( renderFlags != d_data->renderFlags )
-    {
-        d_data->renderFlags = renderFlags;
-        d_layoutCache->invalidate();
+    if ( renderFlags != m_data->renderFlags )
+    {
+        m_data->renderFlags = renderFlags;
+        m_layoutCache->invalidate();
     }
 }
@@ -278,8 +314,8 @@
    \return Render flags
    \sa setRenderFlags()
-*/
+ */
 int QwtText::renderFlags() const
 {
-    return d_data->renderFlags;
+    return m_data->renderFlags;
 }
 
@@ -290,8 +326,8 @@
    \note Setting the font might have no effect, when
          the text contains control sequences for setting fonts.
-*/
-void QwtText::setFont( const QFont &font )
-{
-    d_data->font = font;
+ */
+void QwtText::setFont( const QFont& font )
+{
+    m_data->font = font;
     setPaintAttribute( PaintUsingTextFont );
 }
@@ -300,5 +336,5 @@
 QFont QwtText::font() const
 {
-    return d_data->font;
+    return m_data->font;
 }
 
@@ -311,9 +347,9 @@
 
    \sa setFont(), font(), PaintAttributes
-*/
-QFont QwtText::usedFont( const QFont &defaultFont ) const
-{
-    if ( d_data->paintAttributes & PaintUsingTextFont )
-        return d_data->font;
+ */
+QFont QwtText::usedFont( const QFont& defaultFont ) const
+{
+    if ( m_data->paintAttributes & PaintUsingTextFont )
+        return m_data->font;
 
     return defaultFont;
@@ -326,8 +362,8 @@
    \note Setting the color might have no effect, when
          the text contains control sequences for setting colors.
-*/
-void QwtText::setColor( const QColor &color )
-{
-    d_data->color = color;
+ */
+void QwtText::setColor( const QColor& color )
+{
+    m_data->color = color;
     setPaintAttribute( PaintUsingTextColor );
 }
@@ -336,20 +372,20 @@
 QColor QwtText::color() const
 {
-    return d_data->color;
-}
-
-/*!
-  Return the color of the text, if it has one.
-  Otherwise return defaultColor.
-
-  \param defaultColor Default color
-  \return Color used for drawing the text
-
-  \sa setColor(), color(), PaintAttributes
-*/
-QColor QwtText::usedColor( const QColor &defaultColor ) const
-{
-    if ( d_data->paintAttributes & PaintUsingTextColor )
-        return d_data->color;
+    return m_data->color;
+}
+
+/*!
+   Return the color of the text, if it has one.
+   Otherwise return defaultColor.
+
+   \param defaultColor Default color
+   \return Color used for drawing the text
+
+   \sa setColor(), color(), PaintAttributes
+ */
+QColor QwtText::usedColor( const QColor& defaultColor ) const
+{
+    if ( m_data->paintAttributes & PaintUsingTextColor )
+        return m_data->color;
 
     return defaultColor;
@@ -357,21 +393,21 @@
 
 /*!
-  Set the radius for the corners of the border frame
-
-  \param radius Radius of a rounded corner
-  \sa borderRadius(), setBorderPen(), setBackgroundBrush()
-*/
+   Set the radius for the corners of the border frame
+
+   \param radius Radius of a rounded corner
+   \sa borderRadius(), setBorderPen(), setBackgroundBrush()
+ */
 void QwtText::setBorderRadius( double radius )
 {
-    d_data->borderRadius = qMax( 0.0, radius );
-}
-
-/*!
-  \return Radius for the corners of the border frame
-  \sa setBorderRadius(), borderPen(), backgroundBrush()
-*/
+    m_data->borderRadius = qwtMaxF( 0.0, radius );
+}
+
+/*!
+   \return Radius for the corners of the border frame
+   \sa setBorderRadius(), borderPen(), backgroundBrush()
+ */
 double QwtText::borderRadius() const
 {
-    return d_data->borderRadius;
+    return m_data->borderRadius;
 }
 
@@ -381,8 +417,8 @@
    \param pen Background pen
    \sa borderPen(), setBackgroundBrush()
-*/
-void QwtText::setBorderPen( const QPen &pen )
-{
-    d_data->borderPen = pen;
+ */
+void QwtText::setBorderPen( const QPen& pen )
+{
+    m_data->borderPen = pen;
     setPaintAttribute( PaintBackground );
 }
@@ -391,8 +427,8 @@
    \return Background pen
    \sa setBorderPen(), backgroundBrush()
-*/
+ */
 QPen QwtText::borderPen() const
 {
-    return d_data->borderPen;
+    return m_data->borderPen;
 }
 
@@ -402,8 +438,8 @@
    \param brush Background brush
    \sa backgroundBrush(), setBorderPen()
-*/
-void QwtText::setBackgroundBrush( const QBrush &brush )
-{
-    d_data->backgroundBrush = brush;
+ */
+void QwtText::setBackgroundBrush( const QBrush& brush )
+{
+    m_data->backgroundBrush = brush;
     setPaintAttribute( PaintBackground );
 }
@@ -412,8 +448,8 @@
    \return Background brush
    \sa setBackgroundBrush(), borderPen()
-*/
+ */
 QBrush QwtText::backgroundBrush() const
 {
-    return d_data->backgroundBrush;
+    return m_data->backgroundBrush;
 }
 
@@ -427,11 +463,11 @@
          setBorderPen() and setBackgroundBrush()
    \sa testPaintAttribute()
-*/
+ */
 void QwtText::setPaintAttribute( PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 }
 
@@ -443,8 +479,8 @@
 
    \sa setPaintAttribute()
-*/
+ */
 bool QwtText::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return d_data->paintAttributes & attribute;
+    return m_data->paintAttributes & attribute;
 }
 
@@ -455,11 +491,11 @@
    \param on On/Off
    \sa testLayoutAttribute()
-*/
+ */
 void QwtText::setLayoutAttribute( LayoutAttribute attribute, bool on )
 {
     if ( on )
-        d_data->layoutAttributes |= attribute;
+        m_data->layoutAttributes |= attribute;
     else
-        d_data->layoutAttributes &= ~attribute;
+        m_data->layoutAttributes &= ~attribute;
 }
 
@@ -471,8 +507,20 @@
 
    \sa setLayoutAttribute()
-*/
+ */
 bool QwtText::testLayoutAttribute( LayoutAttribute attribute ) const
 {
-    return d_data->layoutAttributes | attribute;
+    return m_data->layoutAttributes | attribute;
+}
+
+/*!
+   Find the height for a given width
+
+   \param width Width
+   \return Calculated height
+ */
+
+double QwtText::heightForWidth( double width ) const
+{
+    return heightForWidth( width, QFont() );
 }
 
@@ -484,22 +532,22 @@
 
    \return Calculated height
-*/
-double QwtText::heightForWidth( double width, const QFont &defaultFont ) const
+ */
+double QwtText::heightForWidth( double width, const QFont& defaultFont ) const
 {
     // We want to calculate in screen metrics. So
     // we need a font that uses screen metrics
 
-    const QFont font( usedFont( defaultFont ), QApplication::desktop() );
+    const QFont font = QwtPainter::scaledFont( usedFont( defaultFont ) );
 
     double h = 0;
 
-    if ( d_data->layoutAttributes & MinimumLayout )
+    if ( m_data->layoutAttributes & MinimumLayout )
     {
         double left, right, top, bottom;
-        d_data->textEngine->textMargins( font, d_data->text,
+        m_data->textEngine->textMargins( font, m_data->text,
             left, right, top, bottom );
 
-        h = d_data->textEngine->heightForWidth(
-            font, d_data->renderFlags, d_data->text,
+        h = m_data->textEngine->heightForWidth(
+            font, m_data->renderFlags, m_data->text,
             width + left + right );
 
@@ -508,9 +556,19 @@
     else
     {
-        h = d_data->textEngine->heightForWidth(
-            font, d_data->renderFlags, d_data->text, width );
+        h = m_data->textEngine->heightForWidth(
+            font, m_data->renderFlags, m_data->text, width );
     }
 
     return h;
+}
+
+/*!
+   Returns the size, that is needed to render text
+
+   \return Calculated size
+ */
+QSizeF QwtText::textSize() const
+{
+    return textSize( QFont() );
 }
 
@@ -520,26 +578,26 @@
    \param defaultFont Font of the text
    \return Calculated size
-*/
-QSizeF QwtText::textSize( const QFont &defaultFont ) const
+ */
+QSizeF QwtText::textSize( const QFont& defaultFont ) const
 {
     // We want to calculate in screen metrics. So
     // we need a font that uses screen metrics
 
-    const QFont font( usedFont( defaultFont ), QApplication::desktop() );
-
-    if ( !d_layoutCache->textSize.isValid()
-        || d_layoutCache->font != font )
-    {
-        d_layoutCache->textSize = d_data->textEngine->textSize(
-            font, d_data->renderFlags, d_data->text );
-        d_layoutCache->font = font;
-    }
-
-    QSizeF sz = d_layoutCache->textSize;
-
-    if ( d_data->layoutAttributes & MinimumLayout )
+    const QFont font = QwtPainter::scaledFont( usedFont( defaultFont ) );
+
+    if ( !m_layoutCache->textSize.isValid()
+        || m_layoutCache->font != font )
+    {
+        m_layoutCache->textSize = m_data->textEngine->textSize(
+            font, m_data->renderFlags, m_data->text );
+        m_layoutCache->font = font;
+    }
+
+    QSizeF sz = m_layoutCache->textSize;
+
+    if ( m_data->layoutAttributes & MinimumLayout )
     {
         double left, right, top, bottom;
-        d_data->textEngine->textMargins( font, d_data->text,
+        m_data->textEngine->textMargins( font, m_data->text,
             left, right, top, bottom );
         sz -= QSizeF( left + right, top + bottom );
@@ -554,18 +612,18 @@
    \param painter Painter
    \param rect Rectangle
-*/
-void QwtText::draw( QPainter *painter, const QRectF &rect ) const
-{
-    if ( d_data->paintAttributes & PaintBackground )
-    {
-        if ( d_data->borderPen != Qt::NoPen ||
-            d_data->backgroundBrush != Qt::NoBrush )
+ */
+void QwtText::draw( QPainter* painter, const QRectF& rect ) const
+{
+    if ( m_data->paintAttributes & PaintBackground )
+    {
+        if ( m_data->borderPen != Qt::NoPen ||
+            m_data->backgroundBrush != Qt::NoBrush )
         {
             painter->save();
 
-            painter->setPen( d_data->borderPen );
-            painter->setBrush( d_data->backgroundBrush );
-
-            if ( d_data->borderRadius == 0 )
+            painter->setPen( m_data->borderPen );
+            painter->setBrush( m_data->backgroundBrush );
+
+            if ( m_data->borderRadius == 0 )
             {
                 QwtPainter::drawRect( painter, rect );
@@ -575,5 +633,5 @@
                 painter->setRenderHint( QPainter::Antialiasing, true );
                 painter->drawRoundedRect( rect,
-                    d_data->borderRadius, d_data->borderRadius );
+                    m_data->borderRadius, m_data->borderRadius );
             }
 
@@ -584,26 +642,26 @@
     painter->save();
 
-    if ( d_data->paintAttributes & PaintUsingTextFont )
-    {
-        painter->setFont( d_data->font );
-    }
-
-    if ( d_data->paintAttributes & PaintUsingTextColor )
-    {
-        if ( d_data->color.isValid() )
-            painter->setPen( d_data->color );
+    if ( m_data->paintAttributes & PaintUsingTextFont )
+    {
+        painter->setFont( m_data->font );
+    }
+
+    if ( m_data->paintAttributes & PaintUsingTextColor )
+    {
+        if ( m_data->color.isValid() )
+            painter->setPen( m_data->color );
     }
 
     QRectF expandedRect = rect;
-    if ( d_data->layoutAttributes & MinimumLayout )
+    if ( m_data->layoutAttributes & MinimumLayout )
     {
         // We want to calculate in screen metrics. So
         // we need a font that uses screen metrics
 
-        const QFont font( painter->font(), QApplication::desktop() );
+        const QFont font = QwtPainter::scaledFont( painter->font() );
 
         double left, right, top, bottom;
-        d_data->textEngine->textMargins(
-            font, d_data->text, left, right, top, bottom );
+        m_data->textEngine->textMargins(
+            font, m_data->text, left, right, top, bottom );
 
         expandedRect.setTop( rect.top() - top );
@@ -613,6 +671,6 @@
     }
 
-    d_data->textEngine->draw( painter, expandedRect,
-        d_data->renderFlags, d_data->text );
+    m_data->textEngine->draw( painter, expandedRect,
+        m_data->renderFlags, m_data->text );
 
     painter->restore();
@@ -627,5 +685,5 @@
 
    If no text engine is registered for the format QwtPlainTextEngine
-   is returnd.
+   is returned.
 
    \param text Text, needed in case of AutoText
@@ -633,9 +691,9 @@
 
    \return Corresponding text engine
-*/
-const QwtTextEngine *QwtText::textEngine( const QString &text,
+ */
+const QwtTextEngine* QwtText::textEngine( const QString& text,
     QwtText::TextFormat format )
 {
-    return QwtTextEngineDict::dict().textEngine( text, format );
+    return TextEngineDict::dict().textEngine( text, format );
 }
 
@@ -651,11 +709,10 @@
    \param engine Text engine
 
-   \sa QwtMathMLTextEngine
    \warning Using QwtText::AutoText does nothing.
-*/
+ */
 void QwtText::setTextEngine( QwtText::TextFormat format,
-    QwtTextEngine *engine )
-{
-    QwtTextEngineDict::dict().setTextEngine( format, engine );
+    QwtTextEngine* engine )
+{
+    TextEngineDict::dict().setTextEngine( format, engine );
 }
 
@@ -667,7 +724,20 @@
    \param format Text format
    \return The text engine, or NULL if no engine is available.
-*/
-const QwtTextEngine *QwtText::textEngine( QwtText::TextFormat format )
-{
-    return  QwtTextEngineDict::dict().textEngine( format );
-}
+ */
+const QwtTextEngine* QwtText::textEngine( QwtText::TextFormat format )
+{
+    return TextEngineDict::dict().textEngine( format );
+}
+
+//! \return text().isNull()
+bool QwtText::isNull() const
+{
+    return m_data->text.isNull();
+}
+
+//! \return text().isEmpty()
+bool QwtText::isEmpty() const
+{
+    return m_data->text.isEmpty();
+}
+
