[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Oct 10 15:33:01 UTC 2018
include/sfx2/sidebar/SidebarController.hxx | 2 ++
include/sfx2/sidebar/SidebarDockingWindow.hxx | 3 +++
include/sfx2/sidebar/TabBar.hxx | 2 ++
sfx2/source/sidebar/SidebarDockingWindow.cxx | 10 ++++++++--
sfx2/source/sidebar/TabBar.cxx | 8 +++++++-
5 files changed, 22 insertions(+), 3 deletions(-)
New commits:
commit 69c826957362be0de36bff190d299545a5780e1a
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Mon Oct 8 16:29:13 2018 -0800
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Oct 10 17:32:37 2018 +0200
Unhardcode sidebar used customizable key bindings
Change-Id: Ia3bc171e2c9805955394fac274de382c3f87d35f
Reviewed-on: https://gerrit.libreoffice.org/61564
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index c314391f195a..c81e306736bd 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -168,6 +168,8 @@ public:
tools::Rectangle GetDeckDragArea() const;
+ css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;}
+
private:
SidebarController(
SidebarDockingWindow* pParentWindow,
diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx
index 2df114e1c585..931cb34c5c6b 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -23,6 +23,8 @@
#include <rtl/ref.hxx>
+#include <svtools/acceleratorexecute.hxx>
+
namespace sfx2 { namespace sidebar {
class SidebarChildWindow;
@@ -55,6 +57,7 @@ protected:
private:
::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController;
bool mbIsReadyToDrag;
+ std::unique_ptr<svt::AcceleratorExecute> mpAccel;
void DoDispose();
};
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index c672bcbf71d0..0c6cd097711c 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -31,6 +31,7 @@
#include <functional>
+#include <svtools/acceleratorexecute.hxx>
class Button;
class CheckBox;
@@ -119,6 +120,7 @@ private:
DECL_LINK(OnToolboxClicked, Button*, void);
SidebarController* pParentSidebarController;
+ std::unique_ptr<svt::AcceleratorExecute> mpAccel;
};
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 9c1f9c66dc32..1ed62e98e5af 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -121,7 +121,13 @@ bool SidebarDockingWindow::EventNotify(NotifyEvent& rEvent)
if (MouseNotifyEvent::KEYINPUT == nType)
{
const vcl::KeyCode& rKeyCode = rEvent.GetKeyEvent()->GetKeyCode();
- if ( ( 0 == rKeyCode.GetModifier() ) && ( KEY_F11 == rKeyCode.GetCode() ) )
+ if (!mpAccel)
+ {
+ mpAccel = svt::AcceleratorExecute::createAcceleratorHelper();
+ mpAccel->init(comphelper::getProcessComponentContext(), mpSidebarController->getXFrame());
+ }
+ const OUString aCommand(mpAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode)));
+ if (".uno:DesignerDialog" == aCommand)
{
std::shared_ptr<PanelDescriptor> xPanelDescriptor =
mpSidebarController->GetResourceManager()->GetPanelDescriptor( "StyleListPanel" );
@@ -129,7 +135,7 @@ bool SidebarDockingWindow::EventNotify(NotifyEvent& rEvent)
Close();
return true;
}
- if ( !( ( KEY_MOD1 == rKeyCode.GetModifier() ) && ( KEY_F5 == rKeyCode.GetCode() ) ) )
+ if (".uno:Sidebar" != aCommand)
return true;
}
else if (MouseNotifyEvent::MOUSEBUTTONDOWN == nType)
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index c69b6b17bb97..4d6a67ed22d2 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -233,7 +233,13 @@ bool TabBar::EventNotify(NotifyEvent& rEvent)
if(MouseNotifyEvent::KEYINPUT == nType)
{
const vcl::KeyCode& rKeyCode = rEvent.GetKeyEvent()->GetKeyCode();
- if((KEY_MOD1 == rKeyCode.GetModifier()) && (KEY_F5 == rKeyCode.GetCode()))
+ if (!mpAccel)
+ {
+ mpAccel = svt::AcceleratorExecute::createAcceleratorHelper();
+ mpAccel->init(comphelper::getProcessComponentContext(), mxFrame);
+ }
+ const OUString aCommand(mpAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode)));
+ if (".uno:Sidebar" == aCommand)
return vcl::Window::EventNotify(rEvent);
return true;
}
More information about the Libreoffice-commits
mailing list