MLightCAD
    Preparing search index...

    Interface UseDocumentReturn

    Reactive view of the active CAD document and its open lifecycle.

    Returned by useDocument. All refs are shared module singletons, so every caller observes the same document state.

    interface UseDocumentReturn {
        beginDocumentOpening: () => void;
        displayName: ComputedRef<string>;
        docTitle: DeepReadonly<Ref<string>>;
        endDocumentOpening: () => void;
        fileName: DeepReadonly<Ref<string>>;
        isDocumentOpening: DeepReadonly<Ref<boolean>>;
        lastOpenErrorCode: DeepReadonly<Ref<AcDbOpenDatabaseErrorCode | undefined>>;
        openMode: DeepReadonly<Ref<AcEdOpenMode>>;
    }
    Index

    Properties

    beginDocumentOpening: () => void

    Marks the viewer as entering a document open operation.

    Prefer relying on AcApDocManager.events.documentToBeOpened when possible. Call this manually only for open flows that bypass the manager events but still need UI affordances such as disabling the ribbon.

    displayName: ComputedRef<string>

    User-facing document label for UI display.

    Resolves to docTitle when present, otherwise falls back to fileName. When the document is unsaved, localizes ACAP_UNTITLED_DOC_TITLE via main.document.untitled.

    docTitle: DeepReadonly<Ref<string>>

    Display title of the active document.

    Mirrors AcApDocument.docTitle. For a new document this is ACAP_UNTITLED_DOC_TITLE until a file is opened.

    endDocumentOpening: () => void

    Marks the viewer as leaving a document open operation.

    Prefer relying on AcApDocManager.events.documentActivated or the failed-to-open-file event. Call this manually to pair with beginDocumentOpening in custom open handlers.

    fileName: DeepReadonly<Ref<string>>

    File name of the active document.

    Mirrors AcApDocument.fileName. Empty for a new untitled document that has not been saved or opened from disk.

    isDocumentOpening: DeepReadonly<Ref<boolean>>

    Whether a document open operation is currently in progress.

    Becomes true when AcApDocManager.events.documentToBeOpened fires or when beginDocumentOpening is called manually, and becomes false when the document is activated, opening fails, or endDocumentOpening is called manually.

    lastOpenErrorCode: DeepReadonly<Ref<AcDbOpenDatabaseErrorCode | undefined>>

    Structured failure category from the most recent failed-to-open-file event, when available.

    openMode: DeepReadonly<Ref<AcEdOpenMode>>

    Current or pending document access mode.

    During an open request this reflects the mode carried by AcDbDocumentEventArgs.mode from documentToBeOpened. After activation it mirrors AcApDocument.openMode.