import { Border, CellBorders, TableCell } from '../core/document-model/index.js'; import { ColorResolver } from '../core/drawingml/colors.js'; import { PoNode } from '../core/po-helpers.js'; /** Which conditional parts of a style a table asks for (`a:tblPr` flags). */ export interface TableStyleFlags { readonly firstRow: boolean; readonly lastRow: boolean; readonly firstCol: boolean; readonly lastCol: boolean; readonly bandRow: boolean; readonly bandCol: boolean; } /** What one part of a table style says about a cell. */ export interface TableStylePart { readonly shadingHex?: string; /** * §20.1.2.3.1 — how opaque that shading is, when the part asks for less than * all of it. A cell's fill is a layer over the table's background, not over * the page, so the two have to be composed rather than each flattened to * white on its own. */ readonly shadingAlpha?: number; readonly borders?: CellBorders; readonly bold?: boolean; readonly italic?: boolean; readonly colorHex?: string; } /** Where a cell sits, which decides the parts that reach it. */ export interface CellPosition { readonly row: number; readonly rowCount: number; readonly col: number; readonly colCount: number; } /** The `a:tblPr` flags, all off unless the table says otherwise. */ export declare function tableStyleFlags(tblPr: PoNode | undefined): TableStyleFlags; /** The GUID a table names, if it names one (`a:tblPr/a:tableStyleId`). */ export declare function tableStyleId(tblPr: PoNode | undefined): string | undefined; /** What the deck's theme lends a style that points at it instead of spelling it out. */ export interface TableStyleTheme { /** §20.1.4.1.14 `a:fillStyleLst` — the fills an `a:fillRef` indexes. */ readonly fills?: ReadonlyArray; /** §20.1.4.2.19 `a:lnStyleLst` — the widths an `a:lnRef` indexes, in points. */ readonly lineWidths?: ReadonlyArray; } /** * The style a cell wears, composed from every part that reaches it. * * @param style The `a:tblStyle` node. * @param flags Which conditional parts the table asks for. * @param at Where the cell sits. * @param colors The deck's colour resolver. * @param theme The theme's style lists, for the parts that point at them. * @returns The composed part, empty when the style says nothing. */ export declare function cellStyle(style: PoNode, flags: TableStyleFlags, at: CellPosition, colors: ColorResolver, theme?: TableStyleTheme): TableStylePart; /** * §20.1.2.1 `a:ln` → the rule it draws on one side of a cell. * * Shared with the cell's OWN `a:lnL`/`a:lnR`/`a:lnT`/`a:lnB`, which are the * same element under a different name. * * @param ln The line node. * @param colors The deck's colour resolver. * @returns The border, `none` when the line is one that draws nothing. */ export declare function lineBorder(ln: PoNode, colors: ColorResolver): Border; /** The same part with the style's fill dropped, for a cell that says `a:noFill`. */ export declare function withoutFill(part: TableStylePart): TableStylePart; /** A cell with the style's fill, borders and run properties filled in under its own. */ export declare function withCellStyle(cell: TableCell, part: TableStylePart): TableCell;