From 0bc56f3081a1c95efd9c5e40ae6a957bf4095aa9 Mon Sep 17 00:00:00 2001 From: László Németh Date: Fri, 17 May 2019 12:40:19 +0200 Subject: tdf#125310 change tracking: don't copy page break MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit at paragraph join, because file saving or changing to Hide Changes mode don't affect this. Also adding page breaks to every paragraph of a deletion is much more annoying, than helpful. See also commit 1bbbe57dfc0b43d6b5444798d77dcdf5e4e76e49 "change tracking: show layout changes at paragraph join" Reviewed-on: https://gerrit.libreoffice.org/72469 Tested-by: Jenkins Reviewed-by: László Németh Conflicts: sw/qa/extras/uiwriter/uiwriter2.cxx Change-Id: Ic05f06b9fdb5152b717e824f9a9eaed878fecc2d Reviewed-on: https://gerrit.libreoffice.org/72778 Tested-by: Jenkins Reviewed-by: Xisco Faulí --- sw/qa/extras/uiwriter/data2/tdf125310.fodt | 23 +++++++++++++++ sw/qa/extras/uiwriter/uiwriter2.cxx | 40 +++++++++++++++++++++++++++ sw/source/core/doc/DocumentRedlineManager.cxx | 2 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/uiwriter/data2/tdf125310.fodt diff --git a/sw/qa/extras/uiwriter/data2/tdf125310.fodt b/sw/qa/extras/uiwriter/data2/tdf125310.fodt new file mode 100644 index 000000000000..cf204e698223 --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/tdf125310.fodt @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + This paragraph has got a page break. + This hasn’t. + + + diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index cafe416f23a6..ebcdbafa1c80 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -25,6 +25,7 @@ #include #include #include +#include namespace { @@ -678,4 +679,43 @@ void SwUiWriterTest2::testDocxAttributeTableExport() CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2); +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310) +{ + load(DATA_DIRECTORY, "tdf125310.fodt"); + + SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), + getProperty(getParagraph(1), "ParaStyleName")); + CPPUNIT_ASSERT_EQUAL(OUString("Standard"), + getProperty(getParagraph(2), "ParaStyleName")); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + // turn on red-lining and show changes + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete + | RedlineFlags::ShowInsert); + CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + CPPUNIT_ASSERT_MESSAGE( + "redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + + // paragraph join + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + pWrtShell->EndPara(/*bSelect=*/true); + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); + rtl::Reference pTransfer = new SwTransferable(*pWrtShell); + pTransfer->Cut(); + + // copied paragraph style + CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), + getProperty(getParagraph(2), "ParaStyleName")); + + // without copying the page break + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index a83e158e27e5..a3c2d29e564b 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1924,7 +1924,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall { pTextNode = pTextNd->GetTextNode(); if (pTextNode && pDelNode != pTextNode ) - pDelNode->CopyCollFormat( *pTextNode ); + pTextNode->ChgFormatColl( pDelNode->GetTextColl() ); pTextNd = SwNodes::GoPrevious( &aIdx ); } } -- cgit