import type { Worksheet } from "./worksheet.js"; /** * Form Control Checkbox - Legacy checkbox control compatible with Office 2007+ and WPS/LibreOffice * * Unlike the modern In-Cell Checkbox (which only works in Microsoft 365), * Form Control Checkboxes are floating controls that work in virtually all * spreadsheet applications. */ /** EMU (English Metric Units) to pixels conversion factor at 96 DPI */ export declare const EMU_PER_PIXEL = 9525; /** EMU to points conversion factor */ export declare const EMU_PER_POINT = 12700; /** Anchor position for form control placement */ export interface FormControlAnchor { /** Column index (0-based) */ col: number; /** Column offset in EMUs (1 pixel ≈ 9525 EMUs at 96 DPI) */ colOff: number; /** Row index (0-based) */ row: number; /** Row offset in EMUs */ rowOff: number; } /** Checkbox state values */ export type CheckboxState = "Checked" | "Unchecked" | "Mixed"; /** Options for adding a form control checkbox */ export interface FormCheckboxOptions { /** Cell reference where the checkbox value (TRUE/FALSE) will be stored */ link?: string; /** Initial checked state */ checked?: boolean; /** Label text displayed next to the checkbox */ text?: string; /** Whether to use flat appearance (no 3D effect) */ noThreeD?: boolean; /** Whether to print the checkbox */ print?: boolean; } /** Internal model for form control checkbox */ export interface FormCheckboxModel { /** Unique shape ID (e.g., 1025, 1026, ...) */ shapeId: number; /** Control property ID (rId in relationships) */ ctrlPropId: number; /** Relationship id (e.g., rId5) in sheet rels for ctrlProp (set during XLSX prepare) */ ctrlPropRelId?: string; /** Top-left anchor */ tl: FormControlAnchor; /** Bottom-right anchor */ br: FormControlAnchor; /** Cell link (e.g., "$A$1") */ link?: string; /** Checked state */ checked: CheckboxState; /** Label text */ text: string; /** Use flat appearance */ noThreeD: boolean; /** Print control */ print: boolean; } /** Range input for form control - can be a cell reference or position object */ export type FormControlRange = string | { /** Top-left position */ tl: { col: number; row: number; colOff?: number; rowOff?: number; } | string; /** Bottom-right position (optional, defaults to reasonable size) */ br?: { col: number; row: number; colOff?: number; rowOff?: number; } | string; } | { /** Start column (0-based) */ startCol: number; /** Start row (0-based) */ startRow: number; /** End column (0-based) */ endCol: number; /** End row (0-based) */ endRow: number; /** Column offset from start in EMUs */ startColOff?: number; /** Row offset from start in EMUs */ startRowOff?: number; /** Column offset from end in EMUs */ endColOff?: number; /** Row offset from end in EMUs */ endRowOff?: number; }; declare class FormCheckbox { worksheet: Worksheet; model: FormCheckboxModel; constructor(worksheet: Worksheet, range: FormControlRange, options?: FormCheckboxOptions); /** * Rebuild a FormCheckbox from a previously-serialised model (e.g. round-tripped * via `worksheet.model`). The model is adopted as-is; no range parsing or shape * id reassignment is performed. */ static fromModel(worksheet: Worksheet, model: FormCheckboxModel): FormCheckbox; /** * Get the checked state */ get checked(): boolean; /** * Set the checked state */ set checked(value: boolean); /** * Get the linked cell address */ get link(): string | undefined; /** * Set the linked cell address */ set link(value: string | undefined); /** * Get the label text */ get text(): string; /** * Set the label text */ set text(value: string); /** * Convert cell reference to absolute format (e.g., "A1" -> "$A$1") */ private _toAbsoluteRef; /** * Parse range input into anchor positions */ private _parseRange; /** * Convert anchor to VML anchor string format * Format: "fromCol, fromColOff, fromRow, fromRowOff, toCol, toColOff, toRow, toRowOff" * VML uses pixels for offsets */ getVmlAnchor(): string; /** * Get VML style string for positioning */ getVmlStyle(): string; /** * Get the numeric checked value for VML (0, 1, or 2) */ getVmlCheckedValue(): number; /** * Convert anchor to VML anchor string format from model */ static getVmlAnchor(model: FormCheckboxModel): string; /** * Get VML style string for positioning from model */ static getVmlStyle(model: FormCheckboxModel): string; /** * Get the numeric checked value for VML from model (0, 1, or 2) */ static getVmlCheckedValue(model: FormCheckboxModel): number; } export { FormCheckbox };