sc/source/ui/navipi/navipi.cxx    |   30 +++++++-----------------------
 vcl/inc/qt5/QtInstanceBuilder.hxx |    4 ++--
 vcl/qt5/QtInstanceBuilder.cxx     |    7 +++----
 3 files changed, 12 insertions(+), 29 deletions(-)

New commits:
commit 70ffc422e515ca2ccea68de2c5bc4bf09cebf500
Author:     Michael Weghorn <[email protected]>
AuthorDate: Sat Feb 15 13:32:09 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sun Feb 16 11:11:43 2025 +0100

    sc: Don't modify string passed to NumToAlpha/AlphaToNum
    
    The NumToAlpha and AlphaToNum helper functions
    are only used by ScNavigatorDlg::ParseRowInputHdl
    (and AlphaToNum also calls NumToAlpha in turn).
    
    So far, both methods were taking an `OUString&`
    param and modifying that string.
    
    However, ScNavigatorDlg::ParseRowInputHdl doesn't
    actually make use of the out param any more after
    calling those methods, so switch the param to
    `const OUString&` instead and stop modifying
    the value in the helper functions.
    
    In AlphaToNum, introduce a new local variable
    `aUpperCaseStr` so that the modified string
    can be used within that function without
    modifying the string passed as a param.
    
    In NumToAlpha, drop the call to ::ScColToAlpha,
    whose only effect was to modify the out param,
    and drop the now unused out param altogether.
    
    Change-Id: Idcfd743603e12a06633b615aa8c912c244f0bd56
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181712
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 168c72e8c147..6dcbe4389be3 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -75,38 +75,34 @@ void ScNavigatorDlg::ReleaseFocus()
 
 namespace
 {
-    SCCOL NumToAlpha(const ScSheetLimits& rSheetLimits, SCCOL nColNo, 
OUString& rStr)
+    SCCOL NumToAlpha(const ScSheetLimits& rSheetLimits, SCCOL nColNo)
     {
         if ( nColNo > SCNAV_MAXCOL(rSheetLimits) )
             nColNo = SCNAV_MAXCOL(rSheetLimits);
         else if ( nColNo < 1 )
             nColNo = 1;
 
-        ::ScColToAlpha( rStr, nColNo - 1);
-
         return nColNo;
     }
 
-    SCCOL AlphaToNum(const ScDocument& rDoc, OUString& rStr)
+    SCCOL AlphaToNum(const ScDocument& rDoc, const OUString& rStr)
     {
         SCCOL  nColumn = 0;
 
         if ( CharClass::isAsciiAlpha( rStr) )
         {
-            rStr = rStr.toAsciiUpperCase();
+            const OUString aUpperCaseStr = rStr.toAsciiUpperCase();
 
-            if (::AlphaToCol( rDoc, nColumn, rStr))
+            if (::AlphaToCol( rDoc, nColumn, aUpperCaseStr))
                 ++nColumn;
 
-            if ( (rStr.getLength() > SCNAV_COLLETTERS(rDoc.GetSheetLimits())) 
||
+            if ( (aUpperCaseStr.getLength() > 
SCNAV_COLLETTERS(rDoc.GetSheetLimits())) ||
                  (nColumn > SCNAV_MAXCOL(rDoc.GetSheetLimits())) )
             {
                 nColumn = SCNAV_MAXCOL(rDoc.GetSheetLimits());
-                NumToAlpha( rDoc.GetSheetLimits(), nColumn, rStr );
+                NumToAlpha( rDoc.GetSheetLimits(), nColumn);
             }
         }
-        else
-            rStr.clear();
 
         return nColumn;
     }
@@ -125,7 +121,7 @@ IMPL_LINK(ScNavigatorDlg, ParseRowInputHdl, int*, result, 
bool)
             ScDocument& rDoc = pData->GetDocument();
 
             if ( CharClass::isAsciiNumeric(aStrCol) )
-                nCol = NumToAlpha(rDoc.GetSheetLimits(), 
static_cast<SCCOL>(aStrCol.toInt32()), aStrCol);
+                nCol = NumToAlpha(rDoc.GetSheetLimits(), 
static_cast<SCCOL>(aStrCol.toInt32()));
             else
                 nCol = AlphaToNum( rDoc, aStrCol );
         }
commit d97caf36686ff31df96edbf40ef1aa3aecc5af4f
Author:     Michael Weghorn <[email protected]>
AuthorDate: Sat Feb 15 13:17:03 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sun Feb 16 11:11:36 2025 +0100

    sc: Merge NumStrToAlpha into only caller
    
    ScNavigatorDlg::ParseRowInputHdl is the only
    caller of NumStrToAlpha, so merge the two.
    
    ScNavigatorDlg::ParseRowInputHdl already calls
    CharClass::isAsciiNumeric, so the repeated check in
    NumStrToAlpha was redundant.
    
    Change-Id: I0065aacb1350e01bdda73468c2f607d0a29967fd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181711
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 0863bb7413ae..168c72e8c147 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -110,18 +110,6 @@ namespace
 
         return nColumn;
     }
