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 e41e309693060c85e194ecd2267ad7e06f35ed53 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Aug 5 14:14:01 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Aug 6 09:52:17 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. Reviewed-on: https://gerrit.libreoffice.org/76986 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins (cherry picked from commit 3166209cca8c8c76d4605eead12431fed2f1e306) Change-Id: I28aa239a1b02c8021879159e5591880804aa0825 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 6944a8991c07..f91fa5ceb2a9 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -702,6 +702,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 e2ac83f39df9..dfa4ae71bb3a 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -257,11 +257,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); @@ -427,7 +434,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 ); @@ -538,7 +545,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