diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2015-10-24 19:31:42 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-10-24 21:27:27 +0000 |
commit | f7c8774b2f3423095d794e90c58ab505ef8a1706 (patch) | |
tree | a0d7bf52a1462ccd58895a864760720fc9d70fff | |
parent | 70a50e8390d1d0260b81dc49b629db3069abe427 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index a4e37df1db4b..ff7f7d6d767e 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()); |