import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { decimalNumber } from "@util/values";
// not implemented
//
//
//
//
//
//
//
//
//
//
//
//
//
/* eslint-disable @typescript-eslint/naming-convention */
export const DocumentGridType = {
DEFAULT: "default",
LINES: "lines",
LINES_AND_CHARS: "linesAndChars",
SNAP_TO_CHARS: "snapToChars",
} as const;
/* eslint-enable */
export interface IDocGridAttributesProperties {
readonly type?: (typeof DocumentGridType)[keyof typeof DocumentGridType];
readonly linePitch?: number;
readonly charSpace?: number;
}
export class DocGridAttributes extends XmlAttributeComponent {
protected readonly xmlKeys = {
type: "w:type",
linePitch: "w:linePitch",
charSpace: "w:charSpace",
};
}
export class DocumentGrid extends XmlComponent {
public constructor(linePitch: number, charSpace?: number, type?: (typeof DocumentGridType)[keyof typeof DocumentGridType]) {
super("w:docGrid");
this.root.push(
new DocGridAttributes({
type: type,
linePitch: decimalNumber(linePitch),
charSpace: charSpace ? decimalNumber(charSpace) : undefined,
}),
);
}
}