Attribute VB_Name = "z_UIRibbon"
Option Explicit

Global g_UIState As New UIState

Sub HT03_ViewRibbon(control As IRibbonControl)
  Select Case control.ID
    Case "SetDatabase":       Call RunSetDB
    Case "Update":            Call RunUpdate
    Case "ExportData":        Call RunExportData
    Case "AddLaw":            Call RunAddLaw
    Case "OpenLawsLocation":  Call RunOpenLawsLocation
    
    Case "QueryLawsVisible":  Call RunQueryLawsVisible
    Case "QueryLawsOnce":     Call RunQueryLawsOnce
    Case "QueryLawsFull":     Call RunQueryLawsFull
    Case "QueryLinksVisible": Call RunLinksVisible
    Case "QueryLinksLaw":     Call RunQueryLinksLaw
    Case "QueryLinksInternal": Call RunQueryLinksInternal
    
    Case "LoadLinkText":      Call RunLoadLinkText
    
    Case "Unstuck":           Call RunUnstuck
    Case "Help":              Call RunHelp
  End Select
End Sub

Sub OnDefaultDocSource(control As IRibbonControl, ByRef val)
  val = g_UIState.source_
End Sub

Sub OnDefaultLinkType(control As IRibbonControl, ByRef val)
  val = g_UIState.linkType_
End Sub

Sub OnDefaultLinkDirection(control As IRibbonControl, ByRef val)
  val = g_UIState.direction_
End Sub

Sub OnSourceChange(control As IRibbonControl, idLabel As String, nIndex As Variant)
  g_UIState.source_ = nIndex
End Sub

Sub OnLinkTypeChange(control As IRibbonControl, idLabel As String, nIndex As Variant)
  g_UIState.linkType_ = nIndex
End Sub

Sub OnLinkDirectionChange(control As IRibbonControl, idLabel As String, nIndex As Variant)
  g_UIState.direction_ = nIndex
End Sub
