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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 19 08:25:57 UTC 2021


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

New commits:
commit 5ae7cd1d9d40585602d69b5800cbb58795a733bb
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri May 21 14:31:06 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jul 19 10:25:24 2021 +0200

    jsdialog: early return if welded widget found
    
    Change-Id: Ib06b8dd6614bc6085ccf19f947b2c1f6e2d239c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119154
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 58ac041a78ab..962ac8830ef6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3819,77 +3819,76 @@ static void lcl_sendDialogEvent(unsigned long long int nWindowId, const char* pA
     static constexpr OUStringLiteral sDownAction(u"DOWN");
     static constexpr OUStringLiteral sValue(u"VALUE");
 
-    bool bIsWeldedDialog = false;
+    bool bExecutedWeldedAction = false;
 
     try
     {
         OString sControlId = OUStringToOString(aMap["id"], RTL_TEXTENCODING_ASCII_US);
 
-        bIsWeldedDialog = jsdialog::ExecuteAction(nWindowId, sControlId, aMap);
-        if (!bIsWeldedDialog)
-            bIsWeldedDialog = jsdialog::ExecuteAction(reinterpret_cast<sal_uInt64>(SfxViewShell::Current()),
+        bExecutedWeldedAction = jsdialog::ExecuteAction(nWindowId, sControlId, aMap);
+        if (!bExecutedWeldedAction)
+            bExecutedWeldedAction = jsdialog::ExecuteAction(reinterpret_cast<sal_uInt64>(SfxViewShell::Current()),
                                                       sControlId, aMap);
 
+        if (bExecutedWeldedAction)
+            return;
+
         if (!pWindow)
         {
             SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found.");
             return;
         }
 
-        if (!bIsWeldedDialog)
-        {
-            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"]: "");
+        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"];
+            if (sAction == "selected")
+            {
+                aMap["POS"] = aMap["data"];
+                aMap["TEXT"] = aMap["data"];
 
-                    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(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")
+                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)
                 {
-                    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);
+                    // x;y
+                    aMap["POSX"] = aMap["data"].copy(0, separatorPos);
+                    aMap["POSY"] = aMap["data"].copy(separatorPos + 1);
                 }
-                else
-                    pUIWindow->execute(sClickAction, aMap);
+                pUIWindow->execute(sClickAction, aMap);
             }
+            else
+                pUIWindow->execute(sClickAction, aMap);
         }
     } catch(...) {}
 
     // force resend
-    if (!bIsWeldedDialog)
-        pWindow->Resize();
+    pWindow->Resize();
 }
 
 


More information about the Libreoffice-commits mailing list