wizards/source/access2base/Application.xba |    2 
 wizards/source/access2base/Control.xba     |    1 
 wizards/source/access2base/Form.xba        |   10 ++-
 wizards/source/access2base/Methods.xba     |   93 ++++++++++++++---------------
 wizards/source/access2base/SubForm.xba     |    9 ++
 wizards/source/access2base/acConstants.xba |    2 
 6 files changed, 60 insertions(+), 57 deletions(-)

New commits:
commit 1cbd9f7fbe327662d44605e4b3d4150b740b6f33
Author: Jean-Pierre Ledure <j...@ledure.be>
Date:   Sun Aug 17 16:25:58 2014 +0200

    Access2Base - Remove _This in Form and SubForm objects
    
    The construction in Basic
        Set a._This = a
    is useful to export the address of an object to Subs or Functions.
    It increases however the risk of memory leaks.
    Avoid when avoidable.
    
    Change-Id: I81bf01badf00687526a358eda117a55b12f5d72b

diff --git a/wizards/source/access2base/Application.xba 
b/wizards/source/access2base/Application.xba
index 8b2af9a..f68ced5 100644
--- a/wizards/source/access2base/Application.xba
+++ b/wizards/source/access2base/Application.xba
@@ -329,7 +329,6 @@ Dim iCurrentDoc As Integer, vCurrentDoc As Variant, oForms 
As Variant, oCounter
 &apos; Process when ARGUMENT = STRING or INDEX =&gt; Initialize form object
 Dim ofForm As Object
        Set ofForm = New Form
-       Set ofForm._This = ofForm
 Dim sAllForms As Variant, i As Integer, vName As Variant, oDatabase As Object, 
bFound As Boolean
        Select Case vCurrentDoc.DbConnect
                Case DBCONNECTBASE
@@ -1096,7 +1095,6 @@ Dim i As Integer, iCount As Integer, iAllCount As 
Integer, ofForm As Variant
        iCount = 0
        If iAllCount &gt; 0 Then
                Set ofForm = New Form
-               Set ofForm._This = ofForm
                For i = 0 To iAllCount - 1
                        Set ofForm = Application.AllForms(i)
                        If ofForm.IsLoaded Then iCount = iCount + 1
diff --git a/wizards/source/access2base/Control.xba 
b/wizards/source/access2base/Control.xba
index b6d0410..1d54b01 100644
--- a/wizards/source/access2base/Control.xba
+++ b/wizards/source/access2base/Control.xba
@@ -1223,7 +1223,6 @@ Dim vSelection As Variant, sSelectedText As String
                Case UCase(&quot;Form&quot;)
                        Set ofSubForm = New SubForm             &apos;  Start 
building the SUBFORM object
                        With ofSubForm
-                               Set ._This = ofSubForm
                                Set .DatabaseForm = ControlModel
                                ._Name = _Name
                                ._Shortcut = _Shortcut &amp; &quot;.Form&quot;
diff --git a/wizards/source/access2base/Form.xba 
b/wizards/source/access2base/Form.xba
index 4ec1949..1a29295 100644
--- a/wizards/source/access2base/Form.xba
+++ b/wizards/source/access2base/Form.xba
@@ -15,7 +15,6 @@ REM --- CLASS ROOT FIELDS                                     
                                                                                
                                                                ---
 REM 
-----------------------------------------------------------------------------------------------------------------------
 
 Private        _Type                                   As String               
                &apos;  Must be FORM
-Private _This                                  As Object
 Private        _Shortcut                               As String
 Private        _Name                                   As String
 Private _DocEntry                              As Integer                      
        &apos;  Doc- and DbContainer entries in Root structure
@@ -32,7 +31,6 @@ REM --- CONSTRUCTORS / DESTRUCTORS                            
                                                                                
                                                        ---
 REM 
-----------------------------------------------------------------------------------------------------------------------
 Private Sub Class_Initialize()
        _Type = OBJFORM
-       Set _This = Nothing
        _Shortcut = &quot;&quot;
        _Name = &quot;&quot;
        _DocEntry = -1
@@ -225,11 +223,17 @@ Public Function OptionGroup(ByVal Optional pvGroupName As 
Variant) As Variant
 &apos; Return either an error or an object of type OPTIONGROUP based on its 
name
 
 Const cstThisSub = &quot;Form.OptionGroup&quot;
