2021-05-24 21:04:38 +03:00
|
|
|
import { decimalNumber } from "file/values";
|
2017-12-30 20:25:16 +00:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
2019-11-01 01:57:01 +00:00
|
|
|
|
|
|
|
import { ILevelsOptions, Level } from "./level";
|
2017-03-08 17:09:48 +01:00
|
|
|
import { MultiLevelType } from "./multi-level-type";
|
2016-05-19 22:42:23 +01:00
|
|
|
|
2021-05-24 21:04:38 +03:00
|
|
|
// <xsd:complexType name="CT_AbstractNum">
|
|
|
|
// <xsd:sequence>
|
|
|
|
// <xsd:element name="nsid" type="CT_LongHexNumber" minOccurs="0"/>
|
|
|
|
// <xsd:element name="multiLevelType" type="CT_MultiLevelType" minOccurs="0"/>
|
|
|
|
// <xsd:element name="tmpl" type="CT_LongHexNumber" minOccurs="0"/>
|
|
|
|
// <xsd:element name="name" type="CT_String" minOccurs="0"/>
|
|
|
|
// <xsd:element name="styleLink" type="CT_String" minOccurs="0"/>
|
|
|
|
// <xsd:element name="numStyleLink" type="CT_String" minOccurs="0"/>
|
|
|
|
// <xsd:element name="lvl" type="CT_Lvl" minOccurs="0" maxOccurs="9"/>
|
|
|
|
// </xsd:sequence>
|
|
|
|
// <xsd:attribute name="abstractNumId" type="ST_DecimalNumber" use="required"/>
|
|
|
|
// </xsd:complexType>
|
|
|
|
|
|
|
|
// <xsd:attribute name="restartNumberingAfterBreak" type="w12:ST_OnOff"/>
|
|
|
|
// https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx/cbddeff8-01aa-4486-a48e-6a83dede4f13
|
2021-03-12 03:58:05 +00:00
|
|
|
class AbstractNumberingAttributes extends XmlAttributeComponent<{
|
|
|
|
readonly abstractNumId: number;
|
|
|
|
readonly restartNumberingAfterBreak: number;
|
|
|
|
}> {
|
2018-11-02 02:51:57 +00:00
|
|
|
protected readonly xmlKeys = {
|
2017-03-10 10:42:24 +01:00
|
|
|
abstractNumId: "w:abstractNumId",
|
|
|
|
restartNumberingAfterBreak: "w15:restartNumberingAfterBreak",
|
|
|
|
};
|
2016-05-19 22:42:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class AbstractNumbering extends XmlComponent {
|
2018-11-02 02:51:57 +00:00
|
|
|
public readonly id: number;
|
2016-05-19 22:42:23 +01:00
|
|
|
|
2019-11-08 03:11:19 +00:00
|
|
|
constructor(id: number, levelOptions: ILevelsOptions[]) {
|
2016-05-19 22:42:23 +01:00
|
|
|
super("w:abstractNum");
|
2018-01-23 01:33:12 +00:00
|
|
|
this.root.push(
|
|
|
|
new AbstractNumberingAttributes({
|
2021-05-24 21:04:38 +03:00
|
|
|
abstractNumId: decimalNumber(id),
|
2018-01-23 01:33:12 +00:00
|
|
|
restartNumberingAfterBreak: 0,
|
|
|
|
}),
|
|
|
|
);
|
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-26 15:08:34 +01:00
|
|
|
|
2019-11-08 03:11:19 +00:00
|
|
|
for (const option of levelOptions) {
|
2019-11-01 01:57:01 +00:00
|
|
|
this.root.push(new Level(option));
|
|
|
|
}
|
2017-03-08 18:03:24 +01:00
|
|
|
}
|
2017-03-08 17:09:48 +01:00
|
|
|
}
|