Styles Spotlight: Make numbering consistent in all VCL backends

Currently styles spotlight numbers are reverse for GTK compared to the
other VCL backends. This patch makes inserting items into the style list
happen in the same order for all VCL plugins.

Change-Id: Id14b385b24bc03ca5a794d0279990d3a411fd762
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205573
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski
2026-05-26 19:45:22 +02:00
parent 169b5f14eb
commit f55852a2a4
7 changed files with 26 additions and 12 deletions
+2 -1
View File
@@ -366,7 +366,8 @@ public:
const std::function<void(TreeIter&, int nSourceIndex)>& func,
const weld::TreeIter* pParent = nullptr,
const std::vector<int>* pFixedWidths = nullptr,
bool bGoingToSetText = false)
bool bGoingToSetText = false,
bool bForceForwardInsert = false)
= 0;
/* expanding on-demand node details
+3 -2
View File
@@ -772,7 +772,8 @@ static void FillBox_Impl(weld::TreeView& rBox, StyleTreeArr_Impl& rTreeArray,
rBox.set_font_color(
rIter, Application::GetSettings().GetStyleSettings().GetDisableColor());
},
pParent, nullptr, /*bGoingToSetText*/ true);
pParent, nullptr, /*bGoingToSetText*/ true,
/*ForceForwardInsert*/ blcl_insert ? true : false);
std::unique_ptr<weld::TreeIter> xChildParentIter = rBox.make_iterator(pParent);
if (!pParent)
@@ -1324,7 +1325,7 @@ void StyleList::FillFlatTreeView()
m_xFmtLb->set_font_color(
rIter, Application::GetSettings().GetStyleSettings().GetDisableColor());
},
nullptr, nullptr, /*bGoingToSetText*/ true);
nullptr, nullptr, /*bGoingToSetText*/ true, /*ForceForwardInsert*/ true);
}
else
{
+1 -1
View File
@@ -98,7 +98,7 @@ public:
virtual void bulk_insert_for_each(
int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
const weld::TreeIter* pParent = nullptr, const std::vector<int>* pFixedWidths = nullptr,
bool bGoingToSetText = false) override;
bool bGoingToSetText = false, bool bForceForwardInsert = false) override;
virtual bool get_row_expanded(const weld::TreeIter& rIter) const override;
virtual void expand_row(const weld::TreeIter& rIter) override;
+1 -1
View File
@@ -1669,7 +1669,7 @@ public:
virtual void bulk_insert_for_each(
int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
const weld::TreeIter* pParent = nullptr, const std::vector<int>* pFixedWidths = nullptr,
bool bGoingToSetText = false) override;
bool bGoingToSetText = false, bool bForceForwardInsert = false) override;
virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) override;
+1 -1
View File
@@ -481,7 +481,7 @@ void QtInstanceTreeView::visible_foreach(const std::function<bool(weld::TreeIter
void QtInstanceTreeView::bulk_insert_for_each(
int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
const weld::TreeIter* pParent, const std::vector<int>* pFixedWidths, bool)
const weld::TreeIter* pParent, const std::vector<int>* pFixedWidths, bool, bool)
{
SolarMutexGuard g;
+1 -1
View File
@@ -4053,7 +4053,7 @@ void SalInstanceTreeView::do_insert_separator(int pos, const OUString& /*rId*/)
void SalInstanceTreeView::bulk_insert_for_each(
int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
const weld::TreeIter* pParent, const std::vector<int>* pFixedWidths, bool bGoingToSetText)
const weld::TreeIter* pParent, const std::vector<int>* pFixedWidths, bool bGoingToSetText, bool)
{
const SalInstanceTreeIter* pVclIter = static_cast<const SalInstanceTreeIter*>(pParent);
SvTreeListEntry* pVclParent = pVclIter ? pVclIter->iter : nullptr;
+17 -5
View File
@@ -14973,7 +14973,8 @@ public:
virtual void bulk_insert_for_each(int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
const weld::TreeIter* pParent,
const std::vector<int>* pFixedWidths,
bool /*bGoingToSetText*/) override
bool /*bGoingToSetText*/,
bool bForceForwardInsert) override
{
GtkInstanceTreeIter* pGtkIter = const_cast<GtkInstanceTreeIter*>(static_cast<const GtkInstanceTreeIter*>(pParent));
@@ -14994,11 +14995,22 @@ public:
if (pFixedWidths)
set_column_fixed_widths(*pFixedWidths);
while (nSourceCount)
if (bForceForwardInsert)
{
// tdf#125241 inserting backwards is massively faster
m_Prepend(m_pTreeModel, &aGtkIter.iter, pGtkIter ? &pGtkIter->iter : nullptr);
func(aGtkIter, --nSourceCount);
for (int i = 0; i < nSourceCount; ++i)
{
m_Insert(m_pTreeModel, &aGtkIter.iter, pGtkIter ? &pGtkIter->iter : nullptr, i);
func(aGtkIter, i);
}
}
else
{
while (nSourceCount)
{
// tdf#125241 inserting backwards is massively faster
m_Prepend(m_pTreeModel, &aGtkIter.iter, pGtkIter ? &pGtkIter->iter : nullptr);
func(aGtkIter, --nSourceCount);
}
}
thaw();