wizards/source/access2base/Application.xba   |  117 +++++++++++++++++++++++++++
 wizards/source/access2base/PropertiesGet.xba |   99 ----------------------
 wizards/source/access2base/PropertiesSet.xba |   18 ----
 wizards/source/access2base/Python.xba        |   12 +-
 4 files changed, 123 insertions(+), 123 deletions(-)

New commits:
commit fd2a8fc9651037263069aa5f0f97c205d8fc4a1c
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Tue Aug 20 11:56:42 2019 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Tue Aug 20 12:01:40 2019 +0200

    Access2Base - Move getObject, getValue and setValue
    
    Functions moved from module PropertiesGet to Application
    No effect in Basic
    Compliant with Python rules where module/class name is mandatory
    
    Change-Id: I970825590cbce86a9178bd750ffdb23ce87ae282

diff --git a/wizards/source/access2base/Application.xba 
b/wizards/source/access2base/Application.xba
index b59ff96b2e30..f821cf270519 100644
--- a/wizards/source/access2base/Application.xba
+++ b/wizards/source/access2base/Application.xba
@@ -1071,6 +1071,105 @@ Error_Function:
 End Function           &apos;  Forms   V0.9.0
 
 REM 
-----------------------------------------------------------------------------------------------------------------------
+Public Function getObject(Optional pvShortcut As Variant) As Variant
+&apos; Return the object described by pvShortcut ignoring its final property
+&apos; Example:                &quot;Forms!myForm!myControl.myProperty&quot; 
=&gt;     Controls(Forms(&quot;myForm&quot;), &quot;myControl&quot;))
+
+Const cstEXCLAMATION = &quot;!&quot;
+Const cstDOT = &quot;.&quot;
+
+       If _ErrorHandler() Then On Local Error Goto Error_Function
+Const cstThisSub = &quot;getObject&quot;
+       Utils._SetCalledSub(cstThisSub)
+       If IsMissing(pvShortcut) Then Call _TraceArguments()
+       If Not Utils._CheckArgument(pvShortcut, 1, vbString) Then Goto 
Exit_Function
+
+Dim iCurrentIndex As Integer, vCurrentObject As Variant, sCurrentProperty As 
String
+Dim sComponents() As String, sSubComponents() As String, sDialog As String
+Dim oDoc As Object
+       Set vCurrentObject = Nothing
+       sComponents = Split(Trim(pvShortcut), cstEXCLAMATION)
+       If UBound(sComponents) = 0 Then Goto Trace_Error
+       If Not Utils._InList(UCase(sComponents(0)), Array(&quot;FORMS&quot;, 
&quot;DIALOGS&quot;, &quot;TEMPVARS&quot;)) Then Goto Trace_Error
+       If sComponents(1) = &quot;0&quot; Or Left(sComponents(1), 2) = 
&quot;0.&quot; Then
+               Set oDoc = _A2B_.CurrentDocument()
+               If oDoc.DbConnect = DBCONNECTFORM Then sComponents(1) = 
oDoc.DbContainers(0).FormName Else Goto Trace_Error
+       End If
+
+       sSubComponents = Split(sComponents(UBound(sComponents)), cstDOT)
+       sComponents(UBound(sComponents)) = sSubComponents(0)                    
        &apos;  Ignore final property, if any
