summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/scriptforge/SF_UI.xba63
-rw-r--r--wizards/source/scriptforge/python/scriptforge.py2
2 files changed, 64 insertions, 1 deletions
diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba
index 8c511a35cc8d..c8a7f9a8f861 100644
--- a/wizards/source/scriptforge/SF_UI.xba
+++ b/wizards/source/scriptforge/SF_UI.xba
@@ -119,6 +119,14 @@ Dim oComp As Object ' com.sun.star.lang.XComponent
End Function ' ScriptForge.SF_UI.ActiveWindow
REM -----------------------------------------------------------------------------
+Property Get Height() As Long
+''' Returns the height of the active window
+Dim oPosSize As Object ' com.sun.star.awt.Rectangle
+ Set oPosSize = SF_UI._PosSize()
+ If Not IsNull(oPosSize) Then Height = oPosSize.Height Else Height = -1
+End Property ' ScriptForge.SF_UI.Height
+
+REM -----------------------------------------------------------------------------
Property Get MACROEXECALWAYS As Integer
''' Macros are always executed
MACROEXECALWAYS = cstMACROEXECALWAYS
@@ -148,6 +156,30 @@ Property Get ServiceName As String
ServiceName = "ScriptForge.UI"
End Property ' ScriptForge.SF_UI.ServiceName
+REM -----------------------------------------------------------------------------
+Property Get Width() As Long
+''' Returns the width of the active window
+Dim oPosSize As Object ' com.sun.star.awt.Rectangle
+ Set oPosSize = SF_UI._PosSize()
+ If Not IsNull(oPosSize) Then Width = oPosSize.Width Else Width = -1
+End Property ' ScriptForge.SF_UI.Width
+
+REM -----------------------------------------------------------------------------
+Property Get X() As Long
+''' Returns the X coordinate of the active window
+Dim oPosSize As Object ' com.sun.star.awt.Rectangle
+ Set oPosSize = SF_UI._PosSize()
+ If Not IsNull(oPosSize) Then X = oPosSize.X Else X = -1
+End Property ' ScriptForge.SF_UI.X
+
+REM -----------------------------------------------------------------------------
+Property Get Y() As Long
+''' Returns the Y coordinate of the active window
+Dim oPosSize As Object ' com.sun.star.awt.Rectangle
+ Set oPosSize = SF_UI._PosSize()
+ If Not IsNull(oPosSize) Then Y = oPosSize.Y Else Y = -1
+End Property ' ScriptForge.SF_UI.Y
+
REM ===================================================================== METHODS
REM -----------------------------------------------------------------------------
@@ -495,6 +527,11 @@ Check:
Try:
Select Case UCase(PropertyName)
Case "ACTIVEWINDOW" : GetProperty = ActiveWindow()
+ Case "HEIGHT" : GetProperty = SF_UI.Height
+ Case "WIDTH" : GetProperty = SF_UI.Width
+ Case "X" : GetProperty = SF_UI.X
+ Case "Y" : GetProperty = SF_UI.Y
+
Case Else
End Select
@@ -827,6 +864,10 @@ Public Function Properties() As Variant
Properties = Array( _
"ActiveWindow" _
+ , "Height" _
+ , "Width" _
+ , "X" _
+ , "Y" _
)
End Function ' ScriptForge.SF_UI.Properties
@@ -1273,6 +1314,28 @@ Catch:
End Function ' ScriptForge.SF_UI._IdentifyWindow
REM -----------------------------------------------------------------------------
+Public Function _PosSize() As Object
+''' Returns the PosSize structure of the active window
+
+Dim vWindow As Window ' A single component
+Dim oContainer As Object ' com.sun.star.awt.XWindow
+Dim oPosSize As Object ' com.sun.star.awt.Rectangle
+
+ Set oPosSize = Nothing
+
+Try:
+ vWindow = SF_UI._IdentifyWindow(StarDesktop.CurrentComponent)
+ If Not IsNull(vWindow.Frame) Then
+ Set oContainer = vWindow.Frame.ContainerWindow
+ Set oPosSize = oContainer.getPosSize()
+ End If
+
+Finally:
+ Set _PosSize = oPosSize
+ Exit Function
+End Function ' ScriptForge.SF_UI._PosSize
+
+REM -----------------------------------------------------------------------------
Private Function _Repr() As String
''' Convert the UI instance to a readable string, typically for debugging purposes (DebugPrint ...)
''' Args:
diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py
index 8843d0627b63..4a0523dc3f1a 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -1511,7 +1511,7 @@ class SFScriptForge:
serviceimplementation = 'basic'
servicename = 'ScriptForge.UI'
servicesynonyms = ('ui', 'scriptforge.ui')
- serviceproperties = dict(ActiveWindow = False)
+ serviceproperties = dict(ActiveWindow = False, Height = False, Width = False, X = False, Y = False)
# Class constants
MACROEXECALWAYS, MACROEXECNEVER, MACROEXECNORMAL = 2, 1, 0