vcl/source/graphic/UnoGraphicProvider.cxx | 66 ++++++++++-------------------- 1 file changed, 22 insertions(+), 44 deletions(-)
New commits: commit 3158b14e0b26875300a8098bc117a5e69b76f48f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu May 22 15:07:14 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri May 23 06:10:34 2025 +0200 Simplify GraphicProvider::queryGraphic nExtWidth and nExtHeight are unused since commit 1c25d22bfa072eb78da8930a3877f37a70ff707b (Simplify an "ImportGraphic" method by removing useless pExtHeader (WmfExternal), 2022-05-19). Is nExtMapMode (and maybe bLazyRead) obsolete, too? Change-Id: I1de1ea4f08c6e6ef332fbabc228395c7490520cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185669 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx index 0e75a7505975..77801f89d657 100644 --- a/vcl/source/graphic/UnoGraphicProvider.cxx +++ b/vcl/source/graphic/UnoGraphicProvider.cxx @@ -346,24 +346,13 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co } } - // Check for the goal width and height if they are defined - sal_uInt16 nExtWidth = 0; - sal_uInt16 nExtHeight = 0; sal_uInt16 nExtMapMode = 0; for (const auto& rProp : aFilterData) { const OUString aName( rProp.Name ); const uno::Any aValue( rProp.Value ); - if (aName == "ExternalWidth") - { - aValue >>= nExtWidth; - } - else if (aName == "ExternalHeight") - { - aValue >>= nExtHeight; - } - else if (aName == "ExternalMapMode") + if (aName == "ExternalMapMode") { aValue >>= nExtMapMode; } @@ -400,43 +389,32 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co { ::GraphicFilter& rFilter = ::GraphicFilter::GetGraphicFilter(); + if ( nExtMapMode > 0 ) { - Graphic aVCLGraphic; - - // Define APM Header if goal height and width are defined - WmfExternal aExtHeader; - aExtHeader.xExt = nExtWidth; - aExtHeader.yExt = nExtHeight; - aExtHeader.mapMode = nExtMapMode; - if ( nExtMapMode > 0 ) - { - bLazyRead = false; - } + bLazyRead = false; + } - ErrCode error = ERRCODE_NONE; - if (bLazyRead) - { - Graphic aGraphic = rFilter.ImportUnloadedGraphic(*pIStm); - if (!aGraphic.IsNone()) - aVCLGraphic = std::move(aGraphic); - } - if (aVCLGraphic.IsNone()) - error = rFilter.ImportGraphic(aVCLGraphic, aPath, *pIStm, GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE); + Graphic aVCLGraphic; + ErrCode error = ERRCODE_NONE; + if (bLazyRead) + { + aVCLGraphic = rFilter.ImportUnloadedGraphic(*pIStm); + } + if (aVCLGraphic.IsNone()) + error = rFilter.ImportGraphic(aVCLGraphic, aPath, *pIStm, GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE); - if( (error == ERRCODE_NONE ) && - ( aVCLGraphic.GetType() != GraphicType::NONE ) ) - { - if (!aPath.isEmpty() && bLoadAsLink) - aVCLGraphic.setOriginURL(aPath); + if (error == ERRCODE_NONE && !aVCLGraphic.IsNone()) + { + if (!aPath.isEmpty() && bLoadAsLink) + aVCLGraphic.setOriginURL(aPath); - rtl::Reference<::unographic::Graphic> pUnoGraphic = new ::unographic::Graphic; + rtl::Reference<::unographic::Graphic> pUnoGraphic = new ::unographic::Graphic; - pUnoGraphic->init( aVCLGraphic ); - xRet = pUnoGraphic; - } - else{ - SAL_WARN("svtools", "Could not create graphic for:" << aPath << " error: " << error); - } + pUnoGraphic->init( aVCLGraphic ); + xRet = pUnoGraphic; + } + else{ + SAL_WARN("svtools", "Could not create graphic for:" << aPath << " error: " << error); } }