diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-03-06 21:20:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-03-07 10:00:16 +0100 |
commit | c641ca15f2a898b7ec66cf39ef4517a1221bab81 (patch) | |
tree | 63cca3a6bd2081dc25eb0681d6d3c490e09b3cb4 /sfx2 | |
parent | 418cb3c844da2e7094fa6b63b33d8c938897203c (diff) |
tdf#147782 retain focus in launching frame on first activate
Change-Id: I813c675ecf7c4a364f9d770af12e99275f510e7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131088
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/recfloat.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/inc/recfloat.hxx | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index 18833ea5edfa..6a6fc17dbd9a 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/frame/XDispatchRecorder.hpp> #include <svl/eitem.hxx> @@ -101,6 +102,7 @@ SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(SfxBindings* pBind, SfxChildWindo "FloatingRecord") , m_xToolbar(m_xBuilder->weld_toolbar("toolbar")) , m_xDispatcher(new ToolbarUnoDispatcher(*m_xToolbar, *m_xBuilder, pBind->GetActiveFrame())) + , m_bFirstActivate(true) { // start recording SfxBoolItem aItem( SID_RECORDMACRO, true ); @@ -108,6 +110,18 @@ SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(SfxBindings* pBind, SfxChildWindo SfxCallMode::SYNCHRON, { &aItem }); } +void SfxRecordingFloat_Impl::Activate() +{ + SfxModelessDialogController::Activate(); + if (!m_bFirstActivate) + return; + // tdf#147782 retain focus in launching frame on the first activate on automatically gaining focus on getting launched + m_bFirstActivate = false; + css::uno::Reference<css::awt::XTopWindow> xTopWindow(m_xDispatcher->GetFrame()->getContainerWindow(), css::uno::UNO_QUERY); + if (xTopWindow.is()) + xTopWindow->toFront(); +} + SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl() { m_xDispatcher->dispose(); diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx index e25ad7f08fda..b7a4882cd72e 100644 --- a/sfx2/source/inc/recfloat.hxx +++ b/sfx2/source/inc/recfloat.hxx @@ -42,12 +42,14 @@ class SfxRecordingFloat_Impl final : public SfxModelessDialogController { std::unique_ptr<weld::Toolbar> m_xToolbar; std::unique_ptr<ToolbarUnoDispatcher> m_xDispatcher; + bool m_bFirstActivate; public: SfxRecordingFloat_Impl(SfxBindings* pBindings, SfxChildWindow* pChildWin, weld::Window* pParent); virtual ~SfxRecordingFloat_Impl() override; virtual void FillInfo(SfxChildWinInfo& rInfo) const override; + virtual void Activate() override; }; #endif |