include/vcl/toolkit/field.hxx |    4 --
 vcl/source/control/field.cxx  |   58 ------------------------------------------
 2 files changed, 62 deletions(-)

New commits:
commit 9b0debcf45dc1e3765aeac193f4b1457cacb6248
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Oct 20 11:58:43 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Tue Oct 21 07:20:10 2025 +0200

    Impl{Metric,Currency}ProcessKeyInput always return false
    
    They call ImplNumericProcessKeyInput with bStrictFormat = false, and
    that always returns false in that case. That was so from the initial
    import time.
    
    This makes a bunch of overridden PreNotify unneeded: they call their
    inherited method always.
    
    Change-Id: Ia55aabdb25b2acc9caa67f529f8de3864048ace2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192714
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx
index ab1ca80d57d2..e1f3b9e9d316 100644
--- a/include/vcl/toolkit/field.hxx
+++ b/include/vcl/toolkit/field.hxx
@@ -210,7 +210,6 @@ class VCL_DLLPUBLIC MetricField final : public SpinField, 
public MetricFormatter
 public:
     explicit                MetricField( vcl::Window* pParent, WinBits 
nWinStyle );
 
-    SAL_DLLPRIVATE virtual bool            PreNotify( NotifyEvent& rNEvt ) 
override;
     SAL_DLLPRIVATE virtual bool            EventNotify( NotifyEvent& rNEvt ) 
override;
     SAL_DLLPRIVATE virtual void            DataChanged( const 
DataChangedEvent& rDCEvt ) override;
 
@@ -242,7 +241,6 @@ class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetricBox final : 
public ComboBox, public
 public:
     explicit                MetricBox( vcl::Window* pParent, WinBits nWinStyle 
);
 
-    virtual bool            PreNotify( NotifyEvent& rNEvt ) override;
     virtual bool            EventNotify( NotifyEvent& rNEvt ) override;
     virtual void            DataChanged( const DataChangedEvent& rDCEvt ) 
override;
 
@@ -279,7 +277,6 @@ class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyField final : 
public SpinField, pu
 public:
     CurrencyField( vcl::Window* pParent, WinBits nWinStyle );
 
-    virtual bool            PreNotify( NotifyEvent& rNEvt ) override;
     virtual bool            EventNotify( NotifyEvent& rNEvt ) override;
     virtual void            DataChanged( const DataChangedEvent& rDCEvt ) 
override;
 
@@ -584,7 +581,6 @@ class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyBox final : 
public ComboBox, publi
 public:
     explicit                CurrencyBox( vcl::Window* pParent, WinBits 
nWinStyle );
 
-    virtual bool            PreNotify( NotifyEvent& rNEvt ) override;
     virtual bool            EventNotify( NotifyEvent& rNEvt ) override;
     virtual void            DataChanged( const DataChangedEvent& rDCEvt ) 
override;
 
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index d4f3751a2df6..305c72213dc5 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -943,13 +943,6 @@ void NumericBox::ReformatAll()
     SetUpdateMode( true );
 }
 
-static bool ImplMetricProcessKeyInput( const KeyEvent& rKEvt,
-                                       bool bUseThousandSep, const 
LocaleDataWrapper& rWrapper )
-{
-    // no meaningful strict format; therefore allow all characters
-    return ImplNumericProcessKeyInput( rKEvt, false, bUseThousandSep, rWrapper 
);
-}
-
 static OUString ImplMetricGetUnitText(std::u16string_view rStr)
 {
     // fetch unit text
@@ -1426,17 +1419,6 @@ sal_Int64 MetricField::GetLast( FieldUnit eOutUnit ) 
const
     return vcl::ConvertValue(mnLast, 0, GetDecimalDigits(), meUnit, eOutUnit);
 }
 
-bool MetricField::PreNotify( NotifyEvent& rNEvt )
-{
-    if ( (rNEvt.GetType() == NotifyEventType::KEYINPUT) && 
!rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
-    {
-        if ( ImplMetricProcessKeyInput( *rNEvt.GetKeyEvent(), 
IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
-            return true;
-    }
-
-    return SpinField::PreNotify( rNEvt );
-}
-
 bool MetricField::EventNotify( NotifyEvent& rNEvt )
 {
     if ( rNEvt.GetType() == NotifyEventType::GETFOCUS )
@@ -1539,17 +1521,6 @@ Size MetricBox::CalcMinimumSize() const
     return aRet;
 }
 
-bool MetricBox::PreNotify( NotifyEvent& rNEvt )
-{
-    if ( (rNEvt.GetType() == NotifyEventType::KEYINPUT) && 
!rNEvt.GetKeyEvent()->GetKeyCode().IsMod2()  )
-    {
-        if ( ImplMetricProcessKeyInput( *rNEvt.GetKeyEvent(), 
IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
-            return true;
-    }
-
-    return ComboBox::PreNotify( rNEvt );
-}
-
 bool MetricBox::EventNotify( NotifyEvent& rNEvt )
 {
     if ( rNEvt.GetType() == NotifyEventType::GETFOCUS )
@@ -1601,13 +1572,6 @@ void MetricBox::ReformatAll()
     SetUpdateMode( true );
 }
 
-static bool ImplCurrencyProcessKeyInput( const KeyEvent& rKEvt,
-                                         bool bUseThousandSep, const 
LocaleDataWrapper& rWrapper )
-{
-    // no strict format set; therefore allow all characters
-    return ImplNumericProcessKeyInput( rKEvt, false, bUseThousandSep, rWrapper 
);
-}
-
 static bool ImplCurrencyGetValue( std::u16string_view rStr, sal_Int64& rValue,
                                   sal_uInt16 nDecDigits, const 
LocaleDataWrapper& rWrapper )
 {
@@ -1688,17 +1652,6 @@ void CurrencyField::dispose()
     SpinField::dispose();
 }
 
-bool CurrencyField::PreNotify( NotifyEvent& rNEvt )
-{
-    if ( (rNEvt.GetType() == NotifyEventType::KEYINPUT) && 
!rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
-    {
-        if ( ImplCurrencyProcessKeyInput( *rNEvt.GetKeyEvent(), 
IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
-            return true;
-    }
-
-    return SpinField::PreNotify( rNEvt );
-}
-
 bool CurrencyField::EventNotify( NotifyEvent& rNEvt )
 {
     if ( rNEvt.GetType() == NotifyEventType::GETFOCUS )
@@ -1771,17 +1724,6 @@ void CurrencyBox::dispose()
     ComboBox::dispose();
 }
 
-bool CurrencyBox::PreNotify( NotifyEvent& rNEvt )
-{
-    if ( (rNEvt.GetType() == NotifyEventType::KEYINPUT) && 
!rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() )
-    {
-        if ( ImplCurrencyProcessKeyInput( *rNEvt.GetKeyEvent(), 
IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
-            return true;
-    }
-
-    return ComboBox::PreNotify( rNEvt );
-}
-
 bool CurrencyBox::EventNotify( NotifyEvent& rNEvt )
 {
     if ( rNEvt.GetType() == NotifyEventType::GETFOCUS )

Reply via email to