include/vcl/fieldvalues.hxx  |   11 --------
 vcl/source/control/field.cxx |   58 +++++++++++++++++++++----------------------
 2 files changed, 29 insertions(+), 40 deletions(-)

New commits:
commit f24a9641b3128424b3794860c178f7c5492f4d37
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Oct 19 13:20:50 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Oct 19 11:36:34 2025 +0200

    This function is not used outside of vcl/source/control/field.cxx
    
    Drop one overload of inline vcl::ConvertDoubleValue, and move another
    overload to be local to the CXX.
    
    Change-Id: Ibffbdd3ad4461fdb49c39fa0626c857f20d1e422
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192661
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/include/vcl/fieldvalues.hxx b/include/vcl/fieldvalues.hxx
index 5abe5facc9ef..949237bf2bb5 100644
--- a/include/vcl/fieldvalues.hxx
+++ b/include/vcl/fieldvalues.hxx
@@ -47,22 +47,11 @@ VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, 
sal_uInt16 nDecDigits, Ma
 
 // for backwards compatibility
 // caution: conversion to double loses precision
-VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, 
sal_uInt16 nDecDigits,
-                                        FieldUnit eInUnit, FieldUnit eOutUnit);
 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);
 
-// for backwards compatibility
-// caution: conversion to double loses precision
-inline double ConvertDoubleValue(sal_Int64 nValue, sal_Int64 nBaseValue, 
sal_uInt16 nDecDigits,
-                                 FieldUnit eInUnit, FieldUnit eOutUnit)
-{
-    return ConvertDoubleValue(static_cast<double>(nValue), nBaseValue, 
nDecDigits, eInUnit,
-                              eOutUnit);
-}
-
 inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, 
FieldUnit eInUnit,
                                  MapUnit eOutUnit)
 {
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index d75c2e8f16ab..94ad93b72022 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1045,12 +1045,39 @@ static double nonValueDoubleToValueDouble( double 
nValue )
     return std::isfinite( nValue ) ? nValue : 0.0;
 }
 
+static double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, 
sal_uInt16 nDecDigits,
+                                 FieldUnit eInUnit, FieldUnit eOutUnit)
+{
+    if ( eInUnit != eOutUnit )
+    {
+        if (eInUnit == FieldUnit::PERCENT && mnBaseValue > 0 && nValue > 0)
+        {
+            sal_Int64 nDiv = 100 * ImplPower10(nDecDigits);
+
+            if (mnBaseValue != 1)
+                nValue *= mnBaseValue;
+
+            nValue += nDiv / 2;
+            nValue /= nDiv;
+        }
+        else
+        {
+            const o3tl::Length eFrom = FieldToO3tlLength(eInUnit, 
o3tl::Length::invalid);
+            const o3tl::Length eTo = FieldToO3tlLength(eOutUnit, 
o3tl::Length::invalid);
+            if (eFrom != o3tl::Length::invalid && eTo != o3tl::Length::invalid)
+                nValue = o3tl::convert(nValue, eFrom, eTo);
+        }
+    }
+
+    return nValue;
+}
+
 namespace vcl
 {
     sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 
nDecDigits,
                            FieldUnit eInUnit, FieldUnit eOutUnit)
     {
-        double nDouble = nonValueDoubleToValueDouble(vcl::ConvertDoubleValue(
+        double nDouble = nonValueDoubleToValueDouble(ConvertDoubleValue(
                     static_cast<double>(nValue), mnBaseValue, nDecDigits, 
eInUnit, eOutUnit));
 
         return clipDoubleAgainstMinMax(nDouble, SAL_MIN_INT64, SAL_MAX_INT64);
@@ -1123,33 +1150,6 @@ namespace vcl
                 convertValue( nValue, nDecDigits, eFieldUnit, eOutUnit ) ) );
     }
 
-    double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 
nDecDigits,
-                              FieldUnit eInUnit, FieldUnit eOutUnit)
-    {
-        if ( eInUnit != eOutUnit )
-        {
-            if (eInUnit == FieldUnit::PERCENT && mnBaseValue > 0 && nValue > 0)
-            {
-                sal_Int64 nDiv = 100 * ImplPower10(nDecDigits);
-
-                if (mnBaseValue != 1)
-                    nValue *= mnBaseValue;
-
-                nValue += nDiv / 2;
-                nValue /= nDiv;
-            }
-            else
-            {
-                const o3tl::Length eFrom = FieldToO3tlLength(eInUnit, 
o3tl::Length::invalid);
-                const o3tl::Length eTo = FieldToO3tlLength(eOutUnit, 
o3tl::Length::invalid);
-                if (eFrom != o3tl::Length::invalid && eTo != 
o3tl::Length::invalid)
-                    nValue = o3tl::convert(nValue, eFrom, eTo);
-            }
-        }
-
-        return nValue;
-    }
-
     double ConvertDoubleValue(double nValue, sal_uInt16 nDigits,
                               MapUnit eInUnit, FieldUnit eOutUnit)
     {
@@ -1223,7 +1223,7 @@ namespace vcl
         FieldUnit eEntryUnit = ImplMetricGetUnit( rStr );
 
         // Recalculate unit
-        rValue = vcl::ConvertDoubleValue(nValue, nBaseValue, nDecDigits, 
eEntryUnit, eUnit);
+        rValue = ConvertDoubleValue(nValue, nBaseValue, nDecDigits, 
eEntryUnit, eUnit);
 
         return true;
     }

Reply via email to