diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-04-26 15:43:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-04-29 09:46:08 +0200 |
commit | fe9a13dc0e6d1384416c2a2343223b33925fc925 (patch) | |
tree | a43a8ea0cc46407b8932dced64cf34d595f3b3e9 /vcl/source/app/weldutils.cxx | |
parent | cf36fe5eb41910c26d58fb25e54ccf2e0ee01365 (diff) |
weld SfxTemplatePanelControl
Change-Id: Ib3f6d01ddec37afc3987423dc15ab84ad6475f37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92942
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/app/weldutils.cxx')
-rw-r--r-- | vcl/source/app/weldutils.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index dea707be3c5e..19f6464052d6 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -105,6 +105,25 @@ void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle) } eState = rToggle.get_state(); } + +void RemoveParentKeepChildren(weld::TreeView& rTreeView, weld::TreeIter& rParent) +{ + if (rTreeView.iter_has_child(rParent)) + { + std::unique_ptr<weld::TreeIter> xNewParent(rTreeView.make_iterator(&rParent)); + if (!rTreeView.iter_parent(*xNewParent)) + xNewParent.reset(); + + while (true) + { + std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator(&rParent)); + if (!rTreeView.iter_children(*xChild)) + break; + rTreeView.move_subtree(*xChild, xNewParent.get(), -1); + } + } + rTreeView.remove(rParent); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |