[Libreoffice-commits] core.git: cui/source

Katarina Behrens bubli at bubli.org
Wed Nov 5 08:15:51 PST 2014


 cui/source/tabpages/transfrm.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit ad268373dc4b7d412d0c690d1f4e2b9ad03b3544
Author: Katarina Behrens <bubli at bubli.org>
Date:   Wed Nov 5 15:52:32 2014 +0100

    Use basegfx library function to clamp numbers
    
    Change-Id: I3142f55ecf94ce2143e92492243bc5959322704f

diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index ba6587b..e1193c1 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -1194,10 +1194,10 @@ void SvxPositionSizeTabPage::SetMinMaxPosition()
     }
 
     const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MAP_100TH_MM, meDlgUnit ) - 1L));
-    fLeft = (fLeft > fMaxLong) ? fMaxLong : (fLeft < -fMaxLong) ? -fMaxLong : fLeft;
-    fRight = (fRight > fMaxLong) ? fMaxLong : (fRight < -fMaxLong) ? -fMaxLong : fRight;
-    fTop = (fTop > fMaxLong) ? fMaxLong : (fTop < -fMaxLong) ? -fMaxLong : fTop;
-    fBottom = (fBottom > fMaxLong) ? fMaxLong : (fBottom < -fMaxLong) ? -fMaxLong : fBottom;
+    fLeft = basegfx::clamp(fLeft, -fMaxLong, fMaxLong);
+    fRight = basegfx::clamp(fRight, -fMaxLong, fMaxLong);
+    fTop = basegfx::clamp(fTop, - fMaxLong, fMaxLong);
+    fBottom = basegfx::clamp(fBottom, -fMaxLong, fMaxLong);
 
     // #i75273# normalizing when setting the min/max values was wrong, removed
     m_pMtrPosX->SetMin(basegfx::fround64(fLeft));


More information about the Libreoffice-commits mailing list