+       
+       Set vCurrentObject = New Collect
+       Set vCurrentObject._This = vCurrentObject
+       Select Case UCase(sComponents(0))
+               Case &quot;FORMS&quot;  :       vCurrentObject._CollType = 
COLLFORMS
+               Case &quot;DIALOGS&quot;        :       
vCurrentObject._CollType = COLLALLDIALOGS
+               Case &quot;TEMPVARS&quot;       :       
vCurrentObject._CollType = COLLTEMPVARS
+       End Select
+       For iCurrentIndex = 1 To UBound(sComponents)    &apos;  Start parsing 
...
+               sSubComponents = Split(sComponents(iCurrentIndex), cstDOT)
+               sComponents(iCurrentIndex) = Utils._Trim(sSubComponents(0))
+               Select Case UBound(sSubComponents)
+                       Case 0
+                               sCurrentProperty = &quot;&quot;
+                       Case 1
+                               sCurrentProperty = sSubComponents(1)
+                       Case Else
+                               Goto Trace_Error
+               End Select
+               Select Case vCurrentObject._Type
+                       Case OBJCOLLECTION
+                               Select Case vCurrentObject._CollType
+                                       Case COLLFORMS
+                                               vCurrentObject = 
Application.AllForms(sComponents(iCurrentIndex))
+                                       Case COLLALLDIALOGS
+                                               sDialog = 
UCase(sComponents(iCurrentIndex))
+                                               vCurrentObject = 
Application.AllDialogs(sDialog)
+                                               If Not vCurrentObject.IsLoaded 
Then Goto Trace_Error
+                                               Set vCurrentObject.UnoDialog = 
_A2B_.Dialogs.Item(sDialog)
+                                       Case COLLTEMPVARS
+                                               If UBound(sComponents) &gt; 1 
Then Goto Trace_Error
+                                               vCurrentObject = 
Application.TempVars(sComponents(1))
+                                       &apos;Case Else
+                               End Select
+                       Case OBJFORM, OBJSUBFORM, OBJCONTROL, OBJDIALOG
+                               vCurrentObject = 
vCurrentObject.Controls(sComponents(iCurrentIndex))
+               End Select
+               If sCurrentProperty &lt;&gt; &quot;&quot; Then vCurrentObject = 
vCurrentObject.getProperty(sCurrentProperty)
+       Next iCurrentIndex
+       
+       Set getObject = vCurrentObject
+                               
+Exit_Function:
+       Utils._ResetCalledSub(cstThisSub)
+       Exit Function
+Trace_Error:
+       TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , 
Array(1, pvShortcut))
+       Goto Exit_Function
+Error_Function:
+       TraceError(TRACEABORT, Err, cstThisSub, Erl)
+       GoTo Exit_Function
+End Function           &apos;  getObject       V0.9.5
+
+REM 
-----------------------------------------------------------------------------------------------------------------------
+Public Function getValue(Optional pvObject As Variant) As Variant
+&apos; getValue also interprets shortcut strings !!
+Dim vItem As Variant, sProperty As String
+       If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call 
_TraceArguments(&quot;getValue&quot;)
+       If VarType(pvObject) = vbString Then
+               Utils._SetCalledSub(&quot;getValue&quot;)
+               Set vItem = getObject(pvObject)
+               sProperty = Utils._FinalProperty(pvObject)
+               If sProperty = &quot;&quot; Then sProperty = &quot;Value&quot;  
                &apos;  Default value if final property in shortcut is absent
+               getValue = vItem.getProperty(sproperty)
+               Utils._ResetCalledSub(&quot;getValue&quot;)
+       Else
+               Set vItem = pvObject
+               getValue = vItem.getProperty(&quot;Value&quot;)
+       End If
+End Function           &apos;  getValue
+
+REM 
-----------------------------------------------------------------------------------------------------------------------
 Function HtmlEncode(ByVal pvString As Variant, ByVal Optional pvLength As 
Variant) As String
 &apos; Converts a string to an HTML-encoded string.
 
@@ -1379,6 +1478,24 @@ Public Function ProductCode()
 End Function   &apos;  ProductCode     V0.9.1
 
 REM 
