wizards/source/scriptforge/SF_UI.xba |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 6de7707236ea918d94f321587cb1a728a42e0892
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Fri Jun 18 12:48:17 2021 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Sat Jun 19 10:02:19 2021 +0200

    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 <j...@ledure.be>
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>

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
 &apos;&apos;&apos; Returns a SFDocuments.Document object referring to the 
active window or the given window
 &apos;&apos;&apos;     Args:
-&apos;&apos;&apos;             WindowName: see definitions. If absent the 
active window is considered
+&apos;&apos;&apos;             WindowName:     when a string, see definitions. 
If absent the active window is considered.
+&apos;&apos;&apos;                                     when an object, must be 
a UNO object of types
+&apos;&apos;&apos;                                        
com.sun.star.lang.XComponent or com.sun.star.comp.dba.ODatabaseDocument
 &apos;&apos;&apos;     Exceptions:
 &apos;&apos;&apos;             DOCUMENTERROR           The targeted window 
could not be found
 &apos;&apos;&apos;     Examples:
 &apos;&apos;&apos;             Dim oDoc As Object
-&apos;&apos;&apos;                     Set oDoc = ui.GetDocument
+&apos;&apos;&apos;                     Set oDoc = ui.GetDocument       &apos;  
or Set oDoc = ui.GetDcument(ThisComponent)
 &apos;&apos;&apos;                     oDoc.Save()
 
 Dim oDocument As Object                        &apos;  Return value
@@ -420,7 +422,10 @@ Const cstSubArgs = &quot;[WindowName]&quot;
 Check:
        If IsMissing(WindowName) Or IsEmpty(WindowName) Then WindowName = 
&quot;&quot;
        If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+               If Not SF_Utils._Validate(WindowName, &quot;WindowName&quot;, 
Array(V_STRING, V_OBJECT)) Then GoTo Finally
+               If VarType(WindowName) = V_STRING Then
                        If Not SF_Utils._ValidateFile(WindowName, 
&quot;WindowName&quot;, , True) Then GoTo Finally
+               End If
        End If
 
 Try:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to