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 /chart2 | |
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 'chart2')
-rw-r--r-- | chart2/source/controller/drawinglayer/DrawViewWrapper.cxx | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index d60b259dad62..4d9598430d08 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -32,7 +32,6 @@ #include <svx/svdoutl.hxx> #include <svx/svxids.hrc> #include <svx/unoshape.hxx> -#include <tools/globname.hxx> #include <editeng/fhgtitem.hxx> #include <com/sun/star/container/XChild.hpp> @@ -58,38 +57,11 @@ namespace return nHitTolerance; } -// this code is copied from sfx2/source/doc/objembed.cxx -SfxObjectShell * lcl_GetParentObjectShell( const uno::Reference< frame::XModel > & xModel ) -{ - SfxObjectShell* pResult = nullptr; - - try - { - uno::Reference< container::XChild > xChildModel( xModel, uno::UNO_QUERY ); - if ( xChildModel.is() ) - { - uno::Reference< lang::XUnoTunnel > xParentTunnel( xChildModel->getParent(), uno::UNO_QUERY ); - if ( xParentTunnel.is() ) - { - SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID ); - pResult = reinterpret_cast< SfxObjectShell * >( - xParentTunnel->getSomething( aSfxIdent.GetByteSequence() ) ); - } - } - } - catch( const uno::Exception& ) - { - // TODO: error handling - } - - return pResult; -} - // this code is copied from sfx2/source/doc/objembed.cxx. It is a workaround to // get the reference device (e.g. printer) from the parent document OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & xModel ) { - SfxObjectShell * pParent = lcl_GetParentObjectShell( xModel ); + SfxObjectShell* pParent = SfxObjectShell::GetParentShell(xModel); if ( pParent ) return pParent->GetDocumentRefDev(); return nullptr; |