sw/qa/extras/htmlexport/data/field-shade-reqif.odt |binary sw/qa/extras/htmlexport/htmlexport.cxx | 14 ++++++++++++++ sw/source/filter/html/htmlfldw.cxx | 14 +++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-)
New commits: commit 3166209cca8c8c76d4605eead12431fed2f1e306 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Aug 5 14:14:01 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Aug 5 18:00:34 2019 +0200 sw XHTML export: <sdfield> and shading is not relevant for ReqIF See commit 4cd3c436923bfba281b1bf16d9785208a2119cea (sw reqif-xhtml export: limit values of the style attribute, 2018-04-11) for motivation. Change-Id: I28aa239a1b02c8021879159e5591880804aa0825 Reviewed-on: https://gerrit.libreoffice.org/76986 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/qa/extras/htmlexport/data/field-shade-reqif.odt b/sw/qa/extras/htmlexport/data/field-shade-reqif.odt new file mode 100644 index 000000000000..be7ec90f5a7f Binary files /dev/null and b/sw/qa/extras/htmlexport/data/field-shade-reqif.odt differ diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 842289f1dd44..f6b5894ee85c 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -683,6 +683,20 @@ DECLARE_HTMLEXPORT_TEST(testFieldShade, "field-shade.odt") assertXPath(pDoc, "/html/body/p[2]/span/span", 0); } +DECLARE_HTMLEXPORT_TEST(testFieldShadeReqIf, "field-shade-reqif.odt") +{ + htmlDocPtr pDoc = parseHtml(maTempFile); + CPPUNIT_ASSERT(pDoc); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 0 + // - Actual : 2 + // i.e. the ReqIF subset of xhtml had a background color and a page number field, resulting in + // an invalid ReqIF-XHTML. + assertXPath(pDoc, "/html/body/div/p[1]/span", 0); + assertXPath(pDoc, "/html/body/div/p[1]/sdfield", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 0ad1b55d5db7..b6381f53847e 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -259,11 +259,18 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, default: break; } - // <SDFIELD>-Tag ausgeben + // ReqIF-XHTML doesn't allow <sdfield>. + if (rHTMLWrt.mbReqIF && pTypeStr) + { + pTypeStr = nullptr; + } + + // Output the <sdfield> tag. if( pTypeStr ) { OStringBuffer sOut; sOut.append('<'); + sOut.append(rHTMLWrt.GetNamespace()); sOut.append(OOO_STRING_SVTOOLS_HTML_sdfield).append(' '). append(OOO_STRING_SVTOOLS_HTML_O_type).append('='). append(pTypeStr); @@ -428,7 +435,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); } - // Off-Tag ausgeben + // Output the closing tag. if( pTypeStr ) HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_sdfield, false ); @@ -539,7 +546,8 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) if( pTextField ) { SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); - bool bFieldShadings = SwViewOption::IsFieldShadings(); + // ReqIF-XHTML doesn't allow specifying a background color. + bool bFieldShadings = SwViewOption::IsFieldShadings() && !rHTMLWrt.mbReqIF; if (bFieldShadings) { // If there is a text portion background started already, that should have priority. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits