sw/qa/extras/htmlexport/data/twoListsWithSameStyle.fodt | 19 +++++++ sw/qa/extras/htmlexport/htmlexport.cxx | 14 +++++ sw/source/filter/html/htmlnumwriter.cxx | 40 ++++++++-------- 3 files changed, 53 insertions(+), 20 deletions(-)
New commits: commit ad3cbef7f60de1e490c752051823a35ee37b311e Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Jun 24 12:00:08 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat Jun 24 11:57:10 2023 +0200 ReqIF: 'ol' elements must have no 'start' attribute Change-Id: If02f4d2f0a34f2f39b90fb7b8c6d29e46d0da0ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153549 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/qa/extras/htmlexport/data/twoListsWithSameStyle.fodt b/sw/qa/extras/htmlexport/data/twoListsWithSameStyle.fodt new file mode 100644 index 000000000000..a5dc0f014d2a --- /dev/null +++ b/sw/qa/extras/htmlexport/data/twoListsWithSameStyle.fodt @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office: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:body> + <office:text> + <text:list text:style-name="Numbering 123"> + <text:list-header> + <text:p/> + </text:list-header> + </text:list> + <text:p/> + <text:list text:style-name="Numbering 123"> + <text:list-header> + <text:p/> + </text:list-header> + </text:list> + </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 521f15504357..6fdb67f68eb7 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2703,6 +2703,20 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf155871) CPPUNIT_ASSERT(pDoc); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsNoStartAttribute) +{ + createSwDoc("twoListsWithSameStyle.fodt"); + ExportToReqif(); + + SvMemoryStream aStream; + WrapReqifFromTempFile(aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); + CPPUNIT_ASSERT(pDoc); + + // No 'start' attribute must be present in 'ol' + assertXPath(pDoc, "//reqif-xhtml:ol[@start]", 0); +} + 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 8fa9b0074c99..6640f8f9376b 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -217,10 +217,10 @@ SwHTMLWriter& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, // Ordered list: <OL> sOut += OOO_STRING_SVTOOLS_HTML_orderlist; - // determine the type by the format - char cType = 0; - if (!rWrt.mbReqIF) // No 'type' attribute in ReqIF + if (!rWrt.mbReqIF) // No 'type' nor 'start' attribute in ReqIF { + // determine the type by the format + char cType = 0; switch (eType) { case SVX_NUM_CHARS_UPPER_LETTER: @@ -238,29 +238,29 @@ SwHTMLWriter& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, cType = 'i'; break; } - } - if( cType ) - { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_type "=\"" + OStringChar(cType) + "\""; - } + if( cType ) + { + sOut += " " OOO_STRING_SVTOOLS_HTML_O_type "=\"" + OStringChar(cType) + "\""; + } - sal_uInt16 nStartVal = rNumFormat.GetStart(); - if( bStartValue && 1 == nStartVal && i == rInfo.GetDepth()-1 ) - { - if ( rWrt.m_pCurrentPam->GetPointNode().GetTextNode()->GetNum() ) + sal_uInt16 nStartVal = rNumFormat.GetStart(); + if( bStartValue && 1 == nStartVal && i == rInfo.GetDepth()-1 ) { - nStartVal = static_cast< sal_uInt16 >( rWrt.m_pCurrentPam->GetPointNode() - .GetTextNode()->GetNumberVector()[i] ); + if ( rWrt.m_pCurrentPam->GetPointNode().GetTextNode()->GetNum() ) + { + nStartVal = static_cast< sal_uInt16 >( rWrt.m_pCurrentPam->GetPointNode() + .GetTextNode()->GetNumberVector()[i] ); + } + else + { + OSL_FAIL( "<OutHTML_NumberBulletListStart(..) - text node has no number." ); + } } - else + if( nStartVal != 1 ) { - OSL_FAIL( "<OutHTML_NumberBulletListStart(..) - text node has no number." ); + sOut += " " OOO_STRING_SVTOOLS_HTML_O_start "=\"" + OString::number(static_cast<sal_Int32>(nStartVal)) + "\""; } } - if( nStartVal != 1 ) - { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_start "=\"" + OString::number(static_cast<sal_Int32>(nStartVal)) + "\""; - } } rWrt.Strm().WriteOString(sOut);