From a2ad27a2be429c6d17ef28c28ac5aee66ad8545d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 16 Jan 2017 21:25:25 +0300 Subject: tdf#104718: Prompt user to continue on SAXException Change-Id: Ib0f9a89c670f8d513ebee206a6a1487802f901ff Reviewed-on: https://gerrit.libreoffice.org/33181 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index f836cf85ac42..94f2fbba4c7e 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -41,6 +41,7 @@ #include #include +#include "sfx2/objsh.hxx" // this extern variable is declared in OOXMLStreamImpl.hxx OUString customTarget; @@ -503,11 +504,14 @@ void OOXMLDocumentImpl::resolve(Stream & rStream) { xParser->parseStream(aParserInput); } - catch (xml::sax::SAXException const&) + catch (xml::sax::SAXException const& rErr) { - // don't swallow these - handlers may not have been executed, + // don't silently swallow these - handlers may not have been executed, // and the domain mapper is likely in an inconsistent state - throw; + // In case user chooses to try to continue loading, don't ask again for this file + SfxObjectShell* rShell = SfxObjectShell::GetShellFromComponent(mxModel); + if (!rShell || !rShell->IsContinueImportOnFilterExceptions("SAXException: " + rErr.Message)) + throw; } catch (uno::RuntimeException const&) { -- cgit