sw/qa/extras/htmlexport/data/reqif-p.xhtml | 1 + sw/qa/extras/htmlexport/htmlexport.cxx | 15 +++++++++++++++ sw/source/filter/html/css1atr.cxx | 2 +- sw/source/filter/html/htmlatr.cxx | 2 +- sw/source/filter/html/htmlplug.cxx | 18 ++++++++++++++---- 5 files changed, 32 insertions(+), 6 deletions(-)
New commits: commit d33d5d03e9c2595fdec73e5b70c3d43a1c7c063c Author: Miklos Vajna <[email protected]> Date: Mon Mar 19 17:23:56 2018 +0100 sw XHTML export: avoid <strike> for strikeout in ReqIF mode Similar to how <u> for underline is avoided, the spec explicitly forbids this. Change-Id: I314a49df496d7b02049154564884e296b9633576 Reviewed-on: https://gerrit.libreoffice.org/51578 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins <[email protected]> (cherry picked from commit afe4dfe1d60b81ff673f0859c8c79c19ef26356c) diff --git a/sw/qa/extras/htmlexport/data/reqif-p.xhtml b/sw/qa/extras/htmlexport/data/reqif-p.xhtml index 315a4db80918..b05cdeb9d8e7 100644 --- a/sw/qa/extras/htmlexport/data/reqif-p.xhtml +++ b/sw/qa/extras/htmlexport/data/reqif-p.xhtml @@ -3,3 +3,4 @@ <reqif-xhtml:a href="http://libreoffice.org/">http://libreoffice.org</reqif-xhtml:a> <reqif-xhtml:span style="text-decoration: underline">u</reqif-xhtml:span> <reqif-xhtml:strong>s</reqif-xhtml:strong> +<reqif-xhtml:strike>s</reqif-xhtml:strike> diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 7d54e628f9cc..8f031d7346ce 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -360,6 +360,9 @@ DECLARE_HTMLEXPORT_TEST(testReqIfParagraph, "reqif-p.xhtml") // This was <strong>, namespace prefix was missing. CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:strong>") != -1); + + // This was "<strike>" instead of CSS. + CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:span style=\"text-decoration: line-through\"") != -1); } DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleData, "reqif-ole-data.xhtml") diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 9fc4a02bcf77..fc83048a3697 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -2295,7 +2295,7 @@ static Writer& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( Writer& rWrt, { // this also works in HTML does not need to be written as // a STYLE-Options, and must not be written as Hint - OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT), + OSL_ENSURE( !rHTMLWrt.IsCSS1Source(CSS1_OUTMODE_HINT) || rHTMLWrt.mbReqIF, "write crossedOut as Hint?" ); pCOStr = sCSS1_PV_line_through; } diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index b08e1ee3f1ee..e4e4b1ad67eb 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -2765,7 +2765,7 @@ static Writer& OutHTML_SwCrossedOut( Writer& rWrt, const SfxPoolItem& rHt ) // Because of Netscape, we output STRIKE and not S! const FontStrikeout nStrike = static_cast<const SvxCrossedOutItem&>(rHt).GetStrikeout(); - if( STRIKEOUT_NONE != nStrike ) + if( STRIKEOUT_NONE != nStrike && !rHTMLWrt.mbReqIF ) { HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_strike, rHTMLWrt.m_bTagOn ); } commit 869d01ee34c8b225c3f26560b6856c3b204ecd62 Author: Miklos Vajna <[email protected]> Date: Mon Mar 19 16:39:59 2018 +0100 sw XHTML export: fix missing type attribute for fallback image This was working in OutHTML_FrameFormatGrfNode(), but not in OutHTML_FrameFormatOLENodeGrf(). Reviewed-on: https://gerrit.libreoffice.org/51571 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins <[email protected]> (cherry picked from commit bd063a890e486989b59963e59dd67e8a692f27ba) Conflicts: sw/source/filter/html/htmlplug.cxx Change-Id: I4f8e280713cad2a00cad5da65a09afc5a36d40d0 diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 6816853351c1..7d54e628f9cc 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -406,6 +406,18 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, "reqif-ole-img.xhtml") // Check alternate text (it was empty, for export the 'alt' attribute was used). CPPUNIT_ASSERT_EQUAL(OUString("OLE Object"), getProperty<OUString>(xObject, "Title").trim()); + + if (!mbExported) + return; + + // "type" attribute was missing for the inner <object> element. + SvStream* pStream = maTempFile.GetStream(StreamMode::READ); + CPPUNIT_ASSERT(pStream); + pStream->Seek(STREAM_SEEK_TO_END); + sal_uInt64 nLength = pStream->Tell(); + pStream->Seek(0); + OString aStream(read_uInt8s_ToOString(*pStream, nLength)); + CPPUNIT_ASSERT(aStream.indexOf("type=\"image/png\"") != -1); } DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfPngImg, "reqif-png-img.xhtml") diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index cc2b6709b6df..015f3f49d9ec 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1456,16 +1456,26 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame } OUString aGraphicURL; + OUString aMimeType; if(!rHTMLWrt.mbEmbedImages) { const OUString* pTempFileName = rHTMLWrt.GetOrigFileName(); if(pTempFileName) aGraphicURL = *pTempFileName; + OUString aFilterName("JPG"); + XOutFlags nFlags = XOutFlags::UseGifIfPossible | XOutFlags::UseNativeIfPossible; + + if (bObjectOpened) + { + aFilterName = "PNG"; + nFlags = XOutFlags::NONE; + aMimeType = "image/png"; + } + sal_uInt16 nErr = XOutBitmap::WriteGraphic( aGraphic, aGraphicURL, - "JPG", - (XOutFlags::UseGifIfPossible | - XOutFlags::UseNativeIfPossible) ); + aFilterName, + nFlags ); if( nErr ) // fehlerhaft, da ist nichts auszugeben { rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; @@ -1482,7 +1492,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame nFlags |= HtmlFrmOpts::Replacement; OutHTML_Image( rWrt, rFrameFormat, aGraphicURL, aGraphic, pOLENd->GetTitle(), pOLENd->GetTwipSize(), - nFlags, "ole" ); + nFlags, "ole", nullptr, aMimeType ); if (bObjectOpened) // Close native data. _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
