/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <basegfx/utils/zoomtools.hxx>
namespace basegfx::zoomtools
{
/** 2^(1/6) as the default step
This ensures (unless the rounding is used) that 6 steps lead to double / half zoom level.
*/ constdouble ZOOM_FACTOR = 1.12246205;
/** * Round a value against a specified multiple. Values below half * of the multiple are rounded down and all others are rounded up. * * @param nCurrent current value * @param nMultiple multiple against which the current value is rounded
*/ static sal_uInt16 roundMultiple(sal_uInt16 nCurrent, int nMultiple)
{ // round zoom to a multiple of nMultiple return (( nCurrent + nMultiple / 2 ) - ( nCurrent + nMultiple / 2 ) % nMultiple);
}
/** * Convert geometric progression results into more common values by * rounding them against certain multiples depending on the size. * Beginning with 50 the multiple is 5, with 100, 10, and so on. * * @param nCurrent current zoom factor
*/ static sal_uInt16 roundZoom(double nCurrent)
{ // convert nCurrent properly to int
sal_uInt16 nNew = nCurrent + 0.5;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.