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 949d1ee783f58504fdf7cb6b6a164384ae82533f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon May 29 14:47:20 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon May 29 16:50:54 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>

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 da0b8bd4c673..a0524ca3f2b5 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2659,6 +2659,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 98b581700224..6f8f52cc3f7c 100644
--- a/sw/source/filter/html/htmlnumwriter.cxx
+++ b/sw/source/filter/html/htmlnumwriter.cxx
@@ -219,8 +219,10 @@ SwHTMLWriter& 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';
@@ -235,6 +237,7 @@ SwHTMLWriter& OutHTML_NumberBulletListStart( SwHTMLWriter& 
rWrt,
                 case SVX_NUM_ROMAN_LOWER:
                     cType = 'i';
                     break;
+                }
             }
             if( cType )
             {

Reply via email to