sw/qa/extras/htmlexport/data/TableWithIndent.fodt | 22 ++++++++++++++++++++++ sw/qa/extras/htmlexport/htmlexport.cxx | 18 ++++++++++++++++++ sw/source/filter/html/htmltabw.cxx | 10 ++++++++++ 3 files changed, 50 insertions(+)
New commits: commit 2561cb3f97f9c58051a609873de6af175e529b42 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Mar 2 16:15:16 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Fri Mar 3 06:17:17 2023 +0000 tdf#153923: close 'dd' tag properly Change-Id: I4ae3b23c616fc2ea40a5fdf8640bf5db0bb371ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148122 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148153 Tested-by: Mike Kaganski <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sw/qa/extras/htmlexport/data/TableWithIndent.fodt b/sw/qa/extras/htmlexport/data/TableWithIndent.fodt new file mode 100644 index 000000000000..5daaa75e8e24 --- /dev/null +++ b/sw/qa/extras/htmlexport/data/TableWithIndent.fodt @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:automatic-styles> + <style:style style:name="Table1" style:family="table"> + <style:table-properties style:width="14cm" fo:margin-left="3cm" table:align="left"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <table:table table:name="Table1" table:style-name="Table1"> + <table:table-column/> + <table:table-row> + <table:table-cell office:value-type="string"> + <text:p/> + </table:table-cell> + </table:table-row> + </table:table> + <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 19e40fb1c256..1326fbb48dc5 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2328,6 +2328,24 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir) assertXPath(pXmlDoc, "//reqif-xhtml:div[@id='mysect']", "style", "dir: ltr"); } +CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf153923) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "TableWithIndent.fodt"; + mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); + uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY_THROW); + uno::Sequence<beans::PropertyValue> aStoreProperties = { + comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")) + }; + xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); + + htmlDocUniquePtr pDoc = parseHtml(maTempFile); + // Without the fix in place, this would fail + CPPUNIT_ASSERT(pDoc); + + // The 'dd' tag was not closed + assertXPath(pDoc, "/html/body//dd"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 1150b72d5320..debf5d3d0e3a 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -1059,6 +1059,7 @@ Writer& OutHTML_SwTableNode( Writer& rWrt, SwTableNode & rNode, if( rHTMLWrt.m_bLFPossible ) rHTMLWrt.OutNewLine(); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_dd ); + rHTMLWrt.IncIndentLevel(); } // eFlyHoriOri and eTabHoriOri now only contain the values of @@ -1185,6 +1186,15 @@ Writer& OutHTML_SwTableNode( Writer& rWrt, SwTableNode & rNode, // move Pam behind the table rHTMLWrt.m_pCurrentPam->GetPoint()->nNode = *rNode.EndOfSectionNode(); + if (nNewDefListLvl) + { + rHTMLWrt.DecIndentLevel(); + if (rHTMLWrt.m_bLFPossible) + rHTMLWrt.OutNewLine(); + // close the dd element + HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_dd, false); + } + if( bPreserveForm ) { rHTMLWrt.m_bPreserveForm = false;
