cui/source/tabpages/border.cxx                      |    4 ++--
 cui/source/tabpages/transfrm.cxx                    |    2 +-
 include/svx/transfrmhelper.hxx                      |    8 ++++----
 include/vcl/fieldvalues.hxx                         |    5 +++--
 svx/source/dialog/compressgraphicdialog.cxx         |    4 ++--
 svx/source/dialog/dlgunit.hxx                       |    2 +-
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |    2 +-
 sw/source/ui/misc/pgfnote.cxx                       |    2 +-
 vcl/source/control/field.cxx                        |    3 ++-
 9 files changed, 17 insertions(+), 15 deletions(-)

New commits:
commit 866c0c6b7749cf021d3238390af33a87b1ef9221
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Oct 19 14:58:51 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Oct 19 16:29:47 2025 +0200

    Rename a variant vcl::ConvertValue to reflect what it does with digits
    
    It is the opposite to what ConvertAndUnscaleValue does.
    The remaining vcl::ConvertValue is inconsistent, scaling in case of
    percent unit, and ignoring digits otherwise; maybe it makes sense to
    cleanup its use, and extract percent handling, in a separate change.
    
    Change-Id: I8b5d258c32b26c6320f506b6e34a067552e39288
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192666
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 234cfb226a27..dec5de00d836 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -791,7 +791,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
         if( bWidthEq )
         {
             // Determine the width first as some styles can be missing 
depending on it
-            sal_Int64 nWidthPt = vcl::ConvertValue(nWidth, 
m_xLineWidthMF->get_digits(),
+            sal_Int64 nWidthPt = vcl::ConvertAndScaleValue(nWidth, 
m_xLineWidthMF->get_digits(),
                                                    MapUnit::MapTwip, 
FieldUnit::POINT);
             SetLineWidth(nWidthPt);
             m_xLbLineStyle->SetWidth(nWidth);
@@ -1329,7 +1329,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, 
SvtLineListBox&, void)
     // set value inside edit box
     if (nOldWidth != nNewWidth)
     {
-        const sal_Int64 nNewWidthPt = vcl::ConvertValue(
+        const sal_Int64 nNewWidthPt = vcl::ConvertAndScaleValue(
             nNewWidth,
             m_xLineWidthMF->get_digits(),
             MapUnit::MapTwip,
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 96e82b90fb3c..c154cb325828 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -1299,7 +1299,7 @@ void SvxPositionSizeTabPage::SetMinMaxPosition()
         }
     }
 
-    const double 
fMaxLong(vcl::ConvertValue(std::numeric_limits<sal_Int64>::max(), 0, 
MapUnit::Map100thMM, meDlgUnit) - 1);
+    const double 
fMaxLong(vcl::ConvertAndScaleValue(std::numeric_limits<sal_Int64>::max(), 0, 
MapUnit::Map100thMM, meDlgUnit) - 1);
     fLeft = std::clamp(fLeft, -fMaxLong, fMaxLong);
     fRight = std::clamp(fRight, -fMaxLong, fMaxLong);
     fTop = std::clamp(fTop, - fMaxLong, fMaxLong);
diff --git a/include/svx/transfrmhelper.hxx b/include/svx/transfrmhelper.hxx
index f544553d22a2..db5673a38933 100644
--- a/include/svx/transfrmhelper.hxx
+++ b/include/svx/transfrmhelper.hxx
@@ -31,11 +31,11 @@ namespace TransfrmHelper
     inline void ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 
nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit)
     {
         const basegfx::B2DPoint aTopLeft(
-            
static_cast<double>(vcl::ConvertValue(basegfx::fround64(rRange.getMinX()), 
nDigits, ePoolUnit, eDlgUnit)),
-            
static_cast<double>(vcl::ConvertValue(basegfx::fround64(rRange.getMinY()), 
nDigits, ePoolUnit, eDlgUnit)));
+            
static_cast<double>(vcl::ConvertAndScaleValue(basegfx::fround64(rRange.getMinX()),
 nDigits, ePoolUnit, eDlgUnit)),
+            
static_cast<double>(vcl::ConvertAndScaleValue(basegfx::fround64(rRange.getMinY()),
 nDigits, ePoolUnit, eDlgUnit)));
         const basegfx::B2DPoint aBottomRight(
-            
static_cast<double>(vcl::ConvertValue(basegfx::fround64(rRange.getMaxX()), 
nDigits, ePoolUnit, eDlgUnit)),
-            
static_cast<double>(vcl::ConvertValue(basegfx::fround64(rRange.getMaxY()), 
nDigits, ePoolUnit, eDlgUnit)));
+            
static_cast<double>(vcl::ConvertAndScaleValue(basegfx::fround64(rRange.getMaxX()),
 nDigits, ePoolUnit, eDlgUnit)),
+            
static_cast<double>(vcl::ConvertAndScaleValue(basegfx::fround64(rRange.getMaxY()),
 nDigits, ePoolUnit, eDlgUnit)));
 
         rRange = basegfx::B2DRange(aTopLeft, aBottomRight);
     }
