summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-06-24 12:00:08 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-06-24 11:57:10 +0200
commitad3cbef7f60de1e490c752051823a35ee37b311e (patch)
treef428baed0468e534dc0b0457887b42059dd4ca27
parent698d82ec6c582fdd4633e9e5cc9c439d4a0eff7d (diff)
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.kaganski@collabora.com>
-rw-r--r--sw/qa/extras/htmlexport/data/twoListsWithSameStyle.fodt19
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx14
-rw-r--r--sw/source/filter/html/htmlnumwriter.cxx40
3 files changed, 53 insertions, 20 deletions
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);