summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-08-05 13:41:51 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-08-05 14:48:17 +0200
commitda9b11a50ac33c70324fe007aa03ca01531abeb3 (patch)
tree7b71488caa6ea7490739ae56c59a054dafb49d1a
parent063d7fda7e3942706ca8818abe7f2758a7991b92 (diff)
Use o3tl::convert in VbaApplicationBase::CentimetersToPoints
Note that the old conversion was incorrect; it likely followed MS documentation [1], which is inaccurate: running in Word MsgBox CentimetersToPoints(1.0) gives 28.34646 (expected given the 1 in = 72 pt definition). [1] https://docs.microsoft.com/en-us/office/vba/api/word.application.centimeterstopoints Change-Id: I4eefccc4bd17958f944f364bc3ea579a8fdbd703 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137855 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx4
1 files changed, 1 insertions, 3 deletions
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index fe00e0c89739..b3ba3138de28 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -409,9 +409,7 @@ void SAL_CALL VbaApplicationBase::OnTime( const uno::Any& aEarliestTime, const O
float SAL_CALL VbaApplicationBase::CentimetersToPoints( float Centimeters )
{
- // i cm = 28.35 points
- static const float rate = 28.35f;
- return ( Centimeters * rate );
+ return o3tl::convert(Centimeters, o3tl::Length::cm, o3tl::Length::pt);
}
uno::Any SAL_CALL VbaApplicationBase::getVBE()