tdf#134038 use mnCheckWidthReq to avoid text width calculation
when mnCheckWidthReq is available
Change-Id: I9964b1df9e025ab737d0d306148930c34b7d7148
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96474
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index f095e66..37d63fb 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1180,6 +1180,7 @@ size_t ScCheckListMenuControl::initMembers()
if (!mxChecks->n_children() && !mbHasDates)
{
std::vector<int> aFixedWidths { mnCheckWidthReq };
// tdf#134038 insert in the fastest order, this might be backwards so only do it for
// the !mbHasDates case where no entry depends on another to exist before getting
// inserted. We cannot retain pre-existing treeview content, only clear and fill it.
@@ -1188,7 +1189,7 @@ size_t ScCheckListMenuControl::initMembers()
insertMember(*mxChecks, rIter, maMembers[i]);
if (maMembers[i].mbVisible)
++nVisMemCount;
});
}, mnCheckWidthReq != -1 ? &aFixedWidths : nullptr);
}
else
{