+Dim ogGroup As Object
        Utils._SetCalledSub(cstThisSub)
        If IsMissing(pvGroupName) Then Call _TraceArguments()
        If _ErrorHandler() Then On Local Error Goto Error_Function
        
-       Set OptionGroup = _OptionGroup(pvGroupName, CTLPARENTISFORM, _This)
+       Set ogGroup = _OptionGroup(pvGroupName, CTLPARENTISFORM, Component, 
DatabaseForm)
+       If Not IsNull(ogGroup) Then
+               ogGroup._DocEntry = _DocEntry
+               ogGroup._DbEntry = _DbEntry
+       End If
+       Set OptionGroup = ogGroup
        
 Exit_Function:
        Utils._ResetCalledSub(cstThisSub)
diff --git a/wizards/source/access2base/Methods.xba 
b/wizards/source/access2base/Methods.xba
index 8d7a11a..9afac28 100644
--- a/wizards/source/access2base/Methods.xba
+++ b/wizards/source/access2base/Methods.xba
@@ -199,7 +199,8 @@ REM --- PRIVATE FUNCTIONS                                   
                                                                                
                                                                ---
 REM 
-----------------------------------------------------------------------------------------------------------------------
 Public Function _OptionGroup(ByVal pvGroupName As Variant _
                                        , ByVal psParentType As String _
-                                       , pvForm As Object _
+                                       , poComponent As Object _
+                                       , poDatabaseForm As Object _
                                        ) As Variant
 &apos; Return either an error or an object of type OPTIONGROUP based on its 
name
 
@@ -215,57 +216,53 @@ Dim lXY() As Long, iIndex() As Integer            &apos;  
Two indexes X-Y coordinates
 Dim oView As Object
 
 Const cstPixels = 10                                                   &apos;  
Tolerance on coordinates when drawed approximately
-       With pvForm
-               bFound = False
-               For i = 0 To .DatabaseForm.GroupCount - 1               &apos;  
Does a group with the right name exist ?
-                       .DatabaseForm.getGroup(i, vOptionButtons, sGroupName)
-                       If UCase(sGroupName) = UCase(Utils._Trim(pvGroupName)) 
Then
-                               bFound = True
-                               Exit For
+       bFound = False
+       For i = 0 To poDatabaseForm.GroupCount - 1              &apos;  Does a 
group with the right name exist ?
+               poDatabaseForm.getGroup(i, vOptionButtons, sGroupName)
+               If UCase(sGroupName) = UCase(Utils._Trim(pvGroupName)) Then
+                       bFound = True
+                       Exit For
+               End If
+       Next i
+
+       If bFound Then
+               ogGroup = New Optiongroup
+               ogGroup._Name = sGroupName
+               ogGroup._ButtonsGroup = vOptionButtons
+               ogGroup._Count = UBound(vOptionButtons) + 1
+               ogGroup._ParentType = psParentType
+               Set ogGroup._ParentComponent = poComponent
+
+               ReDim lXY(1, ogGroup._Count - 1)
+               ReDim iIndex(ogGroup._Count - 1)
+               For i = 0 To ogGroup._Count - 1                 &apos;  Find 
the position of each radiobutton
+                       Set oView = 
poComponent.CurrentController.getControl(ogGroup._ButtonsGroup(i))
+                       lXY(0, i) = oView.PosSize.X
+                       lXY(1, i) = oView.PosSize.Y
+               Next i
+               For i = 0 To ogGroup._Count - 1                 &apos;  Sort 
them on XY coordinates             
+                       If i = 0 Then
+                               iIndex(0) = 0
+                       Else
+                               iIndex(i) = i
+                               For j = i - 1 To 0 Step -1
+                                       If lXY(1, i) - lXY(1, j) &lt; - 
cstPixels Or ( Abs(lXY(1, i) - lXY(1, j)) &lt;= cstPixels And lXY(0, i) - 
lXY(0, j) &lt; - cstPixels ) Then
+                                               iIndex(i) = iIndex(j)
+                                               iIndex(j) = iIndex(j) + 1
+                                       End If
+                               Next j
                        End If
                Next i
+               ogGroup._ButtonsIndex = iIndex()
 
