[Libreoffice-commits] core.git: sw/qa sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Tue May 21 05:49:23 UTC 2019


 sw/qa/extras/uiwriter/data2/tdf125310b.fodt   |   24 ++++++++++++++++++
 sw/qa/extras/uiwriter/uiwriter2.cxx           |   33 ++++++++++++++++++++++++++
 sw/source/core/doc/DocumentRedlineManager.cxx |    2 -
 3 files changed, 58 insertions(+), 1 deletion(-)

New commits:
commit 23c159d948af360baecfe243e1321987760916d7
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon May 20 18:28:03 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue May 21 07:48:29 2019 +0200

    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"
    
    Change-Id: Ib9cbb58266a9067b1f8fb1f15bfdf9ff752a1ba4
    Reviewed-on: https://gerrit.libreoffice.org/72611
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

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:oas
 is: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 8decde583f53..4df901c34608 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1291,4 +1291,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf125310)
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(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());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index fe99e3f6b8dd..ed2ac2d9cbe3 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1935,7 +1935,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
                     {


More information about the Libreoffice-commits mailing list