sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt | 74 +++++++++++++++++++ sw/qa/extras/htmlexport/htmlexport.cxx | 17 ++++ sw/source/filter/html/htmlnumwriter.cxx | 5 + 3 files changed, 95 insertions(+), 1 deletion(-)
New commits: commit 58db45b03dbde974cc1898df76fd145e440f5cd8 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon May 29 14:47:20 2023 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue May 30 16:02:56 2023 +0200 ReqIF: 'ol' elements must have no 'type' attribute Change-Id: I62098bac9dc3751f7b939cbf94f1561b4539a294 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152368 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 949d1ee783f58504fdf7cb6b6a164384ae82533f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152387 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt b/sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt new file mode 100644 index 000000000000..c9a8225662a9 --- /dev/null +++ b/sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt @@ -0,0 +1,74 @@ +<?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" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:automatic-styles> + <text:list-style style:name="A_upper"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="A"/> + </text:list-style> + <text:list-style style:name="a_lower"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="a"/> + </text:list-style> + <text:list-style style:name="I_upper"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="I"/> + </text:list-style> + <text:list-style style:name="i_lower"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="i"/> + </text:list-style> + </office:automatic-styles> + <office:body> + <office:text> + <text:p>List A</text:p> + <text:list text:style-name="A_upper"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + <text:p>List a</text:p> + <text:list text:style-name="a_lower"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + <text:p>List I</text:p> + <text:list text:style-name="I_upper"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + <text:p>List i</text:p> + <text:list text:style-name="i_lower"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 0ba830337da6..132969717157 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2541,6 +2541,23 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_RightAlignedTable) assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:div", "align"); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsWithNumFormat) +{ + createSwDoc("listsWithNumFormat.fodt"); + ExportToReqif(); + + SvMemoryStream aStream; + WrapReqifFromTempFile(aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); + CPPUNIT_ASSERT(pDoc); + + // No 'type' attribute must be present in 'ol' + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[1]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[2]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[3]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[4]", "type"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index a3bc30891f76..8045fb5b1c02 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -224,8 +224,10 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, // determine the type by the format char cType = 0; - switch( eType ) + if (!rWrt.mbReqIF) // No 'type' attribute in ReqIF { + switch (eType) + { case SVX_NUM_CHARS_UPPER_LETTER: case SVX_NUM_CHARS_UPPER_LETTER_N: cType = 'A'; @@ -240,6 +242,7 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, case SVX_NUM_ROMAN_LOWER: cType = 'i'; break; + } } if( cType ) {