[Libreoffice-commits] core.git: vcl/inc vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 19 15:13:08 UTC 2020


 vcl/inc/listbox.hxx                |    3 ++-
 vcl/source/control/imp_listbox.cxx |   11 ++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 4b26862f696ef04b42ff922f6b620383e2747808
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Apr 18 21:29:42 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Apr 19 17:12:33 2020 +0200

    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 at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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;
         }
     }


More information about the Libreoffice-commits mailing list