-----------------------------------------------------------------------------------------------------------------------
+Public Function setValue(Optional pvObject As Variant, ByVal Optional pvValue 
As Variant) As Boolean
+&apos; setValue also interprets shortcut strings !!
+Dim vItem As Variant, sProperty As String
+       If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then 
Call _TraceArguments(&quot;setValue&quot;)
+       If VarType(pvObject) = vbString Then
+               Utils._SetCalledSub(&quot;setValue&quot;)
+               Set vItem = getObject(pvObject)
+               sProperty = Utils._FinalProperty(pvObject)
+               If sProperty = &quot;&quot; Then sProperty = &quot;Value&quot;
+               setValue = vItem.setProperty(sProperty, pvValue)
+               Utils._ResetCalledSub(&quot;setValue&quot;)
+       Else
+               Set vItem = pvObject
+               setValue = vItem.setProperty(&quot;Value&quot;, pvValue)
+       End If
+End Function           &apos;  setValue
+
+REM 
-----------------------------------------------------------------------------------------------------------------------
 Public Function SysCmd(Optional pvAction As Variant _
                                                , Optional pvText As Variant _
                                                , Optional pvValue As Variant _
diff --git a/wizards/source/access2base/PropertiesGet.xba 
b/wizards/source/access2base/PropertiesGet.xba
index 3ada734ee766..332eaaa2e5c2 100644
--- a/wizards/source/access2base/PropertiesGet.xba
+++ b/wizards/source/access2base/PropertiesGet.xba
@@ -399,87 +399,6 @@ Public Function getName(Optional pvObject As Variant) As 
String
 End Function           &apos;  getName
 
 REM 
-----------------------------------------------------------------------------------------------------------------------
-Public Function getObject(Optional pvShortcut As Variant) As Variant
-&apos; Return the object described by pvShortcut ignoring its final property
-&apos; Example:                &quot;Forms!myForm!myControl.myProperty&quot; 
=&gt;     Controls(Forms(&quot;myForm&quot;), &quot;myControl&quot;))
-
-Const cstEXCLAMATION = &quot;!&quot;
-Const cstDOT = &quot;.&quot;
-
-       If _ErrorHandler() Then On Local Error Goto Error_Function
-Const cstThisSub = &quot;getObject&quot;
-       Utils._SetCalledSub(cstThisSub)
-       If IsMissing(pvShortcut) Then Call _TraceArguments()
-       If Not Utils._CheckArgument(pvShortcut, 1, vbString) Then Goto 
Exit_Function
-
-Dim iCurrentIndex As Integer, vCurrentObject As Variant, sCurrentProperty As 
String
-Dim sComponents() As String, sSubComponents() As String, sDialog As String
-Dim oDoc As Object
-       Set vCurrentObject = Nothing
-       sComponents = Split(Trim(pvShortcut), cstEXCLAMATION)
-       If UBound(sComponents) = 0 Then Goto Trace_Error
-       If Not Utils._InList(UCase(sComponents(0)), Array(&quot;FORMS&quot;, 
&quot;DIALOGS&quot;, &quot;TEMPVARS&quot;)) Then Goto Trace_Error
-       If sComponents(1) = &quot;0&quot; Or Left(sComponents(1), 2) = 
&quot;0.&quot; Then
-               Set oDoc = _A2B_.CurrentDocument()
-               If oDoc.DbConnect = DBCONNECTFORM Then sComponents(1) = 
oDoc.DbContainers(0).FormName Else Goto Trace_Error
-       End If
-
-       sSubComponents = Split(sComponents(UBound(sComponents)), cstDOT)
-       sComponents(UBound(sComponents)) = sSubComponents(0)                    
        &apos;  Ignore final property, if any
-       
-       Set vCurrentObject = New Collect
-       Set vCurrentObject._This = vCurrentObject
-       Select Case UCase(sComponents(0))
-               Case &quot;FORMS&quot;  :       vCurrentObject._CollType = 
COLLFORMS
-               Case &quot;DIALOGS&quot;        :       
vCurrentObject._CollType = COLLALLDIALOGS
-               Case &quot;TEMPVARS&quot;       :       
vCurrentObject._CollType = COLLTEMPVARS
-       End Select
-       For iCurrentIndex = 1 To UBound(sComponents)    &apos;  Start parsing 
...
-               sSubComponents = Split(sComponents(iCurrentIndex), cstDOT)
-               sComponents(iCurrentIndex) = Utils._Trim(sSubComponents(0))
-               Select Case UBound(sSubComponents)
-                       Case 0
-                               sCurrentProperty = &quot;&quot;
-                       Case 1
-                               sCurrentProperty = sSubComponents(1)
-                       Case Else
-                               Goto Trace_Error
-               End Select
-               Select Case vCurrentObject._Type
-                       Case OBJCOLLECTION
-                               Select Case vCurrentObject._CollType
-                                       Case COLLFORMS
-                                               vCurrentObject = 
Application.AllForms(sComponents(iCurrentIndex))
-                                       Case COLLALLDIALOGS
-                                               sDialog = 
UCase(sComponents(iCurrentIndex))
-                                               vCurrentObject = 
Application.AllDialogs(sDialog)
-                                               If Not vCurrentObject.IsLoaded 
Then Goto Trace_Error
-                                               Set vCurrentObject.UnoDialog = 
_A2B_.Dialogs.Item(sDialog)
-                                       Case COLLTEMPVARS
-                                               If UBound(sComponents) &gt; 1 
Then Goto Trace_Error
-                                               vCurrentObject = 
Application.TempVars(sComponents(1))
-                                       &apos;Case Else
-                               End Select
-                       Case OBJFORM, OBJSUBFORM, OBJCONTROL, OBJDIALOG
-                               vCurrentObject = 
vCurrentObject.Controls(sComponents(iCurrentIndex))
-               End Select
-               If sCurrentProperty &lt;&gt; &quot;&quot; Then vCurrentObject = 
vCurrentObject.getProperty(sCurrentProperty)
-       Next iCurrentIndex
-       
-       Set getObject = vCurrentObject
-                               
-Exit_Function:
-       Utils._ResetCalledSub(cstThisSub)
-       Exit Function
-Trace_Error:
-       TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , 
Array(1, pvShortcut))
-       Goto Exit_Function
-Error_Function:
-       TraceError(TRACEABORT, Err, cstThisSub, Erl)
-       GoTo Exit_Function
-End Function           &apos;  getObject       V0.9.5
-
-REM 
-----------------------------------------------------------------------------------------------------------------------
 Public Function getObjectType(Optional pvObject As Variant) As String
        If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call 
