include/vcl/weld.hxx                 |   60 +++++++++++++++++++++++++++++++----
 vcl/inc/jsdialog/jsdialogbuilder.hxx |    4 +-
 vcl/inc/qt5/QtInstanceSpinButton.hxx |   12 +++----
 vcl/inc/salvtables.hxx               |   16 +++------
 vcl/jsdialog/jsdialogbuilder.cxx     |    8 ++--
 vcl/qt5/QtInstanceSpinButton.cxx     |   30 ++++++++---------
 vcl/source/app/salvtables.cxx        |   42 +++++++++---------------
 vcl/unx/gtk3/gtkinst.cxx             |   42 +++++++-----------------
 8 files changed, 116 insertions(+), 98 deletions(-)

New commits:
commit 20a4fba188cc70ff837dd0d6e0d7063ad66a4386
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Feb 17 13:10:16 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Feb 18 08:58:55 2025 +0100

    tdf#130857 Pass double values to/from weld::SpinButton subclasses
    
    As described in previous commit
    
        Change-Id: I2ecf0b8713a99e15887ab4ee6d4cda27f1afdfc4
        Author: Michael Weghorn <[email protected]>
        Date:   Mon Feb 17 10:54:18 2025 +0100
    
            tdf#130857 vcl: Move sal_Int64 <-> double helpers to 
weld::SpinButton
    
    , the weld::SpinButton API uses integers (sal_Int64) to represent
    all values, including floating point values, while GtkInstanceSpinButton
    and SalInstanceSpinButton internally use double to represent values.
    
    So far, the conversion between them was done in
    GtkInstanceSpinButton and SalInstanceSpinButton methods.
    
    Move the logic to the weld::SpinButton subclass instead:
    
    Let the existing public methods (used by dialog implementations)
    no longer be (purely) virtual, but let them do the conversion
    and then call newly introduced (purely) virtual methods that
    take/return the double equivalent (which depends on the return
    value of `weld::SpinButton::get_digits()`).
    
    Override those methods in the weld::SpinButton subclasses instead,
    so no conversion needs to be done there any more.
    
    For GtkInstanceSpinButton and SalInstanceSpinButton,
    this commit should not result in any change of behavior
    
    QtInstanceSpinButton so far didn't do the conversion
    by itself, but should now get it "for free" from
    the base class implementation without having to
    implement the same logic that the GTK and VCL
    implementations previously had once again.
    Drop any explicit rounding that some QtInstanceSpinButton
    methods did so far to convert the double value to an
    integer.
    
    Change-Id: I31bc2b95b46bae8174388cddc9a383ed61e6763e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181782
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index a1a438ca1c60..98b23e092ce9 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1905,11 +1905,35 @@ protected:
         return basegfx::fround64(fDouble * Power10(get_digits()));
     }
 
+    // methods to implement in subclasses which use floating point values 
directly;
+    // public methods using sal_Int64 values whose floating point value 
depends on get_digits()
+    // take care of conversion
+    virtual void set_floating_point_value(double fValue) = 0;
+    virtual double get_floating_point_value() const = 0;
+    virtual void set_floating_point_range(double fMin, double fMax) = 0;
+    virtual void get_floating_point_range(double& rMin, double& rMax) const = 
0;
+    virtual void set_floating_point_increments(double fStep, double fPage) = 0;
+    virtual void get_floating_point_increments(double& rStep, double& rPage) 
const = 0;
+
 public:
-    virtual void set_value(sal_Int64 value) = 0;
-    virtual sal_Int64 get_value() const = 0;
-    virtual void set_range(sal_Int64 min, sal_Int64 max) = 0;
-    virtual void get_range(sal_Int64& min, sal_Int64& max) const = 0;
+    void set_value(sal_Int64 value) { 
set_floating_point_value(convert_value_to_double(value)); }
+
+    sal_Int64 get_value() const { return 
convert_double_to_value(get_floating_point_value()); }
+
+    void set_range(sal_Int64 min, sal_Int64 max)
+    {
+        set_floating_point_range(convert_value_to_double(min), 
convert_value_to_double(max));
+    }
+
+    void get_range(sal_Int64& min, sal_Int64& max) const
+    {
+        double fMin = 0;
+        double fMax = 0;
+        get_floating_point_range(fMin, fMax);
+        min = convert_double_to_value(fMin);
+        max = convert_double_to_value(fMax);
+    }
+
     void set_min(sal_Int64 min)
     {
         sal_Int64 dummy, max;
@@ -1934,8 +1958,21 @@ public:
         get_range(dummy, max);
         return max;
     }
