~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to libs/flake/KoViewConverter.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <QtCore/QPointF>
24
24
#include <QtCore/QRectF>
25
25
 
 
26
#include "flake_export.h"
 
27
 
26
28
/**
27
29
 * The interface for view conversions.
 
30
 *
28
31
 * All KoShape based objects are using a postscript-point (pt) based measurement system
29
32
 * which requires a conversion to view coordinates (in pixel sizes) at the moment
30
33
 * we are painting, and a conversion to the normalized coordinate system if we
31
34
 * receive mouse events so we can figure out which KoShape object was touched.
 
35
 *
 
36
 * The zoom level is expressed on a scale of 0.0 to 1.0 to infinite, where 1.0 is
 
37
 * 100%
32
38
 */
33
 
class KoViewConverter
 
39
class FLAKE_EXPORT KoViewConverter
34
40
{
35
41
public:
36
 
    KoViewConverter() {}
 
42
    KoViewConverter();
37
43
    virtual ~KoViewConverter() {}
38
44
 
39
45
    /**
40
46
     * Convert a coordinate in pt to pixels.
41
47
     * @param documentPoint the point in the document coordinate system of a KoShape.
42
48
     */
43
 
    virtual QPointF documentToView(const QPointF &documentPoint) const = 0;
 
49
    virtual QPointF documentToView(const QPointF &documentPoint) const;
44
50
 
45
51
    /**
46
52
     * Convert a coordinate in pixels to pt.
47
53
     * @param viewPoint the point in the coordinate system of the widget, or window.
48
54
     */
49
 
    virtual QPointF viewToDocument(const QPointF &viewPoint) const = 0;
 
55
    virtual QPointF viewToDocument(const QPointF &viewPoint) const;
50
56
 
51
57
    /**
52
58
     * Convert a rectangle in pt to pixels.
53
59
     * @param documentRect the rect in the document coordinate system of a KoShape.
54
60
     */
55
 
    virtual QRectF documentToView(const QRectF &documentRect) const = 0;
 
61
    virtual QRectF documentToView(const QRectF &documentRect) const;
56
62
 
57
63
    /**
58
64
     * Convert a rectangle in pixels to pt.
59
65
     * @param viewRect the rect in the coordinate system of the widget, or window.
60
66
     */
61
 
    virtual QRectF viewToDocument(const QRectF &viewRect) const = 0;
 
67
    virtual QRectF viewToDocument(const QRectF &viewRect) const;
62
68
 
63
69
    /**
64
70
     * Convert a size in pt to pixels.
65
71
     * @param documentSize the size in pt.
66
72
     * @return the size in pixels.
67
73
     */
68
 
    virtual QSizeF documentToView(const QSizeF& documentSize) const = 0;
 
74
    virtual QSizeF documentToView(const QSizeF& documentSize) const;
69
75
 
70
76
    /**
71
77
     * Convert a size in pixels to pt.
72
78
     * @param viewSize the size in pixels.
73
79
     * @return the size in pt.
74
80
     */
75
 
    virtual QSizeF viewToDocument(const QSizeF& viewSize) const = 0;
 
81
    virtual QSizeF viewToDocument(const QSizeF& viewSize) const;
76
82
 
77
83
    /**
78
84
     * Convert a single x coordinate in pt to pixels.
79
85
     * @param documentX the x coordinate in pt.
80
86
     * @return the x coordinate in pixels.
81
87
     */
82
 
    virtual qreal documentToViewX(qreal documentX) const = 0;
 
88
    virtual qreal documentToViewX(qreal documentX) const;
83
89
 
84
90
    /**
85
91
     * Convert a single y coordinate in pt to pixels.
86
92
     * @param documentY the y coordinate in pt.
87
93
     * @return the y coordinate in pixels.
88
94
     */
89
 
    virtual qreal documentToViewY(qreal documentY) const = 0;
 
95
    virtual qreal documentToViewY(qreal documentY) const;
90
96
 
91
97
    /**
92
98
     * Convert a single x coordinate in pixels to pt.
93
99
     * @param viewX the x coordinate in pixels.
94
100
     * @return the x coordinate in pt.
95
101
     */
96
 
    virtual qreal viewToDocumentX(qreal viewX) const = 0;
 
102
    virtual qreal viewToDocumentX(qreal viewX) const;
97
103
 
98
104
    /**
99
105
     * Convert a single y coordinate in pixels to pt.
100
106
     * @param viewY the y coordinate in pixels.
101
107
     * @return the y coordinate in pt.
102
108
     */
103
 
    virtual qreal viewToDocumentY(qreal viewY) const = 0;
 
109
    virtual qreal viewToDocumentY(qreal viewY) const;
104
110
 
105
111
    /**
106
112
     * Retrieve the zoom levels of the individual x and y axes.
107
113
     * @param zoomX a pointer to a qreal which will be modified to the horizontal zoom.
108
114
     * @param zoomY a pointer to a qreal which will be modified to the vertical zoom.
109
115
     */
110
 
    virtual void zoom(qreal *zoomX, qreal *zoomY) const = 0;
111
 
 
 
116
    virtual void zoom(qreal *zoomX, qreal *zoomY) const;
 
117
 
 
118
    /**
 
119
     * Set the zoom level. 1.0 is 100%.
 
120
     */
 
121
    virtual void setZoom(qreal zoom);
 
122
 
 
123
    /**
 
124
     * Return the current zoom level. 1.0 is 100%.
 
125
     */
 
126
    qreal zoom() const;
 
127
 
 
128
private:
 
129
    qreal m_zoomLevel; // 1.0 is 100%
112
130
};
113
131
 
114
132
#endif