Index: trunk/BNC/qwt/qwt_null_paintdevice.cpp
===================================================================
--- trunk/BNC/qwt/qwt_null_paintdevice.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_null_paintdevice.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,9 +11,8 @@
 #include <qpaintengine.h>
 #include <qpainterpath.h>
-#include <qpixmap.h>
 
 class QwtNullPaintDevice::PrivateData
 {
-public:
+  public:
     PrivateData():
         mode( QwtNullPaintDevice::NormalMode )
@@ -24,53 +23,57 @@
 };
 
-class QwtNullPaintDevice::PaintEngine: public QPaintEngine
-{
-public:
+class QwtNullPaintDevice::PaintEngine QWT_FINAL : public QPaintEngine
+{
+  public:
     PaintEngine();
 
-    virtual bool begin( QPaintDevice * );
-    virtual bool end();
-
-    virtual Type type () const;
-    virtual void updateState(const QPaintEngineState &);
-
-    virtual void drawRects(const QRect *, int );
-    virtual void drawRects(const QRectF *, int );
-
-    virtual void drawLines(const QLine *, int );
-    virtual void drawLines(const QLineF *, int );
-
-    virtual void drawEllipse(const QRectF &);
-    virtual void drawEllipse(const QRect &);
-
-    virtual void drawPath(const QPainterPath &);
-
-    virtual void drawPoints(const QPointF *, int );
-    virtual void drawPoints(const QPoint *, int );
-
-    virtual void drawPolygon(const QPointF *, int , PolygonDrawMode );
-    virtual void drawPolygon(const QPoint *, int , PolygonDrawMode );
-
-    virtual void drawPixmap(const QRectF &,
-        const QPixmap &, const QRectF &);
-
-    virtual void drawTextItem(const QPointF &, const QTextItem &);
-
-    virtual void drawTiledPixmap(const QRectF &,
-        const QPixmap &, const QPointF &s);
-
-    virtual void drawImage(const QRectF &,
-        const QImage &, const QRectF &, Qt::ImageConversionFlags );
-
-private:
-    QwtNullPaintDevice *nullDevice();
+    virtual bool begin( QPaintDevice* ) QWT_OVERRIDE;
+    virtual bool end() QWT_OVERRIDE;
+
+    virtual Type type () const QWT_OVERRIDE;
+    virtual void updateState(const QPaintEngineState&) QWT_OVERRIDE;
+
+    virtual void drawRects(const QRect*, int ) QWT_OVERRIDE;
+    virtual void drawRects(const QRectF*, int ) QWT_OVERRIDE;
+
+    virtual void drawLines(const QLine*, int ) QWT_OVERRIDE;
+    virtual void drawLines(const QLineF*, int ) QWT_OVERRIDE;
+
+    virtual void drawEllipse(const QRectF&) QWT_OVERRIDE;
+    virtual void drawEllipse(const QRect&) QWT_OVERRIDE;
+
+    virtual void drawPath(const QPainterPath&) QWT_OVERRIDE;
+
+    virtual void drawPoints(const QPointF*, int ) QWT_OVERRIDE;
+    virtual void drawPoints(const QPoint*, int ) QWT_OVERRIDE;
+
+    virtual void drawPolygon(
+        const QPointF*, int, PolygonDrawMode ) QWT_OVERRIDE;
+
+    virtual void drawPolygon(
+        const QPoint*, int, PolygonDrawMode ) QWT_OVERRIDE;
+
+    virtual void drawPixmap(const QRectF&,
+        const QPixmap&, const QRectF&) QWT_OVERRIDE;
+
+    virtual void drawTextItem(
+        const QPointF&, const QTextItem&) QWT_OVERRIDE;
+
+    virtual void drawTiledPixmap(const QRectF&,
+        const QPixmap&, const QPointF& s) QWT_OVERRIDE;
+
+    virtual void drawImage(const QRectF&, const QImage&,
+        const QRectF&, Qt::ImageConversionFlags ) QWT_OVERRIDE;
+
+  private:
+    QwtNullPaintDevice* nullDevice();
 };
 
-QwtNullPaintDevice::PaintEngine::PaintEngine():
-    QPaintEngine( QPaintEngine::AllFeatures )
-{
-}
-
-bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice * )
+QwtNullPaintDevice::PaintEngine::PaintEngine()
+    : QPaintEngine( QPaintEngine::AllFeatures )
+{
+}
+
+bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice* )
 {
     setActive( true );
@@ -86,11 +89,16 @@
 QPaintEngine::Type QwtNullPaintDevice::PaintEngine::type() const
 {
-    return QPaintEngine::User;
+    /*
+        How to avoid conflicts with other 3rd party pain engines ?
+        At least we don't use QPaintEngine::User what is known to
+        be the value of some print engines
+     */
+    return static_cast< QPaintEngine::Type >( QPaintEngine::MaxUser - 2 );
 }
 
 void QwtNullPaintDevice::PaintEngine::drawRects(
-    const QRect *rects, int rectCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRect* rects, int rectCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -106,7 +114,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawRects(
-    const QRectF *rects, int rectCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF* rects, int rectCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -122,7 +130,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawLines(
-    const QLine *lines, int lineCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QLine* lines, int lineCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -138,7 +146,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawLines(
-    const QLineF *lines, int lineCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QLineF* lines, int lineCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -154,7 +162,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawEllipse(
-    const QRectF &rect)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -170,7 +178,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawEllipse(
-    const QRect &rect)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRect& rect)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -187,7 +195,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPath(
-    const QPainterPath &path)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPainterPath& path)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -197,7 +205,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPoints(
-    const QPointF *points, int pointCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPointF* points, int pointCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -213,7 +221,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPoints(
-    const QPoint *points, int pointCount)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPoint* points, int pointCount)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -229,7 +237,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPolygon(
-    const QPointF *points, int pointCount, PolygonDrawMode mode)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPointF* points, int pointCount, PolygonDrawMode mode)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -257,7 +265,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPolygon(
-    const QPoint *points, int pointCount, PolygonDrawMode mode)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPoint* points, int pointCount, PolygonDrawMode mode)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -285,7 +293,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawPixmap(
-    const QRectF &rect, const QPixmap &pm, const QRectF &subRect )
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect, const QPixmap& pm, const QRectF& subRect )
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -295,7 +303,7 @@
 
 void QwtNullPaintDevice::PaintEngine::drawTextItem(
-    const QPointF &pos, const QTextItem &textItem)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPointF& pos, const QTextItem& textItem)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -311,8 +319,8 @@
 
 void QwtNullPaintDevice::PaintEngine::drawTiledPixmap(
-    const QRectF &rect, const QPixmap &pixmap,
-    const QPointF &subRect)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect, const QPixmap& pixmap,
+    const QPointF& subRect)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -328,8 +336,8 @@
 
 void QwtNullPaintDevice::PaintEngine::drawImage(
-    const QRectF &rect, const QImage &image,
-    const QRectF &subRect, Qt::ImageConversionFlags flags)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QRectF& rect, const QImage& image,
+    const QRectF& subRect, Qt::ImageConversionFlags flags)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -339,7 +347,7 @@
 
 void QwtNullPaintDevice::PaintEngine::updateState(
-    const QPaintEngineState &engineState)
-{
-    QwtNullPaintDevice *device = nullDevice();
+    const QPaintEngineState& engineState)
+{
+    QwtNullPaintDevice* device = nullDevice();
     if ( device == NULL )
         return;
@@ -348,17 +356,17 @@
 }
 