-    virtual void set_increments(sal_Int64 step, sal_Int64 page) = 0;
-    virtual void get_increments(sal_Int64& step, sal_Int64& page) const = 0;
+
+    void set_increments(sal_Int64 step, sal_Int64 page)
+    {
+        set_floating_point_increments(convert_value_to_double(step), 
convert_value_to_double(page));
+    }
+
+    void get_increments(sal_Int64& step, sal_Int64& page) const
+    {
+        double fStep = 0;
+        double fPage = 0;
+        get_floating_point_increments(fStep, fPage);
+        step = convert_double_to_value(fStep);
+        page = convert_double_to_value(fPage);
+    }
+
     virtual void set_digits(unsigned int digits) = 0;
     virtual unsigned int get_digits() const = 0;
 
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 944b96c75e86..72ddcee9baf5 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -566,8 +566,8 @@ public:
     JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, 
SalInstanceBuilder* pBuilder,
                  bool bTakeOwnership);
 
-    virtual void set_value(sal_Int64 value) override;
-    virtual void set_range(sal_Int64 min, sal_Int64 max) override;
+    virtual void set_floating_point_value(double fValue) override;
+    virtual void set_floating_point_range(double fMin, double fMax) override;
 };
 
 class JSFormattedSpinButton final
diff --git a/vcl/inc/qt5/QtInstanceSpinButton.hxx 
b/vcl/inc/qt5/QtInstanceSpinButton.hxx
index 1766455a364e..a4cc48925347 100644
--- a/vcl/inc/qt5/QtInstanceSpinButton.hxx
+++ b/vcl/inc/qt5/QtInstanceSpinButton.hxx
@@ -25,13 +25,13 @@ public:
 
     virtual QWidget* getQWidget() const override;
 
-    virtual void set_value(sal_Int64 nValue) override;
-    virtual sal_Int64 get_value() const override;
-    virtual void set_range(sal_Int64 nMin, sal_Int64 nMax) override;
-    virtual void get_range(sal_Int64& rMin, sal_Int64& rMax) const override;
+    virtual void set_floating_point_value(double fValue) override;
+    virtual double get_floating_point_value() const override;
+    virtual void set_floating_point_range(double fMin, double fMax) override;
+    virtual void get_floating_point_range(double& rMin, double& rMax) const 
override;
 
-    virtual void set_increments(sal_Int64 nStep, sal_Int64 nPage) override;
-    virtual void get_increments(sal_Int64& rStep, sal_Int64& rPage) const 
override;
+    virtual void set_floating_point_increments(double fStep, double fPage) 
override;
+    virtual void get_floating_point_increments(double& rStep, double& rPage) 
const override;
     virtual void set_digits(unsigned int nDigits) override;
     virtual unsigned int get_digits() const override;
 
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 2ba0f2895f35..e26ac2619bcb 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -688,17 +688,17 @@ public:
     SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* 
pBuilder,
                           bool bTakeOwnership);
 
-    virtual sal_Int64 get_value() const override;
+    virtual double get_floating_point_value() const override;
 
-    virtual void set_value(sal_Int64 value) override;
+    virtual void set_floating_point_value(double fValue) override;
 
-    virtual void set_range(sal_Int64 min, sal_Int64 max) override;
+    virtual void set_floating_point_range(double fMin, double fMax) override;
 
-    virtual void get_range(sal_Int64& min, sal_Int64& max) const override;
+    virtual void get_floating_point_range(double& rMin, double& rMax) const 
override;
 
-    virtual void set_increments(sal_Int64 step, sal_Int64 /*page*/) override;
+    virtual void set_floating_point_increments(double fStep, double /*fPage*/) 
override;
 
-    virtual void get_increments(sal_Int64& step, sal_Int64& page) const 
override;
+    virtual void get_floating_point_increments(double& rStep, double& rPage) 
const override;
 
     virtual void set_digits(unsigned int digits) override;
 
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index c0a73b01237e..f28bd940f57c 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1373,9 +1373,9 @@ JSSpinButton::JSSpinButton(JSDialogSender* pSender, 
::FormattedField* pSpin,
 {
 }
 
-void JSSpinButton::set_value(sal_Int64 value)
+void JSSpinButton::set_floating_point_value(double fValue)
 {
-    SalInstanceSpinButton::set_value(value);
+    SalInstanceSpinButton::set_floating_point_value(fValue);
 
     std::unique_ptr<jsdialog::ActionDataMap> pMap = 
std::make_unique<jsdialog::ActionDataMap>();
     (*pMap)[ACTION_TYPE ""_ostr] = "setText";
@@ -1383,9 +1383,9 @@ void JSSpinButton::set_value(sal_Int64 value)
     sendAction(std::move(pMap));
 }
 
-void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max)
+void JSSpinButton::set_floating_point_range(double fMin, double fMax)
 {
-    SalInstanceSpinButton::set_range(min, max);
+    SalInstanceSpinButton::set_floating_point_range(fMin, fMax);
     sendUpdate();
 }
 
