include/oox/helper/graphichelper.hxx | 3 ++- oox/source/helper/graphichelper.cxx | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
New commits: commit c3ce373227433f40d686847a22e78651bedbab24 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Thu Oct 26 18:11:40 2023 +0200 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Fri Oct 27 12:28:56 2023 +0200 tdf#156593 FILEOPEN OOXML: image shown in full instead of cropped Revert "Revert "tdf#118133 DOCX import: disable lazy-loading of tiff images"" This reverts commit c6bf16909db054ec5467ebdc0ea0c9dc07307048. Lazy-loading doesn't work with cropped TIFF images, because in case of Lazy-load TIFF images we are using MapUnit::MapPixel, but in case of cropped images we are using MapUnit::Map100thMM and the crop values are relative to original bitmap size. Change-Id: I2dbf6caf08d7899ec2eae683996d997809d62b89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158509 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx index 32e699ed3468..0d0b69216617 100644 --- a/include/oox/helper/graphichelper.hxx +++ b/include/oox/helper/graphichelper.hxx @@ -121,7 +121,8 @@ public: css::uno::Reference< css::graphic::XGraphic > importGraphic( const css::uno::Reference< css::io::XInputStream >& rxInStrm, - const WmfExternal* pExtHeader = nullptr ) const; + const WmfExternal* pExtHeader = nullptr, + const bool bLazyLoad = true ) const; /** Imports a graphic from the passed binary memory block. */ css::uno::Reference< css::graphic::XGraphic > diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index d197b341da70..830f0131284b 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -229,13 +229,13 @@ awt::Size GraphicHelper::convertHmmToAppFont( const awt::Size& rHmm ) const // Graphics and graphic objects ---------------------------------------------- Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStream >& rxInStrm, - const WmfExternal* pExtHeader ) const + const WmfExternal* pExtHeader, const bool bLazyLoad ) const { Reference< XGraphic > xGraphic; if( rxInStrm.is() && mxGraphicProvider.is() ) try { Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("InputStream", rxInStrm), - comphelper::makePropertyValue("LazyRead", true) }; + comphelper::makePropertyValue("LazyRead", bLazyLoad) }; if ( pExtHeader && pExtHeader->mapMode > 0 ) { @@ -283,8 +283,11 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr xGraphic = mxGraphicMapper->findGraphic(rStreamName); if (!xGraphic.is()) { + // Lazy-loading doesn't work with cropped TIFF images, because in case of Lazy-load TIFF images + // we are using MapUnit::MapPixel, but in case of cropped images we are using MapUnit::Map100thMM + // and the crop values are relative to original bitmap size. auto xStream = mxStorage->openInputStream(rStreamName); - xGraphic = importGraphic(xStream, pExtHeader); + xGraphic = importGraphic(xStream, pExtHeader, !rStreamName.endsWith(".tiff")); if (xGraphic.is()) mxGraphicMapper->putGraphic(rStreamName, xGraphic); }