37 int pixelToLayoutUnitX(
int x )
const;
38 int pixelToLayoutUnitY(
int y )
const;
39 TQPoint pixelToLayoutUnit(
const TQPoint &p )
const
40 {
return TQPoint( pixelToLayoutUnitX( p.x() ),
41 pixelToLayoutUnitY( p.y() ) ); }
42 TQRect pixelToLayoutUnit(
const TQRect &r )
const
43 {
return TQRect( pixelToLayoutUnit( r.topLeft() ),
44 pixelToLayoutUnit( r.bottomRight() ) ); }
47 int layoutUnitToPixelX(
int lupix )
const;
48 int layoutUnitToPixelY(
int lupix )
const;
52 int layoutUnitToPixelX(
int x,
int w )
const;
55 int layoutUnitToPixelY(
int y,
int h )
const;
57 TQPoint layoutUnitToPixel(
const TQPoint &p )
const
58 {
return TQPoint( layoutUnitToPixelX( p.x() ),
59 layoutUnitToPixelY( p.y() ) ); }
60 TQRect layoutUnitToPixel(
const TQRect &r )
const
61 {
return TQRect( layoutUnitToPixel( r.topLeft() ),
62 layoutUnitToPixel( r.bottomRight() ) ); }
68 {
return tqRound( pt * m_resolutionX ); }
69 int ptToPixelY(
double pt )
const
70 {
return tqRound( pt * m_resolutionY ); }
71 TQPoint ptToPixel(
const KoPoint & p )
const {
72 return TQPoint( ptToPixelX( p.x() ), ptToPixelY( p.y() ) );
74 double pixelXToPt(
int x )
const
75 {
return static_cast<double>(x) / m_resolutionX; }
76 double pixelYToPt(
int y )
const
77 {
return static_cast<double>(y) / m_resolutionY; }
78 KoPoint pixelToPt(
const TQPoint& p )
const {
79 return KoPoint( pixelXToPt( p.x() ), pixelYToPt( p.y() ) );
84 {
return ptToPixelX( ptToLayoutUnitPt( x_pt ) ); }
85 int ptToLayoutUnitPixY(
double y_pt )
const
86 {
return ptToPixelY( ptToLayoutUnitPt( y_pt ) ); }
87 TQPoint ptToLayoutUnitPix(
const KoPoint & p )
const {
88 return TQPoint( ptToLayoutUnitPixX( p.x() ), ptToLayoutUnitPixY( p.y() ) );
95 double layoutUnitToFontSize(
int luSize,
bool )
const;
113 {
return pt *
static_cast<double>( m_layoutUnitFactor ); }
116 {
return ptSize * m_layoutUnitFactor; }
119 {
return KoPoint( ptToLayoutUnitPt( p.x() ),
120 ptToLayoutUnitPt( p.y() ) ); }
122 {
return KoRect( ptToLayoutUnitPt( r.topLeft() ),
123 ptToLayoutUnitPt( r.bottomRight() ) ); }
125 static double layoutUnitPtToPt(
double lupt )
126 {
return lupt /
static_cast<double>( m_layoutUnitFactor ); }
128 {
return KoPoint( layoutUnitPtToPt( p.x() ),
129 layoutUnitPtToPt( p.y() ) ); }
This class extends KoZoomHandler to add support for WYSIWYG text layouting.
int ptToPixelX(double pt) const
Basic pt to pixel and pixel to pt conversions, valid at any zoom level, as well as at the Layout Unit...
static double ptToLayoutUnitPt(double pt)
Not zoom dependent.
int ptToLayoutUnitPixX(double x_pt) const
The "document pt" -> "Layout Unit pixels" conversions, for convenience.
static int ptToLayoutUnitPt(int ptSize)
Same thing for integer values, e.g.
static void setPtToLayoutUnitFactor(int factor)
Change the factor that converts between pointsizes and layout units (by default 20 - for 1440 DPI at ...
static int m_layoutUnitFactor
This being static ensures that the same value is used by all KoTextZoomHandler instances.