convert the weak reference macro in tools into a template

which required making SfxFrame subclass SvCompatWeakBase,
but that makes the relationships clearer anyhow.

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