diff options
-rw-r--r-- | include/sfx2/charwin.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/control/charwin.cxx | 24 |
2 files changed, 17 insertions, 8 deletions
diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx index 405af4bd53ad..a2beabc5b2df 100644 --- a/include/sfx2/charwin.hxx +++ b/include/sfx2/charwin.hxx @@ -44,6 +44,7 @@ private: virtual void GetFocus() override; virtual void LoseFocus() override; virtual bool KeyInput(const KeyEvent&) override; + virtual bool Command(const CommandEvent&) override; virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; public: SvxCharView(const VclPtr<VirtualDevice>& rVirDev); diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx index f80bd30b684d..b94d2bcd1e82 100644 --- a/sfx2/source/control/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -19,6 +19,7 @@ #include <vcl/settings.hxx> #include <vcl/virdev.hxx> +#include <vcl/commandevent.hxx> #include <vcl/event.hxx> #include <vcl/svapp.hxx> #include <vcl/weldutils.hxx> @@ -65,16 +66,10 @@ bool SvxCharView::MouseButtonDown(const MouseEvent& rMEvt) } maMouseClickHdl.Call(this); + return true; } - if (rMEvt.IsRight()) - { - GrabFocus(); - Invalidate(); - createContextMenu(rMEvt.GetPosPixel()); - } - - return true; + return CustomWidgetController::MouseButtonDown(rMEvt); } bool SvxCharView::KeyInput(const KeyEvent& rKEvt) @@ -92,6 +87,19 @@ bool SvxCharView::KeyInput(const KeyEvent& rKEvt) return bRet; } +bool SvxCharView::Command(const CommandEvent& rCommandEvent) +{ + if (rCommandEvent.GetCommand() == CommandEventId::ContextMenu) + { + GrabFocus(); + Invalidate(); + createContextMenu(rCommandEvent.GetMousePosPixel()); + return true; + } + + return weld::CustomWidgetController::Command(rCommandEvent); +} + void SvxCharView::InsertCharToDoc() { if (GetText().isEmpty()) |