kozoomhandler.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#include "kozoomhandler.h"
00021
#include <kdebug.h>
00022
#include <qpaintdevice.h>
00023
#include <koGlobal.h>
00024
00025
00026
00027
00028 int KoTextZoomHandler::m_layoutUnitFactor = 20;
00029
00030 KoZoomHandler::KoZoomHandler()
00031 {
00032
00033 setZoomAndResolution( 100, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY() );
00034 }
00035
00036 void KoZoomHandler::setZoomAndResolution(
int zoom,
int dpiX,
int dpiY )
00037 {
00038 m_zoom = zoom;
00039
00040 m_resolutionX = POINT_TO_INCH( static_cast<double>(dpiX) );
00041 m_resolutionY = POINT_TO_INCH( static_cast<double>(dpiY) );
00042 m_zoomedResolutionX = static_cast<double>(m_zoom) * m_resolutionX / 100.0;
00043 m_zoomedResolutionY = static_cast<double>(m_zoom) * m_resolutionY / 100.0;
00044
00045
00046
00047
00048
00049 }
00050
00051 void KoZoomHandler::setResolution(
double resolutionX,
double resolutionY )
00052 {
00053 m_zoomedResolutionX = resolutionX;
00054 m_zoomedResolutionY = resolutionY;
00055 }
00056
00057
#if 0
00058
int KoZoomHandler::fontSizeToLayoutUnit(
double ptSizeFloat,
bool forPrint )
const
00059
{
00060
return ptToLayoutUnit( ptSizeFloat / ( m_zoomedResolutionY *
00061 ( forPrint ? 1.0 : (72.0 / QPaintDevice::x11AppDpiY()) ) ) );
00062 }
00063
#endif
00064
00065 double KoZoomHandler::layoutUnitToFontSize(
int luSize,
bool )
const
00066
{
00067
00068
return layoutUnitPtToPt( luSize ) * static_cast<double>(m_zoom) / 100.0;
00069
00070 }
00071
00072 int KoZoomHandler::layoutUnitToPixelX(
int x,
int w )
const
00073
{
00074
00075
00076
00077
return layoutUnitToPixelY( x + w - 1 ) - layoutUnitToPixelY( x ) + 1;
00078 }
00079
00080 int KoZoomHandler::layoutUnitToPixelY(
int y,
int h )
const
00081
{
00082
00083
00084
00085
return layoutUnitToPixelY( y + h - 1 ) - layoutUnitToPixelY( y ) + 1;
00086 }
This file is part of the documentation for lib Library Version 1.3.5.