formula/source/core/api/FormulaCompiler.cxx | 2 +- sc/source/core/tool/compiler.cxx | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-)
New commits: commit 75eb756e25bfe78fd0bc3f92c53fe93a4a87c80c Author: Eike Rathke <er...@redhat.com> AuthorDate: Tue Sep 6 13:48:29 2022 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Sep 7 16:03:16 2022 +0200 A ColRowName (label) is a QuotedLabel is a SingleQuoted This is a combination of 2 commits. A ColRowName (label) is a QuotedLabel is a SingleQuoted Hence a ' is not escaped by \' but by '' doubling it. See also ODFF 5.10 Quoted Label https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1017950_715980110 Apparently this was always wrong and even stored in files and never correctly read/compiled back. Change-Id: I94bdb7d1fdffe9bbd77cf443883dd76637be981b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139491 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 64f673238cf9b645a751e8f8137ca14e595a779a) Conflicts: sc/source/core/tool/compiler.cxx Always enquote ColRowName (label) as SingleQuoted It's anyway required by ODFF and also in UI prevents confusion between defined names and labels of the same name. Change-Id: Iba03f15f1f778132696101507e61cc0ef8de6c6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139533 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 55e7de171b666a87f29f072e0a4787480946c066) Conflicts: sc/source/core/tool/compiler.cxx Change-Id: I94bdb7d1fdffe9bbd77cf443883dd76637be981b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139548 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 044921d70cc0..192cb56173fc 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1203,7 +1203,7 @@ bool FormulaCompiler::DeQuote( OUString& rStr ) if ( nLen > 1 && rStr[0] == '\'' && rStr[ nLen-1 ] == '\'' ) { rStr = rStr.copy( 1, nLen-2 ); - rStr = rStr.replaceAll( "\\\'", "\'" ); + rStr = rStr.replaceAll( "''", "'" ); return true; } return false; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 7bcb949c8fe5..7be5a364a3af 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5506,15 +5506,10 @@ void ScCompiler::LocalizeString( OUString& rName ) const // quote characters contained within are escaped by '\\'. bool ScCompiler::EnQuote( OUString& rStr ) { - sal_Int32 nType = ScGlobal::getCharClass().getStringType( rStr, 0, rStr.getLength() ); - if ( !CharClass::isNumericType( nType ) - && CharClass::isAlphaNumericType( nType ) ) - return false; - sal_Int32 nPos = 0; while ( (nPos = rStr.indexOf( '\'', nPos)) != -1 ) { - rStr = rStr.replaceAt( nPos, 0, u"\\" ); + rStr = rStr.replaceAt( nPos, 0, u"'" ); nPos += 2; } rStr = "'" + rStr + "'";