[Libreoffice-commits] core.git: wizards/source
Jean-Pierre Ledure
jp at ledure.be
Thu Nov 10 11:00:53 UTC 2016
wizards/source/access2base/DoCmd.xba | 12 +++---------
wizards/source/access2base/Trace.xba | 13 +++----------
wizards/source/access2base/Utils.xba | 19 +++++++++++++++++++
3 files changed, 25 insertions(+), 19 deletions(-)
New commits:
commit 61f760d2c4ce97fc3f0f533cd2989ea2aad33276
Author: Jean-Pierre Ledure <jp at ledure.be>
Date: Thu Nov 10 11:56:49 2016 +0100
Access2Base - Code cleanup
Replace double code by function calls (dialog libraries handling)
Change-Id: I17fc700e47a258b281214fe29e075bc782fb6acd
diff --git a/wizards/source/access2base/DoCmd.xba b/wizards/source/access2base/DoCmd.xba
index fd64239..9b6500c 100644
--- a/wizards/source/access2base/DoCmd.xba
+++ b/wizards/source/access2base/DoCmd.xba
@@ -2302,15 +2302,9 @@ REM ----------------------------------------------------------------------------
Private Function _PromptFormat(ByVal pvList As Variant) As String
' Return user selection in Format dialog
-Dim oDialog As Object, oDialogLib As Object, iOKCancel As Integer, oControl As Object
- Set oDialogLib = DialogLibraries
- If oDialogLib.hasByName("Access2BaseDev") Then
- If Not oDialogLib.IsLibraryLoaded("Access2BaseDev") Then oDialogLib.loadLibrary("Access2BaseDev")
- Set oDialog = CreateUnoDialog(DialogLibraries.Access2BaseDev.dlgFormat)
- Else
- If Not oDialogLib.IsLibraryLoaded("Access2Base") Then oDialogLib.loadLibrary("Access2Base")
- Set oDialog = CreateUnoDialog(DialogLibraries.Access2Base.dlgFormat)
- End If
+Dim oDialog As Object, iOKCancel As Integer, oControl As Object
+
+ Set oDialog = CreateUnoDialog(Utils._GetDialogLib().dlgFormat)
oDialog.Title = _GetLabel("DLGFORMAT_TITLE")
Set oControl = oDialog.Model.getByName("lblFormat")
diff --git a/wizards/source/access2base/Trace.xba b/wizards/source/access2base/Trace.xba
index 3b3f4df..fdc08d4 100644
--- a/wizards/source/access2base/Trace.xba
+++ b/wizards/source/access2base/Trace.xba
@@ -31,17 +31,10 @@ Public Sub TraceConsole()
' Display the Trace dialog with current trace log values and parameter choices
If _ErrorHandler() Then On Local Error Goto Error_Sub
-Dim sLineBreak As String, oDialogLib As Object, oTraceDialog As Object
+Dim sLineBreak As String, oTraceDialog As Object
sLineBreak = vbNewLine
-
- Set oDialogLib = DialogLibraries
- If oDialogLib.hasByName("Access2BaseDev") Then
- If Not oDialogLib.IsLibraryLoaded("Access2BaseDev") Then oDialogLib.loadLibrary("Access2BaseDev")
- Set oTraceDialog = CreateUnoDialog(DialogLibraries.Access2BaseDev.dlgTrace)
- Else
- If Not oDialogLib.IsLibraryLoaded("Access2Base") Then oDialogLib.loadLibrary("Access2Base")
- Set oTraceDialog = CreateUnoDialog(DialogLibraries.Access2Base.dlgTrace)
- EndIf
+
+ Set oTraceDialog = CreateUnoDialog(Utils._GetDialogLib().dlgTrace)
oTraceDialog.Title = _GetLabel("DLGTRACE_TITLE") ' HelpText ???
Dim oEntries As Object, oTraceLog As Object, oClear As Object, oMinLevel As Object, oNbEntries As Object, oDump As Object
diff --git a/wizards/source/access2base/Utils.xba b/wizards/source/access2base/Utils.xba
index a7be0b3..c2b6172 100644
--- a/wizards/source/access2base/Utils.xba
+++ b/wizards/source/access2base/Utils.xba
@@ -197,6 +197,25 @@ Dim oPip As Object, sLocation As String
End Function ' ExtensionLocation
REM -----------------------------------------------------------------------------------------------------------------------
+Private Function _GetDialogLib() As Object
+' Return actual Access2Base dialogs library
+
+Dim oDialogLib As Object
+
+ Set oDialogLib = DialogLibraries
+ If oDialogLib.hasByName("Access2BaseDev") Then
+ If Not oDialogLib.IsLibraryLoaded("Access2BaseDev") Then oDialogLib.loadLibrary("Access2BaseDev")
+ Set _GetDialogLib = DialogLibraries.Access2BaseDev
+ ElseIf oDialogLib.hasByName("Access2Base") Then
+ If Not oDialogLib.IsLibraryLoaded("Access2Base") Then oDialogLib.loadLibrary("Access2Base")
+ Set _GetDialogLib = DialogLibraries.Access2Base
+ Else
+ Set _GetDialogLib = Nothing
+ EndIf
+
+End Function
+
+REM -----------------------------------------------------------------------------------------------------------------------
Private Function _GetResultSetColumnValue(poResultSet As Object _
, ByVal piColIndex As Integer _
, Optional ByVal pbReturnBinary As Boolean _
More information about the Libreoffice-commits
mailing list