xmloff/source/core/xmlimp.cxx | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-)
New commits: commit 10bc0a3619f0e7bba07985069cb99663cc688fb9 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Jun 10 11:08:56 2024 +0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Jun 10 13:42:05 2024 +0200 tdf#161488: allow failed image loading in repair mode Change-Id: I19a68f2f016b5ab95565c7fbcc4c435cf13c6b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168596 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins (cherry picked from commit bf02c5fa586d2ff7dbfac37d3ea0a07675efc15e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168615 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 209c141fb0d4..e6b1aa66ee7f 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1306,19 +1306,38 @@ uno::Reference<graphic::XGraphic> SvXMLImport::loadGraphicByURL(OUString const & { uno::Reference<graphic::XGraphic> xGraphic; - if (mxGraphicStorageHandler.is()) + try { - if (IsPackageURL(rURL)) + if (mxGraphicStorageHandler.is()) { - xGraphic = mxGraphicStorageHandler->loadGraphic(rURL); + if (IsPackageURL(rURL)) + { + xGraphic = mxGraphicStorageHandler->loadGraphic(rURL); + } + else + { + OUString const& rAbsoluteURL = GetAbsoluteReference(rURL); + GraphicExternalLink aExternalLink(rAbsoluteURL); + Graphic aGraphic(aExternalLink); + xGraphic = aGraphic.GetXGraphic(); + } } - else + } + catch (...) + { + bool bRepairPackage = false; + if (auto const xStorProps{ GetSourceStorage().query<beans::XPropertySet>() }) { - OUString const & rAbsoluteURL = GetAbsoluteReference(rURL); - GraphicExternalLink aExternalLink(rAbsoluteURL); - Graphic aGraphic(aExternalLink); - xGraphic = aGraphic.GetXGraphic(); + try + { + xStorProps->getPropertyValue(u"RepairPackage"_ustr) >>= bRepairPackage; + } + catch (uno::Exception&) + { + } } + if (!bRepairPackage) + throw; } return xGraphic;