summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-04 13:01:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-04 17:36:48 +0100
commit10943505162d515f16acfb4d195d171421ff834f (patch)
treef5a67a7ae6e94227fa83b7b37611bf3d0d0ebca6 /editeng
parent4887f113d3bb3ffaf7bd93e2e0dba13fdb11afee (diff)
have one set of twips<->mm conversions
Change-Id: I510f4a0524a7c72eb124cba103cbf398024976d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110407 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/uno/unoipset.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index 523b29794461..417e62d771e0 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -260,10 +260,6 @@ uno::Reference< beans::XPropertySetInfo > const & SvxItemPropertySet::getProper
}
-#ifndef TWIPS_TO_MM
-#define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
-#endif
-
/** converts the given any with a metric to 100th/mm if needed */
void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, uno::Any & rMetric ) throw()
{
@@ -275,19 +271,19 @@ void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, uno::Any & rMetric ) throw
switch( rMetric.getValueTypeClass() )
{
case uno::TypeClass_BYTE:
- rMetric <<= static_cast<sal_Int8>(TWIPS_TO_MM(*o3tl::forceAccess<sal_Int8>(rMetric)));
+ rMetric <<= static_cast<sal_Int8>(TwipsToHMM(*o3tl::forceAccess<sal_Int8>(rMetric)));
break;
case uno::TypeClass_SHORT:
- rMetric <<= static_cast<sal_Int16>(TWIPS_TO_MM(*o3tl::forceAccess<sal_Int16>(rMetric)));
+ rMetric <<= static_cast<sal_Int16>(TwipsToHMM(*o3tl::forceAccess<sal_Int16>(rMetric)));
break;
case uno::TypeClass_UNSIGNED_SHORT:
- rMetric <<= static_cast<sal_uInt16>(TWIPS_TO_MM(*o3tl::forceAccess<sal_uInt16>(rMetric)));
+ rMetric <<= static_cast<sal_uInt16>(TwipsToHMM(*o3tl::forceAccess<sal_uInt16>(rMetric)));
break;
case uno::TypeClass_LONG:
- rMetric <<= static_cast<sal_Int32>(TWIPS_TO_MM(*o3tl::forceAccess<sal_Int32>(rMetric)));
+ rMetric <<= static_cast<sal_Int32>(TwipsToHMM(*o3tl::forceAccess<sal_Int32>(rMetric)));
break;
case uno::TypeClass_UNSIGNED_LONG:
- rMetric <<= static_cast<sal_uInt32>(TWIPS_TO_MM(*o3tl::forceAccess<sal_uInt32>(rMetric)));
+ rMetric <<= static_cast<sal_uInt32>(TwipsToHMM(*o3tl::forceAccess<sal_uInt32>(rMetric)));
break;
default:
SAL_WARN("editeng", "AW: Missing unit translation to 100th mm, " << OString::number(static_cast<sal_Int32>(rMetric.getValueTypeClass())));