-               If bFound Then
-                       ogGroup = New Optiongroup
-                       ogGroup._Name = sGroupName
-                       ogGroup._ButtonsGroup = vOptionButtons
-                       ogGroup._Count = UBound(vOptionButtons) + 1
-                       ogGroup._ParentType = psParentType
-                       Set ogGroup._ParentComponent = .Component
-                       ogGroup._DocEntry = ._DocEntry
-                       ogGroup._DbEntry = ._DbEntry
-
-                       ReDim lXY(1, ogGroup._Count - 1)
-                       ReDim iIndex(ogGroup._Count - 1)
-                       For i = 0 To ogGroup._Count - 1                 &apos;  
Find the position of each radiobutton
-                               Set oView = 
.Component.CurrentController.getControl(ogGroup._ButtonsGroup(i))
-                               lXY(0, i) = oView.PosSize.X
-                               lXY(1, i) = oView.PosSize.Y
-                       Next i
-                       For i = 0 To ogGroup._Count - 1                 &apos;  
Sort them on XY coordinates             
-                               If i = 0 Then
-                                       iIndex(0) = 0
-                               Else
-                                       iIndex(i) = i
-                                       For j = i - 1 To 0 Step -1
-                                               If lXY(1, i) - lXY(1, j) &lt; - 
cstPixels Or ( Abs(lXY(1, i) - lXY(1, j)) &lt;= cstPixels And lXY(0, i) - 
lXY(0, j) &lt; - cstPixels ) Then
-                                                       iIndex(i) = iIndex(j)
-                                                       iIndex(j) = iIndex(j) + 
1
-                                               End If
-                                       Next j
-                               End If
-                       Next i
-                       ogGroup._ButtonsIndex = iIndex()
-
-                       Set _OptionGroup = ogGroup
-
-               Else
-
-                       Set _OptionGroup = Nothing
-                       TraceError(TRACEFATAL, ERRWRONGARGUMENT, 
Utils._CalledSub(), 0, , Array(1, pvGroupName))
+               Set _OptionGroup = ogGroup
 
-               End If
-       End With
+       Else
+
+               Set _OptionGroup = Nothing
+               TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, 
, Array(1, pvGroupName))
+
+       End If
        
 Exit_Function:
        Exit Function
diff --git a/wizards/source/access2base/SubForm.xba 
b/wizards/source/access2base/SubForm.xba
index 1ddb62c..0f8b164 100644
--- a/wizards/source/access2base/SubForm.xba
+++ b/wizards/source/access2base/SubForm.xba
@@ -15,7 +15,6 @@ REM --- CLASS ROOT FIELDS                                     
                                                                                
                                                                ---
 REM 
-----------------------------------------------------------------------------------------------------------------------
 
 Private        _Type                                   As String               
                &apos;  Must be SUBFORM
-Private _This                                  As Object
 Private        _Shortcut                               As String
 Private        _Name                                   As String
 Private _DocEntry                              As Integer
@@ -126,11 +125,17 @@ Public Function OptionGroup(ByVal Optional pvGroupName As 
Variant) As Variant
 &apos; Return either an error or an object of type OPTIONGROUP based on its 
name
 
 Const cstThisSub = &quot;SubForm.OptionGroup&quot;
+Dim ogGroup As Object
        Utils._SetCalledSub(cstThisSub)
        If IsMissing(pvGroupName) Then Call _TraceArguments()
        If _ErrorHandler() Then On Local Error Goto Error_Function
        
-       Set OptionGroup = _OptionGroup(pvGroupName, CTLPARENTISSUBFORM, _This)
+       Set ogGroup = _OptionGroup(pvGroupName, CTLPARENTISSUBFORM, 
ParentComponent, DatabaseForm)
+       If Not IsNull(ogGroup) Then
+               ogGroup._DocEntry = _DocEntry
+               ogGroup._DbEntry = _DbEntry
+       End If
+       Set OptionGroup = ogGroup
        
 Exit_Function:
        Utils._ResetCalledSub(cstThisSub)
diff --git a/wizards/source/access2base/acConstants.xba 
b/wizards/source/access2base/acConstants.xba
index 400a029..c5849ff 100644
--- a/wizards/source/access2base/acConstants.xba
+++ b/wizards/source/access2base/acConstants.xba
@@ -8,7 +8,7 @@ REM 
============================================================================
 Option Explicit
 
 REM Access2Base -----------------------------------------------------
-Global Const Access2Base_Version = &quot;1.1.0b&quot;
+Global Const Access2Base_Version = &quot;1.1.0c&quot;
 
 REM AcCloseSave
 REM -----------------------------------------------------------------
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to