"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RowBreaksXform = void 0;
const page_breaks_xform_1 = require("./page-breaks-xform.js");
const list_xform_1 = require("../list-xform.js");
/**
 * Xform for row page breaks (rowBreaks element in worksheet XML)
 * Used to define manual page breaks between rows when printing.
 */
class RowBreaksXform extends list_xform_1.ListXform {
    constructor() {
        super({
            tag: "rowBreaks",
            count: true,
            childXform: new page_breaks_xform_1.PageBreaksXform()
        });
    }
    // Override to add manualBreakCount attribute required by Excel
    render(xmlStream, model) {
        if (model && model.length) {
            xmlStream.openNode(this.tag, this.$);
            xmlStream.addAttribute(this.$count, model.length);
            xmlStream.addAttribute("manualBreakCount", model.length);
            const { childXform } = this;
            for (const childModel of model) {
                childXform.render(xmlStream, childModel);
            }
            xmlStream.closeNode();
        }
    }
}
exports.RowBreaksXform = RowBreaksXform;
