tdf#136208 make combo/list/spin take focus on use of scroll wheel

So using the scrollwheel on those widgets when they do not have focus will
cause then to take focus. That will then cause the fontsize/fontname widgets to
reset back to the current document size/name if they are scrolled to a new
value, but their new value not explicitly applied to the current document,
when focus is restored to the document window.

Change-Id: I5d27e5e90c4d76d9cb3321878d82e22d40cacf81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102261
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx
index 0485001..4d714e4 100644
--- a/vcl/inc/listbox.hxx
+++ b/vcl/inc/listbox.hxx
@@ -427,7 +427,7 @@ public:
    sal_Int32       GetCurrentPos() const           { return maLBWindow->GetCurrentPos(); }

    bool            ProcessKeyInput( const KeyEvent& rKEvt )    { return maLBWindow->ProcessKeyInput( rKEvt ); }
    bool            HandleWheelAsCursorTravel( const CommandEvent& rCEvt );
    bool            HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control& rControl);

    /**
     * Removes existing separators, and sets the position of the
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 00764d6..b5b14d8 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -784,7 +784,7 @@ bool ComboBox::EventNotify( NotifyEvent& rNEvt )
                )
            )
        {
            bDone = m_pImpl->m_pImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
            bDone = m_pImpl->m_pImplLB->HandleWheelAsCursorTravel(*rNEvt.GetCommandEvent(), *this);
        }
        else
        {
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index e25a506..a11d0eb 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -2402,7 +2402,7 @@ const Wallpaper& ImplListBox::GetDisplayBackground() const
    return maLBWindow->GetDisplayBackground();
}

bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
bool ImplListBox::HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control& rControl)
{
    bool bDone = false;
    if ( rCEvt.GetCommand() == CommandEventId::Wheel )
@@ -2410,6 +2410,8 @@ bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
        const CommandWheelData* pData = rCEvt.GetWheelData();
        if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
        {
            if (!rControl.HasChildPathFocus())
                rControl.GrabFocus();
            sal_uInt16 nKey = ( pData->GetDelta() < 0 ) ? KEY_DOWN : KEY_UP;
            KeyEvent aKeyEvent( 0, vcl::KeyCode( nKey ) );
            bDone = ProcessKeyInput( aKeyEvent );
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index fbada64..a82e4ce 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -883,7 +883,7 @@ bool ListBox::PreNotify( NotifyEvent& rNEvt )
                    )
                )
            {
                bDone = mpImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
                bDone = mpImplLB->HandleWheelAsCursorTravel(*rNEvt.GetCommandEvent(), *this);
            }
            else
            {
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index d9298ae..f63c037 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -554,6 +554,9 @@ bool SpinField::EventNotify(NotifyEvent& rNEvt)
                    else
                        Up();
                    bDone = true;

                    if (!HasChildPathFocus())
                        GrabFocus();
                }
            }
            else