From 610db8d5d0500aed2ca6d4da822cf70746b44d49 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Thu, 31 Mar 2016 14:47:27 +0530 Subject: lok context menu: Expose context menu Change-Id: I0968689630e10f838c075e86357eb36a9a220d0d --- sw/source/uibase/inc/edtwin.hxx | 4 ++-- sw/source/uibase/uno/unotxdoc.cxx | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'sw') diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index 58f2a489a7e4..96c1d5a7898c 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -197,8 +197,6 @@ protected: virtual void MouseButtonUp(const MouseEvent& rMEvt) override; virtual void RequestHelp(const HelpEvent& rEvt) override; - virtual void Command( const CommandEvent& rCEvt ) override; - // Drag & Drop Interface virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; @@ -295,6 +293,8 @@ public: virtual ~SwEditWin(); virtual void dispose() override; + virtual void Command( const CommandEvent& rCEvt ) override; + /// @see OutputDevice::LogicInvalidate(). void LogicInvalidate(const Rectangle* pRectangle) override; /// Same as MouseButtonDown(), but coordinates are in logic unit. diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 2087912ee710..5a7d25211b92 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3305,12 +3305,19 @@ void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int SolarMutexGuard aGuard; SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); - MouseEvent aEvent(Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); + Point aPos(nX , nY); + MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); switch (nType) { case LOK_MOUSEEVENT_MOUSEBUTTONDOWN: rEditWin.LogicMouseButtonDown(aEvent); + + if (nButtons & MOUSE_RIGHT) + { + const CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true, nullptr); + rEditWin.Command(aCEvt); + } break; case LOK_MOUSEEVENT_MOUSEBUTTONUP: rEditWin.LogicMouseButtonUp(aEvent); -- cgit