-inline QwtNullPaintDevice *QwtNullPaintDevice::PaintEngine::nullDevice()
+inline QwtNullPaintDevice* QwtNullPaintDevice::PaintEngine::nullDevice()
 {
     if ( !isActive() )
         return NULL;
 
-    return static_cast<QwtNullPaintDevice *>( paintDevice() );
+    return static_cast< QwtNullPaintDevice* >( paintDevice() );
 }
 
 //! Constructor
 QwtNullPaintDevice::QwtNullPaintDevice():
-    d_engine( NULL )
-{
-    d_data = new PrivateData;
+    m_engine( NULL )
+{
+    m_data = new PrivateData;
 }
 
@@ -366,6 +374,6 @@
 QwtNullPaintDevice::~QwtNullPaintDevice()
 {
-    delete d_engine;
-    delete d_data;
+    delete m_engine;
+    delete m_data;
 }
 
@@ -378,5 +386,5 @@
 void QwtNullPaintDevice::setMode( Mode mode )
 {
-    d_data->mode = mode;
+    m_data->mode = mode;
 }
 
@@ -384,22 +392,22 @@
     \return Render mode
     \sa setMode()
-*/
+ */
 QwtNullPaintDevice::Mode QwtNullPaintDevice::mode() const
 {
-    return d_data->mode;
+    return m_data->mode;
 }
 
 //! See QPaintDevice::paintEngine()
-QPaintEngine *QwtNullPaintDevice::paintEngine() const
-{
-    if ( d_engine == NULL )
-    {
-        QwtNullPaintDevice *that =
-            const_cast< QwtNullPaintDevice * >( this );
-
-        that->d_engine = new PaintEngine();
-    }
-
-    return d_engine;
+QPaintEngine* QwtNullPaintDevice::paintEngine() const
+{
+    if ( m_engine == NULL )
+    {
+        QwtNullPaintDevice* that =
+            const_cast< QwtNullPaintDevice* >( this );
+
+        that->m_engine = new PaintEngine();
+    }
+
+    return m_engine;
 }
 
@@ -411,5 +419,5 @@
 
     \sa sizeMetrics()
-*/
+ */
 int QwtNullPaintDevice::metric( PaintDeviceMetric deviceMetric ) const
 {
@@ -456,14 +464,23 @@
             break;
         }
+#if QT_VERSION >= 0x050100
+        case PdmDevicePixelRatio:
+        {
+            value = 1.0;
+            break;
+        }
+#endif
         default:
-            value = 0;
-    }
+        {
+            value = QPaintDevice::metric( deviceMetric );
+        }
+    }
+
     return value;
