sw/source/filter/ww8/rtfattributeoutput.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit f7c8774b2f3423095d794e90c58ab505ef8a1706 Author: Vasily Melenchuk <vasily.melenc...@cib.de> Date: Sat Oct 24 19:31:42 2015 +0300 tdf#39960 fix saving of GIF images into RTF Currently in case of RTF export LO converts all unknown graphic into WMF. And some images due to zero prefSize produce invalid WMF of zero dimensions. As a workaround for current case we do not convert GIF images to WMF, PNG format looks better here. The code can be extended to provide suitable converters for other formats. Change-Id: I0c98111a4496250874aa4f664dd2f70134c1bdd1 Reviewed-on: https://gerrit.libreoffice.org/19581 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index a4e37df..ff7f7d6 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3837,6 +3837,9 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat if (rGraphic.GetType()==GRAPHIC_NONE) return; + ConvertDataFormat pConvertDestinationFormat = ConvertDataFormat::WMF; + const sal_Char* pConvertDestinationBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; + GfxLink aGraphicLink; const sal_Char* pBLIPType = 0; if (rGraphic.IsLink()) @@ -3869,6 +3872,11 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat pBLIPType = IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; break; + case GFX_LINK_TYPE_NATIVE_GIF: + // GIF is not supported by RTF, but we override default conversion to WMF, PNG seems fits better here. + pConvertDestinationFormat = ConvertDataFormat::PNG; + pConvertDestinationBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; + break; default: break; } @@ -3977,9 +3985,9 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat else { aStream.Seek(0); - if (GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE) + if (GraphicConverter::Export(aStream, rGraphic, pConvertDestinationFormat) != ERRCODE_NONE) SAL_WARN("sw.rtf", "failed to export the graphic"); - pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; + pBLIPType = pConvertDestinationBLIPType; aStream.Seek(STREAM_SEEK_TO_END); nSize = aStream.Tell(); pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits