Use platform-independent ::rtl::math::round to fix msvc build

This commit is contained in:
Korrawit Pruegsanusak 2012-01-17 00:18:08 +07:00
parent ef0ee083e6
commit a9ebfbc2b6
5 changed files with 15 additions and 10 deletions

View file

@ -76,6 +76,7 @@
#include <svx/dialogs.hrc>
#include <svx/zoom_def.hxx>
#include <rtl/math.hxx>
#include "sc.hrc"
#include "scabstdlg.hxx"
@ -448,9 +449,9 @@ sal_Bool ScPreviewShell::ScrollCommand( const CommandEvent& rCEvt )
long nOld = pPreview->GetZoom();
long nNew = nOld;
if ( pData->GetDelta() < 0 )
nNew = Max( (long) MINZOOM, (long)round( nOld / ZOOM_FACTOR ));
nNew = Max( (long) MINZOOM, (long)::rtl::math::round( nOld / ZOOM_FACTOR ));
else
nNew = Min( (long) MAXZOOM, (long)round( nOld * ZOOM_FACTOR ));
nNew = Min( (long) MAXZOOM, (long)::rtl::math::round( nOld * ZOOM_FACTOR ));
if ( nNew != nOld )
{

View file

@ -150,6 +150,7 @@
#include <algorithm>
#include <svx/zoom_def.hxx>
#include <rtl/math.hxx>
#define SPLIT_MARGIN 30
#define SC_ICONSIZE 36
@ -1059,9 +1060,9 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
long nNew = nOld;
if ( pData->GetDelta() < 0 )
nNew = Max( (long) MINZOOM, (long)round( nOld / ZOOM_FACTOR ));
nNew = Max( (long) MINZOOM, (long)::rtl::math::round( nOld / ZOOM_FACTOR ));
else
nNew = Min( (long) MAXZOOM, (long)round( nOld * ZOOM_FACTOR ));
nNew = Min( (long) MAXZOOM, (long)::rtl::math::round( nOld * ZOOM_FACTOR ));
if ( nNew != nOld )
{

View file

@ -83,6 +83,7 @@
#include "SpellDialogChildWindow.hxx"
#include <svx/zoom_def.hxx>
#include <rtl/math.hxx>
#include "Window.hxx"
#include "fupoor.hxx"
@ -718,9 +719,9 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi
long nNewZoom;
if( pData->GetDelta() < 0L )
nNewZoom = Max( (long) pWin->GetMinZoom(), (long)round( nOldZoom / ZOOM_FACTOR ));
nNewZoom = Max( (long) pWin->GetMinZoom(), (long)::rtl::math::round( nOldZoom / ZOOM_FACTOR ));
else
nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)round( nOldZoom * ZOOM_FACTOR ));
nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)::rtl::math::round( nOldZoom * ZOOM_FACTOR ));
SetZoom( nNewZoom );
Invalidate( SID_ATTR_ZOOM );

View file

@ -37,6 +37,7 @@
#include <svx/dialogs.hrc>
#include <svx/zoom_def.hxx>
#include <rtl/math.hxx>
#include <set>
@ -359,11 +360,11 @@ sal_Bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
// click to - button
if ( nXDiff >= nButtonLeftOffset && nXDiff <= nButtonRightOffset )
mpImpl->mnCurrentZoom = round( mpImpl->mnCurrentZoom / ZOOM_FACTOR );
mpImpl->mnCurrentZoom = ::rtl::math::round( mpImpl->mnCurrentZoom / ZOOM_FACTOR );
// click to + button
else if ( nXDiff >= aControlRect.GetWidth() - nSliderXOffset + nButtonLeftOffset &&
nXDiff <= aControlRect.GetWidth() - nSliderXOffset + nButtonRightOffset )
mpImpl->mnCurrentZoom = round( mpImpl->mnCurrentZoom * ZOOM_FACTOR );
mpImpl->mnCurrentZoom = ::rtl::math::round( mpImpl->mnCurrentZoom * ZOOM_FACTOR );
// click to slider
else if( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset )
mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff );

View file

@ -53,6 +53,7 @@
#include <IDocumentSettingAccess.hxx>
#include <svx/zoom_def.hxx>
#include <rtl/math.hxx>
//Das SetVisArea der DocShell darf nicht vom InnerResizePixel gerufen werden.
//Unsere Einstellungen muessen aber stattfinden.
@ -1311,9 +1312,9 @@ sal_Bool SwView::HandleWheelCommands( const CommandEvent& rCEvt )
{
sal_uInt16 nFact = pWrtShell->GetViewOptions()->GetZoom();
if( 0L > pWData->GetDelta() )
nFact = static_cast< sal_uInt16 >(Max( 20, (int)round( nFact / ZOOM_FACTOR )));
nFact = static_cast< sal_uInt16 >(Max( 20, (int)::rtl::math::round( nFact / ZOOM_FACTOR )));
else
nFact = static_cast< sal_uInt16 >(Min( 600, (int)round( nFact * ZOOM_FACTOR )));
nFact = static_cast< sal_uInt16 >(Min( 600, (int)::rtl::math::round( nFact * ZOOM_FACTOR )));
SetZoom( SVX_ZOOM_PERCENT, nFact );
bOk = sal_True;