~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to kchart/kdchart/src/KDChartNullPaintDevice.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C++ -*-
2
 
   KDChart - a multi-platform charting engine
3
 
   */
4
 
 
5
 
/****************************************************************************
6
 
 ** Copyright (C) 2009 Klaralvdalens Datakonsult AB.  All rights reserved.
7
 
 **
8
 
 ** This file is part of the KD Chart library.
9
 
 **
10
 
 ** This file may be used under the terms of the GNU General Public
11
 
 ** License versions 2.0 or 3.0 as published by the Free Software
12
 
 ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
13
 
 ** included in the packaging of this file.  Alternatively you may (at
14
 
 ** your option) use any later version of the GNU General Public
15
 
 ** License if such license has been publicly approved by
16
 
 ** Klarälvdalens Datakonsult AB (or its successors, if any).
17
 
 ** 
18
 
 ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
19
 
 ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
20
 
 ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
21
 
 ** not expressly granted herein.
22
 
 ** 
23
 
 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24
 
 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25
 
 **
26
 
 **********************************************************************/
27
 
 
28
 
#ifndef NULL_PAINT_DEVICE_H
29
 
#define NULL_PAINT_DEVICE_H
30
 
 
31
 
#include <QPaintDevice>
32
 
#include <QPaintEngine>
33
 
 
34
 
namespace KDChart
35
 
{
36
 
    class NullPaintEngine : public QPaintEngine
37
 
    {
38
 
    public:
39
 
        virtual bool begin(QPaintDevice * /*pdev*/) { return true; }
40
 
        virtual void drawEllipse(const QRectF & /*rect*/) { }
41
 
        virtual void drawEllipse(const QRect & /*rect*/) { }
42
 
        virtual void drawImage(const QRectF & /*rectangle*/, const QImage & /*image*/, const QRectF & /*sr*/, Qt::ImageConversionFlags /*flags*/) { }
43
 
        virtual void drawLines(const QLineF * /*lines*/, int /*lineCount*/) { }
44
 
        virtual void drawLines(const QLine * /*lines*/, int /*lineCount*/) { }
45
 
        virtual void drawPath(const QPainterPath & /*path*/) { }
46
 
        virtual void drawPixmap(const QRectF & /*r*/, const QPixmap & /*pm*/, const QRectF & /*sr*/) { }
47
 
        virtual void drawPoints(const QPointF * /*points*/, int /*pointCount*/) { }
48
 
        virtual void drawPoints(const QPoint * /*points*/, int /*pointCount*/) { }
49
 
        virtual void drawPolygon(const QPointF * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) { }
50
 
        virtual void drawPolygon(const QPoint * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) { }
51
 
        virtual void drawRects(const QRectF * /*rects*/, int /*rectCount*/) { }
52
 
        virtual void drawRects(const QRect * /*rects*/, int /*rectCount*/) { }
53
 
        virtual void drawTextItem(const QPointF & /*p*/, const QTextItem & /*textItem*/) { }
54
 
        virtual void drawTiledPixmap(const QRectF & /*rect*/, const QPixmap & /*pixmap*/, const QPointF & /*p*/) { }
55
 
        virtual bool end()  { return true; }
56
 
 
57
 
        virtual Type type() const { return QPaintEngine::User; }
58
 
        virtual void updateState(const QPaintEngineState & /*state*/) { }
59
 
    };
60
 
 
61
 
    class NullPaintDevice : public QPaintDevice
62
 
    {
63
 
    public:
64
 
        NullPaintDevice(const QSize& size) : m_size(size) { }
65
 
        ~NullPaintDevice() { }
66
 
 
67
 
        int metric(PaintDeviceMetric metric) const
68
 
        {
69
 
            switch(metric)
70
 
            {
71
 
            case QPaintDevice::PdmWidth:
72
 
                return m_size.width();
73
 
            case QPaintDevice::PdmHeight:
74
 
                return m_size.height();
75
 
            case QPaintDevice::PdmWidthMM:
76
 
                return 1;
77
 
            case QPaintDevice::PdmHeightMM:
78
 
                return 1;
79
 
            case QPaintDevice::PdmNumColors:
80
 
                return int((uint)(-1));
81
 
            case QPaintDevice::PdmDepth:
82
 
                return 1;
83
 
            case QPaintDevice::PdmDpiX:
84
 
                return 1;
85
 
            case QPaintDevice::PdmDpiY:
86
 
                return 1;
87
 
            case QPaintDevice::PdmPhysicalDpiX:
88
 
                return 1;
89
 
            case QPaintDevice::PdmPhysicalDpiY:
90
 
                return 1;
91
 
            }
92
 
            return 1;
93
 
        }
94
 
 
95
 
        QPaintEngine* paintEngine() const
96
 
        {
97
 
            static NullPaintEngine nullPaintEngine;
98
 
            return &nullPaintEngine;
99
 
        }
100
 
 
101
 
    private:
102
 
        QSize m_size;
103
 
    };
104
 
 
105
 
}
106
 
 
107
 
#endif