Access2Base - Insert Window argument in CommandBars collection

Window argument forces the determination of the window
in which toolbars are searched for.
This argument is not part of the standard MSAccess API => Unpublished
This commit is contained in:
Jean-Pierre Ledure
2017-11-07 14:34:39 +01:00
parent 8b7551fb5c
commit 180e69dca9

View File

@@ -573,9 +573,10 @@ Exit_Sub:
End Sub ' CloseConnection V1.2.0 End Sub ' CloseConnection V1.2.0
REM ----------------------------------------------------------------------------------------------------------------------- REM -----------------------------------------------------------------------------------------------------------------------
Public Function CommandBars(Optional ByVal pvIndex As Variant) As Variant Public Function CommandBars(Optional ByVal pvIndex As Variant, Optional ByRef poWindow As Object) As Variant
' Return an object of type CommandBar indicated by its index or its name (CASE-INSENSITIVE string) ' Return an object of type CommandBar indicated by its index or its name (CASE-INSENSITIVE string)
' If no pvIndex argument, return a Collection type ' If no pvIndex argument, return a Collection type
' (Unpublished) With poWindow, force the frame in which toolbars are detected
If _ErrorHandler() Then On Local Error Goto Error_Function If _ErrorHandler() Then On Local Error Goto Error_Function
Const cstThisSub = "CommandBars" Const cstThisSub = "CommandBars"
@@ -596,9 +597,8 @@ Const cstCustom = "CUSTOM"
iObjectsCount = 0 iObjectsCount = 0
bFound = False bFound = False
iBuiltin = 1 ' Default = builtin
Set oWindow = _SelectWindow() If IsMissing(poWindow) Then Set oWindow = _SelectWindow() Else Set oWindow = poWindow
If IsNull(oWindow.Frame) Then Goto Trace_WindowError If IsNull(oWindow.Frame) Then Goto Trace_WindowError
' List of 21 modules ' List of 21 modules
@@ -639,6 +639,7 @@ Const cstCustom = "CUSTOM"
Set oModuleUI = CreateUnoService("com.sun.star.ui.ModuleUIConfigurationManagerSupplier") Set oModuleUI = CreateUnoService("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")
For k = 0 To UBound(vModules) For k = 0 To UBound(vModules)
For j = 0 To UBound(sSupportedModules) For j = 0 To UBound(sSupportedModules)
iBuiltin = 1 ' Default = builtin
If vModules(k) = sSupportedModules(j) Then ' Supported modules only If vModules(k) = sSupportedModules(j) Then ' Supported modules only
Set oToolbar = oModuleUI.getUIConfigurationManager(vModules(k)) Set oToolbar = oModuleUI.getUIConfigurationManager(vModules(k))
vUIElements() = oToolbar.getUIElementsInfo(0) vUIElements() = oToolbar.getUIElementsInfo(0)