prepare Level to be extended for overrides

This commit is contained in:
felipe
2017-04-12 15:53:35 +02:00
parent 28c62c1ee4
commit 16b9057ac6

View File

@ -56,21 +56,29 @@ class LevelJc extends XmlComponent {
} }
} }
export class Level extends XmlComponent { class LevelBase extends XmlComponent {
private paragraphProperties: ParagraphProperties; private paragraphProperties: ParagraphProperties;
private runProperties: RunProperties; private runProperties: RunProperties;
constructor(level: number, numberFormat: string, levelText: string, lvlJc: string) { constructor(level: number, start?: number, numberFormat?: string, levelText?: string, lvlJc?: string) {
super("w:lvl"); super("w:lvl");
this.root.push(new LevelAttributes({ this.root.push(new LevelAttributes({
ilvl: level, ilvl: level,
tentative: 1, tentative: 1,
})); }));
this.root.push(new Start(1)); if (start !== undefined) {
this.root.push(new NumberFormat(numberFormat)); this.root.push(new Start(start));
this.root.push(new LevelText(levelText)); }
this.root.push(new LevelJc(lvlJc)); if (numberFormat !== undefined) {
this.root.push(new NumberFormat(numberFormat));
}
if (levelText !== undefined) {
this.root.push(new LevelText(levelText));
}
if (lvlJc !== undefined) {
this.root.push(new LevelJc(lvlJc));
}
this.paragraphProperties = new ParagraphProperties(); this.paragraphProperties = new ParagraphProperties();
this.runProperties = new RunProperties(); this.runProperties = new RunProperties();
@ -198,3 +206,11 @@ export class Level extends XmlComponent {
return this; return this;
}; };
} }
export class Level extends LevelBase {
// This is the level that sits under abstractNum. We make a
// handful of properties required
constructor(level: number, numberFormat: string, levelText: string, lvlJc: string) {
super(level, 1, numberFormat, levelText, lvlJc);
}
}