diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-04-18 21:29:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-04-19 17:12:33 +0200 |
commit | 4b26862f696ef04b42ff922f6b620383e2747808 (patch) | |
tree | 815a5f685336503c192f38fd0ef591b001297ba3 | |
parent | 1b7edbafe0c73ce53b78696aa88f67a5eb526878 (diff) |
mru entry heights aren't initially correct until whole list is invalidated
and recalculates them, set them correctly to begin with
Change-Id: I55735c1982a972cb76caca95363820beb2be350a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92492
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/inc/listbox.hxx | 3 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx index 5addb1c7de24..dd71d65943f2 100644 --- a/vcl/inc/listbox.hxx +++ b/vcl/inc/listbox.hxx @@ -267,7 +267,8 @@ public: ImplEntryList* GetEntryList() const { return mpEntryList.get(); } - sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ); + sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ); // sorts using mbSort + sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort ); // to insert ignoring mbSort, e.g. mru void RemoveEntry( sal_Int32 nPos ); void Clear(); void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; } diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index d60ebfcaece5..1c866149eabc 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -732,13 +732,13 @@ void ImplListBoxWindow::ImplCallSelect() mbSelectionChanged = false; } -sal_Int32 ImplListBoxWindow::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ) +sal_Int32 ImplListBoxWindow::InsertEntry(sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort) { assert(nPos >= 0); assert(mpEntryList->GetEntryCount() < LISTBOX_MAX_ENTRIES); ImplClearLayoutData(); - sal_Int32 nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort ); + sal_Int32 nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, bSort ); if( GetStyle() & WB_WORDBREAK ) pNewEntry->mnFlags |= ListBoxEntryFlags::MultiLine; @@ -747,6 +747,11 @@ sal_Int32 ImplListBoxWindow::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEnt return nNewPos; } +sal_Int32 ImplListBoxWindow::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ) +{ + return InsertEntry(nPos, pNewEntry, mbSort); +} + void ImplListBoxWindow::RemoveEntry( sal_Int32 nPos ) { ImplClearLayoutData(); @@ -2551,7 +2556,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ) if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND ) { ImplEntryType* pNewEntry = new ImplEntryType( aEntry ); - maLBWindow->GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, false ); + maLBWindow->InsertEntry(nMRUCount++, pNewEntry, false); bChanges = true; } } |