diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-06-02 08:48:56 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-06-02 10:31:45 +0200 |
commit | 4da0de52bbd9a2f53ce0e838f7b22c228e510f97 (patch) | |
tree | 79ca8fa5082e3e0c7c1cb52aff7571eef308b0ee /sw/source/filter | |
parent | edfd864ab45c029bb590ab34c711cd269e140f09 (diff) |
sw XHTML / reqif export: export PNG shapes directly
The old markup was:
<object data="draw-png_xhtml_89305eb5d44b6428.gif">
The new markup is:
<object data="draw-png_xhtml_89305eb5d44b6428.png" type="image/png">
Which now passes the validator.
Change-Id: Ibcdac7aeef0e39c926176bf8852cffe17a137fa2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116565
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/html/htmlflywriter.cxx | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index a050c9c2056b..f4ff89c0b2b9 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -41,6 +41,7 @@ #include <editeng/brushitem.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> +#include <svx/svdograf.hxx> #include <fmtanchr.hxx> #include <fmtornt.hxx> @@ -1747,15 +1748,27 @@ static Writer & OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& r Graphic aGraphic( const_cast<SwFrameFormat &>(rFrameFormat).MakeGraphic( &aIMap ) ); Size aSz( 0, 0 ); OUString GraphicURL; + OUString aMimeType("image/jpeg"); if(!rHTMLWrt.mbEmbedImages) { if( rHTMLWrt.GetOrigFileName() ) GraphicURL = *rHTMLWrt.GetOrigFileName(); + + OUString aFilterName("JPG"); + XOutFlags nFlags = XOutFlags::UseGifIfPossible | XOutFlags::UseNativeIfPossible; + + if (rHTMLWrt.mbReqIF) + { + // Writing image without fallback PNG in ReqIF mode: force PNG output. + aFilterName = "PNG"; + nFlags = XOutFlags::NONE; + aMimeType = "image/png"; + } + if( aGraphic.GetType() == GraphicType::NONE || XOutBitmap::WriteGraphic( aGraphic, GraphicURL, - "JPG", - (XOutFlags::UseGifIfPossible| - XOutFlags::UseNativeIfPossible) ) != ERRCODE_NONE ) + aFilterName, + nFlags ) != ERRCODE_NONE ) { // empty or incorrect, because there is nothing to output rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD; @@ -1767,10 +1780,11 @@ static Writer & OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& r URIHelper::GetMaybeFileHdl() ); } + HtmlWriter aHtml(rWrt.Strm(), rHTMLWrt.maNamespace); OutHTML_ImageStart( aHtml, rWrt, rFrameFormat, GraphicURL, aGraphic, rFrameFormat.GetName(), aSz, HtmlFrmOpts::GenImgMask, "frame", - aIMap.GetIMapObjectCount() ? &aIMap : nullptr ); + aIMap.GetIMapObjectCount() ? &aIMap : nullptr, aMimeType ); OutHTML_ImageEnd(aHtml, rWrt); return rWrt; |