"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const paragraph = require("../../docx/paragraph");
const formatting = require("../../docx/run/formatting");
const properties_1 = require("../../docx/run/properties");
const xml_components_1 = require("../../docx/xml-components");
const components_1 = require("./components");
class StyleAttributes extends xml_components_1.XmlAttributeComponent {
    constructor() {
        super(...arguments);
        this.xmlKeys = {
            type: "w:type",
            styleId: "w:styleId",
            default: "w:default",
            customStyle: "w:customStyle",
        };
    }
}
class Style extends xml_components_1.XmlComponent {
    constructor(attributes, name) {
        super("w:style");
        this.root.push(new StyleAttributes(attributes));
        if (name) {
            this.root.push(new components_1.Name(name));
        }
    }
    push(styleSegment) {
        this.root.push(styleSegment);
    }
}
exports.Style = Style;
class ParagraphStyle extends Style {
    constructor(styleId, name) {
        super({ type: "paragraph", styleId: styleId }, name);
        this.paragraphProperties = new paragraph.ParagraphProperties();
        this.runProperties = new properties_1.RunProperties();
        this.root.push(this.paragraphProperties);
        this.root.push(this.runProperties);
    }
    addParagraphProperty(property) {
        this.paragraphProperties.push(property);
    }
    addRunProperty(property) {
        this.runProperties.push(property);
    }
    basedOn(parentId) {
        this.root.push(new components_1.BasedOn(parentId));
        return this;
    }
    quickFormat() {
        this.root.push(new components_1.QuickFormat());
        return this;
    }
    next(nextId) {
        this.root.push(new components_1.Next(nextId));
        return this;
    }
    size(twips) {
        this.addRunProperty(new formatting.Size(twips));
        return this;
    }
    bold() {
        this.addRunProperty(new formatting.Bold());
        return this;
    }
    italics() {
        this.addRunProperty(new formatting.Italics());
        return this;
    }
    smallCaps() {
        this.addRunProperty(new formatting.SmallCaps());
        return this;
    }
    allCaps() {
        this.addRunProperty(new formatting.Caps());
        return this;
    }
    strike() {
        this.addRunProperty(new formatting.Strike());
        return this;
    }
    doubleStrike() {
        this.addRunProperty(new formatting.DoubleStrike());
        return this;
    }
    subScript() {
        this.addRunProperty(new formatting.SubScript());
        return this;
    }
    superScript() {
        this.addRunProperty(new formatting.SuperScript());
        return this;
    }
    underline(underlineType, color) {
        this.addRunProperty(new formatting.Underline(underlineType, color));
        return this;
    }
    color(color) {
        this.addRunProperty(new formatting.Color(color));
        return this;
    }
    font(fontName) {
        this.addRunProperty(new formatting.RunFonts(fontName));
        return this;
    }
    center() {
        this.addParagraphProperty(new paragraph.Alignment("center"));
        return this;
    }
    left() {
        this.addParagraphProperty(new paragraph.Alignment("left"));
        return this;
    }
    right() {
        this.addParagraphProperty(new paragraph.Alignment("right"));
        return this;
    }
    justified() {
        this.addParagraphProperty(new paragraph.Alignment("both"));
        return this;
    }
    thematicBreak() {
        this.addParagraphProperty(new paragraph.ThematicBreak());
        return this;
    }
    maxRightTabStop() {
        this.addParagraphProperty(new paragraph.MaxRightTabStop());
        return this;
    }
    leftTabStop(position) {
        this.addParagraphProperty(new paragraph.LeftTabStop(position));
        return this;
    }
    indent(attrs) {
        this.addParagraphProperty(new paragraph.Indent(attrs));
        return this;
    }
    spacing(params) {
        this.addParagraphProperty(new paragraph.Spacing(params));
        return this;
    }
    keepNext() {
        this.addParagraphProperty(new paragraph.KeepNext());
        return this;
    }
    keepLines() {
        this.addParagraphProperty(new paragraph.KeepLines());
        return this;
    }
}
exports.ParagraphStyle = ParagraphStyle;
class HeadingStyle extends ParagraphStyle {
    constructor(styleId, name) {
        super(styleId, name);
        this.basedOn("Normal");
        this.next("Normal");
        this.quickFormat();
    }
}
exports.HeadingStyle = HeadingStyle;
class TitleStyle extends HeadingStyle {
    constructor() {
        super("Title", "Title");
    }
}
exports.TitleStyle = TitleStyle;
class Heading1Style extends HeadingStyle {
    constructor() {
        super("Heading1", "Heading 1");
    }
}
exports.Heading1Style = Heading1Style;
class Heading2Style extends HeadingStyle {
    constructor() {
        super("Heading2", "Heading 2");
    }
}
exports.Heading2Style = Heading2Style;
class Heading3Style extends HeadingStyle {
    constructor() {
        super("Heading3", "Heading 3");
    }
}
exports.Heading3Style = Heading3Style;
class Heading4Style extends HeadingStyle {
    constructor() {
        super("Heading4", "Heading 4");
    }
}
exports.Heading4Style = Heading4Style;
class Heading5Style extends HeadingStyle {
    constructor() {
        super("Heading5", "Heading 5");
    }
}
exports.Heading5Style = Heading5Style;
class Heading6Style extends HeadingStyle {
    constructor() {
        super("Heading6", "Heading 6");
    }
}
exports.Heading6Style = Heading6Style;
class ListParagraph extends ParagraphStyle {
    constructor() {
        super("ListParagraph");
        this.root.push(new components_1.Name("List Paragraph"));
        this.root.push(new components_1.BasedOn("Normal"));
        this.root.push(new components_1.QuickFormat());
    }
}
exports.ListParagraph = ListParagraph;
//# sourceMappingURL=index.js.map