cui/source/tabpages/border.cxx |    9 ++++-----
 include/vcl/fieldvalues.hxx    |    8 --------
 sw/source/ui/misc/pgfnote.cxx  |    6 +++---
 vcl/source/control/field.cxx   |   15 ---------------
 4 files changed, 7 insertions(+), 31 deletions(-)

New commits:
commit e94fbce26e60f1581681cfd05d8d520f5275d688
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Oct 19 13:32:33 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Oct 19 12:18:06 2025 +0200

    Uses of an overload of vcl::ConvertDoubleValue -> vcl::ConvertValue
    
    ... and drop the unused overload.
    vcl::ConvertValue does the same, except:
    1. Avoids the sal_Int64 -> double -> sal_Int64 conversion where possible;
    2. Uses nonValueDoubleToValueDouble to handle not finite result.
    
    Change-Id: Ia758339db0931545c2812db9c6e15439ea65f555
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192662
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index bfd8532f153d..60f187064fb4 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -791,9 +791,8 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
         if( bWidthEq )
         {
             // Determine the width first as some styles can be missing 
depending on it
-            sal_Int64 nWidthPt =  
static_cast<sal_Int64>(vcl::ConvertDoubleValue(
-                        sal_Int64( nWidth ), m_xLineWidthMF->get_digits(),
-                        MapUnit::MapTwip, FieldUnit::POINT ));
+            sal_Int64 nWidthPt = vcl::ConvertValue(nWidth, 
m_xLineWidthMF->get_digits(),
+                                                   MapUnit::MapTwip, 
FieldUnit::POINT);
             SetLineWidth(nWidthPt);
             m_xLbLineStyle->SetWidth(nWidth);
 
@@ -1330,11 +1329,11 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, 
SvtLineListBox&, void)
     // set value inside edit box
     if (nOldWidth != nNewWidth)
     {
-        const sal_Int64 nNewWidthPt = 
static_cast<sal_Int64>(vcl::ConvertDoubleValue(
+        const sal_Int64 nNewWidthPt = vcl::ConvertValue(
             nNewWidth,
             m_xLineWidthMF->get_digits(),
             MapUnit::MapTwip,
-            FieldUnit::POINT));
+            FieldUnit::POINT);
         SetLineWidth(nNewWidthPt);
     }
 
diff --git a/include/vcl/fieldvalues.hxx b/include/vcl/fieldvalues.hxx
index 949237bf2bb5..fcbf4038a9e7 100644
--- a/include/vcl/fieldvalues.hxx
+++ b/include/vcl/fieldvalues.hxx
@@ -49,20 +49,12 @@ VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, 
sal_uInt16 nDecDigits, Ma
 // caution: conversion to double loses precision
 VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, 
FieldUnit eInUnit,
                                         MapUnit eOutUnit);
-VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, 
MapUnit eInUnit,
-                                        FieldUnit eOutUnit);
 
 inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, 
FieldUnit eInUnit,
                                  MapUnit eOutUnit)
 {
     return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, 
eInUnit, eOutUnit);
 }
-
-inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, 
MapUnit eInUnit,
-                                 FieldUnit eOutUnit)
-{
-    return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, 
eInUnit, eOutUnit);
-}
 }
 
 #endif // INCLUDED_VCL_FIELDVALUES_HXX
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index c0b13b967e26..b81652ed2371 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -197,9 +197,9 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet)
     // Separator width
     m_xLineWidthEdit->connect_value_changed(LINK(this, SwFootNotePage, 
LineWidthChanged_Impl));
 
-    sal_Int64 nWidthPt = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
-            sal_Int64( pFootnoteInfo->GetLineWidth() ), 
m_xLineWidthEdit->get_digits(),
-            MapUnit::MapTwip, m_xLineWidthEdit->get_unit( ) ));
+    sal_Int64 nWidthPt = vcl::ConvertValue(
+            pFootnoteInfo->GetLineWidth(), m_xLineWidthEdit->get_digits(),
+            MapUnit::MapTwip, m_xLineWidthEdit->get_unit( ) );
     m_xLineWidthEdit->set_value(nWidthPt, FieldUnit::NONE);
 
     // Separator style
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 94ad93b72022..c49386ca0cde 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1150,21 +1150,6 @@ namespace vcl
                 convertValue( nValue, nDecDigits, eFieldUnit, eOutUnit ) ) );
     }
 
-    double ConvertDoubleValue(double nValue, sal_uInt16 nDigits,
-                              MapUnit eInUnit, FieldUnit eOutUnit)
-    {
-        if ( !checkConversionUnits(eInUnit, eOutUnit) )
-        {
-            OSL_FAIL( "invalid parameters" );
-            return nValue;
-        }
-
-        tools::Long nDecDigits = nDigits;
-        FieldUnit eFieldUnit = ImplMap2FieldUnit( eInUnit, nDecDigits );
-
-        return convertValue(nValue, nDecDigits, eFieldUnit, eOutUnit);
-    }
-
     double ConvertDoubleValue(double nValue, sal_uInt16 nDigits,
                               FieldUnit eInUnit, MapUnit eOutUnit)
     {

Reply via email to