diff --git a/vcl/qt5/QtInstanceSpinButton.cxx b/vcl/qt5/QtInstanceSpinButton.cxx
index 936d0f2ab692..2b8331506ca3 100644
--- a/vcl/qt5/QtInstanceSpinButton.cxx
+++ b/vcl/qt5/QtInstanceSpinButton.cxx
@@ -42,50 +42,50 @@ QtInstanceSpinButton::QtInstanceSpinButton(QtDoubleSpinBox* 
pSpinBox)
 
 QWidget* QtInstanceSpinButton::getQWidget() const { return m_pSpinBox; }
 
-void QtInstanceSpinButton::set_value(sal_Int64 nValue)
+void QtInstanceSpinButton::set_floating_point_value(double fValue)
 {
     SolarMutexGuard g;
-    GetQtInstance().RunInMainThread([&] { (m_pSpinBox->setValue(nValue)); });
+    GetQtInstance().RunInMainThread([&] { (m_pSpinBox->setValue(fValue)); });
 }
 
-sal_Int64 QtInstanceSpinButton::get_value() const
+double QtInstanceSpinButton::get_floating_point_value() const
 {
     SolarMutexGuard g;
 
-    sal_Int64 nValue;
-    GetQtInstance().RunInMainThread([&] { nValue = 
std::round(m_pSpinBox->value()); });
-    return nValue;
+    double fValue;
+    GetQtInstance().RunInMainThread([&] { fValue = m_pSpinBox->value(); });
+    return fValue;
 }
 
-void QtInstanceSpinButton::set_range(sal_Int64 nMin, sal_Int64 nMax)
+void QtInstanceSpinButton::set_floating_point_range(double fMin, double fMax)
 {
     SolarMutexGuard g;
-    GetQtInstance().RunInMainThread([&] { (m_pSpinBox->setRange(nMin, nMax)); 
});
+    GetQtInstance().RunInMainThread([&] { (m_pSpinBox->setRange(fMin, fMax)); 
});
 }
 
-void QtInstanceSpinButton::get_range(sal_Int64& rMin, sal_Int64& rMax) const
+void QtInstanceSpinButton::get_floating_point_range(double& rMin, double& 
rMax) const
 {
     SolarMutexGuard g;
 
     GetQtInstance().RunInMainThread([&] {
-        rMin = std::round(m_pSpinBox->minimum());
-        rMax = std::round(m_pSpinBox->maximum());
+        rMin = m_pSpinBox->minimum();
+        rMax = m_pSpinBox->maximum();
     });
 }
 
-void QtInstanceSpinButton::set_increments(sal_Int64 nStep, sal_Int64)
+void QtInstanceSpinButton::set_floating_point_increments(double fStep, double)
 {
     SolarMutexGuard g;
 
-    GetQtInstance().RunInMainThread([&] { m_pSpinBox->setSingleStep(nStep); });
+    GetQtInstance().RunInMainThread([&] { m_pSpinBox->setSingleStep(fStep); });
 }
 
-void QtInstanceSpinButton::get_increments(sal_Int64& rStep, sal_Int64& rPage) 
const
+void QtInstanceSpinButton::get_floating_point_increments(double& rStep, 
double& rPage) const
 {
     SolarMutexGuard g;
 
     GetQtInstance().RunInMainThread([&] {
-        rStep = std::round(m_pSpinBox->singleStep());
+        rStep = m_pSpinBox->singleStep();
         rPage = rStep;
     });
 }
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 0a7f090ad17b..547f95e44687 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5863,37 +5863,34 @@ 
SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanc
         m_xButton->SetActivateHdl(LINK(this, SalInstanceSpinButton, 
ActivateHdl));
 }
 
-sal_Int64 SalInstanceSpinButton::get_value() const
-{
-    return convert_double_to_value(m_rFormatter.GetValue());
-}
+double SalInstanceSpinButton::get_floating_point_value() const { return 
m_rFormatter.GetValue(); }
 
