diff options
author | Chr. Rossmanith <ChrRossmanith@gmx.de> | 2013-03-16 20:55:46 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-03-18 10:46:23 +0000 |
commit | 38d0e65fa51a559b0f607b3f00f5db2527dbab57 (patch) | |
tree | f9343b6267e1947c5897b397e43f035be62c5e72 | |
parent | 42bcae1d31fb2265a5d89ae4f3db926e5ebb7aa6 (diff) |
Reuse ImplPower10()
Change-Id: I0a86e43065689d2478ced4804ab083244d8d35f5
Reviewed-on: https://gerrit.libreoffice.org/2774
Reviewed-by: Joren De Cuyper <joren.libreoffice@telenet.be>
Reviewed-by: Thorsten Behrens <tbehrens@suse.com>
Tested-by: Thorsten Behrens <tbehrens@suse.com>
-rw-r--r-- | vcl/source/control/field.cxx | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index c0037e9595f1..69cb02edd8cc 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -53,7 +53,7 @@ using namespace ::comphelper; static sal_Int64 ImplPower10( sal_uInt16 n ) { - sal_uInt16 i; + sal_uInt16 i; sal_Int64 nValue = 1; for ( i=0; i < n; i++ ) @@ -1264,9 +1264,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sa { if ( (mnBaseValue <= 0) || (nValue <= 0) ) return nValue; - nDiv = 100; - for ( sal_uInt16 i=0; i < nDecDigits; i++ ) - nDiv *= 10; + nDiv = 100 * ImplPower10(nDecDigits); nMult = mnBaseValue; } @@ -1333,11 +1331,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, } else { - while ( nDecDigits ) - { - nValue *= 10; - nDecDigits--; - } + nValue *= ImplPower10(nDecDigits); } if ( eFieldUnit != eOutUnit ) @@ -1381,19 +1375,11 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, if ( nDecDigits < 0 ) { - while ( nDecDigits ) - { - nValue *= 10; - nDecDigits++; - } + nValue *= ImplPower10(-nDecDigits); } else { - while ( nDecDigits ) - { - nValue /= 10; - nDecDigits--; - } + nValue /= ImplPower10(nDecDigits); } if ( eFieldUnit != eInUnit ) |