now extends XmlComponent

This commit is contained in:
Dolan Miu
2016-04-09 20:16:35 +01:00
parent 84610bd72f
commit f68a2aff56
33 changed files with 180 additions and 371 deletions

View File

@ -2,16 +2,11 @@ import {XmlComponent} from "../../docx/xml-components";
import {ParagraphPropertiesDefaults} from "./paragraph-properties";
import {RunPropertiesDefaults} from "./run-properties";
export class DocumentDefaults implements XmlComponent {
private docDefaults: Array<XmlComponent>;
xmlKeys = {
docDefaults: "w:docDefaults"
}
export class DocumentDefaults extends XmlComponent {
constructor() {
this.docDefaults = new Array<XmlComponent>();
this.docDefaults.push(new RunPropertiesDefaults());
this.docDefaults.push(new ParagraphPropertiesDefaults());
super("w:docDefaults");
this.root.push(new RunPropertiesDefaults());
this.root.push(new ParagraphPropertiesDefaults());
}
}

View File

@ -1,15 +1,10 @@
import {XmlComponent} from "../../docx/xml-components";
import {ParagraphProperties} from "../../docx/paragraph/properties";
export class ParagraphPropertiesDefaults implements XmlComponent {
private pPrDefault: Array<XmlComponent>;
xmlKeys = {
pPrDefault: "w:pPrDefault"
}
export class ParagraphPropertiesDefaults extends XmlComponent {
constructor() {
this.pPrDefault = new Array<XmlComponent>();
this.pPrDefault.push(new ParagraphProperties());
super("w:pPrDefault");
this.root.push(new ParagraphProperties());
}
}

View File

@ -1,15 +1,10 @@
import {XmlComponent} from "../../docx/xml-components";
import {RunProperties} from "../../docx/run/properties";
export class RunPropertiesDefaults implements XmlComponent {
private rPrDefault: Array<XmlComponent>;
xmlKeys = {
rPrDefault: "w:rPrDefault"
}
export class RunPropertiesDefaults extends XmlComponent {
constructor() {
this.rPrDefault = new Array<XmlComponent>();
this.rPrDefault.push(new RunProperties());
super("w:rPrDefault");
this.root.push(new RunProperties());
}
}

View File

@ -5,16 +5,11 @@ import {LatentStyles} from "./latent-styles";
import {LatentStyleException} from "./latent-styles/exceptions";
import {LatentStyleExceptionAttributes} from "./latent-styles/exceptions/attributes";
export class Styles implements XmlComponent {
private styles: Array<XmlComponent>;
xmlKeys = {
styles: 'w:styles'
}
export class Styles extends XmlComponent {
constructor() {
this.styles = new Array<XmlComponent>();
this.styles.push(new DocumentAttributes({
super("w:styles");
this.root.push(new DocumentAttributes({
mc: 'http://schemas.openxmlformats.org/markup-compatibility/2006',
r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
w: 'http://schemas.openxmlformats.org/wordprocessingml/2006/main',
@ -22,15 +17,15 @@ export class Styles implements XmlComponent {
w15: 'http://schemas.microsoft.com/office/word/2012/wordml',
Ignorable: 'w14 w15'
}))
this.styles.push(new DocumentDefaults());
this.root.push(new DocumentDefaults());
var latentStyles = new LatentStyles();
//latentStyles.push(new LatentStyleException(new LatentStyleExceptionAttributes({
// name: "Normal"
//})));
this.styles.push(latentStyles);
this.root.push(latentStyles);
}
push(style: XmlComponent): void {
this.styles.push(style);
this.root.push(style);
}
}

View File

@ -8,7 +8,7 @@ interface LatentStyleExceptionAttributesProperties {
unhideWhenUsed?: string
}
export class LatentStyleExceptionAttributes implements XmlComponent {
export class LatentStyleExceptionAttributes extends XmlComponent {
private _attr: Object;
xmlKeys = {
@ -20,6 +20,7 @@ export class LatentStyleExceptionAttributes implements XmlComponent {
};
constructor(properties?: LatentStyleExceptionAttributesProperties) {
super("_attr");
this._attr = properties
if (!properties) {

View File

@ -1,15 +1,10 @@
import {XmlComponent} from "../../../docx/xml-components";
import {LatentStyleExceptionAttributes} from "./attributes";
export class LatentStyleException implements XmlComponent {
private lsdException: Array<XmlComponent>;
xmlKeys = {
lsdException: "w:lsdException"
}
export class LatentStyleException extends XmlComponent {
constructor(attributes: LatentStyleExceptionAttributes) {
this.lsdException = new Array<XmlComponent>();
this.lsdException.push(attributes);
super("w:lsdException");
this.root.push(attributes);
}
}

View File

@ -1,18 +1,13 @@
import {XmlComponent} from "../../docx/xml-components";
import {LatentStyleException} from "./exceptions";
export class LatentStyles implements XmlComponent {
private latentStyles: Array<XmlComponent>;
xmlKeys = {
latentStyles: "w:latentStyles"
}
export class LatentStyles extends XmlComponent {
constructor() {
this.latentStyles = new Array<XmlComponent>();
super("w:latentStyles");
}
push(latentException: LatentStyleException): void {
this.latentStyles.push(latentException);
this.root.push(latentException);
}
}

View File

@ -7,7 +7,7 @@ interface StyleAttributesProperties {
customStyle?: string;
}
export class StyleAttributes implements XmlComponent {
export class StyleAttributes extends XmlComponent {
private _attr: Object;
xmlKeys = {
@ -18,6 +18,7 @@ export class StyleAttributes implements XmlComponent {
};
constructor(properties?: StyleAttributesProperties) {
super("_attr");
this._attr = properties
if (!properties) {

View File

@ -1,14 +1,9 @@
import {XmlComponent} from "../../docx/xml-components";
export class Name implements XmlComponent {
private name: Array<XmlComponent>;
xmlKeys = {
}
export class Name extends XmlComponent {
constructor() {
this.name = new Array<XmlComponent>();
super("w:name");
}
}

View File

@ -1,19 +1,14 @@
import {XmlComponent} from "../../docx/xml-components";
import {StyleAttributes} from "./attributes";
export class Style implements XmlComponent {
private style: Array<XmlComponent>;
xmlKeys = {
style: "w:style"
}
export class Style extends XmlComponent {
constructor(attributes: StyleAttributes) {
this.style = new Array<XmlComponent>();
this.style.push(attributes);
super("w:style");
this.root.push(attributes);
}
push(styleSegment: XmlComponent): void {
this.style.push(styleSegment);
this.root.push(styleSegment);
}
}