summaryrefslogtreecommitdiff
path: root/sfx2/source/toolbox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-09-12 17:22:23 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-09-13 12:49:46 +0200
commit0c88fd43aebc57ebe8e4e49b74c1b6bef067ad89 (patch)
tree16173deb89a3b34d040a36ce2a25590d6bc0e849 /sfx2/source/toolbox
parent35377971467be9b2ba30bab3e9b0983be11b4196 (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/toolbox')
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx16
1 files changed, 1 insertions, 15 deletions
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 0559ac6464f9..1240100e9daa 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -47,7 +47,6 @@
#include <vcl/taskpanelist.hxx>
#include <vcl/event.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/globname.hxx>
#include <vcl/InterimItemWindow.hxx>
#include <sfx2/tbxctrl.hxx>
@@ -84,7 +83,6 @@ svt::ToolboxController* SfxToolBoxControllerFactory( const Reference< XFrame >&
if ( !aTargetURL.Arguments.isEmpty() )
return nullptr;
- SfxObjectShell* pObjShell = nullptr;
Reference < XController > xController;
Reference < XModel > xModel;
if ( rFrame.is() )
@@ -94,19 +92,7 @@ svt::ToolboxController* SfxToolBoxControllerFactory( const Reference< XFrame >&
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_QUERY );
- if ( xObj.is() )
- {
- css::uno::Sequence < sal_Int8 > aSeq = SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence();
- 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;