I'm working on a LibreOffice extension where the Options dialog has to have a list of checkboxes that are created programmatically, since they depend on what extra data files (custom settings for a spelling/grammar checker) the user has installed.
It's easy enough to add some checkboxes manually in the macro organizer dialog editor that I can export to a .xdl file and load from Python, but I haven't found any sort of "container" that I can add checkboxes to so I can get automatic positioning and scrolling.
I can add entries programmatically to a ListBox that I've made in a dialog.xdl using
boxC = windowC.getControl("toggleIds")
boxM = boxC.getModel()
entries = ("some", "checkbox", "entries")
uno.invoke(boxM, "setPropertyValue", ("StringItemList", uno.Any("[]string", entries)))
but multiselection in a listbox requires ctrl-clicking, which is not very intuitive.
I can programmatically add a single checkbox to the dialog window (the "main part" of the extension's Options tab) using
windowM = windowC.getModel()
ctx = uno.getComponentContext()
cb1 = ctx.ServiceManager.createInstanceWithContext("com.sun.star.form.component.CheckBox", ctx)
cb1.Label = "some label"
cb1.State = 1;
windowM.insertByName("mycb1", cb1)
which puts it at the very top, but then it seems I'd have to manually do all the scrolling-code, positioning etc. If I do insertByName multiple times here, it adds them all at the same position, I haven't yet figured out how to add them below one another.
I see there is C++ code which uses SvxCheckListBox, e.g. optcomp.cxx, but this seems like a newer development, at least I can't find anything referring to it in the old Java AWT docs.
TL;DR: Is there a simple way to programmatically make a list of checkboxes from Python extensions to LibreOffice?