summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-01-21 12:52:30 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-01-26 10:27:42 +0100
commit752d15176fe6c3361288f3939508cd9d4497115d (patch)
tree5078beb005b2704972c485e8dc42252399b0ef93
parentbb0b878b9d8a63e43c5063b65b1b2381621a18f6 (diff)
Add SwXTextDocument::postMouseEvent()
Change-Id: Ic2e6343288e87e23026b2f0c17338ecf5f1bed99
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx6
-rw-r--r--sw/source/uibase/inc/edtwin.hxx3
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx20
4 files changed, 28 insertions, 3 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index a837c76494a6..2d5161e2f2e0 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -413,6 +413,8 @@ public:
* @param pData is private data of the client that will be sent back when the callback is invoked
*/
virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
+ /// @see vcl::ITiledRenderable::postMouseEvent().
+ virtual void postMouseEvent(int nType, int nX, int nY) SAL_OVERRIDE;
void Invalidate();
void Reactivate(SwDocShell* pNewDocShell);
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index fef9d4d83c08..d04e3d79b9fb 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6250,15 +6250,15 @@ void SwEditWin::LogicInvalidate(const vcl::Region* pRegion)
m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
-void SwEditWin::LogicMouseMove(const MouseEvent& rMouseEvent)
+void SwEditWin::LogicMouseMove(const MouseEvent& /*rMouseEvent*/)
{
}
-void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
+void SwEditWin::LogicMouseButtonDown(const MouseEvent& /*rMouseEvent*/)
{
}
-void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
+void SwEditWin::LogicMouseButtonUp(const MouseEvent& /*rMouseEvent*/)
{
}
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index c28ad6e7bb26..c1018f8f5132 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -302,8 +302,11 @@ public:
* @param pRegion If 0, that means the whole area, otherwise the area in logic coordinates.
*/
void LogicInvalidate(const vcl::Region* pRegion) SAL_OVERRIDE;
+ /// Same as MouseMove(), but coordinates are in logic unit.
void LogicMouseMove(const MouseEvent& rMouseEvent);
+ /// Same as MouseButtonDown(), but coordinates are in logic unit.
void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
+ /// Same as MouseButtonUp(), but coordinates are in logic unit.
void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
};
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 08fd4a49caa9..cd4b4bc330fb 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -129,6 +129,7 @@
#include <swatrset.hxx>
#include <view.hxx>
#include <srcview.hxx>
+#include <edtwin.hxx>
#include <svtools/langtab.hxx>
#include <map>
@@ -3172,6 +3173,25 @@ void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* p
pViewShell->registerLibreOfficeKitCallback(pCallback, pData);
}
+void SwXTextDocument::postMouseEvent(int nType, int nX, int nY)
+{
+ SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
+ MouseEvent aEvent(Point(nX, nY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
+
+ switch (nType)
+ {
+ case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
+ rEditWin.LogicMouseButtonDown(aEvent);
+ break;
+ case LOK_MOUSEEVENT_MOUSEBUTTONUP:
+ rEditWin.LogicMouseButtonUp(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+}
+
void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
{
return SwXTextDocumentBaseClass::operator new(t);