EventMasterSetup

Internal members (not exported)

Factory helpers

Create #

Create a configured master setup event manager.

Signature:

Public Function Create(ByVal hostBook As Workbook) As EventMasterSetup

Lifecycle

Configure #

Bind the orchestrator to the workbook hosting master setup assets.

Signature:

Public Sub Configure(ByVal hostBook As Workbook)

OnWorkbookOpen #

Handle the workbook open the way the setup does.

Signature:

Public Sub OnWorkbookOpen(Optional ByVal excelApplication As Application)

The managers are dropped and built from the sheets on the first read after the open. The preparation of the workbook is a dev-time step: it writes on the sheets, and the Initialize button of the Dev tab is its one door.

Two things the open does write, the same two EventSetup.OnWorkbookOpen writes. Every flag of the __updated registry goes to yes, so the next Update Translations reads every watched column. And a workbook saved during a debug session reopens with the debug flag still set, and that flag is what Passwords.Protect reads before it does anything: while it is set every re-protect is ignored. LeaveDebugMode puts the matrix back and clears the flag, and returns untouched when the flag is off; the matrix is applied on its own after it because Excel drops UserInterfaceOnly when a file closes, and a sheet protected without it is closed to this code as much as to the user. Each step is skipped when its helper cannot be built. The application argument is kept for the callers that pass it.


OnRibbonLoad #

Store the ribbon reference for future invalidation support.

Signature:

Public Sub OnRibbonLoad(ByVal ribbon As IRibbonUI)

RefreshTranslations #

Drop the choices helper and the variables manager after an edit.

Signature:

Public Sub RefreshTranslations()

The master setup holds its content in English, so the service carries no translation object of its own. A choices edit cascades through RefreshChoices into the Variables table, and a Variables table that grew rows through the ribbon needs a manager over the rows it has today, so both caches drop. The manager is cheap to rebuild: the column indexes come off the hidden names.


Accessors

HostWorkbook #

Expose the currently configured workbook.

Signature:

Public Property Get HostWorkbook() As Workbook

Dropdowns #

Provide the dropdown manager built over the __dropdowns sheet.

Signature:

Public Property Get Dropdowns() As DropdownLists

Nothing when the workbook has no __dropdowns sheet.


Variables #

Provide the master setup variables manager built over the Variables table.

Signature:

Public Property Get Variables() As MasterSetupVariables

Nothing when the Variables sheet is missing or carries no table.


Choices #

Provide the master setup choices helper.

Signature:

Public Property Get Choices() As LLChoices

Updater #

The update watcher over the __updated registry, or Nothing.

Signature:

Public Function Updater() As UpdatedValues

Nothing when the workbook has no registry sheet.


Ribbon #

Expose the cached ribbon interface.

Signature:

Public Property Get Ribbon() As IRibbonUI

UserLog #

The user log of the workbook, built once and held.

Signature:

Public Function UserLog() As MasterSetupLog

The dated record of the user actions, kept on the very hidden __log worksheet. The ribbon, the events manager and the exports module write their outcome lines through it. An old master setup grows the log sheet on the first logged event.

Returns: MasterSetupLog. The held log, or Nothing when the build failed.


Internal helpers

EnsureUpdater #

Build the update watcher over the __updated sheet, once.

Signature:

Private Sub EnsureUpdater()

A workbook without the sheet answers Nothing. Create is guarded the way EventSetup guards its watcher.


EnsureLog #

Build the user log once, growing the __log sheet when it is missing.

Signature:

Private Sub EnsureLog()

Adding a worksheet needs the workbook structure open, so a workbook without the log sheet is unprotected through its passwords for the build and protected again after it. A workbook with no usable password sheet is built bare. The tried flag keeps a failed build from repeating on every logged line, and a failed build leaves the log at Nothing so every caller stays quiet.


ResolvePasswords #

The password manager of the workbook, or Nothing.

Signature:

Private Function ResolvePasswords() As Passwords

Passwords.Create raises on a sheet missing its tables or its names; a workbook without a usable password sheet answers Nothing.


EnsureDropdownManager #

Build the dropdown manager over the __dropdowns sheet, once.

Signature:

Private Function EnsureDropdownManager() As DropdownLists

The manager is built from the sheet as it stands, the way the worksheet functions build theirs. A workbook without the sheet answers Nothing. Create is guarded the way EventSetup guards its dictionary: a half-built sheet answers Nothing and the caller decides.


EnsureVariablesManager #

Build the variables manager over the Variables table, once.

Signature:

Private Function EnsureVariablesManager() As MasterSetupVariables

The manager reads the first table of the Variables sheet. A sheet that is missing or carries no table answers Nothing. Create is guarded the way EventSetup guards its dictionary: a half-built table answers Nothing and the caller decides.


Used in (5 file(s))