_TraceArguments(&quot;getObjectType&quot;)
        getObjectType = PropertiesGet._getProperty(pvObject, 
&quot;ObjectType&quot;)
@@ -707,24 +626,6 @@ Public Function getTypeName(Optional pvObject As Variant) 
As Variant
 End Function           &apos;  getTypeName
 
 REM 
-----------------------------------------------------------------------------------------------------------------------
-Public Function getValue(Optional pvObject As Variant) As Variant
-&apos; getValue also interprets shortcut strings !!
-Dim vItem As Variant, sProperty As String
-       If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call 
_TraceArguments(&quot;getValue&quot;)
-       If VarType(pvObject) = vbString Then
-               Utils._SetCalledSub(&quot;getValue&quot;)
-               Set vItem = getObject(pvObject)
-               sProperty = Utils._FinalProperty(pvObject)
-               If sProperty = &quot;&quot; Then sProperty = &quot;Value&quot;  
                &apos;  Default value if final property in shortcut is absent
-               getValue = vItem.getProperty(sproperty)
-               Utils._ResetCalledSub(&quot;getValue&quot;)
-       Else
-               Set vItem = pvObject
-               getValue = vItem.getProperty(&quot;Value&quot;)
-       End If
-End Function           &apos;  getValue
-
-REM 
-----------------------------------------------------------------------------------------------------------------------
 Public Function getVisible(Optional pvObject As Variant) As Variant
        If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call 
_TraceArguments(&quot;getVisible&quot;)
        getVisible = PropertiesGet._getProperty(pvObject, &quot;Visible&quot;)
