diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-02-20 13:28:10 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-25 20:12:09 +0200 |
commit | 8edd9a85bbbfba3d9edb232bdbd03a7634bb8614 (patch) | |
tree | 347000bffdf75b6cd7d33ba3cf365733809dda0d /editeng | |
parent | 2ea6fc6b1f8465d6859b6acd1a96a0157ecf18f5 (diff) |
tdf#115874: show non-zero fraction part for pts
Change-Id: I6183d9d7e28b76bb4da0229c42573ee833f2520a
Reviewed-on: https://gerrit.libreoffice.org/50033
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 3fcf374de426102da36f5b07fda5b0534de62233)
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/itemtype.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index 39126f065f1d..83d8c8e91661 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -29,6 +29,7 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper* pIntl ) { bool bNeg = false; + bool bShowAtLeastOneDecimalDigit = true; sal_Int32 nRet = 0; if ( nVal < 0 ) @@ -74,6 +75,11 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In } case MapUnit::MapPoint: + // fractions of a point are used, e.g., for font size + nRet = OutputDevice::LogicToLogic(nVal, eSrcUnit, MapUnit::MapTwip) * 50; + bShowAtLeastOneDecimalDigit = false; + break; + case MapUnit::MapTwip: case MapUnit::MapPixel: return OUString::number( OutputDevice::LogicToLogic( @@ -107,7 +113,7 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In else sRet.append(nRet / nDiff); nRet %= nDiff; - if( 4 == nDigits ) + if( 4 == nDigits && (bShowAtLeastOneDecimalDigit || nRet) ) { if(pIntl) sRet.append(pIntl->getLocaleData()->getNumDecimalSep()); |