vcl/inc/jsdialog/jsdialogbuilder.hxx |    3 +++
 vcl/jsdialog/jsdialogbuilder.cxx     |    9 ++++++++-
 vcl/source/control/fmtfield.cxx      |    4 ++--
 3 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 5d4c7accb91893a53dfaf9814dd9fa6db6c7005b
Author:     Dennis Francis <[email protected]>
AuthorDate: Fri Oct 31 16:38:55 2025 +0530
Commit:     Andras Timar <[email protected]>
CommitDate: Mon Nov 10 19:03:14 2025 +0100

    lok: formatted-spin-button is ignoring input
    
    Calling Edit::SetText() via SalInstanceFormattedSpinButton::set_text()
    on a FormattedField does not parse and store the value using its
    formatter at least in the jsdialog case.
    
    Signed-off-by: Dennis Francis <[email protected]>
    Change-Id: Ia20ba0f260a6c5e78b19dff328899d974658de94
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193260
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit c8876c34fb8b9bd99f6b62b505876dbe7ab523b2)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193758
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index bd733f2a4669..29930748f213 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -620,6 +620,9 @@ public:
 
     virtual void set_text(const OUString& rText) override;
     void set_text_without_notify(const OUString& rText);
+
+private:
+    VclPtr<::FormattedField> m_pFmtSpin;
 };
 
 class JSMessageDialog final : public JSWidget<SalInstanceMessageDialog, 
::MessageDialog>
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index a7ac443bf561..e31e1c34247b 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1403,12 +1403,19 @@ 
JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::Formatte
                                              SalInstanceBuilder* pBuilder, 
bool bTakeOwnership)
     : JSWidget<SalInstanceFormattedSpinButton, ::FormattedField>(pSender, 
pSpin, pBuilder,
                                                                  
bTakeOwnership)
+    , m_pFmtSpin(pSpin)
 {
 }
 
 void JSFormattedSpinButton::set_text(const OUString& rText)
 {
-    SalInstanceFormattedSpinButton::set_text(rText);
+    if (!m_pFmtSpin)
+        return;
+
+    disable_notify_events();
+    m_pFmtSpin->SetValueFromString(rText);
+    enable_notify_events();
+
     sendUpdate();
 }
 
commit 5b3d4a20dfd8a8a458a49b30eb3376dbaa1cb4a9
Author:     Dennis Francis <[email protected]>
AuthorDate: Fri Oct 31 16:26:56 2025 +0530
Commit:     Andras Timar <[email protected]>
CommitDate: Mon Nov 10 19:03:02 2025 +0100

    lok: FormattedField: ensure formatter has min and max
    
    If not use the limits of a 32 bit integer. Without this check if min/max
    are not set already, the json min/max will be set to 0/0 which is
    problematic in web clients where it rejects all inputs.
    
    Signed-off-by: Dennis Francis <[email protected]>
    Change-Id: I9fa2bb68b47626ad42bae51e52e4b14baecb82fb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193259
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit f62a357d7b32084de1e32e88d599938a59b94f11)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193757
    Tested-by: Andras Timar <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index ec8f5569ecab..37a205f92574 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -1360,8 +1360,8 @@ void 
FormattedField::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
         // weld::TimeFormatter uses h24 format
         rJsonWriter.put("type", "time");
     }
-    rJsonWriter.put("min", rFormatter.GetMinValue());
-    rJsonWriter.put("max", rFormatter.GetMaxValue());
+    rJsonWriter.put("min", rFormatter.HasMinValue() ? rFormatter.GetMinValue() 
: std::numeric_limits<sal_Int32>::min());
+    rJsonWriter.put("max", rFormatter.HasMaxValue() ? rFormatter.GetMaxValue() 
: std::numeric_limits<sal_Int32>::max());
     rJsonWriter.put("value", rFormatter.GetValue());
     rJsonWriter.put("step", rFormatter.GetSpinSize());
 }

Reply via email to