summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx7
-rw-r--r--sd/source/ui/inc/ViewShell.hxx6
-rw-r--r--sd/source/ui/inc/Window.hxx6
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx38
-rw-r--r--sd/source/ui/view/sdwindow.cxx39
-rw-r--r--sd/source/ui/view/viewshel.cxx39
6 files changed, 69 insertions, 66 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 5229db8759a1..8676a09bb989 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 d94376e1764e..ec5ff6514bd9 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -409,12 +409,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 0d47a487035e..e60e35a89557 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 339fe46449d9..ae800a94f0ff 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 c46be7b78302..b3009d6f1b22 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -1015,6 +1015,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 82a6e67db3cc..bc732104f2b1 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -514,45 +514,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())