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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 23 14:39:11 UTC 2020


 sw/qa/extras/uiwriter/data2/tdf117923.docx              |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx                     |   42 ++++++++++++++++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    3 +
 3 files changed, 45 insertions(+)

New commits:
commit 7690f3269c89140930f49068133e7d061d475948
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Apr 23 10:15:31 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Apr 23 16:38:34 2020 +0200

    tdf#132351 DOCX export: fix character formatting of numbering
    
    with removed ListAutoFormat.
    
    Using untouched text portion of paragraph marker,
    DOCX export restored the changed character
    formatting of numbering with removed ListAutoFormat
    (see RES_PARATR_LIST_AUTOFMT in wrtw8nds.cxx).
    
    Follow-up of commit e4509d7db7562f7e4ab9366b915ed558291ac3de
    (tdf#127606 DOCX lists: fix unchangeable formatting)
    
    Change-Id: Ie576a204d86694296cb29185a5b130e87a518b7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92744
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/uiwriter/data2/tdf117923.docx b/sw/qa/extras/uiwriter/data2/tdf117923.docx
new file mode 100644
index 000000000000..c10ac24050b2
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf117923.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 22348f88655d..7eb427901bf2 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -125,6 +125,48 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground)
                          getProperty<OUString>(getParagraph(3), "ParaStyleName"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat)
+{
+    createDoc("tdf117923.docx");
+    // Ensure that all text portions are calculated before testing.
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwViewShell* pViewShell
+        = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    pViewShell->Reformat();
+
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+
+    // Check that we actually test the line we need
+    assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", "GHI GHI GHI GHI");
+    assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", "nType",
+                "PortionType::Number");
+    assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", "rText", "2.");
+    // The numbering height was 960 in DOC format.
+    assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", "nHeight", "220");
+
+    // tdf#127606: now it's possible to change formatting of numbering
+    // increase font size (220 -> 260)
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:Grow", {});
+    pViewShell->Reformat();
+    discardDumpedLayout();
+    pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", "nHeight", "260");
+
+    // save it to DOCX
+    reload("Office Open XML Text", "tdf117923.docx");
+    pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    pViewShell
+        = pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+    pViewShell->Reformat();
+    discardDumpedLayout();
+    pXmlDoc = parseLayoutDump();
+    // this was 220
+    assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", "nHeight", "260");
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf101534)
 {
     // Copy the first paragraph of the document.
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index a09987617a0c..771c4885004f 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1313,6 +1313,9 @@ namespace //local functions originally from docfmt.cxx
                         (pCurrentNode->GetIndex() < nEndIndex || pEnd->nContent.GetIndex() == pEndNode->Len()))
                     {
                         pCurrentNode->ResetAttr(RES_PARATR_LIST_AUTOFMT);
+                        // reset also paragraph marker
+                        SwIndex nIdx( pCurrentNode, pCurrentNode->Len() );
+                        pCurrentNode->GetTextNode()->RstTextAttr(nIdx, 1);
                     }
                     pCurrentNode = SwNodes::GoPrevious( &aIdx );
                 }


More information about the Libreoffice-commits mailing list