/** * Removal of one control from an AxForm or AxFormExtension, in place. * * The inverse of insertFormExtensionControl (see formExtensionControlXml.ts) and * of the bridge's AddControl, and it has the same reason for existing as * directXmlDeleteAction: there is no C# operation for it, so the only way to * take a button off a form was d365fo_file(action="create", overwrite=true) — * rewriting the whole form from hand-authored XML, which loses every collection * the caller did not think to re-type. * * Two things make this more than a string replace: * * 1. Controls NEST. A button lives inside a ButtonGroup inside an ActionPane * inside /, and every level is another . The * target is found by walking the tree, not by matching a `` substring * — the latter also matches data sources, data fields, the form's own * , and every override method's . * * 2. A form EXTENSION expresses a control in two shapes (see * formExtensionControlXml.ts): a bare nested under a * container the extension owns, or an envelope in * the extension's root whose real control sits under * . Deleting the out of an envelope leaves the * envelope behind — a control-less wrapper with a reference, which * is not a shape the deserializer expects. The whole envelope goes. * * Separators: a toolbar button is almost always followed by an * , which exists only to space that button from * the next one. Removing the button and leaving the separator puts a stray * divider on the ActionPane, so `removeSeparator` drops the adjacent one too — * opt-in, because "adjacent separator" is a layout judgement and a separator * between two REMAINING buttons is load-bearing. * * Pure and side-effect-free; the file I/O stays in the caller. */ export interface RemoveFormControlSpec { /** of the control to remove (case-insensitive). */ controlName: string; /** * Also remove an adjacent AxFormButtonSeparatorControl sibling — the one after * the control, or the one before it when there is nothing after. Off by * default. */ removeSeparator?: boolean; } export type RemoveFormControlResult = /** Control removed. `removed` names every control element deleted, in file order. */ { kind: 'removed'; xml: string; removed: string[]; notes: string[]; } /** No control of that name. `present` lists the ones there are, for the error. */ | { kind: 'not-found'; present: string[]; } /** Not a form/form-extension shape this writer recognises; the caller declines. */ | { kind: 'unsupported'; }; /** * Remove `spec.controlName` from a form or form extension. * * Returns the updated XML with every untouched byte preserved, or a result that * says why nothing was written — never a silent no-op. */ export declare function removeFormControl(xml: string, spec: RemoveFormControlSpec): RemoveFormControlResult; //# sourceMappingURL=formControlRemoval.d.ts.map