summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-06-10 11:08:56 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-06-10 09:16:49 +0200
commitbf02c5fa586d2ff7dbfac37d3ea0a07675efc15e (patch)
treea51fd811c8521f5aff78ad29f674f30af4f2a9b6
parent99ed68ac1fbaf883ddc730936299bba95d9e1d6f (diff)
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.kaganski@collabora.com> Tested-by: Jenkins
-rw-r--r--xmloff/source/core/xmlimp.cxx35
1 files changed, 27 insertions, 8 deletions
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index b39775f0699d..016ca91dc014 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -1303,19 +1303,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;