summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2023-10-26 18:11:40 +0200
committerBalazs Varga <balazs.varga.extern@allotropia.de>2023-10-27 12:28:56 +0200
commitc3ce373227433f40d686847a22e78651bedbab24 (patch)
treeb5cf4eb0d578c0ab5d93f36e4a9742da7acac504 /oox
parent819f87faee0e8d629f5176a107e4b07422abea73 (diff)
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.extern@allotropia.de>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/helper/graphichelper.cxx9
1 files changed, 6 insertions, 3 deletions
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);
}