[Libreoffice-commits] core.git: desktop/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 20 09:49:14 UTC 2021


 desktop/source/lib/init.cxx |  103 +++-----------------------------------------
 1 file changed, 8 insertions(+), 95 deletions(-)

New commits:
commit af0cc133129d18fae86b603b4af3e196af57f664
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jun 9 17:44:27 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Jul 20 11:48:37 2021 +0200

    jsdialog: remove UITest based events execution
    
    Change-Id: I393893389d82a54a8d689caba3f2acb10cff533a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116930
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119199
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 962ac8830ef6..86f66d2aa225 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -956,29 +956,6 @@ void hideSidebar()
         SetLastExceptionMsg("No view shell or sidebar");
 }
 
-VclPtr<Window> getSidebarWindow()
-{
-    VclPtr<Window> xRet;
-
-    setupSidebar();
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): nullptr;
-    if (!pViewFrame)
-        return xRet;
-
-    // really a SidebarChildWindow
-    SfxChildWindow *pChild = pViewFrame->GetChildWindow(SID_SIDEBAR);
-    if (!pChild)
-        return xRet;
-
-    // really a SidebarDockingWindow
-    vcl::Window *pWin = pChild->GetWindow();
-    if (!pWin)
-        return xRet;
-    xRet = pWin;
-    return xRet;
-}
-
 }  // end anonymous namespace
 
 // Could be anonymous in principle, but for the unit testing purposes, we
@@ -3803,92 +3780,28 @@ static void lcl_sendDialogEvent(unsigned long long int nWindowId, const char* pA
     SolarMutexGuard aGuard;
 
     StringMap aMap(jsdialog::jsonToStringMap(pArguments));
-    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nWindowId);
-
-    if (!pWindow && nWindowId >= 1000000000 /* why unsigned? */)
-        pWindow = getSidebarWindow();
 
     if (aMap.find("id") == aMap.end())
         return;
 
-    static constexpr OUStringLiteral sClickAction(u"CLICK");
-    static constexpr OUStringLiteral sSelectAction(u"SELECT");
-    static constexpr OUStringLiteral sClearAction(u"CLEAR");
-    static constexpr OUStringLiteral sTypeAction(u"TYPE");
-    static constexpr OUStringLiteral sUpAction(u"UP");
-    static constexpr OUStringLiteral sDownAction(u"DOWN");
-    static constexpr OUStringLiteral sValue(u"VALUE");
-
-    bool bExecutedWeldedAction = false;
+    sal_uInt64 nCurrentShellId = reinterpret_cast<sal_uInt64>(SfxViewShell::Current());
 
     try
     {
         OString sControlId = OUStringToOString(aMap["id"], RTL_TEXTENCODING_ASCII_US);
 
-        bExecutedWeldedAction = jsdialog::ExecuteAction(nWindowId, sControlId, aMap);
-        if (!bExecutedWeldedAction)
-            bExecutedWeldedAction = jsdialog::ExecuteAction(reinterpret_cast<sal_uInt64>(SfxViewShell::Current()),
-                                                      sControlId, aMap);
+        // dialogs send own id but notebookbar and sidebar controls are remembered by SfxViewShell id
+        bool bFoundWeldedControl = jsdialog::ExecuteAction(nWindowId, sControlId, aMap);
+        if (!bFoundWeldedControl)
+            bFoundWeldedControl = jsdialog::ExecuteAction(nCurrentShellId, sControlId, aMap);
 
-        if (bExecutedWeldedAction)
+        if (bFoundWeldedControl)
             return;
 
-        if (!pWindow)
-        {
-            SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found.");
-            return;
-        }
-
-        WindowUIObject aUIObject(pWindow);
-        std::unique_ptr<UIObject> pUIWindow(aUIObject.get_visible_child(aMap["id"]));
-        if (pUIWindow) {
-            OUString sAction((aMap.find("cmd") != aMap.end())? aMap["cmd"]: "");
-
-            if (sAction == "selected")
-            {
-                aMap["POS"] = aMap["data"];
-                aMap["TEXT"] = aMap["data"];
+        // force resend - used in mobile-wizard
+        jsdialog::SendFullUpdate(nCurrentShellId, "Panel");
 
-                pUIWindow->execute(sSelectAction, aMap);
-            }
-            else if (sAction == "plus")
-            {
-                pUIWindow->execute(sUpAction, aMap);
-            }
-            else if (sAction == "minus")
-            {
-                pUIWindow->execute(sDownAction, aMap);
-            }
-            else if (sAction == "set")
-            {
-                aMap["TEXT"] = aMap["data"];
-
-                pUIWindow->execute(sClearAction, aMap);
-                pUIWindow->execute(sTypeAction, aMap);
-            }
-            else if (sAction == "value")
-            {
-                aMap["VALUE"] = aMap["data"];
-                pUIWindow->execute(sValue, aMap);
-            }
-            else if (sAction == "click" && aMap["type"] == "drawingarea")
-            {
-                int separatorPos = aMap["data"].indexOf(';');
-                if (separatorPos > 0)
-                {
-                    // x;y
-                    aMap["POSX"] = aMap["data"].copy(0, separatorPos);
-                    aMap["POSY"] = aMap["data"].copy(separatorPos + 1);
-                }
-                pUIWindow->execute(sClickAction, aMap);
-            }
-            else
-                pUIWindow->execute(sClickAction, aMap);
-        }
     } catch(...) {}
-
-    // force resend
-    pWindow->Resize();
 }
 
 


More information about the Libreoffice-commits mailing list