summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-04-23 10:15:31 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-04-27 11:31:45 +0200
commitf64bc71404e5662c4537ae166eae2ee054197350 (patch)
tree45d3c02907ac0cd9bd1404ba7e0c85a75b313096 /sw
parent11768f901b4c9e34e598187a31adf5028377c65c (diff)
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) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92744 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry-picked from commit 7690f3269c89140930f49068133e7d061d475948) Change-Id: Ie576a204d86694296cb29185a5b130e87a518b7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92801 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data2/tdf117923.docxbin0 -> 21227 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx42
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx3
3 files changed, 45 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/tdf117923.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 921c7dcd1468..6472929fc5ab 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -142,6 +142,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)
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_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 caec3a3e9fe7..dd25731710cb 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1311,6 +1311,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 );
}