[Libreoffice-commits] core.git: editeng/source
Mike Kaganski
mike.kaganski at collabora.com
Tue Feb 20 12:23:49 UTC 2018
editeng/source/items/itemtype.cxx | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 3fcf374de426102da36f5b07fda5b0534de62233
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Tue Feb 20 13:28:10 2018 +0300
tdf#115874: show non-zero fraction part for pts
Change-Id: I6183d9d7e28b76bb4da0229c42573ee833f2520a
Reviewed-on: https://gerrit.libreoffice.org/50033
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
index 6019ddc220c8..f3b26da98e09 100644
--- a/editeng/source/items/itemtype.cxx
+++ b/editeng/source/items/itemtype.cxx
@@ -32,6 +32,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 )
@@ -77,6 +78,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(
@@ -110,7 +116,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());
More information about the Libreoffice-commits
mailing list