diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 39 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 9 |
2 files changed, 48 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 24e5876203e7..e59c8cccacf4 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -166,6 +166,7 @@ public: void testBulletMultiDeleteInvalidation(); void testCondCollCopy(); void testMoveShapeHandle(); + void testRedlinePortions(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -252,6 +253,7 @@ public: CPPUNIT_TEST(testBulletMultiDeleteInvalidation); CPPUNIT_TEST(testCondCollCopy); CPPUNIT_TEST(testMoveShapeHandle); + CPPUNIT_TEST(testRedlinePortions); CPPUNIT_TEST_SUITE_END(); private: @@ -3561,6 +3563,43 @@ void SwTiledRenderingTest::testCondCollCopy() xTransferable->getTransferData(aFlavor); } +void SwTiledRenderingTest::testRedlinePortions() +{ + // Given a document with 3 portions: before insert redline (foo), the insert redline (ins) and after insert + // redline (bar): + SwXTextDocument* pXTextDocument = createDoc(); + SwDocShell* pDocShell = pXTextDocument->GetDocShell(); + SwView* pView = pDocShell->GetView(); + pView->SetRedlineAuthor("first"); + pDocShell->SetView(pView); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + pWrtShell->Insert("foo"); + pDocShell->SetChangeRecording(true); + pWrtShell->Insert("ins"); + pDocShell->SetChangeRecording(false); + pWrtShell->Insert("bar after"); + + // When deleting "fooinsbar": + pView->SetRedlineAuthor("second"); + pDocShell->SetView(pView); + pWrtShell->SttEndDoc(/*bStt*/true); + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, /*nCount=*/9, /*bBasicCall=*/false); + pDocShell->SetChangeRecording(true); + pWrtShell->Delete(); + + // Then make sure that the portion list is updated, so "bar" can be marked as deleted without + // marking " after" as well: + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//Text[1]", "Portion", "foo"); + assertXPath(pXmlDoc, "//Text[2]", "Portion", "ins"); + // Without the accompanying fix in place, this test would have failed width: + // - Expected: bar + // - Actual : bar after + // i.e. the portion list was outdated, even " after" was marked as deleted. + assertXPath(pXmlDoc, "//Text[3]", "Portion", "bar"); + assertXPath(pXmlDoc, "//Text[4]", "Portion", " after"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index c6d469678fa3..35568a615581 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -57,6 +57,7 @@ #include <txtfld.hxx> #include <flowfrm.hxx> +#include <txtfrm.hxx> using namespace com::sun::star; @@ -286,6 +287,14 @@ void lcl_LOKInvalidateFrames(const sw::BroadcastingModify& rMod, const SwRootFra if (pPoint) { pTmpFrame->InvalidateSize(); + + // Also empty the text portion cache, so it gets rebuilt, taking the new redlines + // into account. + if (pTmpFrame->IsTextFrame()) + { + auto pTextFrame = static_cast<SwTextFrame*>(pTmpFrame); + pTextFrame->ClearPara(); + } } } } |