summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-28 12:47:29 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-29 10:09:51 +0200
commitd50ef086b87dbfb28db1fc9f9e76fa33eadfaf35 (patch)
tree23b041eb01010bef6ed5f82b25c88172401ca8f5 /sw
parent0ab64f84571fa3c1aa31e886ef4792e3584a852f (diff)
tdf#101168 sw: fix missing repaint on undo with multiple windows
Need to lock / unlock all view shells, not just the current one. Change-Id: I754214a202c6bbb74daac6f933481cb3fe7b9dbb Reviewed-on: https://gerrit.libreoffice.org/27620 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 1e21c32a2f81b4ae5302fc8d537e4f200a1a3e76)
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx36
-rw-r--r--sw/source/uibase/shells/basesh.cxx12
2 files changed, 44 insertions, 4 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 5a379bd3b10d..6d65a8e25bb0 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -59,6 +59,7 @@ public:
void testViewCursorCleanup();
void testViewLock();
void testTextEditViewInvalidations();
+ void testUndoInvalidations();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -83,6 +84,7 @@ public:
CPPUNIT_TEST(testViewCursorCleanup);
CPPUNIT_TEST(testViewLock);
CPPUNIT_TEST(testTextEditViewInvalidations);
+ CPPUNIT_TEST(testUndoInvalidations);
CPPUNIT_TEST_SUITE_END();
private:
@@ -855,6 +857,40 @@ void SwTiledRenderingTest::testTextEditViewInvalidations()
comphelper::LibreOfficeKit::setActive(false);
}
+void SwTiledRenderingTest::testUndoInvalidations()
+{
+ // Load a document and create two views.
+ comphelper::LibreOfficeKit::setActive();
+ SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ SfxLokHelper::createView();
+ pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
+ ViewCallback aView2;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+
+ // Insert a character the end of the document.
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->EndDoc();
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'c', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'c', 0);
+ SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
+ CPPUNIT_ASSERT_EQUAL(OUString("Aaa bbb.c"), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+
+ // Undo and assert that both views are invalidated.
+ aView1.m_bTilesInvalidated = false;
+ aView2.m_bTilesInvalidated = false;
+ comphelper::dispatchCommand(".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
+ // Undo was dispatched on the first view, this second view was not invalidated.
+ CPPUNIT_ASSERT(aView2.m_bTilesInvalidated);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index bc1721995d78..0b8fb13380cf 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -488,15 +488,19 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
switch( nId )
{
case SID_UNDO:
- rWrtShell.LockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.LockPaint();
rWrtShell.Do( SwWrtShell::UNDO, nCnt );
- rWrtShell.UnlockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.UnlockPaint();
break;
case SID_REDO:
- rWrtShell.LockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.LockPaint();
rWrtShell.Do( SwWrtShell::REDO, nCnt );
- rWrtShell.UnlockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.UnlockPaint();
break;
case SID_REPEAT: