diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2021-06-18 12:48:17 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2021-06-19 10:02:19 +0200 |
commit | 6de7707236ea918d94f321587cb1a728a42e0892 (patch) | |
tree | c6fffb5cff2b7f753d17baa3db28c12954be699c /wizards | |
parent | d32a9f90e85a5cfa9ffd629494de3c291282454e (diff) |
ScriptForge - (SF_UI) GetDocument() accepts component object
SF_UI.GetDocument() has 1 argument.
Before, must be a string designating an open window
Now, also a UNO object of types
com.sun.star.lang.XComponent or
com.sun.star.comp.dba.ODatabaseDocument
Typical usage: pass ThisComponent or ThisDatabaseDocument
as argument to create a new SFDocuments.Document/Base/Calc service.
Change-Id: Id9e0a40425dc3ce5e83953af5da4fb7ef8dd6f63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117442
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/scriptforge/SF_UI.xba | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba index 9b98053a85c9..122dd218da93 100644 --- a/wizards/source/scriptforge/SF_UI.xba +++ b/wizards/source/scriptforge/SF_UI.xba @@ -402,12 +402,14 @@ REM ---------------------------------------------------------------------------- Public Function GetDocument(Optional ByVal WindowName As Variant) As Variant ''' Returns a SFDocuments.Document object referring to the active window or the given window ''' Args: -''' WindowName: see definitions. If absent the active window is considered +''' WindowName: when a string, see definitions. If absent the active window is considered. +''' when an object, must be a UNO object of types +''' com.sun.star.lang.XComponent or com.sun.star.comp.dba.ODatabaseDocument ''' Exceptions: ''' DOCUMENTERROR The targeted window could not be found ''' Examples: ''' Dim oDoc As Object -''' Set oDoc = ui.GetDocument +''' Set oDoc = ui.GetDocument ' or Set oDoc = ui.GetDcument(ThisComponent) ''' oDoc.Save() Dim oDocument As Object ' Return value @@ -420,7 +422,10 @@ Const cstSubArgs = "[WindowName]" Check: If IsMissing(WindowName) Or IsEmpty(WindowName) Then WindowName = "" If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then + If Not SF_Utils._Validate(WindowName, "WindowName", Array(V_STRING, V_OBJECT)) Then GoTo Finally + If VarType(WindowName) = V_STRING Then If Not SF_Utils._ValidateFile(WindowName, "WindowName", , True) Then GoTo Finally + End If End If Try: |