-void SalInstanceSpinButton::set_value(sal_Int64 value)
+void SalInstanceSpinButton::set_floating_point_value(double fValue)
 {
-    m_rFormatter.SetValue(convert_value_to_double(value));
+    m_rFormatter.SetValue(fValue);
 }
 
-void SalInstanceSpinButton::set_range(sal_Int64 min, sal_Int64 max)
+void SalInstanceSpinButton::set_floating_point_range(double fMin, double fMax)
 {
-    m_rFormatter.SetMinValue(convert_value_to_double(min));
-    m_rFormatter.SetMaxValue(convert_value_to_double(max));
+    m_rFormatter.SetMinValue(fMin);
+    m_rFormatter.SetMaxValue(fMax);
 }
 
-void SalInstanceSpinButton::get_range(sal_Int64& min, sal_Int64& max) const
+void SalInstanceSpinButton::get_floating_point_range(double& rMin, double& 
rMax) const
 {
-    min = convert_double_to_value(m_rFormatter.GetMinValue());
-    max = convert_double_to_value(m_rFormatter.GetMaxValue());
+    rMin = m_rFormatter.GetMinValue();
+    rMax = m_rFormatter.GetMaxValue();
 }
 
-void SalInstanceSpinButton::set_increments(sal_Int64 step, sal_Int64 /*page*/)
+void SalInstanceSpinButton::set_floating_point_increments(double fStep, double 
/*fPage*/)
 {
-    m_rFormatter.SetSpinSize(convert_value_to_double(step));
+    m_rFormatter.SetSpinSize(fStep);
 }
 
-void SalInstanceSpinButton::get_increments(sal_Int64& step, sal_Int64& page) 
const
+void SalInstanceSpinButton::get_floating_point_increments(double& rStep, 
double& rPage) const
 {
-    step = convert_double_to_value(m_rFormatter.GetSpinSize());
-    page = convert_double_to_value(m_rFormatter.GetSpinSize());
+    rStep = m_rFormatter.GetSpinSize();
+    rPage = m_rFormatter.GetSpinSize();
 }
 
 void SalInstanceSpinButton::set_digits(unsigned int digits)
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 86b69e1d3c58..7edf22c210fd 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17739,16 +17739,16 @@ public:
 #endif
     }
 
-    virtual sal_Int64 get_value() const override
+    virtual double get_floating_point_value() const override
     {
-        return convert_double_to_value(gtk_spin_button_get_value(m_pButton));
+        return gtk_spin_button_get_value(m_pButton);
     }
 
-    virtual void set_value(sal_Int64 value) override
+    virtual void set_floating_point_value(double fValue) override
     {
         disable_notify_events();
         m_bBlank = false;
-        gtk_spin_button_set_value(m_pButton, convert_value_to_double(value));
+        gtk_spin_button_set_value(m_pButton, fValue);
         enable_notify_events();
     }
 
@@ -17787,36 +17787,28 @@ public:
         enable_notify_events();
     }
 
-    virtual void set_range(sal_Int64 min, sal_Int64 max) override
+    virtual void set_floating_point_range(double fMin, double fMax) override
     {
         disable_notify_events();
-        gtk_spin_button_set_range(m_pButton, convert_value_to_double(min),
-                                  convert_value_to_double(max));
+        gtk_spin_button_set_range(m_pButton, fMin, fMax);
         enable_notify_events();
     }
 
-    virtual void get_range(sal_Int64& min, sal_Int64& max) const override
+    virtual void get_floating_point_range(double& rMin, double& rMax) const 
override
     {
-        double gtkmin, gtkmax;
-        gtk_spin_button_get_range(m_pButton, &gtkmin, &gtkmax);
-        min = convert_double_to_value(gtkmin);
-        max = convert_double_to_value(gtkmax);
+        gtk_spin_button_get_range(m_pButton, &rMin, &rMax);
     }
 
-    virtual void set_increments(sal_Int64 step, sal_Int64 page) override
+    virtual void set_floating_point_increments(double fStep, double fPage) 
override
     {
         disable_notify_events();
-        gtk_spin_button_set_increments(m_pButton, 
convert_value_to_double(step),
-                                       convert_value_to_double(page));
+        gtk_spin_button_set_increments(m_pButton, fStep, fPage);
         enable_notify_events();
     }
 
