From c428b24381ef0b63805d0818010dfb4e76858c68 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Ledure Date: Sat, 7 Mar 2026 15:41:20 +0100 Subject: [PATCH] ScriptForge - ui.Activate() Fix maximize ui.Activate(...) sets the focus on the window in argument. Before the actual patch, when the window in background was maximized, it appeared in foreground simply "restored". Now "restored" or "maximized" depends on the previous status. Limited impact on existing scripts. Improvement valid for Python and Basic user scripts. No impact on help documentation. Change-Id: Ie3d30967948d114a422345afa9d13d54e587b79e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201175 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure --- wizards/source/scriptforge/SF_UI.xba | 3 +++ wizards/source/scriptforge/script.xlb | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba index a28b9d4e3b2a..1d4e69967082 100644 --- a/wizards/source/scriptforge/SF_UI.xba +++ b/wizards/source/scriptforge/SF_UI.xba @@ -217,6 +217,7 @@ Dim oEnum As Object ' com.sun.star.container.XEnumeration Dim oComp As Object ' com.sun.star.lang.XComponent Dim vWindow As Window ' A single component Dim oContainer As Object ' com.sun.star.awt.XWindow +Dim bMaximized As Boolean ' True when window is maximized Const cstThisSub = "UI.Activate" Const cstSubArgs = "WindowName" @@ -242,9 +243,11 @@ Try: Set oContainer = vWindow.Frame.ContainerWindow With oContainer If .isVisible() = False Then .setVisible(True) + bMaximized = .IsMaximized .IsMinimized = False .setFocus() .toFront() ' Force window change in Linux + If bMaximized Then .IsMaximized = True ' Re-maximized only when True Wait 1 ' Bypass desynchro issue in Linux End With bActivate = True diff --git a/wizards/source/scriptforge/script.xlb b/wizards/source/scriptforge/script.xlb index a77ee4a07d5b..bead89b8a66e 100644 --- a/wizards/source/scriptforge/script.xlb +++ b/wizards/source/scriptforge/script.xlb @@ -1,6 +1,13 @@ + + + + + + + @@ -14,11 +21,4 @@ - - - - - - - \ No newline at end of file