tdf#148771 in scrollable dropdowns show some lines before selected entry

and don't just position with the selected entry at the top so it's quick
to pick preceeding adjacent entries

Change-Id: I20103200c34037fb02b3c0dcc29d154c1197549d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133893
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index 1391008..fa01c64 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -1876,6 +1876,11 @@ void ImplListBoxWindow::SetTopEntry( sal_Int32 nTop )

void ImplListBoxWindow::ShowProminentEntry( sal_Int32 nEntryPos )
{
    sal_Int32 nPos = nEntryPos;
    auto nWHeight = PixelToLogic( GetSizePixel() ).Height();
    while( nEntryPos > 0 && maEntryList.GetAddedHeight( nPos+1, nEntryPos ) < nWHeight/2 )
        nEntryPos--;

    SetTopEntry( nEntryPos );
}