"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const picture_run_1 = require("../run/picture-run");
const text_run_1 = require("../run/text-run");
const xml_components_1 = require("../xml-components");
const alignment_1 = require("./formatting/alignment");
const border_1 = require("./formatting/border");
const indent_1 = require("./formatting/indent");
const keep_1 = require("./formatting/keep");
const page_break_1 = require("./formatting/page-break");
const spacing_1 = require("./formatting/spacing");
const style_1 = require("./formatting/style");
const tab_stop_1 = require("./formatting/tab-stop");
const unordered_list_1 = require("./formatting/unordered-list");
const properties_1 = require("./properties");
class Paragraph extends xml_components_1.XmlComponent {
    constructor(text) {
        super("w:p");
        this.properties = new properties_1.ParagraphProperties();
        this.root.push(this.properties);
        if (text !== undefined) {
            this.root.push(new text_run_1.TextRun(text));
        }
    }
    addRun(run) {
        this.root.push(run);
        return this;
    }
    createTextRun(text) {
        const run = new text_run_1.TextRun(text);
        this.addRun(run);
        return run;
    }
    createPictureRun(imageData) {
        const run = new picture_run_1.PictureRun(imageData);
        this.addRun(run);
        return run;
    }
    heading1() {
        this.properties.push(new style_1.Style("Heading1"));
        return this;
    }
    heading2() {
        this.properties.push(new style_1.Style("Heading2"));
        return this;
    }
    heading3() {
        this.properties.push(new style_1.Style("Heading3"));
        return this;
    }
    heading4() {
        this.properties.push(new style_1.Style("Heading4"));
        return this;
    }
    heading5() {
        this.properties.push(new style_1.Style("Heading5"));
        return this;
    }
    title() {
        this.properties.push(new style_1.Style("Title"));
        return this;
    }
    center() {
        this.properties.push(new alignment_1.Alignment("center"));
        return this;
    }
    left() {
        this.properties.push(new alignment_1.Alignment("left"));
        return this;
    }
    right() {
        this.properties.push(new alignment_1.Alignment("right"));
        return this;
    }
    justified() {
        this.properties.push(new alignment_1.Alignment("both"));
        return this;
    }
    thematicBreak() {
        this.properties.push(new border_1.ThematicBreak());
        return this;
    }
    pageBreak() {
        this.root.push(new page_break_1.PageBreak());
        return this;
    }
    maxRightTabStop() {
        this.properties.push(new tab_stop_1.MaxRightTabStop());
        return this;
    }
    leftTabStop(position) {
        this.properties.push(new tab_stop_1.LeftTabStop(position));
        return this;
    }
    rightTabStop(position) {
        this.properties.push(new tab_stop_1.RightTabStop(position));
        return this;
    }
    centerTabStop(position) {
        this.properties.push(new tab_stop_1.CenterTabStop(position));
        return this;
    }
    bullet() {
        this.properties.push(new style_1.Style("ListParagraph"));
        this.properties.push(new unordered_list_1.NumberProperties(1, 0));
        return this;
    }
    setNumbering(numbering, indentLevel) {
        this.properties.push(new style_1.Style("ListParagraph"));
        this.properties.push(new unordered_list_1.NumberProperties(numbering.id, indentLevel));
        return this;
    }
    style(styleId) {
        this.properties.push(new style_1.Style(styleId));
        return this;
    }
    indent(attrs) {
        this.properties.push(new indent_1.Indent(attrs));
        return this;
    }
    spacing(params) {
        this.properties.push(new spacing_1.Spacing(params));
        return this;
    }
    keepNext() {
        this.properties.push(new keep_1.KeepNext());
        return this;
    }
    keepLines() {
        this.properties.push(new keep_1.KeepLines());
        return this;
    }
}
exports.Paragraph = Paragraph;
//# sourceMappingURL=paragraph.js.map