include/vcl/weld.hxx | 4 ++++ svx/source/fmcomp/gridcell.cxx | 11 +++++++++-- vcl/inc/salvtables.hxx | 2 ++ vcl/source/app/salvtables.cxx | 2 ++ vcl/unx/gtk3/gtkinst.cxx | 16 +++++++++++++++- 5 files changed, 32 insertions(+), 3 deletions(-)
New commits: commit c5fb86f91c3d799cb3817706a5c9a344939a4f1e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat May 18 21:17:01 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun May 19 16:44:09 2024 +0200 Resolves: tdf#157453 support FM_PROP_LINECOUNT for combobox dropdow rows Change-Id: I3d18ed505c2eea7305903f9a476c332db0148113 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167837 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index bd394dc5d3bc..c3a688d84be0 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 31128317f9cc..8d728384cd5c 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 54abb89ffa21..984baf4e61b8 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -923,6 +923,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 4df7d6ad38fa..e086def8434c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -6910,6 +6910,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 cb71fabe81af..f9b087e25f4e 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -21032,6 +21032,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(); @@ -21112,6 +21117,7 @@ private: gint m_nPrePopupCursorPos; int m_nMRUCount; int m_nMaxMRUCount; + int m_nMaxDropdownRows; static gboolean idleAutoComplete(gpointer widget) { @@ -21234,7 +21240,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) @@ -22152,6 +22158,7 @@ public: , m_nPrePopupCursorPos(-1) , m_nMRUCount(0) , m_nMaxMRUCount(0) + , m_nMaxDropdownRows(-1) { int nActive = gtk_combo_box_get_active(m_pComboBox); @@ -22863,6 +22870,11 @@ public: return nWidth; } + virtual void set_max_drop_down_rows(int nMaxRows) override + { + m_nMaxDropdownRows = nMaxRows; + } + virtual ~GtkInstanceComboBox() override { m_xCustomMenuButtonHelper.reset(); @@ -23248,6 +23260,8 @@ public: return 0; } + virtual void set_max_drop_down_rows(int) override { assert(false && "not implemented"); } + virtual ~GtkInstanceEntryTreeView() override { if (m_nAutoCompleteIdleId)