Resolves: tdf#157453 support FM_PROP_LINECOUNT for combobox dropdow rows

Change-Id: I3d18ed505c2eea7305903f9a476c332db0148113
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167814
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index fc585bd..2a4e1ef 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -889,6 +889,10 @@ public:
    virtual void set_max_mru_count(int nCount) = 0;
    virtual OUString get_mru_entries() const = 0;
    virtual void set_mru_entries(const OUString& rEntries) = 0;

    // Backwards compatibility, should be avoided to allow
    // UI consistency.
    virtual void set_max_drop_down_rows(int nRows) = 0;
};

enum class ColumnToggleType
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index e8c56fb..2f17f7f 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2629,9 +2629,16 @@ void DbListBox::Init(BrowserDataWin& rParent, const Reference< XRowSet >& xCurso
    DbCellControl::Init( rParent, xCursor );
}

void DbListBox::implAdjustGenericFieldSetting( const Reference< XPropertySet >& /*rxModel*/ )
void DbListBox::implAdjustGenericFieldSetting(const Reference<XPropertySet>& _rxModel)
{
    // ignore FM_PROP_LINECOUNT
    DBG_ASSERT( m_pWindow, "DbListBox::implAdjustGenericFieldSetting: not to be called without window!" );
    DBG_ASSERT( _rxModel.is(), "DbListBox::implAdjustGenericFieldSetting: invalid model!" );
    if ( m_pWindow && _rxModel.is() )
    {
        sal_Int16  nLines   = getINT16( _rxModel->getPropertyValue( FM_PROP_LINECOUNT ) );
        weld::ComboBox& rComboBox = static_cast<ListBoxControl*>(m_pWindow.get())->get_widget();
        rComboBox.set_max_drop_down_rows(nLines);
    }
}

CellControllerRef DbListBox::CreateController() const
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 4074e09..d6d3a90 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -922,6 +922,8 @@ public:
        return 20 * (pDefault ? pDefault->GetDPIScaleFactor() : 1.0);
    }

    void set_max_drop_down_rows(int nRows) override { m_xComboBox->SetDropDownLineCount(nRows); }

    void CallHandleEventListener(VclWindowEvent& rEvent)
    {
        if (rEvent.GetId() == VclEventId::DropdownPreOpen
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index faf645f..8dc0edf 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6927,6 +6927,8 @@ public:

    virtual void set_mru_entries(const OUString&) override { assert(false && "not implemented"); }

    virtual void set_max_drop_down_rows(int) override { assert(false && "not implemented"); }

    virtual void set_item_menu(const OUString&, weld::Menu*) override
    {
        assert(false && "not implemented");
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index a899fc1..6a06947 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -21034,6 +21034,11 @@ public:
#endif
    }

    virtual void set_max_drop_down_rows(int) override
    {
        SAL_WARN( "vcl.gtk", "set_max_drop_down_rows unimplemented");
    }

    virtual ~GtkInstanceComboBox() override
    {
//        m_xCustomMenuButtonHelper.reset();
@@ -21114,6 +21119,7 @@ private:
    gint m_nPrePopupCursorPos;
    int m_nMRUCount;
    int m_nMaxMRUCount;
    int m_nMaxDropdownRows;

    static gboolean idleAutoComplete(gpointer widget)
    {
@@ -21236,7 +21242,7 @@ private:
    {
        const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();

        int nMaxRows = rSettings.GetListBoxMaximumLineCount();
        int nMaxRows = m_nMaxDropdownRows == -1 ? rSettings.GetListBoxMaximumLineCount() : m_nMaxDropdownRows;
        bool bAddScrollWidth = false;
        int nRows = get_count_including_mru();
        if (nMaxRows < nRows)
@@ -22154,6 +22160,7 @@ public:
        , m_nPrePopupCursorPos(-1)
        , m_nMRUCount(0)
        , m_nMaxMRUCount(0)
        , m_nMaxDropdownRows(-1)
    {
        int nActive = gtk_combo_box_get_active(m_pComboBox);

@@ -22838,6 +22845,11 @@ public:
        return nWidth;
    }

    virtual void set_max_drop_down_rows(int nMaxRows) override
    {
        m_nMaxDropdownRows = nMaxRows;
    }

    virtual ~GtkInstanceComboBox() override
    {
        m_xCustomMenuButtonHelper.reset();
@@ -23223,6 +23235,8 @@ public:
        return 0;
    }

    virtual void set_max_drop_down_rows(int) override { assert(false && "not implemented"); }

    virtual ~GtkInstanceEntryTreeView() override
    {
        if (m_nAutoCompleteIdleId)