-    virtual void get_increments(sal_Int64& step, sal_Int64& page) const 
override
+    virtual void get_floating_point_increments(double& rStep, double& rPage) 
const override
     {
-        double gtkstep, gtkpage;
-        gtk_spin_button_get_increments(m_pButton, &gtkstep, &gtkpage);
-        step = convert_double_to_value(gtkstep);
-        page = convert_double_to_value(gtkpage);
+        gtk_spin_button_get_increments(m_pButton, &rStep, &rPage);
     }
 
     virtual void set_digits(unsigned int digits) override
commit 7528dac1b2cd4ac13a0cf988a68fdc701c0b240f
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Feb 17 10:54:18 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Feb 18 08:58:47 2025 +0100

    tdf#130857 vcl: Move sal_Int64 <-> double helpers to weld::SpinButton
    
    The weld::SpinButton API uses integers (sal_Int64) to represent
    all values, including floating point values (by taking into account
    the number of digits, see also weld::SpinButton::normalize and
    weld::SpinButton::denormalize and how they're used in dialog
    implementations).
    
    However, both GtkInstanceSpinButton and SalInstanceSpinButton
    internally use double to represent values
    (GtkInstanceSpinButton via its GtkSpinButton, SalInstanceSpinButton
    via Formatter) and each had their own implementation to convert
    between the two.
    
    Move the GTK implementations to the weld::SpinButton base class and
    reuse them in SalInstanceSpinButton. This also avoids
    the need to reimplement the same logic yet another
    time for more weld::SpinButton subclasses, like
    QtInstanceSpinButton.
    
    Change-Id: I2ecf0b8713a99e15887ab4ee6d4cda27f1afdfc4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181781
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4a35e917dc65..a1a438ca1c60 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1894,6 +1894,17 @@ protected:
         return TRISTATE_TRUE;
     }
 
+    // helper methods to convert between sal_Int64 value and
+    // floating point number it represents (depending on get_digits())
+    double convert_value_to_double(sal_Int64 nValue) const
+    {
+        return static_cast<double>(nValue) / Power10(get_digits());
+    }
+    sal_Int64 convert_double_to_value(double fDouble) const
+    {
+        return basegfx::fround64(fDouble * Power10(get_digits()));
+    }
+
 public:
     virtual void set_value(sal_Int64 value) = 0;
     virtual sal_Int64 get_value() const = 0;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index f1651e94c664..2ba0f2895f35 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -684,10 +684,6 @@ private:
     DECL_LINK(InputHdl, sal_Int64*, TriState);
     DECL_LINK(ActivateHdl, Edit&, bool);
 
-    double toField(sal_Int64 nValue) const;
-
-    sal_Int64 fromField(double fValue) const;
-
 public:
     SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* 
pBuilder,
                           bool bTakeOwnership);
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c56972ffa9d2..0a7f090ad17b 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5845,19 +5845,6 @@ IMPL_LINK(SalInstanceIconView, CommandHdl, const 
CommandEvent&, rEvent, bool)
     return m_aCommandHdl.Call(rEvent);
 }
 
-double SalInstanceSpinButton::toField(sal_Int64 nValue) const
-{
-    return static_cast<double>(nValue) / Power10(get_digits());
-}
-
-sal_Int64 SalInstanceSpinButton::fromField(double fValue) const
-{
-    auto const x = fValue * Power10(get_digits());
-    return x == double(std::numeric_limits<sal_Int64>::max())
-               ? std::numeric_limits<sal_Int64>::max()
-               : sal_Int64(std::round(x));
-}
-
 SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, 
SalInstanceBuilder* pBuilder,
                                              bool bTakeOwnership)
     : SalInstanceEntry(pButton, pBuilder, bTakeOwnership)
@@ -5876,31 +5863,37 @@ 
SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanc
         m_xButton->SetActivateHdl(LINK(this, SalInstanceSpinButton, 
ActivateHdl));
 }
 
-sal_Int64 SalInstanceSpinButton::get_value() const { return 
fromField(m_rFormatter.GetValue()); }
+sal_Int64 SalInstanceSpinButton::get_value() const
+{
+    return convert_double_to_value(m_rFormatter.GetValue());
+}
 
