summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx12
-rw-r--r--sw/source/core/crsr/crsrsh.cxx3
2 files changed, 15 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 10cd61ec5f14..56f087a1c84e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1195,16 +1195,28 @@ void SwTiledRenderingTest::testShapeTextUndoGroupShells()
// This was -1: the view shell id for the (top) undo list action wasn't known.
CPPUNIT_ASSERT_EQUAL(nView1, rUndoManager.GetUndoAction()->GetViewShellId());
+ // Create an editeng text selection in the first view.
+ EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0);
+ // 0th para, 0th char -> 0th para, 1st char.
+ ESelection aWordSelection(0, 0, 0, 1);
+ rEditView.SetSelection(aWordSelection);
+
// Create a second view, and make sure that the new view sees the same
// cursor position as the old one.
SfxLokHelper::createView();
pXTextDocument->initializeForTiledRendering({});
ViewCallback aView2;
aView2.m_aViewCursor = Rectangle();
+ aView2.m_bViewSelectionSet = false;
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
// Difference was 935 twips, the new view didn't see the editeng cursor of
// the old one. The new difference should be <1px, but here we deal with twips.
CPPUNIT_ASSERT(std::abs(aView1.m_aOwnCursor.Top() - aView2.m_aViewCursor.Top()) < 10);
+ // This was false, editeng text selection of the first view wasn't noticed
+ // by the second view.
+ CPPUNIT_ASSERT(aView2.m_bViewSelectionSet);
mxComponent->dispose();
mxComponent.clear();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 44776817a9d4..3a9ebe96ecf8 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1230,10 +1230,13 @@ void SwCursorShell::NotifyCursor(SfxViewShell* pOtherShell) const
auto pView = const_cast<SdrView*>(GetDrawView());
if (pView->GetTextEditObject())
{
+ // Blinking cursor.
EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
rEditView.RegisterOtherShell(pOtherShell);
rEditView.ShowCursor();
rEditView.RegisterOtherShell(nullptr);
+ // Text selection, if any.
+ rEditView.DrawSelection(pOtherShell);
}
else
{