2017-09-21 14:56:46 +01:00
|
|
|
// http://officeopenxml.com/WPindentation.php
|
2022-06-26 23:26:42 +01:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
|
|
|
import { signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
|
2016-05-21 00:02:46 +01:00
|
|
|
|
2018-08-21 02:46:21 +01:00
|
|
|
export interface IIndentAttributesProperties {
|
2021-05-24 17:12:10 +03:00
|
|
|
readonly start?: number | string;
|
|
|
|
readonly end?: number | string;
|
|
|
|
readonly left?: number | string;
|
|
|
|
readonly right?: number | string;
|
|
|
|
readonly hanging?: number | string;
|
|
|
|
readonly firstLine?: number | string;
|
2016-05-21 00:02:46 +01:00
|
|
|
}
|
|
|
|
|
2021-05-24 17:12:10 +03:00
|
|
|
// <xsd:complexType name="CT_Ind">
|
|
|
|
// <xsd:attribute name="start" type="ST_SignedTwipsMeasure" use="optional"/>
|
|
|
|
// <xsd:attribute name="startChars" type="ST_DecimalNumber" use="optional"/>
|
|
|
|
// <xsd:attribute name="end" type="ST_SignedTwipsMeasure" use="optional"/>
|
|
|
|
// <xsd:attribute name="endChars" type="ST_DecimalNumber" use="optional"/>
|
|
|
|
// <xsd:attribute name="left" type="ST_SignedTwipsMeasure" use="optional"/>
|
|
|
|
// <xsd:attribute name="leftChars" type="ST_DecimalNumber" use="optional"/>
|
|
|
|
// <xsd:attribute name="right" type="ST_SignedTwipsMeasure" use="optional"/>
|
|
|
|
// <xsd:attribute name="rightChars" type="ST_DecimalNumber" use="optional"/>
|
|
|
|
// <xsd:attribute name="hanging" type="s:ST_TwipsMeasure" use="optional"/>
|
|
|
|
// <xsd:attribute name="hangingChars" type="ST_DecimalNumber" use="optional"/>
|
|
|
|
// <xsd:attribute name="firstLine" type="s:ST_TwipsMeasure" use="optional"/>
|
|
|
|
// <xsd:attribute name="firstLineChars" type="ST_DecimalNumber" use="optional"/>
|
|
|
|
// </xsd:complexType>
|
2017-03-10 10:42:24 +01:00
|
|
|
class IndentAttributes extends XmlAttributeComponent<IIndentAttributesProperties> {
|
2018-11-02 02:51:57 +00:00
|
|
|
protected readonly xmlKeys = {
|
2021-05-24 17:12:10 +03:00
|
|
|
start: "w:start",
|
|
|
|
end: "w:end",
|
2017-03-10 10:42:24 +01:00
|
|
|
left: "w:left",
|
2021-05-24 17:12:10 +03:00
|
|
|
right: "w:right",
|
2017-03-10 10:42:24 +01:00
|
|
|
hanging: "w:hanging",
|
2017-09-16 12:31:31 -06:00
|
|
|
firstLine: "w:firstLine",
|
2017-03-10 10:42:24 +01:00
|
|
|
};
|
2016-05-21 00:02:46 +01:00
|
|
|
}
|
|
|
|
|
2021-05-24 17:12:10 +03:00
|
|
|
// <xsd:complexType name="CT_PPrBase">
|
|
|
|
// <xsd:sequence>
|
|
|
|
// ...
|
|
|
|
// <xsd:element name="ind" type="CT_Ind" minOccurs="0"/>
|
2016-05-21 00:02:46 +01:00
|
|
|
export class Indent extends XmlComponent {
|
2022-08-31 07:52:27 +01:00
|
|
|
public constructor({ start, end, left, right, hanging, firstLine }: IIndentAttributesProperties) {
|
2016-05-21 00:02:46 +01:00
|
|
|
super("w:ind");
|
2021-05-24 17:12:10 +03:00
|
|
|
this.root.push(
|
|
|
|
new IndentAttributes({
|
|
|
|
start: start === undefined ? undefined : signedTwipsMeasureValue(start),
|
|
|
|
end: end === undefined ? undefined : signedTwipsMeasureValue(end),
|
|
|
|
left: left === undefined ? undefined : signedTwipsMeasureValue(left),
|
|
|
|
right: right === undefined ? undefined : signedTwipsMeasureValue(right),
|
|
|
|
hanging: hanging === undefined ? undefined : twipsMeasureValue(hanging),
|
|
|
|
firstLine: firstLine === undefined ? undefined : twipsMeasureValue(firstLine),
|
|
|
|
}),
|
|
|
|
);
|
2016-05-21 00:02:46 +01:00
|
|
|
}
|
2017-03-08 17:15:46 +01:00
|
|
|
}
|