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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user