diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-09-12 17:22:23 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-09-13 12:49:46 +0200 |
commit | 0c88fd43aebc57ebe8e4e49b74c1b6bef067ad89 (patch) | |
tree | 16173deb89a3b34d040a36ce2a25590d6bc0e849 /sfx2/source/statbar | |
parent | 35377971467be9b2ba30bab3e9b0983be11b4196 (diff) |
Unify the code used to get object shell for components
and their parents across the codebase.
Change-Id: Ifb37fb940d285f81c1724a912204533e8c3b0044
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102546
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2/source/statbar')
-rw-r--r-- | sfx2/source/statbar/stbitem.cxx | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 5695bfb296ee..58dea92b8026 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -46,7 +46,6 @@ #include <svl/intitem.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/convert.hxx> -#include <tools/globname.hxx> #include <ctrlfactoryimpl.hxx> using namespace ::com::sun::star; @@ -80,7 +79,6 @@ svt::StatusbarController* SfxStatusBarControllerFactory( uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); - SfxObjectShell* pObjShell = nullptr; uno::Reference < frame::XController > xController; uno::Reference < frame::XModel > xModel; if ( rFrame.is() ) @@ -90,18 +88,7 @@ svt::StatusbarController* SfxStatusBarControllerFactory( xModel = xController->getModel(); } - if ( xModel.is() ) - { - // Get tunnel from model to retrieve the SfxObjectShell pointer from it - css::uno::Reference < css::lang::XUnoTunnel > xObj( xModel, uno::UNO_QUERY ); - css::uno::Sequence < sal_Int8 > aSeq = SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence(); - if ( xObj.is() ) - { - sal_Int64 nHandle = xObj->getSomething( aSeq ); - if ( nHandle ) - pObjShell = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); - } - } + SfxObjectShell* pObjShell = SfxObjectShell::GetShellFromComponent(xModel); SfxModule* pModule = pObjShell ? pObjShell->GetModule() : nullptr; SfxSlotPool* pSlotPool = nullptr; |