diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2014-08-02 17:50:16 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2014-08-03 17:09:14 +0000 |
commit | 7d7118990810d094cd29b98a95b38b6374a4fe69 (patch) | |
tree | e72dcbdea1d8f1b342cd62845f912fab974c75af | |
parent | mark numbers as untranslatable (diff) | |
download | core-7d7118990810d094cd29b98a95b38b6374a4fe69.tar.gz core-7d7118990810d094cd29b98a95b38b6374a4fe69.zip |
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>
-rw-r--r-- | wizards/source/access2base/Control.xba | 1 | ||||
-rw-r--r-- | wizards/source/access2base/Form.xba | 42 | ||||
-rw-r--r-- | wizards/source/access2base/PropertiesGet.xba | 18 | ||||
-rw-r--r-- | wizards/source/access2base/PropertiesSet.xba | 19 | ||||
-rw-r--r-- | wizards/source/access2base/SubForm.xba | 41 | ||||
-rw-r--r-- | wizards/source/access2base/acConstants.xba | 2 |
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("Format") 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 ' 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 ' com.sun.star.text.TextDocument Public ContainerWindow As Object ' (No name) Public DatabaseForm As Object ' 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 = "" + _OrderBy = "" Set Component = Nothing Set ContainerWindow = Nothing Set DatabaseForm = Nothing @@ -201,6 +203,24 @@ Property Get OpenArgs() As Variant End Property ' OpenArgs (get) REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OrderBy() As Variant + OrderBy = _PropertyGet("OrderBy") +End Property ' OrderBy (get) V1.2.0 + +Property Let OrderBy(ByVal pvValue As Variant) + Call _PropertySet("OrderBy", pvValue) +End Property ' OrderBy (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OrderByOn() As Variant + OrderByOn = _PropertyGet("OrderByOn") +End Property ' OrderByOn (get) V1.2.0 + +Property Let OrderByOn(ByVal pvValue As Variant) + Call _PropertySet("OrderByOn", pvValue) +End Property ' OrderByOn (set) + +REM ----------------------------------------------------------------------------------------------------------------------- Public Function OptionGroup(ByVal Optional pvGroupName As Variant) As Variant ' 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("AllowAdditions", "AllowDeletions", "AllowEdits", "Bookmark" _ , "Caption", "CurrentRecord", "Filter", "FilterOn", "Height", "IsLoaded" _ - , "Name", "ObjectType", "OpenArgs" _ + , "Name", "ObjectType", "OpenArgs", "OrderBy", "OrderByOn" _ , "RecordSource", "Visible", "Width" _ ) ' Recordset removed Else @@ -682,6 +703,10 @@ Dim oObject As Object _PropertyGet = _Type Case UCase("OpenArgs") _PropertyGet = _OpenArgs + Case UCase("OrderBy") + _PropertyGet = _OrderBy + Case UCase("OrderByOn") + If DatabaseForm.Order = "" Then _PropertyGet = False Else _PropertyGet = True Case UCase("Recordset") If DatabaseForm.Command = "" Then Goto Trace_Error ' 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("OrderBy") + If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value + _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue) + Case UCase("OrderByOn") + If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value + If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order = "" + DatabaseForm.reload() Case UCase("RecordSource") 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("Height", pvValue) End Property ' Height (set) +Property Set OrderBy(ByVal pvValue As Variant) + Call _PropertySet("OrderBy", pvValue) +End Property ' OrderBy (set) + +Property Set OrderByOn(ByVal pvValue As Variant) + Call _PropertySet("OrderByOn", pvValue) +End Property ' OrderByOn (set) + Property Set RecordSource(ByVal pvValue As Variant) Call _PropertySet("RecordSource", pvValue) End Property ' 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 ' getOptionValue REM ----------------------------------------------------------------------------------------------------------------------- +Public Function getOrderBy(Optional pvObject As Variant) As String + If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments("getOrderBy") + getOrderBy = PropertiesGet._getProperty(pvObject, "OrderBy") +End Function ' getOrderBy + +REM ----------------------------------------------------------------------------------------------------------------------- +Public Function getOrderByOn(Optional pvObject As Variant) As Boolean + If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments("getOrderByOn") + getOrderByOn = PropertiesGet._getProperty(pvObject, "OrderByOn") +End Function ' getOrderByOn + +REM ----------------------------------------------------------------------------------------------------------------------- Public Function getPage(Optional pvObject As Variant) As String If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments("getPage") getPage = PropertiesGet._getProperty(pvObject, "Page") @@ -924,6 +936,12 @@ Public Function _getProperty(pvItem As Variant, ByVal psProperty As String, ByVa Case UCase("OptionValue") If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function _getProperty = pvItem.OptionValue + Case UCase("OrderBy") + If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function + _getProperty = pvItem.OrderBy + Case UCase("OrderByOn") + If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function + _getProperty = pvItem.OrderByOn Case UCase("Page") 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 ' 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("setOrderBy") + setOrderBy = PropertiesSet._setProperty(pvObject, "OrderBy", pvValue) +End Function ' setOrderBy + +REM ----------------------------------------------------------------------------------------------------------------------- +Public Function setOrderByOn(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean +' Only for open forms + If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments("setOrderByOn") + setOrderByOn = PropertiesSet._setProperty(pvObject, "OrderByOn", pvValue) +End Function ' 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("setPage") setPage = PropertiesSet._setProperty(pvObject, "Page", pvValue) @@ -464,6 +477,12 @@ Dim ocButton As Variant, iRadioIndex As Integer Case UCase("OptionValue") If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function pvItem.OptionValue = pvValue + Case UCase("OrderBy") + If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function + pvItem.OrderBy = pvValue + Case UCase("OrderByOn") + If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function + pvItem.OrderByOn = pvValue Case UCase("Page") 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 ' com.sun.star.text.TextDocument Public DatabaseForm As Object ' com.sun.star.form.component.DataForm and com.sun.star.sdb.ResultSet (a.o.) @@ -32,6 +33,7 @@ Private Sub Class_Initialize() _Name = "" _DocEntry = -1 _DbEntry = -1 + _OrderBy = "" Set ParentComponent = Nothing Set DatabaseForm = Nothing End Sub ' Constructor @@ -139,6 +141,24 @@ Error_Function: End Function ' OptionGroup V1.1.0 REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OrderBy() As Variant + OrderBy = _PropertyGet("OrderBy") +End Property ' OrderBy (get) V1.2.0 + +Property Let OrderBy(ByVal pvValue As Variant) + Call _PropertySet("OrderBy", pvValue) +End Property ' OrderBy (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OrderByOn() As Variant + OrderByOn = _PropertyGet("OrderByOn") +End Property ' OrderByOn (get) V1.2.0 + +Property Let OrderByOn(ByVal pvValue As Variant) + Call _PropertySet("OrderByOn", pvValue) +End Property ' OrderByOn (set) + +REM ----------------------------------------------------------------------------------------------------------------------- Public Function Parent() As Object Utils._SetCalledSub("SubForm.getParent") @@ -349,7 +369,7 @@ Private Function _PropertiesList() As Variant _PropertiesList = Array("AllowAdditions", "AllowDeletions", "AllowEdits", "CurrentRecord" _ , "Filter", "FilterOn", "LinkChildFields", "LinkMasterFields", "Name" _ - , "ObjectType", "Parent", "RecordSource" _ + , "ObjectType", "OrderBy", "OrderByOn", "Parent", "RecordSource" _ ) ' Recordset removed End Function ' _PropertiesList @@ -409,6 +429,10 @@ Dim oDatabase As Object, vBookmark As Variant, vEMPTY As Variant _PropertyGet = _Name Case UCase("ObjectType") _PropertyGet = _Type + Case UCase("OrderBy") + _PropertyGet = _OrderBy + Case UCase("OrderByOn") + If DatabaseForm.Order = "" Then _PropertyGet = False Else _PropertyGet = True Case UCase("Recordset") If DatabaseForm.Command = "" Then Goto Trace_Error ' 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("OrderBy") + If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value + _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue) + Case UCase("OrderByOn") + If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value + If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order = "" + DatabaseForm.reload() Case UCase("RecordSource") 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("FilterOn", pvValue) End Property ' FilterOn (set) +Property Set OrderBy(ByVal pvValue As Variant) + Call _PropertySet("OrderBy", pvValue) +End Property ' OrderBy (set) + +Property Set OrderByOn(ByVal pvValue As Variant) + Call _PropertySet("OrderByOn", pvValue) +End Property ' OrderByOn (set) + Property Set RecordSource(ByVal pvValue As Variant) Call _PropertySet("RecordSource", pvValue) End Property ' 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 = "1.1.0" +Global Const Access2Base_Version = "1.1.0a" REM AcCloseSave REM ----------------------------------------------------------------- |