-
-    SCCOL NumStrToAlpha(const ScSheetLimits& rSheetLimits, OUString& rStr)
-    {
-        SCCOL  nColumn = 0;
-
-        if ( CharClass::isAsciiNumeric(rStr) )
-            nColumn = NumToAlpha( rSheetLimits, 
static_cast<SCCOL>(rStr.toInt32()), rStr );
-        else
-            rStr.clear();
-
-        return nColumn;
-    }
 }
 
 IMPL_LINK(ScNavigatorDlg, ParseRowInputHdl, int*, result, bool)
@@ -137,7 +125,7 @@ IMPL_LINK(ScNavigatorDlg, ParseRowInputHdl, int*, result, 
bool)
             ScDocument& rDoc = pData->GetDocument();
 
             if ( CharClass::isAsciiNumeric(aStrCol) )
-                nCol = NumStrToAlpha( rDoc.GetSheetLimits(), aStrCol );
+                nCol = NumToAlpha(rDoc.GetSheetLimits(), 
static_cast<SCCOL>(aStrCol.toInt32()), aStrCol);
             else
                 nCol = AlphaToNum( rDoc, aStrCol );
         }
commit 62cb9a6f1f5c5cd5c8427978e2f9cdef550c1bd6
Author:     Michael Weghorn <[email protected]>
AuthorDate: Sat Feb 15 01:26:49 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sun Feb 16 11:11:29 2025 +0100

    tdf#130857 qt weld: Implement QtInstanceBuilder::weld_metric_spin_button
    
    Do the same as the GTK implementation does.
    
    Change-Id: I1c15af157213f33120cf93ea8edcd9dfc08c5eb8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181686
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx 
b/vcl/inc/qt5/QtInstanceBuilder.hxx
index 8b1051a4a3f0..2ed75b7c4d88 100644
--- a/vcl/inc/qt5/QtInstanceBuilder.hxx
+++ b/vcl/inc/qt5/QtInstanceBuilder.hxx
@@ -58,8 +58,8 @@ public:
     virtual std::unique_ptr<weld::Calendar> weld_calendar(const OUString&) 
override;
     virtual std::unique_ptr<weld::Entry> weld_entry(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString& 
rId) override;
-    virtual std::unique_ptr<weld::MetricSpinButton> 
weld_metric_spin_button(const OUString&,
-                                                                            
FieldUnit) override;
+    virtual std::unique_ptr<weld::MetricSpinButton>
+    weld_metric_spin_button(const OUString& rId, FieldUnit eUnit) override;
     virtual std::unique_ptr<weld::FormattedSpinButton>
     weld_formatted_spin_button(const OUString&) override;
     virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OUString& 
rId) override;
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 4bfa1d1ffb14..d4f01952a3fd 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -325,11 +325,10 @@ std::unique_ptr<weld::SpinButton> 
QtInstanceBuilder::weld_spin_button(const OUSt
     return xRet;
 }
 
-std::unique_ptr<weld::MetricSpinButton> 
QtInstanceBuilder::weld_metric_spin_button(const OUString&,
-                                                                               
    FieldUnit)
+std::unique_ptr<weld::MetricSpinButton>
+QtInstanceBuilder::weld_metric_spin_button(const OUString& rId, FieldUnit 
eUnit)
 {
-    assert(false && "Not implemented yet");
-    return nullptr;
+    return std::make_unique<weld::MetricSpinButton>(weld_spin_button(rId), 
eUnit);
 }
 
 std::unique_ptr<weld::FormattedSpinButton>

Reply via email to