/** * Layout engine for PDF generation. * * Takes a PdfSheetData and produces LayoutPage objects that describe exactly * where each cell, border, and piece of text should be drawn on each PDF page. * * This module is fully independent of the Excel module — it works with * the PDF module's own data model (PdfSheetData, PdfCellData, etc.). * * Key responsibilities: * - Convert column widths (character units) to PDF points * - Convert row heights (points already, but may need scaling) * - Handle merged cells spanning multiple rows/columns * - Paginate content across multiple pages * - Handle fitToPage scaling * - Handle repeated header rows * - Skip hidden rows and columns */ import type { FontManager } from "../font/font-manager.js"; import type { PdfSheetData, PdfChartsheetData, ResolvedPdfOptions, LayoutPage, LayoutCell, LayoutBorder } from "../types.js"; /** * Compute the layout for a sheet across one or more PDF pages. * Yields to the event loop between each output page. */ export declare function layoutSheet(sheet: PdfSheetData, options: ResolvedPdfOptions, fontManager: FontManager): Promise; /** * Produce the layout for a chartsheet — a single PDF page whose entire * content area is covered by one chart. * * Chartsheets have no row/column grid, so we bypass the cell-layout * pipeline entirely. Page dimensions come from `options.pageSize`, with * orientation overridden by the chartsheet's own `orientation` field * (Excel's chartsheet convention defaults to landscape; see the * `CHARTSHEET_EMU_CX/CY` constants that define the drawing canvas in * `xlsx.browser.ts`). * * The returned LayoutPage has: * - `cells = []` (no grid to render) * - `charts` containing one full-content-area chart * - all other cell-grid arrays empty * * The existing `renderSinglePage` in `pdf-exporter.ts` already handles * pages with zero cells and a non-empty `charts` array via the shared * chart-rendering path, so no exporter changes are needed here. */ export declare function layoutChartsheet(sheet: PdfChartsheetData, documentOptions: ResolvedPdfOptions): LayoutPage[]; export declare function paginateRows(rowHeights: number[], availableHeight: number, repeatRowCount: number, rowBreaks: Set): number[][]; /** * Border precedence weight. * * When two adjacent cells both declare a border on a shared edge the winning * border is chosen by: 1. thicker wins, 2. solid beats dashed, * 3. double beats single, 4. darker colour wins (tie-break). * * Returns a numeric score – higher score wins. */ export declare function borderPrecedence(b: LayoutBorder): number; /** * Resolve shared borders between adjacent cells. * * For each shared edge, determine the winning border (by precedence), then: * - The cell that "owns" the winning border keeps it in `borders` for drawing. * - The losing cell has that border side set to `null` (it won't draw). * - Both cells' `borderInsets` are updated to reflect the winning border's * half-width, so text padding accounts for the line that is actually there. */ export declare function resolveSharedBorders(cellGrid: Map, rowCount: number, colCount: number): void;