2017-03-08 17:09:48 +01:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "../docx/xml-components";
|
|
|
|
import { Level } from "./level";
|
|
|
|
import { MultiLevelType } from "./multi-level-type";
|
2016-05-19 22:42:23 +01:00
|
|
|
|
2017-03-08 17:09:48 +01:00
|
|
|
interface IAbstractNumberingAttributesProperties {
|
2016-05-26 15:08:34 +01:00
|
|
|
abstractNumId?: number;
|
|
|
|
restartNumberingAfterBreak?: number;
|
2016-05-19 22:42:23 +01:00
|
|
|
}
|
|
|
|
|
2017-03-10 10:42:24 +01:00
|
|
|
class AbstractNumberingAttributes extends XmlAttributeComponent<IAbstractNumberingAttributesProperties> {
|
|
|
|
protected xmlKeys = {
|
|
|
|
abstractNumId: "w:abstractNumId",
|
|
|
|
restartNumberingAfterBreak: "w15:restartNumberingAfterBreak",
|
|
|
|
};
|
2016-05-19 22:42:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class AbstractNumbering extends XmlComponent {
|
2017-03-08 17:18:12 +01:00
|
|
|
public id: number;
|
2016-05-19 22:42:23 +01:00
|
|
|
|
2016-05-21 00:02:46 +01:00
|
|
|
constructor(id: number) {
|
2016-05-19 22:42:23 +01:00
|
|
|
super("w:abstractNum");
|
|
|
|
this.root.push(new AbstractNumberingAttributes({
|
2016-05-21 00:02:46 +01:00
|
|
|
abstractNumId: id,
|
2017-03-08 17:09:48 +01:00
|
|
|
restartNumberingAfterBreak: 0,
|
2016-05-19 22:42:23 +01:00
|
|
|
}));
|
2016-05-21 00:02:46 +01:00
|
|
|
this.root.push(new MultiLevelType("hybridMultilevel"));
|
2017-03-08 17:18:12 +01:00
|
|
|
this.id = id;
|
2016-05-21 00:02:46 +01:00
|
|
|
}
|
2016-05-26 15:08:34 +01:00
|
|
|
|
2017-03-08 17:09:48 +01:00
|
|
|
public addLevel(level: Level): void {
|
2016-05-21 00:02:46 +01:00
|
|
|
this.root.push(level);
|
2016-05-19 22:42:23 +01:00
|
|
|
}
|
2016-05-26 15:08:34 +01:00
|
|
|
|
2017-03-08 21:59:27 +00:00
|
|
|
public createLevel(num: number, format: string, text: string, align: string = "start"): Level {
|
2017-03-08 18:03:24 +01:00
|
|
|
const level = new Level(num, format, text, align);
|
|
|
|
this.addLevel(level);
|
|
|
|
return level;
|
|
|
|
}
|
2017-03-08 17:09:48 +01:00
|
|
|
}
|