-void SalInstanceSpinButton::set_value(sal_Int64 value) { 
m_rFormatter.SetValue(toField(value)); }
+void SalInstanceSpinButton::set_value(sal_Int64 value)
+{
+    m_rFormatter.SetValue(convert_value_to_double(value));
+}
 
 void SalInstanceSpinButton::set_range(sal_Int64 min, sal_Int64 max)
 {
-    m_rFormatter.SetMinValue(toField(min));
-    m_rFormatter.SetMaxValue(toField(max));
+    m_rFormatter.SetMinValue(convert_value_to_double(min));
+    m_rFormatter.SetMaxValue(convert_value_to_double(max));
 }
 
 void SalInstanceSpinButton::get_range(sal_Int64& min, sal_Int64& max) const
 {
-    min = fromField(m_rFormatter.GetMinValue());
-    max = fromField(m_rFormatter.GetMaxValue());
+    min = convert_double_to_value(m_rFormatter.GetMinValue());
+    max = convert_double_to_value(m_rFormatter.GetMaxValue());
 }
 
 void SalInstanceSpinButton::set_increments(sal_Int64 step, sal_Int64 /*page*/)
 {
-    m_rFormatter.SetSpinSize(toField(step));
+    m_rFormatter.SetSpinSize(convert_value_to_double(step));
 }
 
 void SalInstanceSpinButton::get_increments(sal_Int64& step, sal_Int64& page) 
const
 {
-    step = fromField(m_rFormatter.GetSpinSize());
-    page = fromField(m_rFormatter.GetSpinSize());
+    step = convert_double_to_value(m_rFormatter.GetSpinSize());
+    page = convert_double_to_value(m_rFormatter.GetSpinSize());
 }
 
 void SalInstanceSpinButton::set_digits(unsigned int digits)
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 76bb5bcafc08..86b69e1d3c58 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17681,7 +17681,7 @@ private:
             return 0;
         if (eHandled == TRISTATE_TRUE)
         {
-            *new_value = pThis->toGtk(result);
+            *new_value = pThis->convert_value_to_double(result);
             return 1;
         }
         return GTK_INPUT_ERROR;
@@ -17698,16 +17698,6 @@ private:
         GtkInstanceEditable::signal_activate();
     }
 
-    double toGtk(sal_Int64 nValue) const
-    {
-        return static_cast<double>(nValue) / Power10(get_digits());
-    }
-
-    sal_Int64 fromGtk(double fValue) const
-    {
-        return basegfx::fround64(fValue * Power10(get_digits()));
-    }
-
 #if !GTK_CHECK_VERSION(4, 0, 0)
     static gboolean signalScroll(GtkWidget* pWidget, GdkEventScroll* 
/*pEvent*/, gpointer /*widget*/)
     {
@@ -17751,14 +17741,14 @@ public:
 
     virtual sal_Int64 get_value() const override
     {
-        return fromGtk(gtk_spin_button_get_value(m_pButton));
+        return convert_double_to_value(gtk_spin_button_get_value(m_pButton));
     }
 
     virtual void set_value(sal_Int64 value) override
     {
         disable_notify_events();
         m_bBlank = false;
-        gtk_spin_button_set_value(m_pButton, toGtk(value));
+        gtk_spin_button_set_value(m_pButton, convert_value_to_double(value));
         enable_notify_events();
     }
 
@@ -17800,7 +17790,8 @@ public:
     virtual void set_range(sal_Int64 min, sal_Int64 max) override
     {
         disable_notify_events();
-        gtk_spin_button_set_range(m_pButton, toGtk(min), toGtk(max));
+        gtk_spin_button_set_range(m_pButton, convert_value_to_double(min),
+                                  convert_value_to_double(max));
         enable_notify_events();
     }
 
@@ -17808,14 +17799,15 @@ public:
     {
         double gtkmin, gtkmax;
         gtk_spin_button_get_range(m_pButton, &gtkmin, &gtkmax);
-        min = fromGtk(gtkmin);
-        max = fromGtk(gtkmax);
+        min = convert_double_to_value(gtkmin);
+        max = convert_double_to_value(gtkmax);
     }
 
     virtual void set_increments(sal_Int64 step, sal_Int64 page) override
     {
         disable_notify_events();
-        gtk_spin_button_set_increments(m_pButton, toGtk(step), toGtk(page));
+        gtk_spin_button_set_increments(m_pButton, 
convert_value_to_double(step),
+                                       convert_value_to_double(page));
         enable_notify_events();
     }
 
@@ -17823,8 +17815,8 @@ public:
     {
         double gtkstep, gtkpage;
         gtk_spin_button_get_increments(m_pButton, &gtkstep, &gtkpage);
-        step = fromGtk(gtkstep);
-        page = fromGtk(gtkpage);
+        step = convert_double_to_value(gtkstep);
+        page = convert_double_to_value(gtkpage);
     }
 
     virtual void set_digits(unsigned int digits) override

Reply via email to