diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-14 00:09:43 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-13 23:38:37 +0100 |
commit | 7b8f630db30ee0066a9f4b6e540368d2fcad7fa8 (patch) | |
tree | e40626d45db8a228defeca6e66aba9055974d0a6 /embeddedobj | |
parent | 44f20abf66ce3f9806ad95522d7d9ae698350499 (diff) |
Use o3tl::convert
Change-Id: I78db3001d602ec1a0847785b3c127b9d345f5af7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125173
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/msole/olecomponent.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index d0b11110e65a..1aec0c704926 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -40,6 +40,7 @@ #include <osl/file.hxx> #include <rtl/ref.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/unit_conversion.hxx> #include <systools/win32/comtools.hxx> #include <vcl/threadex.hxx> @@ -1031,27 +1032,23 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect ) if ( pMF ) { // the object uses 0.01 mm as unit, so the metafile size should be converted to object unit - sal_Int64 nMult = 1; - sal_Int64 nDiv = 1; + o3tl::Length eFrom = o3tl::Length::mm100; switch( pMF->mm ) { case MM_HIENGLISH: - nMult = 254; - nDiv = 100; + eFrom = o3tl::Length::in1000; break; case MM_LOENGLISH: - nMult = 254; - nDiv = 10; + eFrom = o3tl::Length::in100; break; case MM_LOMETRIC: - nMult = 10; + eFrom = o3tl::Length::mm10; break; case MM_TWIPS: - nMult = 254; - nDiv = 144; + eFrom = o3tl::Length::twip; break; case MM_ISOTROPIC: @@ -1061,8 +1058,8 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect ) break; } - sal_Int64 nX = static_cast<sal_Int64>(abs( pMF->xExt )) * nMult / nDiv; - sal_Int64 nY = static_cast<sal_Int64>(abs( pMF->yExt )) * nMult / nDiv; + sal_Int64 nX = o3tl::convert(abs( pMF->xExt ), eFrom, o3tl::Length::mm100); + sal_Int64 nY = o3tl::convert(abs( pMF->yExt ), eFrom, o3tl::Length::mm100); if ( nX < SAL_MAX_INT32 && nY < SAL_MAX_INT32 ) { aSize.Width = static_cast<sal_Int32>(nX); |