2017-03-12 22:06:11 +01:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "../xml-components";
|
2016-05-18 17:06:21 +01:00
|
|
|
|
2017-07-07 14:31:08 +01:00
|
|
|
export class TabStop extends XmlComponent {
|
2016-05-18 17:06:21 +01:00
|
|
|
|
|
|
|
constructor(tab: Tab) {
|
|
|
|
super("w:tabs");
|
|
|
|
this.root.push(tab);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-07 14:31:08 +01:00
|
|
|
export type TabOptions = "left" | "right";
|
2017-03-12 22:06:11 +01:00
|
|
|
|
2017-07-07 14:31:08 +01:00
|
|
|
export class TabAttributes extends XmlAttributeComponent<{val: TabOptions, pos: string | number}> {
|
2017-03-12 22:06:11 +01:00
|
|
|
protected xmlKeys = {val: "w:val", pos: "w:pos"};
|
|
|
|
}
|
|
|
|
|
2017-07-07 14:31:08 +01:00
|
|
|
export class Tab extends XmlComponent {
|
2016-05-18 17:06:21 +01:00
|
|
|
|
2017-07-07 14:31:08 +01:00
|
|
|
constructor(value: TabOptions, position: string | number) {
|
2016-05-18 17:06:21 +01:00
|
|
|
super("w:tab");
|
2017-03-12 22:06:11 +01:00
|
|
|
this.root.push(new TabAttributes({
|
2016-05-18 17:06:21 +01:00
|
|
|
val: value,
|
2017-03-08 21:40:21 +00:00
|
|
|
pos: position,
|
2016-05-18 17:06:21 +01:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class MaxRightTabStop extends TabStop {
|
|
|
|
constructor() {
|
2016-06-10 15:03:44 +01:00
|
|
|
super(new Tab("right", 9026));
|
2016-05-18 17:06:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class LeftTabStop extends TabStop {
|
|
|
|
constructor(position: number) {
|
|
|
|
super(new Tab("left", position));
|
|
|
|
}
|
|
|
|
}
|