sc/source/ui/app/inputhdl.cxx |   34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

New commits:
commit e1a32c881a7230481ecc8659d587e3621213e10f
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Mon Aug 22 19:04:40 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri Aug 26 21:39:35 2022 +0200

    tdf#142031 - Collect all the characters for the formula suggestion auto 
input
    
    Change-Id: Idec350b09279f42f2ca42a1c02082d8e9e4207b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138702
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f16e52af8fb6..de0a49e692bb 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -68,6 +68,7 @@
 #include <tabvwsh.hxx>
 #include <docsh.hxx>
 #include <scmod.hxx>
+#include <formulaopt.hxx>
 #include <uiitems.hxx>
 #include <global.hxx>
 #include <sc.hrc>
@@ -1019,6 +1020,10 @@ void ScInputHandler::GetFormulaData()
     else
         pFormulaDataPara.reset( new ScTypedCaseStrSet );
 
+    const CharClass* pCharClass = 
(SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName()
+                                       ? ScCompiler::GetCharClassEnglish()
+                                       : ScCompiler::GetCharClassLocalized());
+
     const OUString aParenthesesReplacement( cParenthesesReplacement);
     const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
     sal_uInt32 nListCount = pFuncList->GetCount();
@@ -1027,16 +1032,12 @@ void ScInputHandler::GetFormulaData()
         const ScFuncDesc* pDesc = pFuncList->GetFunction( i );
         if ( pDesc->mxFuncName )
         {
-            const sal_Unicode* pName = pDesc->mxFuncName->getStr();
-            const sal_Int32 nLen = pDesc->mxFuncName->getLength();
+            OUString aFuncName(pCharClass->uppercase(*(pDesc->mxFuncName)));
             // fdo#75264 fill maFormulaChar with all characters used in 
formula names
-            for ( sal_Int32 j = 0; j < nLen; j++ )
-            {
-                sal_Unicode c = pName[ j ];
-                maFormulaChar.insert( c );
-            }
-            OUString aFuncName = *pDesc->mxFuncName + aParenthesesReplacement;
-            pFormulaData->insert(ScTypedStrData(aFuncName, 0.0, 0.0, 
ScTypedStrData::Standard));
+            for (sal_Int32 j = 0; j < aFuncName.getLength(); j++)
+                maFormulaChar.insert(aFuncName[j]);
+            pFormulaData->insert(ScTypedStrData(*(pDesc->mxFuncName) + 
aParenthesesReplacement, 0.0, 0.0,
+                                                ScTypedStrData::Standard));
             pDesc->initArgumentInfo();
             OUString aEntry = pDesc->getSignature();
             pFormulaDataPara->insert(ScTypedStrData(aEntry, 0.0, 0.0, 
ScTypedStrData::Standard));
@@ -1066,8 +1067,19 @@ void ScInputHandler::GetFormulaData()
         }
     }
     miAutoPosFormula = pFormulaData->end();
-    rDoc.GetFormulaEntries( *pFormulaData );
-    rDoc.GetFormulaEntries( *pFormulaDataPara );
+
+    // tdf#142031 - collect all the characters for the formula suggestion auto 
input
+    ScTypedCaseStrSet aStrSet;
+    rDoc.GetFormulaEntries( aStrSet );
+    for (auto iter = aStrSet.begin(); iter != aStrSet.end(); ++iter)
+    {
+        const OUString aFuncName = 
ScGlobal::getCharClass().uppercase((*iter).GetString());
+        // fdo#75264 fill maFormulaChar with all characters used in formula 
names
+        for (sal_Int32 j = 0; j < aFuncName.getLength(); j++)
+            maFormulaChar.insert(aFuncName[j]);
+    }
+    pFormulaData->insert(aStrSet.begin(), aStrSet.end());
+    pFormulaDataPara->insert(aStrSet.begin(), aStrSet.end());
 }
 
 IMPL_LINK( ScInputHandler, ShowHideTipVisibleParentListener, VclWindowEvent&, 
rEvent, void )

Reply via email to