diff --git a/wizards/source/access2base/PropertiesSet.xba 
b/wizards/source/access2base/PropertiesSet.xba
index 668bc58fc652..100806beaddb 100644
--- a/wizards/source/access2base/PropertiesSet.xba
+++ b/wizards/source/access2base/PropertiesSet.xba
@@ -329,24 +329,6 @@ Public Function setTripleState(Optional pvObject As 
Variant, ByVal Optional pvVa
 End Function           &apos;  setTripleState
 
 REM 
-----------------------------------------------------------------------------------------------------------------------
-Public Function setValue(Optional pvObject As Variant, ByVal Optional pvValue 
As Variant) As Boolean
-&apos; setValue also interprets shortcut strings !!
-Dim vItem As Variant, sProperty As String
-       If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then 
Call _TraceArguments(&quot;setValue&quot;)
-       If VarType(pvObject) = vbString Then
-               Utils._SetCalledSub(&quot;setValue&quot;)
-               Set vItem = getObject(pvObject)
-               sProperty = Utils._FinalProperty(pvObject)
-               If sProperty = &quot;&quot; Then sProperty = &quot;Value&quot;
-               setValue = vItem.setProperty(sProperty, pvValue)
-               Utils._ResetCalledSub(&quot;setValue&quot;)
-       Else
-               Set vItem = pvObject
-               setValue = vItem.setProperty(&quot;Value&quot;, pvValue)
-       End If
-End Function           &apos;  setValue
-
-REM 
-----------------------------------------------------------------------------------------------------------------------
 Public Function setVisible(Optional pvObject As Variant, ByVal Optional 
pvValue As Variant) As Boolean
 &apos; Only for open forms and controls
        If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then 
Call _TraceArguments(&quot;setVisible&quot;)
diff --git a/wizards/source/access2base/Python.xba 
b/wizards/source/access2base/Python.xba
index e1d2aad803a4..45144ec7c8d3 100644
--- a/wizards/source/access2base/Python.xba
+++ b/wizards/source/access2base/Python.xba
@@ -78,7 +78,7 @@ Public Function PythonWrapper(ByVal pvCallType As Variant _
                                                                        , ByVal 
pvScript As Variant _
                                                                        , 
ParamArray pvArgs() As Variant _
                                                                ) As Variant
-&apos;          Called from Python to apply
+&apos;         Called from Python to apply
 &apos;                 - on object with entry pvObject in PythonCache
 &apos;                         Conventionally: -1 = Application
 &apos;                                                                 -2 = 
DoCmd
@@ -103,7 +103,7 @@ Const cstScalar = 0, cstObject = 1, cstNull = 2, cstUNO = 3
 &apos;Conventional special values
 Const cstNoArgs = &quot;+++NOARGS+++&quot;, cstSymEmpty = 
&quot;+++EMPTY+++&quot;, cstSymNull = &quot;+++NULL+++&quot;
 
-&apos;https://support.office.com/en-us/article/callbyname-function-49ce9475-c315-4f13-8d35-e98cfe98729a
+&apos;https://support.office.com/en-us/article/CallByName-fonction-49ce9475-c315-4f13-8d35-e98cfe98729a
 &apos;Determines the pvCallType
 Const vbGet = 2, vbLet = 4, vbMethod = 1, vbSet = 8, vbUNO = 16
 
@@ -160,12 +160,12 @@ Const vbGet = 2, vbLet = 4, vbMethod = 1, vbSet = 8, 
vbUNO = 16
                                Case &quot;DVar&quot;                   :       
vReturn = Application.DVar(vArgs(0), vArgs(1), vArgs(2))
                                Case &quot;DVarP&quot;          :       vReturn 
= Application.DVarP(vArgs(0), vArgs(1), vArgs(2))
                                Case &quot;Forms&quot;          :       If 
iNbArgs &lt; 0 Then vReturn = Application.Forms() Else vReturn = 
Application.Forms(vArgs(0))
-                               Case &quot;getObject&quot;      :       vReturn 
= PropertiesGet.getObject(vArgs(0))
-                               Case &quot;getValue&quot;               :       
vReturn = PropertiesGet.getValue(vArgs(0))
+                               Case &quot;getObject&quot;      :       vReturn 
= Application.getObject(vArgs(0))
+                               Case &quot;getValue&quot;               :       
vReturn = Application.getValue(vArgs(0))
                                Case &quot;HtmlEncode&quot;     :       vReturn 
= Application.HtmlEncode(vArgs(0), vArgs(1))
                                Case &quot;OpenDatabase&quot;   :       vReturn 
= Application.OpenDatabase(vArgs(0), vArgs(1), vArgs(2), vArgs(3))
                                Case &quot;ProductCode&quot;    :       vReturn 
= Application.ProductCode()
-                               Case &quot;setValue&quot;               :       
vReturn = PropertiesGet.setValue(vArgs(0), vArgs(1))
+                               Case &quot;setValue&quot;               :       
vReturn = Application.setValue(vArgs(0), vArgs(1))
                                Case &quot;SysCmd&quot;         :       vReturn 
= Application.SysCmd(vArgs(0), vArgs(1), vARgs(2))
                                Case &quot;TempVars&quot;               :       
If iNbArgs &lt; 0 Then vReturn = Application.TempVars() Else vReturn = 
Application.TempVars(vArgs(0))
                                Case &quot;Version&quot;                :       
vReturn = Application.Version()
@@ -604,4 +604,4 @@ Dim vValue As Variant
 
 End Function
 
-</script:module>
+</script:module>
\ No newline at end of file
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to