diff options
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/inc/ViewShell.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/inc/Window.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 38 | ||||
-rw-r--r-- | sd/source/ui/view/sdwindow.cxx | 39 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 39 |
5 files changed, 63 insertions, 65 deletions
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 0686db158ea6..c3219dd4db52 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -416,12 +416,6 @@ 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); - /// Same as MouseMove(), but coordinates are in logic unit. - void LogicMouseMove(const MouseEvent& rMouseEvent); /// Allows adjusting the point or mark of the selection to a document coordinate. void SetCursorMm100Position(const Point& rPosition, bool bPoint, bool bClearMark); /// Gets the currently selected text. diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx index 487255ae8c40..d1aa74a91602 100644 --- a/sd/source/ui/inc/Window.hxx +++ b/sd/source/ui/inc/Window.hxx @@ -192,6 +192,12 @@ protected: Selection GetSurroundingTextSelection() const override; /// @see OutputDevice::LogicInvalidate(). void LogicInvalidate(const ::tools::Rectangle* pRectangle) override; + /// Same as MouseButtonDown(), but coordinates are in logic unit. + virtual void LogicMouseButtonDown(const MouseEvent& rMouseEvent) override; + /// Same as MouseButtonUp(), but coordinates are in logic unit. + virtual void LogicMouseButtonUp(const MouseEvent& rMouseEvent) override; + /// Same as MouseMove(), but coordinates are in logic unit. + virtual void LogicMouseMove(const MouseEvent& rMouseEvent) override; FactoryFunction GetUITestFactory() const override; }; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 3dc5e2839c74..8c8569a1a009 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2476,19 +2476,22 @@ void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) if (!pWindow) return; - KeyEvent aEvent(nCharCode, nKeyCode, 0); + LOKAsyncEventData* pLOKEv = new LOKAsyncEventData; + pLOKEv->mpWindow = pWindow; switch (nType) { case LOK_KEYEVENT_KEYINPUT: - pWindow->KeyInput(aEvent); + pLOKEv->mnEvent = VclEventId::WindowKeyInput; break; case LOK_KEYEVENT_KEYUP: - pWindow->KeyUp(aEvent); + pLOKEv->mnEvent = VclEventId::WindowKeyUp; break; default: assert(false); - break; } + + pLOKEv->maKeyEvent = KeyEvent(nCharCode, nKeyCode, 0); + Application::PostUserEvent(Link<void*, void>(pLOKEv, ITiledRenderable::LOKPostAsyncEvent)); } void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) @@ -2516,33 +2519,28 @@ void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, i return; } - Window* pWindow = pViewShell->GetActiveWindow(); - - Point aPos(Point(convertTwipToMm100(nX), convertTwipToMm100(nY))); - MouseEvent aEvent(aPos, nCount, - MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); - + LOKAsyncEventData* pLOKEv = new LOKAsyncEventData; + pLOKEv->mpWindow = pViewShell->GetActiveWindow(); switch (nType) { case LOK_MOUSEEVENT_MOUSEBUTTONDOWN: - pViewShell->LogicMouseButtonDown(aEvent); - - if (nButtons & MOUSE_RIGHT) - { - const CommandEvent aCEvt(aPos, CommandEventId::ContextMenu, true, nullptr); - pViewShell->Command(aCEvt, pWindow); - } + pLOKEv->mnEvent = VclEventId::WindowMouseButtonDown; break; case LOK_MOUSEEVENT_MOUSEBUTTONUP: - pViewShell->LogicMouseButtonUp(aEvent); + pLOKEv->mnEvent = VclEventId::WindowMouseButtonUp; break; case LOK_MOUSEEVENT_MOUSEMOVE: - pViewShell->LogicMouseMove(aEvent); + pLOKEv->mnEvent = VclEventId::WindowMouseMove; break; default: assert(false); - break; } + + const Point aPos(Point(convertTwipToMm100(nX), convertTwipToMm100(nY))); + pLOKEv->maMouseEvent = MouseEvent(aPos, nCount, + MouseEventModifiers::SIMPLECLICK, + nButtons, nModifier); + Application::PostUserEvent(Link<void*, void>(pLOKEv, ITiledRenderable::LOKPostAsyncEvent)); } void SdXImpressDocument::setTextSelection(int nType, int nX, int nY) diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 8d4a634c60de..b81249061b87 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -1014,6 +1014,45 @@ void Window::LogicInvalidate(const ::tools::Rectangle* pRectangle) SfxLokHelper::notifyInvalidation(&rSfxViewShell, sRectangle); } +void Window::LogicMouseButtonDown(const MouseEvent& rMouseEvent) +{ + // When we're not doing tiled rendering, then positions must be passed as pixels. + assert(comphelper::LibreOfficeKit::isActive()); + + Point aPoint = GetPointerPosPixel(); + SetLastMousePos(rMouseEvent.GetPosPixel()); + + mpViewShell->MouseButtonDown(rMouseEvent, this); + + SetPointerPosPixel(aPoint); +} + +void Window::LogicMouseButtonUp(const MouseEvent& rMouseEvent) +{ + // When we're not doing tiled rendering, then positions must be passed as pixels. + assert(comphelper::LibreOfficeKit::isActive()); + + Point aPoint = GetPointerPosPixel(); + SetLastMousePos(rMouseEvent.GetPosPixel()); + + mpViewShell->MouseButtonUp(rMouseEvent, this); + + SetPointerPosPixel(aPoint); +} + +void Window::LogicMouseMove(const MouseEvent& rMouseEvent) +{ + // When we're not doing tiled rendering, then positions must be passed as pixels. + assert(comphelper::LibreOfficeKit::isActive()); + + Point aPoint = GetPointerPosPixel(); + SetLastMousePos(rMouseEvent.GetPosPixel()); + + mpViewShell->MouseMove(rMouseEvent, this); + + SetPointerPosPixel(aPoint); +} + FactoryFunction Window::GetUITestFactory() const { if (get_id() == "impress_win") diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 9a8c4e856198..f9fdeb1c76a8 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -513,45 +513,6 @@ 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(comphelper::LibreOfficeKit::isActive()); - - Point aPoint = mpActiveWindow->GetPointerPosPixel(); - mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel()); - - MouseButtonDown(rMouseEvent, mpActiveWindow); - - mpActiveWindow->SetPointerPosPixel(aPoint); -} - -void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent) -{ - // When we're not doing tiled rendering, then positions must be passed as pixels. - assert(comphelper::LibreOfficeKit::isActive()); - - Point aPoint = mpActiveWindow->GetPointerPosPixel(); - mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel()); - - MouseButtonUp(rMouseEvent, mpActiveWindow); - - mpActiveWindow->SetPointerPosPixel(aPoint); -} - -void ViewShell::LogicMouseMove(const MouseEvent& rMouseEvent) -{ - // When we're not doing tiled rendering, then positions must be passed as pixels. - assert(comphelper::LibreOfficeKit::isActive()); - - Point aPoint = mpActiveWindow->GetPointerPosPixel(); - mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel()); - - MouseMove(rMouseEvent, mpActiveWindow); - - mpActiveWindow->SetPointerPosPixel(aPoint); -} - void ViewShell::SetCursorMm100Position(const Point& rPosition, bool bPoint, bool bClearMark) { if (SdrView* pSdrView = GetView()) |