sc/source/core/tool/compiler.cxx |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

New commits:
commit 55e7de171b666a87f29f072e0a4787480946c066
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Tue Sep 6 20:10:09 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Wed Sep 7 00:21:34 2022 +0200

    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

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 550354d6b8f4..fd18ad624377 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5355,18 +5355,11 @@ void ScCompiler::CreateStringFromSingleRef( 
OUStringBuffer& rBuffer, const Formu
         if (rDoc.HasStringData(aAbs.Col(), aAbs.Row(), aAbs.Tab()))
         {
             OUString aStr = rDoc.GetString(aAbs, mpInterpreterContext);
-
-            // If string contains only numeric characters or if it contains 
non-alphanumeric characters
-            // -> quote characters contained within are escaped by ''.
-            // -> put quotes around string
-            sal_Int32 nType = ScGlobal::getCharClass().getStringType( aStr, 0, 
aStr.getLength() );
-            if ( CharClass::isNumericType( nType )
-                || !CharClass::isAlphaNumericType( nType ) )
-            {
-                aStr = aStr.replaceAll(u"'", u"''");
-                aStr = "'" + aStr + "'";
-            }
+            // Enquote to SingleQuoted.
+            aStr = aStr.replaceAll(u"'", u"''");
+            rBuffer.append('\'');
             rBuffer.append(aStr);
+            rBuffer.append('\'');
         }
         else
         {

Reply via email to