diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-05 11:25:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-05 17:15:28 +0100 |
commit | 3c855c44050da5be935258e2b38c5b402269c996 (patch) | |
tree | a7b2770a5441366bc6d07a67a0e361f3d8668485 /sd | |
parent | 3a2a610451aebaf2cf6168029d4a9a47072ff9ca (diff) |
move handler for ESC to close slideshow from navigator down to contents
Change-Id: Ie021bcf86043cf2ae02eb39911c748135452853c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112007
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/dlg/navigatr.cxx | 69 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/navigatr.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/inc/sdtreelb.hxx | 6 |
4 files changed, 21 insertions, 62 deletions
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index aa8d9cf273c6..6c478bad5741 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -85,6 +85,10 @@ SdNavigatorWin::SdNavigatorWin(vcl::Window* pParent, SfxBindings* pInBindings) SetDragImage(); + mxToolbox->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); + mxTlbObjects->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); + mxLbDocs->connect_key_press(LINK(this, SdNavigatorWin, KeyInputHdl)); + m_pInitialFocusWidget = mxToolbox.get(); } @@ -578,72 +582,25 @@ NavDocInfo* SdNavigatorWin::GetDocInfo() } /** - * PreNotify - */ -bool SdNavigatorWin::EventNotify(NotifyEvent& rNEvt) -{ - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - bool bOK = false; - - if( pKEvt ) - { - if( KEY_ESCAPE == pKEvt->GetKeyCode().GetCode() ) - { - if( SdPageObjsTLV::IsInDrag() ) - { - // during drag'n'drop we just stop the drag but do not close the navigator - bOK = true; - } - else - { - ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame()); - if( pBase ) - { - sd::SlideShow::Stop( *pBase ); - // Stopping the slide show may result in a synchronous - // deletion of the navigator window. Calling the - // parent's EventNotify after this is unsafe. Therefore we - // return now. - return true; - } - } - } - } - - if( !bOK ) - bOK = Window::EventNotify(rNEvt); - - return bOK; -} - -/** * catch ESCAPE in order to end show */ -void SdNavigatorWin::KeyInput( const KeyEvent& rKEvt ) +IMPL_LINK(SdNavigatorWin, KeyInputHdl, const KeyEvent&, rKEvt, bool) { - bool bOK = false; + bool bConsumed = false; - if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) + if (KEY_ESCAPE == rKEvt.GetKeyCode().GetCode()) { - if( SdPageObjsTLV::IsInDrag() ) - { - // during drag'n'drop we just stop the drag but do not close the navigator - bOK = true; - } - else + // during drag'n'drop we just stop the drag but do not close the navigator + if (!SdPageObjsTLV::IsInDrag()) { ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame()); - if(pBase) - { - ::sd::SlideShow::Stop( *pBase ); - } + if (pBase) + sd::SlideShow::Stop(*pBase); + bConsumed = true; } } - if (!bOK) - { - Window::KeyInput(rKEvt); - } + return bConsumed; } void SdNavigatorWin::SetDragImage() diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 576117dfe89f..764301858ad4 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -321,7 +321,7 @@ IMPL_LINK(SdPageObjsTLV, KeyInputHdl, const KeyEvent&, rKEvt, bool) m_aRowActivatedHdl.Call(*m_xTreeView); return true; } - return false; + return m_aKeyPressHdl.Call(rKEvt); } IMPL_LINK(SdPageObjsTLV, MousePressHdl, const MouseEvent&, rMEvt, bool) diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index 5e54e193c526..01f8b43d20da 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -92,8 +92,6 @@ public: virtual ~SdNavigatorWin() override; virtual void dispose() override; - virtual void KeyInput( const KeyEvent& rKEvt ) override; - void InitTreeLB( const SdDrawDocument* pDoc ); void RefreshDocumentLB( const OUString* pDocName = nullptr ); @@ -102,9 +100,6 @@ public: NavigatorDragType GetNavigatorDragType(); SdPageObjsTLV& GetObjects(); -protected: - virtual bool EventNotify(NotifyEvent& rNEvt) override; - private: friend class ::sd::NavigatorChildWindow; friend class SdNavigatorControllerItem; @@ -138,6 +133,7 @@ private: DECL_LINK( SelectDocumentHdl, weld::ComboBox&, void ); DECL_LINK( MenuSelectHdl, const OString&, void ); DECL_LINK( ShapeFilterCallback, const OString&, void ); + DECL_LINK( KeyInputHdl, const KeyEvent&, bool ); void SetDragImage(); diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index 328cc0f23b47..20df211605b7 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -105,6 +105,7 @@ private: ::sd::DrawDocShellRef m_xBookmarkDocShRef; ///< for the loading of bookmarks Link<weld::TreeView&, void> m_aChangeHdl; Link<weld::TreeView&, bool> m_aRowActivatedHdl; + Link<const KeyEvent&, bool> m_aKeyPressHdl; /** Return the name of the object. When the object has no user supplied name and the bCreate flag is <TRUE/> then a name is created @@ -206,6 +207,11 @@ public: m_aRowActivatedHdl = rLink; } + void connect_key_press(const Link<const KeyEvent&, bool>& rLink) + { + m_aKeyPressHdl = rLink; + } + bool HasSelectedChildren(std::u16string_view rName); bool SelectEntry(std::u16string_view rName); |