fdo#74506 fdo#74291 -Template manager-store selection before calling dialog

It looks like calling a dialog/querybox result in a deselection of
the selected ThumbnailViewItem(s). Therefore lets save this selection
first, before calling such dialog.

Change-Id: I45a1da4307759ca6472f793fff29b1e2507fd5c9
Reviewed-on: https://gerrit.libreoffice.org/7902
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>