sc/source/ui/app/inputhdl.cxx | 58 +++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 23 deletions(-)
New commits: commit 36600c0d0e10828b5a37e786454ef2f8fd2dcb96 Author: Marco Cecchetti <marco.cecche...@collabora.com> AuthorDate: Wed Feb 26 14:48:55 2020 +0100 Commit: Marco Cecchetti <marco.cecche...@collabora.com> CommitDate: Tue Apr 13 12:51:05 2021 +0200 lok: formula input bar: get a function inserted in a not focused top view Change-Id: Ia52ebbcad8d3febab85f19279859e901f8193c49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89548 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95104 Tested-by: Marco Cecchetti <marco.cecche...@collabora.com> Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93343 Tested-by: Jenkins diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 64621cc72a0d..7190cd6450a9 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1670,43 +1670,55 @@ void ScInputHandler::PasteFunctionData() HideTip(); EditView* pActiveView = pTopView ? pTopView : pTableView; + if (comphelper::LibreOfficeKit::isActive() && pTopView && pInputWin) + pInputWin->TextGrabFocus(); if (pActiveView) pActiveView->ShowCursor(); } void ScInputHandler::LOKPasteFunctionData(const OUString& rFunctionName) { - if (!(pActiveViewSh && (pTopView || pTableView))) - return; - - bool bEdit = false; - OUString aFormula; - EditView* pEditView = pTopView ? pTopView : pTableView; - const EditEngine* pEditEngine = pEditView->GetEditEngine(); - if (pEditEngine) + // in case we have no top view try to create it + if (!pTopView && pInputWin) { - aFormula = pEditEngine->GetText(0); - bEdit = aFormula.getLength() > 1 && (aFormula[0] == '=' || aFormula[0] == '+' || aFormula[0] == '-'); + ScInputMode eCurMode = eMode; + SetMode(SC_INPUT_TOP); + if (!pTopView) + SetMode(eCurMode); } - if ( !bEdit ) + EditView* pEditView = pTopView ? pTopView : pTableView; + + if (pActiveViewSh && pEditView) { - OUString aNewFormula('='); - if ( aFormula.startsWith("=") ) - aNewFormula = aFormula; + bool bEdit = false; + OUString aFormula; + const EditEngine* pEditEngine = pEditView->GetEditEngine(); + if (pEditEngine) + { + aFormula = pEditEngine->GetText(0); + bEdit = aFormula.getLength() > 1 && (aFormula[0] == '=' || aFormula[0] == '+' || aFormula[0] == '-'); + } - InputReplaceSelection( aNewFormula ); - } + if ( !bEdit ) + { + OUString aNewFormula('='); + if ( aFormula.startsWith("=") ) + aNewFormula = aFormula; - if (pFormulaData) - { - OUString aNew; - ScTypedCaseStrSet::const_iterator aPos = findText(*pFormulaData, pFormulaData->begin(), rFunctionName, aNew, /* backward = */false); + InputReplaceSelection( aNewFormula ); + } - if (aPos != pFormulaData->end()) + if (pFormulaData) { - miAutoPosFormula = aPos; - PasteFunctionData(); + OUString aNew; + ScTypedCaseStrSet::const_iterator aPos = findText(*pFormulaData, pFormulaData->begin(), rFunctionName, aNew, /* backward = */false); + + if (aPos != pFormulaData->end()) + { + miAutoPosFormula = aPos; + PasteFunctionData(); + } } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits