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

New commits:
commit b1cd3014455aa4493b00ef58954a9524f514ae03
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Wed Feb 26 14:48:55 2020 +0100
Commit:     Marco Cecchetti <marco.cecche...@collabora.com>
CommitDate: Mon Apr 19 10:13:36 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
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114001

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index a4c63f29dba5..c7426232cfa4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1669,43 +1669,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

Reply via email to