diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-24 14:30:41 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-02 08:50:53 +0100 |
commit | b780822f5afbf8cd6c2a8c756251a7edf248f55e (patch) | |
tree | 2f427d8ed6c2b914d03c20dcc63259a3fb086450 /sd | |
parent | 845708fcc8e9a5a18aa7e70741008c6602f08eae (diff) |
Introduce SdXImpressDocument::postMouseEvent() override
It's far from perfect, but the following use-case works:
- open an empty document with a singe slide (only two placeholder
shapes)
- type a few characters (into the title shape), Esc to finish editing
- click into the non-title placeholder
- type + Esc -> characters appear in the non-title shape
Change-Id: Idc97c1fbeda0fb3ac53769e78b7cd665d8aee67b
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/inc/ViewShell.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 24 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 32 |
4 files changed, 63 insertions, 0 deletions
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index b4bd3331a30e..710c72293f1a 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -443,6 +443,11 @@ public: SdPage* pPage, const sal_Int32 nInsertPosition = -1); + /// 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); + class Implementation; protected: diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 768e4f633f90..64080e7ad992 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -244,6 +244,8 @@ public: virtual void initializeForTiledRendering() SAL_OVERRIDE; /// @see vcl::ITiledRenderable::registerCallback(). virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postMouseEvent(). + virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; // XComponent diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index ff9115a08a32..054e8f20dc71 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2362,6 +2362,30 @@ void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void mpDoc->registerLibreOfficeKitCallback(pCallback, pData); } +void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount) +{ + SolarMutexGuard aGuard; + + DrawViewShell* pViewShell = GetViewShell(); + if (!pViewShell) + return; + + MouseEvent aEvent(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + + switch (nType) + { + case LOK_MOUSEEVENT_MOUSEBUTTONDOWN: + pViewShell->LogicMouseButtonDown(aEvent); + break; + case LOK_MOUSEEVENT_MOUSEBUTTONUP: + pViewShell->LogicMouseButtonUp(aEvent); + break; + default: + assert(false); + break; + } +} + uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() { uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 0581a7cb4238..0056af821e18 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -502,6 +502,38 @@ void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) } } +void ViewShell::LogicMouseButtonDown(const MouseEvent& rMouseEvent) +{ + // When we're not doing tiled rendering, then positions must be passed as pixels. + assert(GetDoc()->isTiledRendering()); + + bool bMap = mpActiveWindow->IsMapModeEnabled(); + mpActiveWindow->EnableMapMode(false); + Point aPoint = mpActiveWindow->GetPointerPosPixel(); + mpActiveWindow->SetPointerPosPixel(rMouseEvent.GetPosPixel()); + + MouseButtonDown(rMouseEvent, 0); + + mpActiveWindow->SetPointerPosPixel(aPoint); + mpActiveWindow->EnableMapMode(bMap); +} + +void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent) +{ + // When we're not doing tiled rendering, then positions must be passed as pixels. + assert(GetDoc()->isTiledRendering()); + + bool bMap = mpActiveWindow->IsMapModeEnabled(); + mpActiveWindow->EnableMapMode(false); + Point aPoint = mpActiveWindow->GetPointerPosPixel(); + mpActiveWindow->SetPointerPosPixel(rMouseEvent.GetPosPixel()); + + MouseButtonUp(rMouseEvent, 0); + + mpActiveWindow->SetPointerPosPixel(aPoint); + mpActiveWindow->EnableMapMode(bMap); +} + void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) { if (rMEvt.IsLeaveWindow()) |