[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 2 commits - desktop/source sfx2/source vcl/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 10 09:05:43 UTC 2021
desktop/source/lib/init.cxx | 103 +++----------------------------------------
sfx2/source/sidebar/Deck.cxx | 4 +
vcl/source/window/window.cxx | 4 +
3 files changed, 14 insertions(+), 97 deletions(-)
New commits:
commit 2fe8db830056a7cddf58f487a8b4aed4c718e589
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: Thu Jun 10 11:05:23 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>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f730ab0a4c09..a1006fa43015 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -950,29 +950,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
@@ -3778,92 +3755,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();
}
commit 8e03875ca77e4e3adf13373a5ed2935eef56283f
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jun 8 15:28:41 2021 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Jun 10 11:05:10 2021 +0200
jsdialog: sidebar: dump visibility state for widgets
we need this to build all the widgets on the client side
and alow then show/hide widgets
Change-Id: Ib3d8fc673cc787925e19a6e9df673e923ed7ecef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116841
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 7a5b89139a08..35203a18c4cd 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -136,10 +136,12 @@ void Deck::Resize()
*/
void Deck::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
- rJsonWriter.put("id", get_id()); // TODO could be missing - sort out
+ rJsonWriter.put("id", get_id() != "" ? get_id() : msId);
rJsonWriter.put("type", "deck");
rJsonWriter.put("text", GetText());
rJsonWriter.put("enabled", IsEnabled());
+ if (!IsVisible())
+ rJsonWriter.put("visible", false);
auto childrenNode = rJsonWriter.startArray("children");
for (auto &it : maPanels)
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b9464739c0bb..fd7c2438eb47 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3351,13 +3351,15 @@ void Window::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
rJsonWriter.put("type", windowTypeName(GetType()));
rJsonWriter.put("text", GetText());
rJsonWriter.put("enabled", IsEnabled());
+ if (!IsVisible())
+ rJsonWriter.put("visible", false);
if (vcl::Window* pChild = mpWindowImpl->mpFirstChild)
{
auto childrenNode = rJsonWriter.startArray("children");
while (pChild)
{
- if (pChild->IsVisible()) {
+ {
auto childNode = rJsonWriter.startStruct();
pChild->DumpAsPropertyTree(rJsonWriter);
sal_Int32 nLeft = pChild->get_grid_left_attach();
More information about the Libreoffice-commits
mailing list