fixes for up-casting to Reference<XInterface>

Fix regressions introduced with
6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 "Use the new type-checking
Reference constructor to reduce code noise"

Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 533c6cb6bad6ef0432e8eebbfd4daf90ef71f3b4)

Conflicts:
	framework/source/uifactory/menubarfactory.cxx

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