summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-05-20 18:28:03 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2019-05-23 11:48:23 +0200
commitdfd5b969269eacf33ddd75fb3e4b70b958e911dd (patch)
tree0da9f88d416381be759865c946d9fc5173f37fcc
parentcf4c1bcc2c309ce3dcf1fceda8133a9a8f6a9556 (diff)
tdf#125310 change tracking: don't copy page break
at paragraph deletion, because it's more annoying, than helpful. Note: ODT file saving copies the page break into the deleted paragraph, but not the DOCX export. See also commit 22639148ae5400bac98f32a75d7431b857c80195 "tdf#54819 change tracking: keep paragraph style after full deletion" Reviewed-on: https://gerrit.libreoffice.org/72611 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 23c159d948af360baecfe243e1321987760916d7) Change-Id: Ib9cbb58266a9067b1f8fb1f15bfdf9ff752a1ba4 Reviewed-on: https://gerrit.libreoffice.org/72682 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r--sw/qa/extras/uiwriter/data2/tdf125310b.fodt24
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx43
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx2
3 files changed, 65 insertions, 4 deletions
diff --git a/sw/qa/extras/uiwriter/data2/tdf125310b.fodt b/sw/qa/extras/uiwriter/data2/tdf125310b.fodt
new file mode 100644
index 000000000000..1c131ce99b3a
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/tdf125310b.fodt
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+ <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text" style:master-page-name="">
+ <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" style:page-number="auto" fo:break-before="auto" fo:break-after="auto"/>
+ <style:text-properties fo:font-size="130%" fo:font-weight="bold" style:font-size-asian="130%" style:font-weight-asian="bold" style:font-size-complex="130%" style:font-weight-complex="bold"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Heading_20_1" style:master-page-name="Standard">
+ <style:paragraph-properties style:page-number="auto"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:h text:style-name="P1" text:outline-level="1">This paragraph has got a page break.</text:h>
+ <text:p>This hasn’t.</text:p>
+ <text:h text:style-name="P1" text:outline-level="1">This paragraph has got a page break.</text:h>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index ebcdbafa1c80..01ee96f67ee6 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -51,6 +51,8 @@ public:
void testTableWidth();
void testTdf122942();
void testDocxAttributeTableExport();
+ void testTdf125310();
+ void testTdf125310b();
CPPUNIT_TEST_SUITE(SwUiWriterTest2);
CPPUNIT_TEST(testRedlineMoveInsertInDelete);
@@ -68,6 +70,8 @@ public:
CPPUNIT_TEST(testTableWidth);
CPPUNIT_TEST(testTdf122942);
CPPUNIT_TEST(testDocxAttributeTableExport);
+ CPPUNIT_TEST(testTdf125310);
+ CPPUNIT_TEST(testTdf125310b);
CPPUNIT_TEST_SUITE_END();
private:
@@ -677,9 +681,7 @@ void SwUiWriterTest2::testDocxAttributeTableExport()
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
}
-CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
-
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310)
+void SwUiWriterTest2::testTdf125310()
{
load(DATA_DIRECTORY, "tdf125310.fodt");
@@ -718,4 +720,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310)
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+void SwUiWriterTest2::testTdf125310b()
+{
+ SwDoc* pDoc = createDoc("tdf125310b.fodt");
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Standard"),
+ getProperty<OUString>(getParagraph(2), "ParaStyleName"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
+ getProperty<OUString>(getParagraph(3), "ParaStyleName"));
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+ // turn on red-lining and show changes
+ pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete
+ | RedlineFlags::ShowInsert);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+ pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+ // remove second paragraph with the page break
+ pWrtShell->Down(/*bSelect=*/false);
+ pWrtShell->Down(/*bSelect=*/false);
+ pWrtShell->Up(/*bSelect=*/true);
+ pWrtShell->DelLeft();
+
+ IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess());
+ rIDRA.AcceptAllRedline(true);
+
+ // losing the page break, as without redlining
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index a3c2d29e564b..a46dc49db8ee 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1904,7 +1904,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
SwTextNode* pDelNode = pStt->nNode.GetNode().GetTextNode();
SwTextNode* pTextNode = pEnd->nNode.GetNode().GetTextNode();
if (pDelNode != nullptr && pTextNode != nullptr && pDelNode != pTextNode)
- pTextNode->CopyCollFormat( *pDelNode );
+ pDelNode->ChgFormatColl( pTextNode->GetTextColl() );
}
else
{