vbahelper/source/vbahelper/vbaapplicationbase.cxx |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit da9b11a50ac33c70324fe007aa03ca01531abeb3
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Aug 5 13:41:51 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Aug 5 14:48:17 2022 +0200

    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.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

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()

Reply via email to