diff --git a/include/vcl/fieldvalues.hxx b/include/vcl/fieldvalues.hxx
index c0f4fe089ad8..12cf9b9c8f07 100644
--- a/include/vcl/fieldvalues.hxx
+++ b/include/vcl/fieldvalues.hxx
@@ -42,8 +42,9 @@ VCL_DLLPUBLIC FieldUnit GetTextMetricUnit(std::u16string_view 
aStr);
 
 VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, 
sal_uInt16 nDecDigits,
                                      FieldUnit eInUnit, FieldUnit eOutUnit);
-VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_uInt16 nDecDigits, 
MapUnit eInUnit,
-                                     FieldUnit eOutUnit);
+// nValue is not scaled to nDecDigits; the result is scaled
+VCL_DLLPUBLIC sal_Int64 ConvertAndScaleValue(sal_Int64 nValue, sal_uInt16 
nDecDigits,
+                                             MapUnit eInUnit, FieldUnit 
eOutUnit);
 // nValue is already scaled to nDecDigits; the result is unscaled
 VCL_DLLPUBLIC sal_Int64 ConvertAndUnscaleValue(sal_Int64 nValue, sal_uInt16 
nDecDigits,
                                                FieldUnit eInUnit, FieldUnit 
eOutUnit);
diff --git a/svx/source/dialog/compressgraphicdialog.cxx 
b/svx/source/dialog/compressgraphicdialog.cxx
index 52b35ca5920e..fe98be17c357 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -232,12 +232,12 @@ void CompressGraphicsDialog::UpdateResolutionLB()
 
 double CompressGraphicsDialog::GetViewWidthInch() const
 {
-    return static_cast<double>(vcl::ConvertValue(m_aViewSize100mm.Width(),  2, 
MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
+    return 
static_cast<double>(vcl::ConvertAndScaleValue(m_aViewSize100mm.Width(),  2, 
MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
 }
 
 double CompressGraphicsDialog::GetViewHeightInch() const
 {
-    return static_cast<double>(vcl::ConvertValue(m_aViewSize100mm.Height(),  
2, MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
+    return 
static_cast<double>(vcl::ConvertAndScaleValue(m_aViewSize100mm.Height(),  2, 
MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
 }
 
 BmpScaleFlag CompressGraphicsDialog::GetSelectedInterpolationType() const
diff --git a/svx/source/dialog/dlgunit.hxx b/svx/source/dialog/dlgunit.hxx
index a1e79b1182b1..573ac635dcda 100644
--- a/svx/source/dialog/dlgunit.hxx
+++ b/svx/source/dialog/dlgunit.hxx
@@ -27,7 +27,7 @@
 inline OUString GetUnitString(tools::Long nVal_100, FieldUnit eFieldUnit, 
sal_Unicode cSep)
 {
     OUStringBuffer aVal
-        = OUString::number(vcl::ConvertValue(nVal_100, 2, MapUnit::Map100thMM, 
eFieldUnit));
+        = OUString::number(vcl::ConvertAndScaleValue(nVal_100, 2, 
MapUnit::Map100thMM, eFieldUnit));
 
     while (aVal.getLength() < 3)
         aVal.insert(0, "0");
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx 
b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 802139bbbd64..62fdc75203a1 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -1103,7 +1103,7 @@ void PosSizePropertyPanel::SetPosSizeMinMax(const 
Fraction& rUIScale)
     fRight  -= maRect.getWidth();
     fBottom -= maRect.getHeight();
 
-    const double fMaxLong(static_cast<double>(vcl::ConvertValue( LONG_MAX, 0, 
MapUnit::Map100thMM, meDlgUnit ) - 1));
+    const double fMaxLong(static_cast<double>(vcl::ConvertAndScaleValue( 
LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1));
     fLeft = std::clamp(fLeft, -fMaxLong, fMaxLong);
     fRight = std::clamp(fRight, -fMaxLong, fMaxLong);
     fTop = std::clamp(fTop, - fMaxLong, fMaxLong);
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index dfea0c0607e2..4669c303d91e 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -197,7 +197,7 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet)
     // Separator width
     m_xLineWidthEdit->connect_value_changed(LINK(this, SwFootNotePage, 
LineWidthChanged_Impl));
 
-    sal_Int64 nWidthPt = vcl::ConvertValue(
+    sal_Int64 nWidthPt = vcl::ConvertAndScaleValue(
             pFootnoteInfo->GetLineWidth(), m_xLineWidthEdit->get_digits(),
             MapUnit::MapTwip, m_xLineWidthEdit->get_unit( ) );
     m_xLineWidthEdit->set_value(nWidthPt, FieldUnit::NONE);
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index e5e6ff414660..ad91e506b11e 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1117,7 +1117,8 @@ double convertValue( double nValue, tools::Long nDigits, 
FieldUnit eInUnit, Fiel
 
 namespace vcl
 {
-    sal_Int64 ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits,
+    // nValue is not scaled to nDecDigits; the result is scaled
+    sal_Int64 ConvertAndScaleValue( sal_Int64 nValue, sal_uInt16 nDigits,
                                          MapUnit eInUnit, FieldUnit eOutUnit )
     {
         tools::Long nDecDigits = nDigits;

Reply via email to