-
 }
 
 //! See QPaintEngine::drawRects()
 void QwtNullPaintDevice::drawRects(
-    const QRect *rects, int rectCount)
+    const QRect* rects, int rectCount)
 {
     Q_UNUSED(rects);
@@ -473,5 +490,5 @@
 //! See QPaintEngine::drawRects()
 void QwtNullPaintDevice::drawRects(
-    const QRectF *rects, int rectCount)
+    const QRectF* rects, int rectCount)
 {
     Q_UNUSED(rects);
@@ -481,5 +498,5 @@
 //! See QPaintEngine::drawLines()
 void QwtNullPaintDevice::drawLines(
-    const QLine *lines, int lineCount)
+    const QLine* lines, int lineCount)
 {
     Q_UNUSED(lines);
@@ -489,5 +506,5 @@
 //! See QPaintEngine::drawLines()
 void QwtNullPaintDevice::drawLines(
-    const QLineF *lines, int lineCount)
+    const QLineF* lines, int lineCount)
 {
     Q_UNUSED(lines);
@@ -496,5 +513,5 @@
 
 //! See QPaintEngine::drawEllipse()
-void QwtNullPaintDevice::drawEllipse( const QRectF &rect )
+void QwtNullPaintDevice::drawEllipse( const QRectF& rect )
 {
     Q_UNUSED(rect);
@@ -502,5 +519,5 @@
 
 //! See QPaintEngine::drawEllipse()
-void QwtNullPaintDevice::drawEllipse( const QRect &rect )
+void QwtNullPaintDevice::drawEllipse( const QRect& rect )
 {
     Q_UNUSED(rect);
@@ -508,5 +525,5 @@
 
 //! See QPaintEngine::drawPath()
-void QwtNullPaintDevice::drawPath( const QPainterPath &path )
+void QwtNullPaintDevice::drawPath( const QPainterPath& path )
 {
     Q_UNUSED(path);
@@ -515,5 +532,5 @@
 //! See QPaintEngine::drawPoints()
 void QwtNullPaintDevice::drawPoints(
-    const QPointF *points, int pointCount)
+    const QPointF* points, int pointCount)
 {
     Q_UNUSED(points);
@@ -523,5 +540,5 @@
 //! See QPaintEngine::drawPoints()
 void QwtNullPaintDevice::drawPoints(
-    const QPoint *points, int pointCount)
+    const QPoint* points, int pointCount)
 {
     Q_UNUSED(points);
@@ -531,5 +548,5 @@
 //! See QPaintEngine::drawPolygon()
 void QwtNullPaintDevice::drawPolygon(
-    const QPointF *points, int pointCount,
+    const QPointF* points, int pointCount,
     QPaintEngine::PolygonDrawMode mode)
 {
@@ -541,5 +558,5 @@
 //! See QPaintEngine::drawPolygon()
 void QwtNullPaintDevice::drawPolygon(
-    const QPoint *points, int pointCount,
+    const QPoint* points, int pointCount,
     QPaintEngine::PolygonDrawMode mode)
 {
@@ -550,6 +567,6 @@
 
 //! See QPaintEngine::drawPixmap()
-void QwtNullPaintDevice::drawPixmap( const QRectF &rect,
-    const QPixmap &pm, const QRectF &subRect )
+void QwtNullPaintDevice::drawPixmap( const QRectF& rect,
+    const QPixmap& pm, const QRectF& subRect )
 {
     Q_UNUSED(rect);
@@ -560,5 +577,5 @@
 //! See QPaintEngine::drawTextItem()
 void QwtNullPaintDevice::drawTextItem(
-    const QPointF &pos, const QTextItem &textItem)
+    const QPointF& pos, const QTextItem& textItem)
 {
     Q_UNUSED(pos);
@@ -568,6 +585,6 @@
 //! See QPaintEngine::drawTiledPixmap()
 void QwtNullPaintDevice::drawTiledPixmap(
-    const QRectF &rect, const QPixmap &pixmap,
-    const QPointF &subRect)
+    const QRectF& rect, const QPixmap& pixmap,
+    const QPointF& subRect)
 {
     Q_UNUSED(rect);
@@ -578,6 +595,6 @@
 //! See QPaintEngine::drawImage()
 void QwtNullPaintDevice::drawImage(
-    const QRectF &rect, const QImage &image,
-    const QRectF &subRect, Qt::ImageConversionFlags flags)
+    const QRectF& rect, const QImage& image,
+    const QRectF& subRect, Qt::ImageConversionFlags flags)
 {
     Q_UNUSED(rect);
@@ -589,5 +606,5 @@
 //! See QPaintEngine::updateState()
 void QwtNullPaintDevice::updateState(
-    const QPaintEngineState &state )
+    const QPaintEngineState& state )
 {
     Q_UNUSED(state);
