diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 7 | ||||
-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 |
6 files changed, 69 insertions, 66 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 310dd90f1910..b0ea2340574a 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -358,6 +358,7 @@ void SdTiledRenderingTest::testRegisterCallback() void SdTiledRenderingTest::testPostKeyEvent() { + comphelper::LibreOfficeKit::setActive(); SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); SdPage* pActualPage = pViewShell->GetActualPage(); @@ -372,6 +373,7 @@ void SdTiledRenderingTest::testPostKeyEvent() pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(pView->GetTextEditObject()); EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); @@ -381,6 +383,7 @@ void SdTiledRenderingTest::testPostKeyEvent() rEditView.SetSelection(aWordSelection); // Did we enter the expected character? CPPUNIT_ASSERT_EQUAL(OUString("xx"), rEditView.GetSelected()); + comphelper::LibreOfficeKit::setActive(false); } void SdTiledRenderingTest::testPostMouseEvent() @@ -411,6 +414,7 @@ void SdTiledRenderingTest::testPostMouseEvent() pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, convertMm100ToTwip(aPosition.getX()), convertMm100ToTwip(aPosition.getY()), 1, MOUSE_LEFT, 0); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(pView->GetTextEditObject()); // The new cursor position must be before the first word. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), rEditView.GetSelection().nStartPos); @@ -1353,6 +1357,7 @@ void SdTiledRenderingTest::testTdf102223() pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2), 1, MOUSE_LEFT, 0); + Scheduler::ProcessEventsToIdle(); pView->SdrBeginTextEdit(pTableObject); CPPUNIT_ASSERT(pView->GetTextEditObject()); EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); @@ -1447,6 +1452,7 @@ void SdTiledRenderingTest::testTdf103083() pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2), 1, MOUSE_LEFT, 0); + Scheduler::ProcessEventsToIdle(); pView->SdrBeginTextEdit(pTextObject); CPPUNIT_ASSERT(pView->GetTextEditObject()); EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); @@ -1563,7 +1569,6 @@ void SdTiledRenderingTest::testTdf81754() pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); - Scheduler::ProcessEventsToIdle(); // now save, reload, and assert that we did not lose the edit 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()) |