summaryrefslogtreecommitdiff
path: root/formula/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2024-07-25 17:40:11 +0200
committerEike Rathke <erack@redhat.com>2024-07-25 23:27:21 +0200
commitdc9486f2443fa52588b625c0a2a288bff56a7a45 (patch)
treee188555e86ad3c7e73243243faa84039ef51bc13 /formula/source
parentc671e999f8b84c15d012dbfcf37b3a54acd26cba (diff)
Resolves: tdf#162087 FormulaCompiler::OpCodeMap::maHashMap must be uppercase
which is the case for all English function names, but not the TableRef item specifiers like #All, #Data, ... Change-Id: I7f675e05b0d52eac9596b96b4d2cf299351fb82a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171022 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'formula/source')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 8f0dd62d6ace..93886a061b25 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1282,17 +1282,21 @@ bool FormulaCompiler::IsMatrixFunction( OpCode eOpCode )
}
-void FormulaCompiler::OpCodeMap::putCopyOpCode( const OUString& rSymbol, OpCode eOp )
+void FormulaCompiler::OpCodeMap::putCopyOpCode( const OUString& rSymbol, OpCode eOp, const CharClass* pCharClass )
{
SAL_WARN_IF( !mpTable[eOp].isEmpty() && rSymbol.isEmpty(), "formula.core",
"OpCodeMap::putCopyOpCode: NOT replacing OpCode " << static_cast<sal_uInt16>(eOp)
<< " '" << mpTable[eOp] << "' with empty name!");
if (!mpTable[eOp].isEmpty() && rSymbol.isEmpty())
- maHashMap.emplace(mpTable[eOp], eOp);
+ {
+ OUString aUpper( pCharClass ? pCharClass->uppercase( mpTable[eOp]) : mpTable[eOp].toAsciiUpperCase());
+ maHashMap.emplace(aUpper, eOp);
+ }
else
{
+ OUString aUpper( pCharClass ? pCharClass->uppercase( rSymbol) : rSymbol.toAsciiUpperCase());
mpTable[eOp] = rSymbol;
- maHashMap.emplace(rSymbol, eOp);
+ maHashMap.emplace(aUpper, eOp);
}
}
@@ -1311,6 +1315,9 @@ void FormulaCompiler::OpCodeMap::copyFrom( const OpCodeMap& r )
"OpCodeMap::copyFrom: OpCode 0 assigned, this: '"
<< mpTable[0] << "' that: '" << r.mpTable[0] << "'");
+ std::unique_ptr<CharClass> xCharClass( r.mbEnglish ? nullptr : createCharClassIfNonEnglishUI());
+ const CharClass* pCharClass = xCharClass.get();
+
// For bOverrideKnownBad when copying from the English core map (ODF 1.1
// and API) to the native map (UI "use English function names") replace the
// known bad legacy function names with correct ones.
@@ -1333,7 +1340,7 @@ void FormulaCompiler::OpCodeMap::copyFrom( const OpCodeMap& r )
default:
aSymbol = r.mpTable[i];
}
- putCopyOpCode( aSymbol, eOp);
+ putCopyOpCode( aSymbol, eOp, pCharClass);
}
}
else
@@ -1342,7 +1349,7 @@ void FormulaCompiler::OpCodeMap::copyFrom( const OpCodeMap& r )
{
OpCode eOp = OpCode(i);
const OUString& rSymbol = r.mpTable[i];
- putCopyOpCode( rSymbol, eOp);
+ putCopyOpCode( rSymbol, eOp, pCharClass);
}
}