diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-08 16:15:55 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-11-15 08:58:16 +0000 |
commit | d1909ab7940109ce7d43da04e480db4e82b8310f (patch) | |
tree | 0c755ddba5fbaff06bc1cb1161d84d4196ec7724 /sd | |
parent | 8fc6be8d2c0fd455b9c461143594457a08a3e250 (diff) |
tdf#103756 - CTRL+Z not working to undo changes performed through Navigator
Hooked up the tree control to do explicit handling of accelerator key
input.
Note that there is an extra check for null in SdPageObjsTLB::SetViewFrame
to prevent various 'make check' failures. No idea why this did
not trigger on trunk.
Reviewed-on: https://gerrit.libreoffice.org/30694
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit e9da91fd028e73846b1bed2618357d0abfbdcc57)
Change-Id: I8b47fc2d651f7db2549c73c5314fbc4a7f4efecc
Reviewed-on: https://gerrit.libreoffice.org/30769
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 22 | ||||
-rw-r--r-- | sd/source/ui/inc/sdtreelb.hxx | 9 |
2 files changed, 29 insertions, 2 deletions
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 0e0babdc0ab2..0aeab054e253 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/embed/XEmbedPersist.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> +#include <svtools/acceleratorexecute.hxx> #include <svtools/embedtransfer.hxx> #include <svtools/svlbitm.hxx> #include <svtools/treelistentry.hxx> @@ -56,6 +57,8 @@ #include <comphelper/processfactory.hxx> #include <tools/diagnose_ex.h> #include <o3tl/make_unique.hxx> + + using namespace com::sun::star; class SdPageObjsTLB::IconProvider @@ -252,8 +255,22 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle ) SetDragDropMode( DragDropMode::CTRL_MOVE | DragDropMode::CTRL_COPY | DragDropMode::APP_MOVE | DragDropMode::APP_COPY | DragDropMode::APP_DROP ); + + m_pAccel = ::svt::AcceleratorExecute::createAcceleratorHelper(); } +void SdPageObjsTLB::SetViewFrame( SfxViewFrame* pViewFrame ) +{ + mpFrame = pViewFrame; + if (m_pAccel) + { + sd::ViewShellBase* pBase = sd::ViewShellBase::GetViewShellBase(pViewFrame); + const css::uno::Reference< css::frame::XFrame > xFrame = pBase->GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(); + m_pAccel->init(::comphelper::getProcessComponentContext(), xFrame); + } +} + + SdPageObjsTLB::~SdPageObjsTLB() { disposeOnce(); @@ -268,6 +285,7 @@ void SdPageObjsTLB::dispose() delete mpMedium; mpParent.clear(); mpDropNavWin.clear(); + m_pAccel.reset(); SvTreeListBox::dispose(); } @@ -1075,6 +1093,10 @@ void SdPageObjsTLB::SelectHdl() */ void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt ) { + const vcl::KeyCode& aKeyCode = rKEvt.GetKeyCode(); + if ( m_pAccel->execute( aKeyCode ) ) + // the accelerator consumed the event + return; if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) { // commented code from svtools/source/contnr/svimpbox.cxx diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index 2976b65ae1d7..35e166c09b81 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -50,6 +50,9 @@ class DrawDocShell; typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef; #endif } +namespace svt { + class AcceleratorExecute; +} /** * Effect-Tab-Dialog @@ -62,6 +65,8 @@ private: // set contenttree in SdNavigatorWin bool bisInSdNavigatorWin; + + ::std::unique_ptr< ::svt::AcceleratorExecute> m_pAccel; public: // nested class to implement the TransferableHelper @@ -183,7 +188,7 @@ public: SdPageObjsTLB( vcl::Window* pParent, const SdResId& rSdResId ); SdPageObjsTLB( vcl::Window* pParent, WinBits nStyle ); - virtual ~SdPageObjsTLB(); + virtual ~SdPageObjsTLB(); virtual void dispose() override; // helper function for GetEntryAltText and GetEntryLongDescription @@ -193,7 +198,7 @@ public: virtual void SelectHdl() override; virtual void KeyInput( const KeyEvent& rKEvt ) override; - void SetViewFrame( SfxViewFrame* pViewFrame ) { mpFrame = pViewFrame; } + void SetViewFrame( SfxViewFrame* pViewFrame ); void Fill( const SdDrawDocument*, bool bAllPages, const OUString& rDocName ); void Fill( const SdDrawDocument*, SfxMedium* pSfxMedium, const OUString& rDocName ); |