LibreOffice Module basegfx (master) 1
Functions | Variables
basegfx::zoomtools Namespace Reference

Functions

static sal_uInt16 roundMultiple (sal_uInt16 nCurrent, int nMultiple)
 Round a value against a specified multiple. More...
 
static sal_uInt16 roundZoom (double nCurrent)
 Convert geometric progression results into more common values by rounding them against certain multiples depending on the size. More...
 
static sal_uInt16 enforceStep (sal_uInt16 nCurrent, sal_uInt16 nPrevious, unsigned int nStep)
 Make sure that a certain step isn't skipped during the zooming progress. More...
 
sal_uInt16 zoomIn (sal_uInt16 nCurrent)
 Increasing the zoom level. More...
 
sal_uInt16 zoomOut (sal_uInt16 nCurrent)
 Decreasing the zoom level. More...
 

Variables

const double ZOOM_FACTOR = 1.12246205
 2^(1/6) as the default step More...
 

Function Documentation

◆ enforceStep()

static sal_uInt16 basegfx::zoomtools::enforceStep ( sal_uInt16  nCurrent,
sal_uInt16  nPrevious,
unsigned int  nStep 
)
static

Make sure that a certain step isn't skipped during the zooming progress.

Parameters
nCurrentcurrent zoom factor
nPreviousprevious zoom factor
nStepstep which shouldn't be skipped

Definition at line 69 of file zoomtools.cxx.

Referenced by zoomIn(), and zoomOut().

◆ roundMultiple()

static sal_uInt16 basegfx::zoomtools::roundMultiple ( sal_uInt16  nCurrent,
int  nMultiple 
)
static

Round a value against a specified multiple.

Values below half of the multiple are rounded down and all others are rounded up.

Parameters
nCurrentcurrent value
nMultiplemultiple against which the current value is rounded

Definition at line 29 of file zoomtools.cxx.

Referenced by roundZoom().

◆ roundZoom()

static sal_uInt16 basegfx::zoomtools::roundZoom ( double  nCurrent)
static

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.

Parameters
nCurrentcurrent zoom factor

Definition at line 42 of file zoomtools.cxx.

References roundMultiple().

Referenced by zoomIn(), and zoomOut().

◆ zoomIn()

BASEGFX_DLLPUBLIC sal_uInt16 basegfx::zoomtools::zoomIn ( sal_uInt16  nCurrent)

Increasing the zoom level.

Parameters
nCurrentcurrent zoom factor

Definition at line 83 of file zoomtools.cxx.

References enforceStep(), roundZoom(), and ZOOM_FACTOR.

◆ zoomOut()

BASEGFX_DLLPUBLIC sal_uInt16 basegfx::zoomtools::zoomOut ( sal_uInt16  nCurrent)

Decreasing the zoom level.

This namespace provides functions for optimized geometric zooming.

Parameters
nCurrentcurrent zoom factor

Definition at line 100 of file zoomtools.cxx.

References enforceStep(), roundZoom(), and ZOOM_FACTOR.

Variable Documentation

◆ ZOOM_FACTOR

const double basegfx::zoomtools::ZOOM_FACTOR = 1.12246205

2^(1/6) as the default step

This ensures (unless the rounding is used) that 6 steps lead to double / half zoom level.

Definition at line 20 of file zoomtools.cxx.

Referenced by zoomIn(), and zoomOut().