summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-05-21 14:31:06 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-07-19 10:25:24 +0200
commit5ae7cd1d9d40585602d69b5800cbb58795a733bb (patch)
tree400fc59b0c8c479eae2b483e3a6821dc1f87ba09 /desktop/source
parent3a84543c9b52f681304564ebfb00db8da6a1d407 (diff)
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@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx95
1 files changed, 47 insertions, 48 deletions
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();
}