diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2020-02-26 14:48:55 +0100 |
---|---|---|
committer | Marco Cecchetti <marco.cecchetti@collabora.com> | 2021-04-13 12:51:05 +0200 |
commit | 36600c0d0e10828b5a37e786454ef2f8fd2dcb96 (patch) | |
tree | 6adbd070d3eeb499bd6a3f01a4e116d3c9cad9a0 /sc | |
parent | 65c001867fa02ae69b280d5ebd513275f32c089e (diff) |
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95104
Tested-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93343
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 58 |
1 files changed, 35 insertions, 23 deletions
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(); + } } } } |