summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-03-20 14:58:19 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-03-20 18:35:43 +0100
commitf74d9ba2190426b974ca3d56da58919ac233a5d3 (patch)
tree72471e46e638d7c5eda712d585025ed1d59fe772 /sw
parente3bd5ebf678ef7e5ba588d47eed2f027e84cb3cd (diff)
sw XHTML import: write <div> wrapper in ReqIF mode
ReqIF says the XHTML fragment must be of type xhtml.BlkStruct.class, which is either a <p> or a <div> element (a single one). Just write this wrapper unconditionally, as we ignore it on import anyway, and it could be skipped only in the single-paragraph-doc case. Change-Id: I3051008866c4a28ce54413c73071bd4a5ced8b87 Reviewed-on: https://gerrit.libreoffice.org/51646 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx9
-rw-r--r--sw/source/filter/html/wrthtml.cxx6
2 files changed, 12 insertions, 3 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index fcb073cbcd8b..6a7b5e7774e4 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -341,7 +341,8 @@ DECLARE_HTMLEXPORT_TEST(testReqIfParagraph, "reqif-p.xhtml")
sal_uInt64 nLength = pStream->Tell();
pStream->Seek(0);
- OString aExpected("<reqif-xhtml:p>aaa<reqif-xhtml:br/>\nbbb</reqif-xhtml:p>" SAL_NEWLINE_STRING);
+ OString aExpected("<reqif-xhtml:div><reqif-xhtml:p>aaa<reqif-xhtml:br/>\nbbb"
+ "</reqif-xhtml:p>" SAL_NEWLINE_STRING);
// This was '<table' instead.
aExpected += "<reqif-xhtml:table";
@@ -462,8 +463,10 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable, "reqif-table.xhtml")
htmlDocPtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/html/body/table/tr/th", 1);
- OUString aStyle = getXPath(pDoc, "/html/body/table/tr/th", "style");
+ // <div> was missing, so the XHTML fragment wasn't a valid
+ // xhtml.BlkStruct.class type anymore.
+ assertXPath(pDoc, "/html/body/div/table/tr/th", 1);
+ OUString aStyle = getXPath(pDoc, "/html/body/div/table/tr/th", "style");
CPPUNIT_ASSERT(aStyle.indexOf("background") != -1);
// This failed, there were 2 style attributes, so as a best effort the
// parser took the value of the first.
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index a2b8a8d811bc..5a01534ff141 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -452,6 +452,9 @@ ErrCode SwHTMLWriter::WriteStream()
OutNewLine();
HTMLOutFuncs::Out_AsciiTag( Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_html, false );
}
+ else if (mbReqIF)
+ // ReqIF: end xhtml.BlkStruct.class.
+ HTMLOutFuncs::Out_AsciiTag(Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_division, false);
// delete the table with floating frames
OSL_ENSURE( !m_pHTMLPosFlyFrames, "Were not all frames output?" );
@@ -1076,6 +1079,9 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
Strm().WriteChar( '>' );
}
+ else if (mbReqIF)
+ // ReqIF: start xhtml.BlkStruct.class.
+ HTMLOutFuncs::Out_AsciiTag(Strm(), GetNamespace() + OOO_STRING_SVTOOLS_HTML_division);
return pPageDesc;
}