diff options
Diffstat (limited to 'sc/source/ui/app/inputhdl.cxx')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 8f422831c6a6..68e2f780fc14 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1642,7 +1642,7 @@ void ScInputHandler::PasteFunctionData() pActiveView->ShowCursor(); } -void ScInputHandler::LOKPasteFunctionData( sal_uInt32 nIndex ) +void ScInputHandler::LOKPasteFunctionData(const OUString& rFunctionName) { // in case we have no top view try to create it if (!pTopView && pInputWin) @@ -1675,12 +1675,16 @@ void ScInputHandler::LOKPasteFunctionData( sal_uInt32 nIndex ) InputReplaceSelection( aNewFormula ); } - if (pFormulaData && nIndex < pFormulaData->size()) + if (pFormulaData) { - auto aPos = pFormulaData->begin(); - std::advance(aPos, nIndex); - miAutoPosFormula = aPos; - PasteFunctionData(); + OUString aNew; + ScTypedCaseStrSet::const_iterator aPos = findText(*pFormulaData, pFormulaData->begin(), rFunctionName, aNew, /* backward = */false); + + if (aPos != pFormulaData->end()) + { + miAutoPosFormula = aPos; + PasteFunctionData(); + } } } } |