diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-05 11:45:16 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-05 14:48:28 +0100 |
commit | 972a4a88cf1caec63cb3dcd3be610d1a840f50c9 (patch) | |
tree | 35cdfc924bce421424c5e4f9768ad3b18e33fd70 /sfx2/source/appl/appserv.cxx | |
parent | ddd43218e9900536381733735adf8681d345e775 (diff) |
there's already a way to pass around the SfxRequest source frame
Change-Id: I790497c3e651890e0971ee334d599a98a7aae7f0
Reviewed-on: https://gerrit.libreoffice.org/50768
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/appl/appserv.cxx')
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index bc04d9b178a6..550578327d0b 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -271,7 +271,7 @@ static void showDocument( const char* pBaseName ) namespace { - Reference<XFrame> GetRequestFrame(SfxRequest& rReq) + Reference<XFrame> GetRequestFrame(const SfxRequest& rReq) { const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl(); const SfxPoolItem* pItem = nullptr; @@ -284,7 +284,7 @@ namespace return xFrame; } - weld::Window* getFrameWeld(const Reference<XFrame>& rFrame) + vcl::Window* getFrameWindow(const Reference<XFrame>& rFrame) { if (rFrame.is()) { @@ -292,8 +292,7 @@ namespace { Reference< awt::XWindow > xContainerWindow(rFrame->getContainerWindow(), UNO_SET_THROW); VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContainerWindow); - if (pWindow) - return pWindow->GetFrameWeld(); + return pWindow; } catch (const Exception&) { @@ -305,11 +304,6 @@ namespace return nullptr; } - weld::Window* GetRequestFrameWeld(SfxRequest& rReq) - { - return getFrameWeld(GetRequestFrame(rReq)); - } - class LicenseDialog { private: @@ -362,6 +356,17 @@ namespace }; } +vcl::Window* SfxRequest::GetFrameWindow() const +{ + return getFrameWindow(GetRequestFrame(*this)); +} + +weld::Window* SfxRequest::GetFrameWeld() const +{ + vcl::Window* pWin = GetFrameWindow(); + return pWin ? pWin->GetFrameWeld() : nullptr; +} + void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) { bool bDone = false; @@ -566,7 +571,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } case SID_SHOW_LICENSE: { - LicenseDialog aDialog(GetRequestFrameWeld(rReq)); + LicenseDialog aDialog(rReq.GetFrameWeld()); aDialog.run(); break; } @@ -1030,7 +1035,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } case SID_SAFE_MODE: { - SafeModeQueryDialog aDialog(GetRequestFrameWeld(rReq)); + SafeModeQueryDialog aDialog(rReq.GetFrameWeld()); aDialog.run(); break; } |