sc/source/ui/docshell/docsh.cxx | 42 ++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-)
New commits: commit 61abbc2f9698f48bf92ec102952cd6b4fcc536d1 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Feb 24 16:26:09 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Sat Feb 26 19:54:20 2022 +0100 do not fail import if there are only warnings When opening CVE-2012-4233-4.xls or ofz5527-1.xls in LO UI, they show a warning about too many columns (presumably because Excel as of now supports 16k and LO only 1k columns by default), but besides stripping the extra columns they otherwise actually load normally. But ScFiltersTest::testCVEs() fails loading them just because of the warning. And if 16k columns are forced for the tests, the files unexpectedly load fine, making the test fail. ScDocShell::ConvertFrom() is rather inconsistent on whether only a warning results in a failed load or not, but most seem not to return failure on only warnings, and I think that makes sense, so make code paths for all formats consistently handle it that way. Change-Id: I202f29f5a5a44aecd34b84cf2f8180222e8d870a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130500 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls b/sc/qa/unit/data/xls/pass/CVE-2012-4233-4.xls similarity index 100% rename from sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls rename to sc/qa/unit/data/xls/pass/CVE-2012-4233-4.xls diff --git a/sc/qa/unit/data/xls/fail/ofz5527-1.xls b/sc/qa/unit/data/xls/pass/ofz5527-1.xls similarity index 100% rename from sc/qa/unit/data/xls/fail/ofz5527-1.xls rename to sc/qa/unit/data/xls/pass/ofz5527-1.xls diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d30d4b89f236..5cfe7ee0b78b 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1217,16 +1217,12 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) // all graphics objects must have names m_aDocument.EnsureGraphicNames(); - if (eError == SCWARN_IMPORT_RANGE_OVERFLOW) - { - if (!GetError()) - SetError(eError); - bRet = true; - } - else if (eError != ERRCODE_NONE) + if (eError != ERRCODE_NONE) { if (!GetError()) SetError(eError); + if( eError.IsWarning() ) + bRet = true; } else bRet = true; @@ -1317,6 +1313,8 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) { if (!GetError()) SetError(eError); + if( eError.IsWarning() ) + bRet = true; } else if (!GetError() && (bOverflowRow || bOverflowCol || bOverflowCell)) { @@ -1357,7 +1355,8 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) { if (!GetError()) SetError(eError); - bRet = ( eError == SCWARN_IMPORT_RANGE_OVERFLOW ); + if( eError.IsWarning() ) + bRet = true; } else bRet = true; @@ -1435,8 +1434,13 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } } - if ( eError != ERRCODE_NONE && !GetError() ) - SetError(eError); + if (eError != ERRCODE_NONE) + { + if (!GetError()) + SetError(eError); + if( eError.IsWarning() ) + bRet = true; + } else if (!GetError() && (bOverflowRow || bOverflowCol || bOverflowCell)) { // precedence: row, column, cell @@ -1500,8 +1504,13 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } } - if ( eError != ERRCODE_NONE && !GetError() ) - SetError(eError); + if (eError != ERRCODE_NONE) + { + if (!GetError()) + SetError(eError); + if( eError.IsWarning() ) + bRet = true; + } } else if (aFltName == pFilterHtml || aFltName == pFilterHtmlWebQ) { @@ -1551,8 +1560,13 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } } - if ( eError != ERRCODE_NONE && !GetError() ) - SetError(eError); + if (eError != ERRCODE_NONE) + { + if (!GetError()) + SetError(eError); + if( eError.IsWarning() ) + bRet = true; + } } else {