2021-05-25 03:41:12 +03:00
|
|
|
import { decimalNumber } from "file/values";
|
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
|
|
|
|
|
|
|
// not implemented
|
|
|
|
// <xsd:simpleType name="ST_DocGrid">
|
|
|
|
// <xsd:restriction base="xsd:string">
|
|
|
|
// <xsd:enumeration value="default"/>
|
|
|
|
// <xsd:enumeration value="lines"/>
|
|
|
|
// <xsd:enumeration value="linesAndChars"/>
|
|
|
|
// <xsd:enumeration value="snapToChars"/>
|
|
|
|
// </xsd:restriction>
|
|
|
|
// </xsd:simpleType>
|
|
|
|
|
|
|
|
// <xsd:complexType name="CT_DocGrid">
|
|
|
|
// <xsd:attribute name="type" type="ST_DocGrid"/>
|
|
|
|
// <xsd:attribute name="linePitch" type="ST_DecimalNumber"/>
|
|
|
|
// <xsd:attribute name="charSpace" type="ST_DecimalNumber"/>
|
|
|
|
// </xsd:complexType>
|
2021-11-30 21:11:06 +09:00
|
|
|
|
|
|
|
export enum DocumentGridType {
|
|
|
|
DEFAULT = "default",
|
|
|
|
LINES = "lines",
|
|
|
|
LINES_AND_CHARS = "linesAndChars",
|
|
|
|
SNAP_TO_CHARS = "snapToChars",
|
|
|
|
}
|
2021-05-25 03:41:12 +03:00
|
|
|
export interface IDocGridAttributesProperties {
|
2021-11-30 21:11:06 +09:00
|
|
|
readonly type?: DocumentGridType;
|
2021-05-25 03:41:12 +03:00
|
|
|
readonly linePitch?: number;
|
2021-11-30 21:11:06 +09:00
|
|
|
readonly charSpace?: number;
|
2021-05-25 03:41:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export class DocGridAttributes extends XmlAttributeComponent<IDocGridAttributesProperties> {
|
|
|
|
protected readonly xmlKeys = {
|
2021-11-30 21:11:06 +09:00
|
|
|
type: "w:type",
|
2021-05-25 03:41:12 +03:00
|
|
|
linePitch: "w:linePitch",
|
2021-11-30 21:11:06 +09:00
|
|
|
charSpace: "w:charSpace",
|
2021-05-25 03:41:12 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export class DocumentGrid extends XmlComponent {
|
2021-11-30 21:11:06 +09:00
|
|
|
constructor(linePitch: number, charSpace?: number, type?: DocumentGridType) {
|
2021-05-25 03:41:12 +03:00
|
|
|
super("w:docGrid");
|
2021-11-30 21:11:06 +09:00
|
|
|
|
2021-05-25 03:41:12 +03:00
|
|
|
this.root.push(
|
|
|
|
new DocGridAttributes({
|
2021-11-30 21:11:06 +09:00
|
|
|
type: type,
|
2021-05-25 03:41:12 +03:00
|
|
|
linePitch: decimalNumber(linePitch),
|
2021-11-30 21:11:06 +09:00
|
|
|
charSpace: charSpace ? decimalNumber(charSpace) : undefined,
|
2021-05-25 03:41:12 +03:00
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|