1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; c-brace-offset: 0; -*-
4 // Part of KVIEWSHELL - A framework for multipage text/gfx viewers
6 // (C) 2002-2005 Stefan Kebekus
7 // Distributed under the GPL
11 #include "simplePageSize.h"
12 #include "kvs_debug.h"
14 #include <QPaintDevice>
17 double SimplePageSize::zoomForHeight(quint32 height
, const QPaintDevice
& pd
) const
20 kError(kvs::shell
) << "SimplePageSize::zoomForHeight() called when paper height was invalid" << endl
;
24 return double(height
) / (pd
.logicalDpiY() * pageHeight
.getLength_in_inch());
28 double SimplePageSize::zoomForWidth(quint32 width
, const QPaintDevice
& pd
) const
31 kError(kvs::shell
) << "SimplePageSize::zoomForWidth() called when paper width was invalid" << endl
;
35 return double(width
) / (pd
.logicalDpiX() * pageWidth
.getLength_in_inch());
39 double SimplePageSize::zoomToFitInto(const SimplePageSize
&target
) const
41 if (!isValid() || isSmall() || !target
.isValid()) {
42 kWarning(kvs::shell
) << "SimplePageSize::zoomToFitInto(...) with unsuitable source of target" ;
46 double z1
= target
.width() / pageWidth
;
47 double z2
= target
.height() / pageHeight
;