Files
odfstudio/xmlsecurity/source/dialogs
Michael Weghorn 82edaf048b weld: Return std::unique_ptr in weld::ItemView::get_selected
So far, the method had a weld:::TreeView* out param
and a bool return value, which indicated whether
or not a selected item actually exists (and was
set in the passed TreeIter).

Drop the method param and instead return a
std::unique_ptr<weld::TreeIter>. If it doesn't
own a pointer, there is no selection (i.e. the
case previously indicated by a `false` return
value). If it owns a weld::TreeIter, then
that one points to the (first) selected item.

This simplifies using this as it is no longer
necessary to separately create weld::TreeIter to
pass as an out param first, e.g.

    std::unique_ptr<weld::TreeIter> pEntry = rMyIconView.make_iterator());
    if (rMyIconView.get_selected(xEntry.get()))
    {
        // do sth
    }

now turns into

    if (std::unique_ptr<weld::TreeIter> xEntry = rMyIconView->get_selected())
    {
        // do sth
    }

Adjust all callers accordingly.

It might be worth looking into doing something
similar for other methods (e.g.
weld::ItemView::get_iter_first) as well.

Change-Id: I83146fc8d68a92d50eed9bd635bf91b1450ce495
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196039
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-12-22 09:18:39 +01:00
..
2025-12-01 14:25:01 +01:00