sc/source/ui/dbgui/filtdlg.cxx | 19 ++++++++----------- vcl/unx/gtk3/gtk3gtkinst.cxx | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 13 deletions(-)
New commits: commit 64db723b2047cf566b652c11c94d9d589df0b930 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Sep 7 09:06:01 2020 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Sep 7 11:55:51 2020 +0200 Related: tdf#136455 use insert_vector for bulk insert and insert backwards which is a little faster Change-Id: Ie72d08bb6e869b2d8fe86ae5526706d051233939 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102151 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index ff1f87137095..2b0d5618a92c 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -438,14 +438,14 @@ void ScFilterDlg::UpdateValueList( size_t nList ) const sal_Int32 nFieldSelPos = maFieldLbArr[nList-1]->get_active(); OUString aCurValue = pValList->get_active_text(); - pValList->clear(); - pValList->append_text(aStrNotEmpty); - pValList->append_text(aStrEmpty); + std::unique_ptr<weld::WaitObject> xWaiter; + std::vector<weld::ComboBoxEntry> aEntries; + aEntries.emplace_back(aStrNotEmpty); + aEntries.emplace_back(aStrEmpty); - if ( nFieldSelPos ) + if (nFieldSelPos) { - weld::WaitObject aWaiter(m_xDialog.get()); // even if only the list box has content - + xWaiter.reset(new weld::WaitObject(m_xDialog.get())); // even if only the list box has content SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1; EntryList* pList = nullptr; if (!m_EntryLists.count(nColumn)) @@ -504,13 +504,10 @@ void ScFilterDlg::UpdateValueList( size_t nList ) assert(pList); - pValList->freeze(); for (const auto& rEntry : pList->maFilterEntries) - { - pValList->append_text(rEntry.GetString()); - } - pValList->thaw(); + aEntries.emplace_back(rEntry.GetString()); } + pValList->insert_vector(aEntries, false); pValList->set_entry_text(aCurValue); } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 5230dcf92a88..8a15f98530d7 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -14551,14 +14551,25 @@ public: virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, bool bKeepExisting) override { freeze(); + + int nInsertionPoint; if (!bKeepExisting) + { clear(); + nInsertionPoint = 0; + } + else + nInsertionPoint = get_count(); + GtkTreeIter iter; - for (const auto& rItem : rItems) + // tdf#125241 inserting backwards is faster + for (auto aI = rItems.rbegin(); aI != rItems.rend(); ++aI) { - insert_row(GTK_LIST_STORE(m_pTreeModel), iter, -1, rItem.sId.isEmpty() ? nullptr : &rItem.sId, + const auto& rItem = *aI; + insert_row(GTK_LIST_STORE(m_pTreeModel), iter, nInsertionPoint, rItem.sId.isEmpty() ? nullptr : &rItem.sId, rItem.sString, rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr); } + thaw(); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
