summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2014-08-02 17:50:16 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2014-08-03 17:09:14 +0000
commit7d7118990810d094cd29b98a95b38b6374a4fe69 (patch)
treee72dcbdea1d8f1b342cd62845f912fab974c75af /wizards
parent7f352e1dbabe5ed30598400abc1aa7ee01dac564 (diff)
Access2Base - addition of OrderBy and OrderByOn
The properties OrderBy and OrderByOn have been added to the Form and SubForm objects. The ordering sequence defined by OrderBy is effectively applied when OrderByOn is set to True. Change-Id: I7780e4761f3825f1c678d6ffb38149c5973146e7 Reviewed-on: https://gerrit.libreoffice.org/10697 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/access2base/Control.xba1
-rw-r--r--wizards/source/access2base/Form.xba42
-rw-r--r--wizards/source/access2base/PropertiesGet.xba18
-rw-r--r--wizards/source/access2base/PropertiesSet.xba19
-rw-r--r--wizards/source/access2base/SubForm.xba41
-rw-r--r--wizards/source/access2base/acConstants.xba2
6 files changed, 120 insertions, 3 deletions
diff --git a/wizards/source/access2base/Control.xba b/wizards/source/access2base/Control.xba
index 7e15a1d6800c..b6d0410501ed 100644
--- a/wizards/source/access2base/Control.xba
+++ b/wizards/source/access2base/Control.xba
@@ -1230,6 +1230,7 @@ Dim vSelection As Variant, sSelectedText As String
.ParentComponent = _FormComponent
._DocEntry = _DocEntry
._DbEntry = _DbEntry
+ ._OrderBy = ControlModel.Order
End With
set _PropertyGet = ofSubForm
Case UCase(&quot;Format&quot;)
diff --git a/wizards/source/access2base/Form.xba b/wizards/source/access2base/Form.xba
index 578200bffd56..4ec19491707e 100644
--- a/wizards/source/access2base/Form.xba
+++ b/wizards/source/access2base/Form.xba
@@ -22,6 +22,7 @@ Private _DocEntry As Integer &apos; Doc- and DbContainer entries in Root s
Private _DbEntry As Integer
Private _IsLoaded As Boolean
Private _OpenArgs As Variant
+Private _OrderBy As String
Public Component As Object &apos; com.sun.star.text.TextDocument
Public ContainerWindow As Object &apos; (No name)
Public DatabaseForm As Object &apos; com.sun.star.form.component.DataForm and com.sun.star.sdb.ResultSet (a.o.)
@@ -38,6 +39,7 @@ Private Sub Class_Initialize()
_DbEntry = -1
_IsLoaded = False
_OpenArgs = &quot;&quot;
+ _OrderBy = &quot;&quot;
Set Component = Nothing
Set ContainerWindow = Nothing
Set DatabaseForm = Nothing
@@ -201,6 +203,24 @@ Property Get OpenArgs() As Variant
End Property &apos; OpenArgs (get)
REM -----------------------------------------------------------------------------------------------------------------------
+Property Get OrderBy() As Variant
+ OrderBy = _PropertyGet(&quot;OrderBy&quot;)
+End Property &apos; OrderBy (get) V1.2.0
+
+Property Let OrderBy(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderBy&quot;, pvValue)
+End Property &apos; OrderBy (set)
+
+REM -----------------------------------------------------------------------------------------------------------------------
+Property Get OrderByOn() As Variant
+ OrderByOn = _PropertyGet(&quot;OrderByOn&quot;)
+End Property &apos; OrderByOn (get) V1.2.0
+
+Property Let OrderByOn(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderByOn&quot;, pvValue)
+End Property &apos; OrderByOn (set)
+
+REM -----------------------------------------------------------------------------------------------------------------------
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
@@ -599,6 +619,7 @@ Dim oDoc As Object, oFormsCollection As Object, oDatabase As Object
End If
End With
End Select
+ _OrderBy = DatabaseForm.Order
Else
Set Component = Nothing
Set ContainerWindow = Nothing
@@ -621,7 +642,7 @@ Private Function _PropertiesList() As Variant
If IsLoaded Then
_PropertiesList = Array(&quot;AllowAdditions&quot;, &quot;AllowDeletions&quot;, &quot;AllowEdits&quot;, &quot;Bookmark&quot; _
, &quot;Caption&quot;, &quot;CurrentRecord&quot;, &quot;Filter&quot;, &quot;FilterOn&quot;, &quot;Height&quot;, &quot;IsLoaded&quot; _
- , &quot;Name&quot;, &quot;ObjectType&quot;, &quot;OpenArgs&quot; _
+ , &quot;Name&quot;, &quot;ObjectType&quot;, &quot;OpenArgs&quot;, &quot;OrderBy&quot;, &quot;OrderByOn&quot; _
, &quot;RecordSource&quot;, &quot;Visible&quot;, &quot;Width&quot; _
) &apos; Recordset removed
Else
@@ -682,6 +703,10 @@ Dim oObject As Object
_PropertyGet = _Type
Case UCase(&quot;OpenArgs&quot;)
_PropertyGet = _OpenArgs
+ Case UCase(&quot;OrderBy&quot;)
+ _PropertyGet = _OrderBy
+ Case UCase(&quot;OrderByOn&quot;)
+ If DatabaseForm.Order = &quot;&quot; Then _PropertyGet = False Else _PropertyGet = True
Case UCase(&quot;Recordset&quot;)
If DatabaseForm.Command = &quot;&quot; Then Goto Trace_Error &apos; No underlying data ??
Set oObject = New Recordset
@@ -787,6 +812,13 @@ Dim oDatabase As Object
ContainerWindow.IsMinimized = False
End If
ContainerWindow.setPosSize(0, 0, 0, pvValue, com.sun.star.awt.PosSize.HEIGHT)
+ Case UCase(&quot;OrderBy&quot;)
+ If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
+ _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
+ Case UCase(&quot;OrderByOn&quot;)
+ If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
+ If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order = &quot;&quot;
+ DatabaseForm.reload()
Case UCase(&quot;RecordSource&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
DatabaseForm.Command = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
@@ -869,6 +901,14 @@ Property Set Height(ByVal pvValue As Variant)
Call _PropertySet(&quot;Height&quot;, pvValue)
End Property &apos; Height (set)
+Property Set OrderBy(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderBy&quot;, pvValue)
+End Property &apos; OrderBy (set)
+
+Property Set OrderByOn(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderByOn&quot;, pvValue)
+End Property &apos; OrderByOn (set)
+
Property Set RecordSource(ByVal pvValue As Variant)
Call _PropertySet(&quot;RecordSource&quot;, pvValue)
End Property &apos; RecordSource (set)
diff --git a/wizards/source/access2base/PropertiesGet.xba b/wizards/source/access2base/PropertiesGet.xba
index 460deda74e1c..ae4d170b20ae 100644
--- a/wizards/source/access2base/PropertiesGet.xba
+++ b/wizards/source/access2base/PropertiesGet.xba
@@ -500,6 +500,18 @@ Public Function getOptionValue(Optional pvObject As Variant) As String
End Function &apos; getOptionValue
REM -----------------------------------------------------------------------------------------------------------------------
+Public Function getOrderBy(Optional pvObject As Variant) As String
+ If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;getOrderBy&quot;)
+ getOrderBy = PropertiesGet._getProperty(pvObject, &quot;OrderBy&quot;)
+End Function &apos; getOrderBy
+
+REM -----------------------------------------------------------------------------------------------------------------------
+Public Function getOrderByOn(Optional pvObject As Variant) As Boolean
+ If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;getOrderByOn&quot;)
+ getOrderByOn = PropertiesGet._getProperty(pvObject, &quot;OrderByOn&quot;)
+End Function &apos; getOrderByOn
+
+REM -----------------------------------------------------------------------------------------------------------------------
Public Function getPage(Optional pvObject As Variant) As String
If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;getPage&quot;)
getPage = PropertiesGet._getProperty(pvObject, &quot;Page&quot;)
@@ -924,6 +936,12 @@ Public Function _getProperty(pvItem As Variant, ByVal psProperty As String, ByVa
Case UCase(&quot;OptionValue&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
_getProperty = pvItem.OptionValue
+ Case UCase(&quot;OrderBy&quot;)
+ If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
+ _getProperty = pvItem.OrderBy
+ Case UCase(&quot;OrderByOn&quot;)
+ If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
+ _getProperty = pvItem.OrderByOn
Case UCase(&quot;Page&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJDIALOG, OBJCONTROL)) Then Goto Exit_Function
_getProperty = pvItem.Page
diff --git a/wizards/source/access2base/PropertiesSet.xba b/wizards/source/access2base/PropertiesSet.xba
index bdd6dbf76ba3..c6422cd3eb85 100644
--- a/wizards/source/access2base/PropertiesSet.xba
+++ b/wizards/source/access2base/PropertiesSet.xba
@@ -194,6 +194,19 @@ Public Function setOptionValue(Optional pvObject As Variant, ByVal Optional pvVa
End Function &apos; setOptionValue
REM -----------------------------------------------------------------------------------------------------------------------
+Public Function setOrderBy(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
+ If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setOrderBy&quot;)
+ setOrderBy = PropertiesSet._setProperty(pvObject, &quot;OrderBy&quot;, pvValue)
+End Function &apos; setOrderBy
+
+REM -----------------------------------------------------------------------------------------------------------------------
+Public Function setOrderByOn(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
+&apos; Only for open forms
+ If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setOrderByOn&quot;)
+ setOrderByOn = PropertiesSet._setProperty(pvObject, &quot;OrderByOn&quot;, pvValue)
+End Function &apos; setOrderByOn
+
+REM -----------------------------------------------------------------------------------------------------------------------
Public Function setPage(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setPage&quot;)
setPage = PropertiesSet._setProperty(pvObject, &quot;Page&quot;, pvValue)
@@ -464,6 +477,12 @@ Dim ocButton As Variant, iRadioIndex As Integer
Case UCase(&quot;OptionValue&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.OptionValue = pvValue
+ Case UCase(&quot;OrderBy&quot;)
+ If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
+ pvItem.OrderBy = pvValue
+ Case UCase(&quot;OrderByOn&quot;)
+ If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
+ pvItem.OrderByOn = pvValue
Case UCase(&quot;Page&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJDIALOG, OBJCONTROL)) Then Goto Exit_Function
pvItem.Page = pvValue
diff --git a/wizards/source/access2base/SubForm.xba b/wizards/source/access2base/SubForm.xba
index 6f28c8d7dd12..1ddb62c03dc7 100644
--- a/wizards/source/access2base/SubForm.xba
+++ b/wizards/source/access2base/SubForm.xba
@@ -20,6 +20,7 @@ Private _Shortcut As String
Private _Name As String
Private _DocEntry As Integer
Private _DbEntry As Integer
+Private _OrderBy As String
Public ParentComponent As Object &apos; com.sun.star.text.TextDocument
Public DatabaseForm As Object &apos; com.sun.star.form.component.DataForm and com.sun.star.sdb.ResultSet (a.o.)
@@ -32,6 +33,7 @@ Private Sub Class_Initialize()
_Name = &quot;&quot;
_DocEntry = -1
_DbEntry = -1
+ _OrderBy = &quot;&quot;
Set ParentComponent = Nothing
Set DatabaseForm = Nothing
End Sub &apos; Constructor
@@ -139,6 +141,24 @@ Error_Function:
End Function &apos; OptionGroup V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
+Property Get OrderBy() As Variant
+ OrderBy = _PropertyGet(&quot;OrderBy&quot;)
+End Property &apos; OrderBy (get) V1.2.0
+
+Property Let OrderBy(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderBy&quot;, pvValue)
+End Property &apos; OrderBy (set)
+
+REM -----------------------------------------------------------------------------------------------------------------------
+Property Get OrderByOn() As Variant
+ OrderByOn = _PropertyGet(&quot;OrderByOn&quot;)
+End Property &apos; OrderByOn (get) V1.2.0
+
+Property Let OrderByOn(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderByOn&quot;, pvValue)
+End Property &apos; OrderByOn (set)
+
+REM -----------------------------------------------------------------------------------------------------------------------
Public Function Parent() As Object
Utils._SetCalledSub(&quot;SubForm.getParent&quot;)
@@ -349,7 +369,7 @@ Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;AllowAdditions&quot;, &quot;AllowDeletions&quot;, &quot;AllowEdits&quot;, &quot;CurrentRecord&quot; _
, &quot;Filter&quot;, &quot;FilterOn&quot;, &quot;LinkChildFields&quot;, &quot;LinkMasterFields&quot;, &quot;Name&quot; _
- , &quot;ObjectType&quot;, &quot;Parent&quot;, &quot;RecordSource&quot; _
+ , &quot;ObjectType&quot;, &quot;OrderBy&quot;, &quot;OrderByOn&quot;, &quot;Parent&quot;, &quot;RecordSource&quot; _
) &apos; Recordset removed
End Function &apos; _PropertiesList
@@ -409,6 +429,10 @@ Dim oDatabase As Object, vBookmark As Variant, vEMPTY As Variant
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
+ Case UCase(&quot;OrderBy&quot;)
+ _PropertyGet = _OrderBy
+ Case UCase(&quot;OrderByOn&quot;)
+ If DatabaseForm.Order = &quot;&quot; Then _PropertyGet = False Else _PropertyGet = True
Case UCase(&quot;Recordset&quot;)
If DatabaseForm.Command = &quot;&quot; Then Goto Trace_Error &apos; No underlying data ??
Set oObject = New Recordset
@@ -488,6 +512,13 @@ Dim iArgNr As Integer
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
DatabaseForm.ApplyFilter = pvValue
DatabaseForm.reload()
+ Case UCase(&quot;OrderBy&quot;)
+ If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
+ _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
+ Case UCase(&quot;OrderByOn&quot;)
+ If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
+ If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order = &quot;&quot;
+ DatabaseForm.reload()
Case UCase(&quot;RecordSource&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
DatabaseForm.Command = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
@@ -544,6 +575,14 @@ Property Set FilterOn(ByVal pvValue As Variant)
Call _PropertySet(&quot;FilterOn&quot;, pvValue)
End Property &apos; FilterOn (set)
+Property Set OrderBy(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderBy&quot;, pvValue)
+End Property &apos; OrderBy (set)
+
+Property Set OrderByOn(ByVal pvValue As Variant)
+ Call _PropertySet(&quot;OrderByOn&quot;, pvValue)
+End Property &apos; OrderByOn (set)
+
Property Set RecordSource(ByVal pvValue As Variant)
Call _PropertySet(&quot;RecordSource&quot;, pvValue)
End Property &apos; RecordSource (set)
diff --git a/wizards/source/access2base/acConstants.xba b/wizards/source/access2base/acConstants.xba
index 9906c58407ac..f8c1b4bbe5ee 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.0&quot;
+Global Const Access2Base_Version = &quot;1.1.0a&quot;
REM AcCloseSave
REM -----------------------------------------------------------------